Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-31 16:03:52.395794",
"spec_repo_commit": "a11da7b5"
"regenerated": "2024-10-31 16:41:33.190685",
"spec_repo_commit": "63c441b2"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-31 16:03:52.415002",
"spec_repo_commit": "a11da7b5"
"regenerated": "2024-10-31 16:41:33.209528",
"spec_repo_commit": "63c441b2"
}
}
}
90 changes: 0 additions & 90 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -976,49 +976,6 @@ components:
type: string
x-enum-varnames:
- API_KEYS
AWSRelatedAccount:
description: AWS related account.
properties:
attributes:
$ref: '#/components/schemas/AWSRelatedAccountAttributes'
id:
description: The AWS account ID.
example: '123456789123'
type: string
type:
$ref: '#/components/schemas/AWSRelatedAccountType'
required:
- id
- type
type: object
AWSRelatedAccountAttributes:
description: Attributes for an AWS related account.
properties:
has_datadog_integration:
description: Whether or not the AWS account has a Datadog integration.
type: boolean
name:
description: The name of the AWS account.
type: string
type: object
AWSRelatedAccountType:
default: aws_account
description: Type of AWS related account.
enum:
- aws_account
example: aws_account
type: string
x-enum-varnames:
- AWS_ACCOUNT
AWSRelatedAccountsResponse:
description: List of AWS related accounts.
properties:
data:
description: An AWS related account.
items:
$ref: '#/components/schemas/AWSRelatedAccount'
type: array
type: object
ActiveBillingDimensionsAttributes:
description: List of active billing dimensions.
properties:
Expand Down Expand Up @@ -28974,53 +28931,6 @@ paths:
operator: OR
permissions:
- cloud_cost_management_write
/api/v2/cost/aws_related_accounts:
get:
deprecated: true
description: List the AWS accounts in an organization by calling 'organizations:ListAccounts'
from the specified management account.
operationId: ListAWSRelatedAccounts
parameters:
- description: The ID of the management account to filter by.
example: '123456789123'
in: query
name: filter[management_account_id]
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/AWSRelatedAccountsResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cloud_cost_management_read
summary: List related AWS accounts
tags:
- Cloud Cost Management
x-permission:
operator: OR
permissions:
- cloud_cost_management_read
/api/v2/cost/azure_uc_config:
get:
description: List the Azure configs.
Expand Down
17 changes: 0 additions & 17 deletions examples/v2_cloud-cost-management_ListAWSRelatedAccounts.rs

This file was deleted.

124 changes: 0 additions & 124 deletions src/datadogV2/api/api_cloud_cost_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ pub enum GetCustomCostsFileError {
UnknownValue(serde_json::Value),
}

/// ListAWSRelatedAccountsError is a struct for typed errors of method [`CloudCostManagementAPI::list_aws_related_accounts`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAWSRelatedAccountsError {
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
UnknownValue(serde_json::Value),
}

/// ListCostAWSCURConfigsError is a struct for typed errors of method [`CloudCostManagementAPI::list_cost_awscur_configs`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -980,122 +972,6 @@ impl CloudCostManagementAPI {
}
}

/// List the AWS accounts in an organization by calling 'organizations:ListAccounts' from the specified management account.
pub async fn list_aws_related_accounts(
&self,
filter_management_account_id: String,
) -> Result<
crate::datadogV2::model::AWSRelatedAccountsResponse,
datadog::Error<ListAWSRelatedAccountsError>,
> {
match self
.list_aws_related_accounts_with_http_info(filter_management_account_id)
.await
{
Ok(response_content) => {
if let Some(e) = response_content.entity {
Ok(e)
} else {
Err(datadog::Error::Serde(serde::de::Error::custom(
"response content was None",
)))
}
}
Err(err) => Err(err),
}
}

/// List the AWS accounts in an organization by calling 'organizations:ListAccounts' from the specified management account.
pub async fn list_aws_related_accounts_with_http_info(
&self,
filter_management_account_id: String,
) -> Result<
datadog::ResponseContent<crate::datadogV2::model::AWSRelatedAccountsResponse>,
datadog::Error<ListAWSRelatedAccountsError>,
> {
let local_configuration = &self.config;
let operation_id = "v2.list_aws_related_accounts";

let local_client = &self.client;

let local_uri_str = format!(
"{}/api/v2/cost/aws_related_accounts",
local_configuration.get_operation_host(operation_id)
);
let mut local_req_builder =
local_client.request(reqwest::Method::GET, local_uri_str.as_str());

local_req_builder = local_req_builder.query(&[(
"filter[management_account_id]",
&filter_management_account_id.to_string(),
)]);

// build headers
let mut headers = HeaderMap::new();
headers.insert("Accept", HeaderValue::from_static("application/json"));

// build user agent
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
Err(e) => {
log::warn!("Failed to parse user agent header: {e}, falling back to default");
headers.insert(
reqwest::header::USER_AGENT,
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
)
}
};

// build auth
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
headers.insert(
"DD-API-KEY",
HeaderValue::from_str(local_key.key.as_str())
.expect("failed to parse DD-API-KEY header"),
);
};
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
headers.insert(
"DD-APPLICATION-KEY",
HeaderValue::from_str(local_key.key.as_str())
.expect("failed to parse DD-APPLICATION-KEY header"),
);
};

local_req_builder = local_req_builder.headers(headers);
let local_req = local_req_builder.build()?;
log::debug!("request content: {:?}", local_req.body());
let local_resp = local_client.execute(local_req).await?;

let local_status = local_resp.status();
let local_content = local_resp.text().await?;
log::debug!("response content: {}", local_content);

if !local_status.is_client_error() && !local_status.is_server_error() {
match serde_json::from_str::<crate::datadogV2::model::AWSRelatedAccountsResponse>(
&local_content,
) {
Ok(e) => {
return Ok(datadog::ResponseContent {
status: local_status,
content: local_content,
entity: Some(e),
})
}
Err(e) => return Err(datadog::Error::Serde(e)),
};
} else {
let local_entity: Option<ListAWSRelatedAccountsError> =
serde_json::from_str(&local_content).ok();
let local_error = datadog::ResponseContent {
status: local_status,
content: local_content,
entity: local_entity,
};
Err(datadog::Error::ResponseError(local_error))
}
}

/// List the AWS CUR configs.
pub async fn list_cost_awscur_configs(
&self,
Expand Down
8 changes: 0 additions & 8 deletions src/datadogV2/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,6 @@ pub mod model_aws_cur_config_patch_request_attributes;
pub use self::model_aws_cur_config_patch_request_attributes::AwsCURConfigPatchRequestAttributes;
pub mod model_aws_cur_config_patch_request_type;
pub use self::model_aws_cur_config_patch_request_type::AwsCURConfigPatchRequestType;
pub mod model_aws_related_accounts_response;
pub use self::model_aws_related_accounts_response::AWSRelatedAccountsResponse;
pub mod model_aws_related_account;
pub use self::model_aws_related_account::AWSRelatedAccount;
pub mod model_aws_related_account_attributes;
pub use self::model_aws_related_account_attributes::AWSRelatedAccountAttributes;
pub mod model_aws_related_account_type;
pub use self::model_aws_related_account_type::AWSRelatedAccountType;
pub mod model_azure_uc_configs_response;
pub use self::model_azure_uc_configs_response::AzureUCConfigsResponse;
pub mod model_azure_uc_config_pair;
Expand Down
Loading
Loading