From e40b37e96a4df220972151c2cead99af71d0c4bc Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 3 Mar 2026 17:06:53 +0000 Subject: [PATCH] Regenerate client from commit d57d294 of spec repo --- .generator/schemas/v2/openapi.yaml | 253 +++++++- ...s-integration_CreateAWSAccountCCMConfig.rs | 34 + ...s-integration_DeleteAWSAccountCCMConfig.rs | 18 + ..._aws-integration_GetAWSAccountCCMConfig.rs | 18 + ...s-integration_UpdateAWSAccountCCMConfig.rs | 34 + src/datadog/configuration.rs | 4 + src/datadogV2/api/api_aws_integration.rs | 596 ++++++++++++++++++ src/datadogV2/model/mod.rs | 18 + src/datadogV2/model/model_aws_ccm_config.rs | 98 +++ .../model/model_aws_ccm_config_request.rs | 92 +++ ...model_aws_ccm_config_request_attributes.rs | 92 +++ .../model_aws_ccm_config_request_data.rs | 116 ++++ .../model/model_aws_ccm_config_response.rs | 92 +++ ...odel_aws_ccm_config_response_attributes.rs | 111 ++++ .../model_aws_ccm_config_response_data.rs | 144 +++++ .../model/model_aws_ccm_config_type.rs | 48 ++ .../model_aws_lambda_forwarder_config.rs | 3 +- .../model/model_data_export_config.rs | 148 +++++ ...urns-AWS-CCM-Config-object-response.frozen | 1 + ...eturns-AWS-CCM-Config-object-response.json | 91 +++ ...CM-config-returns-Conflict-response.frozen | 1 + ...-CCM-config-returns-Conflict-response.json | 73 +++ ...M-config-returns-Not-Found-response.frozen | 1 + ...CCM-config-returns-Not-Found-response.json | 39 ++ ...-config-returns-No-Content-response.frozen | 1 + ...CM-config-returns-No-Content-response.json | 29 + ...M-config-returns-Not-Found-response.frozen | 1 + ...CCM-config-returns-Not-Found-response.json | 33 + ...M-config-returns-Not-Found-response.frozen | 1 + ...CCM-config-returns-Not-Found-response.json | 33 + ...urns-AWS-CCM-Config-object-response.frozen | 1 + ...eturns-AWS-CCM-Config-object-response.json | 39 ++ ...M-config-returns-Not-Found-response.frozen | 1 + ...CCM-config-returns-Not-Found-response.json | 39 ++ .../features/v2/aws_integration.feature | 77 +++ tests/scenarios/features/v2/undo.json | 26 + tests/scenarios/function_mappings.rs | 140 ++++ 37 files changed, 2544 insertions(+), 2 deletions(-) create mode 100644 examples/v2_aws-integration_CreateAWSAccountCCMConfig.rs create mode 100644 examples/v2_aws-integration_DeleteAWSAccountCCMConfig.rs create mode 100644 examples/v2_aws-integration_GetAWSAccountCCMConfig.rs create mode 100644 examples/v2_aws-integration_UpdateAWSAccountCCMConfig.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_request.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_request_attributes.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_request_data.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_response.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_response_attributes.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_response_data.rs create mode 100644 src/datadogV2/model/model_aws_ccm_config_type.rs create mode 100644 src/datadogV2/model/model_data_export_config.rs create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d3b9ce53dd..467a7dec3a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -89,6 +89,7 @@ components: the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) + endpoint and query by AWS Account ID.' in: path name: aws_account_config_id @@ -1897,6 +1898,82 @@ components: required: - role_name type: object + AWSCcmConfig: + description: AWS Cloud Cost Management config. + properties: + data_export_configs: + description: List of data export configurations for Cost and Usage Reports. + items: + $ref: '#/components/schemas/DataExportConfig' + type: array + required: + - data_export_configs + type: object + AWSCcmConfigRequest: + description: AWS CCM Config Create/Update Request body. + properties: + data: + $ref: '#/components/schemas/AWSCcmConfigRequestData' + required: + - data + type: object + AWSCcmConfigRequestAttributes: + description: AWS CCM Config attributes for Create/Update requests. + properties: + ccm_config: + $ref: '#/components/schemas/AWSCcmConfig' + required: + - ccm_config + type: object + AWSCcmConfigRequestData: + description: AWS CCM Config Create/Update Request data. + properties: + attributes: + $ref: '#/components/schemas/AWSCcmConfigRequestAttributes' + type: + $ref: '#/components/schemas/AWSCcmConfigType' + required: + - attributes + - type + type: object + AWSCcmConfigResponse: + description: AWS CCM Config response body. + properties: + data: + $ref: '#/components/schemas/AWSCcmConfigResponseData' + required: + - data + type: object + AWSCcmConfigResponseAttributes: + description: AWS CCM Config response attributes. + properties: + data_export_configs: + description: List of data export configurations for Cost and Usage Reports. + items: + $ref: '#/components/schemas/DataExportConfig' + type: array + type: object + AWSCcmConfigResponseData: + description: AWS CCM Config response data. + properties: + attributes: + $ref: '#/components/schemas/AWSCcmConfigResponseAttributes' + id: + $ref: '#/components/schemas/AWSAccountConfigID' + type: + $ref: '#/components/schemas/AWSCcmConfigType' + required: + - type + type: object + AWSCcmConfigType: + default: ccm_config + description: AWS CCM Config resource type. + enum: + - ccm_config + example: ccm_config + type: string + x-enum-varnames: + - CCM_CONFIG AWSCloudAuthPersonaMappingAttributesResponse: description: Attributes for AWS cloud authentication persona mapping response properties: @@ -2370,7 +2447,9 @@ components: Discover the list of available services with the - [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) + [Get list of AWS log ready + + services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) endpoint.' items: @@ -19492,6 +19571,37 @@ components: example: canceled type: string type: object + DataExportConfig: + description: AWS Cost and Usage Report data export configuration. + properties: + bucket_name: + description: Name of the S3 bucket where the Cost and Usage Report is stored. + example: billing + type: string + bucket_region: + description: AWS region of the S3 bucket. + example: us-east-1 + type: string + report_name: + description: Name of the Cost and Usage Report. + example: cost-and-usage-report + type: string + report_prefix: + description: S3 prefix where the Cost and Usage Report is stored. + example: reports + type: string + report_type: + description: Type of the Cost and Usage Report. Currently only `CUR2.0` + is supported. + example: CUR2.0 + type: string + required: + - report_name + - report_prefix + - report_type + - bucket_name + - bucket_region + type: object DataRelationshipsTeams: description: Associates teams with this schedule in a data structure. properties: @@ -84312,6 +84422,147 @@ paths: operator: OR permissions: - aws_configuration_edit + /api/v2/integration/aws/accounts/{aws_account_config_id}/ccm_config: + delete: + description: 'Delete the Cloud Cost Management config for an AWS Account Integration + Config using Cost and Usage Report + + (CUR) 2.0 by config ID.' + operationId: DeleteAWSAccountCCMConfig + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete AWS CCM config + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: 'Get the Cloud Cost Management config for an AWS Account Integration + Config using Cost and Usage Report + + (CUR) 2.0 by config ID.' + operationId: GetAWSAccountCCMConfig + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCcmConfigResponse' + description: AWS CCM Config object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS CCM config + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: 'Update the Cloud Cost Management config for an AWS Account Integration + Config using Cost and Usage Report + + (CUR) 2.0 by config ID.' + operationId: UpdateAWSAccountCCMConfig + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCcmConfigRequest' + description: Update a Cloud Cost Management config for an AWS Account Integration + Config. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCcmConfigResponse' + description: AWS CCM Config object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update AWS CCM config + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: 'Create the Cloud Cost Management config for an AWS Account Integration + Config using Cost and Usage Report + + (CUR) 2.0 by config ID.' + operationId: CreateAWSAccountCCMConfig + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCcmConfigRequest' + description: Create a Cloud Cost Management config for an AWS Account Integration + Config. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSCcmConfigResponse' + description: AWS CCM Config object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create AWS CCM config + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/integration/aws/available_namespaces: get: description: Get a list of available AWS CloudWatch namespaces that can send diff --git a/examples/v2_aws-integration_CreateAWSAccountCCMConfig.rs b/examples/v2_aws-integration_CreateAWSAccountCCMConfig.rs new file mode 100644 index 0000000000..a0088cef16 --- /dev/null +++ b/examples/v2_aws-integration_CreateAWSAccountCCMConfig.rs @@ -0,0 +1,34 @@ +// Create AWS CCM config returns "AWS CCM Config object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; +use datadog_api_client::datadogV2::model::AWSCcmConfig; +use datadog_api_client::datadogV2::model::AWSCcmConfigRequest; +use datadog_api_client::datadogV2::model::AWSCcmConfigRequestAttributes; +use datadog_api_client::datadogV2::model::AWSCcmConfigRequestData; +use datadog_api_client::datadogV2::model::AWSCcmConfigType; +use datadog_api_client::datadogV2::model::DataExportConfig; + +#[tokio::main] +async fn main() { + let body = AWSCcmConfigRequest::new(AWSCcmConfigRequestData::new( + AWSCcmConfigRequestAttributes::new(AWSCcmConfig::new(vec![DataExportConfig::new( + "billing".to_string(), + "us-east-1".to_string(), + "cost-and-usage-report".to_string(), + "reports".to_string(), + "CUR2.0".to_string(), + )])), + AWSCcmConfigType::CCM_CONFIG, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateAWSAccountCCMConfig", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api + .create_aws_account_ccm_config("aws_account_config_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_DeleteAWSAccountCCMConfig.rs b/examples/v2_aws-integration_DeleteAWSAccountCCMConfig.rs new file mode 100644 index 0000000000..5d21d038f9 --- /dev/null +++ b/examples/v2_aws-integration_DeleteAWSAccountCCMConfig.rs @@ -0,0 +1,18 @@ +// Delete AWS CCM config returns "No Content" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteAWSAccountCCMConfig", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api + .delete_aws_account_ccm_config("aws_account_config_id".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_GetAWSAccountCCMConfig.rs b/examples/v2_aws-integration_GetAWSAccountCCMConfig.rs new file mode 100644 index 0000000000..1f9def0b45 --- /dev/null +++ b/examples/v2_aws-integration_GetAWSAccountCCMConfig.rs @@ -0,0 +1,18 @@ +// Get AWS CCM config returns "AWS CCM Config object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetAWSAccountCCMConfig", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api + .get_aws_account_ccm_config("aws_account_config_id".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_UpdateAWSAccountCCMConfig.rs b/examples/v2_aws-integration_UpdateAWSAccountCCMConfig.rs new file mode 100644 index 0000000000..f0bc576f5c --- /dev/null +++ b/examples/v2_aws-integration_UpdateAWSAccountCCMConfig.rs @@ -0,0 +1,34 @@ +// Update AWS CCM config returns "AWS CCM Config object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; +use datadog_api_client::datadogV2::model::AWSCcmConfig; +use datadog_api_client::datadogV2::model::AWSCcmConfigRequest; +use datadog_api_client::datadogV2::model::AWSCcmConfigRequestAttributes; +use datadog_api_client::datadogV2::model::AWSCcmConfigRequestData; +use datadog_api_client::datadogV2::model::AWSCcmConfigType; +use datadog_api_client::datadogV2::model::DataExportConfig; + +#[tokio::main] +async fn main() { + let body = AWSCcmConfigRequest::new(AWSCcmConfigRequestData::new( + AWSCcmConfigRequestAttributes::new(AWSCcmConfig::new(vec![DataExportConfig::new( + "billing".to_string(), + "us-east-1".to_string(), + "cost-and-usage-report".to_string(), + "reports".to_string(), + "CUR2.0".to_string(), + )])), + AWSCcmConfigType::CCM_CONFIG, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateAWSAccountCCMConfig", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api + .update_aws_account_ccm_config("aws_account_config_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index cb1af62305..060d955391 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -255,6 +255,10 @@ impl Default for Configuration { ("v2.update_incident_postmortem_template".to_owned(), false), ("v2.update_incident_todo".to_owned(), false), ("v2.update_incident_type".to_owned(), false), + ("v2.create_aws_account_ccm_config".to_owned(), false), + ("v2.delete_aws_account_ccm_config".to_owned(), false), + ("v2.get_aws_account_ccm_config".to_owned(), false), + ("v2.update_aws_account_ccm_config".to_owned(), false), ("v2.create_jira_issue_template".to_owned(), false), ("v2.delete_jira_account".to_owned(), false), ("v2.delete_jira_issue_template".to_owned(), false), diff --git a/src/datadogV2/api/api_aws_integration.rs b/src/datadogV2/api/api_aws_integration.rs index d6cda8e426..427656a55c 100644 --- a/src/datadogV2/api/api_aws_integration.rs +++ b/src/datadogV2/api/api_aws_integration.rs @@ -6,6 +6,7 @@ use flate2::{ write::{GzEncoder, ZlibEncoder}, Compression, }; +use log::warn; use reqwest::header::{HeaderMap, HeaderValue}; use serde::{Deserialize, Serialize}; use std::io::Write; @@ -36,6 +37,14 @@ pub enum CreateAWSAccountError { UnknownValue(serde_json::Value), } +/// CreateAWSAccountCCMConfigError is a struct for typed errors of method [`AWSIntegrationAPI::create_aws_account_ccm_config`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateAWSAccountCCMConfigError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// CreateAWSEventBridgeSourceError is a struct for typed errors of method [`AWSIntegrationAPI::create_aws_event_bridge_source`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -60,6 +69,14 @@ pub enum DeleteAWSAccountError { UnknownValue(serde_json::Value), } +/// DeleteAWSAccountCCMConfigError is a struct for typed errors of method [`AWSIntegrationAPI::delete_aws_account_ccm_config`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAWSAccountCCMConfigError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// DeleteAWSEventBridgeSourceError is a struct for typed errors of method [`AWSIntegrationAPI::delete_aws_event_bridge_source`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -76,6 +93,14 @@ pub enum GetAWSAccountError { UnknownValue(serde_json::Value), } +/// GetAWSAccountCCMConfigError is a struct for typed errors of method [`AWSIntegrationAPI::get_aws_account_ccm_config`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAWSAccountCCMConfigError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// GetAWSIntegrationIAMPermissionsError is a struct for typed errors of method [`AWSIntegrationAPI::get_aws_integration_iam_permissions`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -132,6 +157,14 @@ pub enum UpdateAWSAccountError { UnknownValue(serde_json::Value), } +/// UpdateAWSAccountCCMConfigError is a struct for typed errors of method [`AWSIntegrationAPI::update_aws_account_ccm_config`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateAWSAccountCCMConfigError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// Configure your Datadog-AWS integration directly through the Datadog API. /// For more information, see the [AWS integration page](). #[derive(Debug, Clone)] @@ -350,6 +383,176 @@ impl AWSIntegrationAPI { } } + /// Create the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn create_aws_account_ccm_config( + &self, + aws_account_config_id: String, + body: crate::datadogV2::model::AWSCcmConfigRequest, + ) -> Result< + crate::datadogV2::model::AWSCcmConfigResponse, + datadog::Error, + > { + match self + .create_aws_account_ccm_config_with_http_info(aws_account_config_id, body) + .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), + } + } + + /// Create the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn create_aws_account_ccm_config_with_http_info( + &self, + aws_account_config_id: String, + body: crate::datadogV2::model::AWSCcmConfigRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_aws_account_ccm_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_aws_account_ccm_config' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/integration/aws/accounts/{aws_account_config_id}/ccm_config", + local_configuration.get_operation_host(operation_id), + aws_account_config_id = datadog::urlencode(aws_account_config_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + 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"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + 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::( + &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 = + 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)) + } + } + /// Create an Amazon EventBridge source. pub async fn create_aws_event_bridge_source( &self, @@ -704,6 +907,107 @@ impl AWSIntegrationAPI { } } + /// Delete the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn delete_aws_account_ccm_config( + &self, + aws_account_config_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_aws_account_ccm_config_with_http_info(aws_account_config_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn delete_aws_account_ccm_config_with_http_info( + &self, + aws_account_config_id: String, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_aws_account_ccm_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_aws_account_ccm_config' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/integration/aws/accounts/{aws_account_config_id}/ccm_config", + local_configuration.get_operation_host(operation_id), + aws_account_config_id = datadog::urlencode(aws_account_config_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // 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() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + 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)) + } + } + /// Delete an Amazon EventBridge source. pub async fn delete_aws_event_bridge_source( &self, @@ -971,6 +1275,128 @@ impl AWSIntegrationAPI { } } + /// Get the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn get_aws_account_ccm_config( + &self, + aws_account_config_id: String, + ) -> Result< + crate::datadogV2::model::AWSCcmConfigResponse, + datadog::Error, + > { + match self + .get_aws_account_ccm_config_with_http_info(aws_account_config_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), + } + } + + /// Get the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn get_aws_account_ccm_config_with_http_info( + &self, + aws_account_config_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_aws_account_ccm_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_aws_account_ccm_config' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/integration/aws/accounts/{aws_account_config_id}/ccm_config", + local_configuration.get_operation_host(operation_id), + aws_account_config_id = datadog::urlencode(aws_account_config_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // 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::( + &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 = + 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)) + } + } + /// Get all AWS IAM permissions required for the AWS integration. pub async fn get_aws_integration_iam_permissions( &self, @@ -1784,4 +2210,174 @@ impl AWSIntegrationAPI { Err(datadog::Error::ResponseError(local_error)) } } + + /// Update the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn update_aws_account_ccm_config( + &self, + aws_account_config_id: String, + body: crate::datadogV2::model::AWSCcmConfigRequest, + ) -> Result< + crate::datadogV2::model::AWSCcmConfigResponse, + datadog::Error, + > { + match self + .update_aws_account_ccm_config_with_http_info(aws_account_config_id, body) + .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), + } + } + + /// Update the Cloud Cost Management config for an AWS Account Integration Config using Cost and Usage Report + /// (CUR) 2.0 by config ID. + pub async fn update_aws_account_ccm_config_with_http_info( + &self, + aws_account_config_id: String, + body: crate::datadogV2::model::AWSCcmConfigRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_aws_account_ccm_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_aws_account_ccm_config' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/integration/aws/accounts/{aws_account_config_id}/ccm_config", + local_configuration.get_operation_host(operation_id), + aws_account_config_id = datadog::urlencode(aws_account_config_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + 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"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + 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::( + &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 = + 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)) + } + } } diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index ea0e124a96..48ccafd418 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -3466,6 +3466,24 @@ pub mod model_aws_account_update_request_data; pub use self::model_aws_account_update_request_data::AWSAccountUpdateRequestData; pub mod model_aws_account_update_request_attributes; pub use self::model_aws_account_update_request_attributes::AWSAccountUpdateRequestAttributes; +pub mod model_aws_ccm_config_response; +pub use self::model_aws_ccm_config_response::AWSCcmConfigResponse; +pub mod model_aws_ccm_config_response_data; +pub use self::model_aws_ccm_config_response_data::AWSCcmConfigResponseData; +pub mod model_aws_ccm_config_response_attributes; +pub use self::model_aws_ccm_config_response_attributes::AWSCcmConfigResponseAttributes; +pub mod model_data_export_config; +pub use self::model_data_export_config::DataExportConfig; +pub mod model_aws_ccm_config_type; +pub use self::model_aws_ccm_config_type::AWSCcmConfigType; +pub mod model_aws_ccm_config_request; +pub use self::model_aws_ccm_config_request::AWSCcmConfigRequest; +pub mod model_aws_ccm_config_request_data; +pub use self::model_aws_ccm_config_request_data::AWSCcmConfigRequestData; +pub mod model_aws_ccm_config_request_attributes; +pub use self::model_aws_ccm_config_request_attributes::AWSCcmConfigRequestAttributes; +pub mod model_aws_ccm_config; +pub use self::model_aws_ccm_config::AWSCcmConfig; pub mod model_aws_namespaces_response; pub use self::model_aws_namespaces_response::AWSNamespacesResponse; pub mod model_aws_namespaces_response_data; diff --git a/src/datadogV2/model/model_aws_ccm_config.rs b/src/datadogV2/model/model_aws_ccm_config.rs new file mode 100644 index 0000000000..357b8909c1 --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config.rs @@ -0,0 +1,98 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS Cloud Cost Management config. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfig { + /// List of data export configurations for Cost and Usage Reports. + #[serde(rename = "data_export_configs")] + pub data_export_configs: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfig { + pub fn new( + data_export_configs: Vec, + ) -> AWSCcmConfig { + AWSCcmConfig { + data_export_configs, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigVisitor { + type Value = AWSCcmConfig; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_export_configs: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_export_configs" => { + data_export_configs = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data_export_configs = data_export_configs + .ok_or_else(|| M::Error::missing_field("data_export_configs"))?; + + let content = AWSCcmConfig { + data_export_configs, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_request.rs b/src/datadogV2/model/model_aws_ccm_config_request.rs new file mode 100644 index 0000000000..0a265909da --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_request.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS CCM Config Create/Update Request body. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfigRequest { + /// AWS CCM Config Create/Update Request data. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSCcmConfigRequestData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfigRequest { + pub fn new(data: crate::datadogV2::model::AWSCcmConfigRequestData) -> AWSCcmConfigRequest { + AWSCcmConfigRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigRequestVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigRequestVisitor { + type Value = AWSCcmConfigRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = AWSCcmConfigRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_request_attributes.rs b/src/datadogV2/model/model_aws_ccm_config_request_attributes.rs new file mode 100644 index 0000000000..148c9b2c23 --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_request_attributes.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS CCM Config attributes for Create/Update requests. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfigRequestAttributes { + /// AWS Cloud Cost Management config. + #[serde(rename = "ccm_config")] + pub ccm_config: crate::datadogV2::model::AWSCcmConfig, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfigRequestAttributes { + pub fn new(ccm_config: crate::datadogV2::model::AWSCcmConfig) -> AWSCcmConfigRequestAttributes { + AWSCcmConfigRequestAttributes { + ccm_config, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigRequestAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigRequestAttributesVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigRequestAttributesVisitor { + type Value = AWSCcmConfigRequestAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut ccm_config: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "ccm_config" => { + ccm_config = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let ccm_config = ccm_config.ok_or_else(|| M::Error::missing_field("ccm_config"))?; + + let content = AWSCcmConfigRequestAttributes { + ccm_config, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigRequestAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_request_data.rs b/src/datadogV2/model/model_aws_ccm_config_request_data.rs new file mode 100644 index 0000000000..be0012053a --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_request_data.rs @@ -0,0 +1,116 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS CCM Config Create/Update Request data. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfigRequestData { + /// AWS CCM Config attributes for Create/Update requests. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::AWSCcmConfigRequestAttributes, + /// AWS CCM Config resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSCcmConfigType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfigRequestData { + pub fn new( + attributes: crate::datadogV2::model::AWSCcmConfigRequestAttributes, + type_: crate::datadogV2::model::AWSCcmConfigType, + ) -> AWSCcmConfigRequestData { + AWSCcmConfigRequestData { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigRequestDataVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigRequestDataVisitor { + type Value = AWSCcmConfigRequestData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AWSCcmConfigType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AWSCcmConfigRequestData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_response.rs b/src/datadogV2/model/model_aws_ccm_config_response.rs new file mode 100644 index 0000000000..c900a3142c --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_response.rs @@ -0,0 +1,92 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS CCM Config response body. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfigResponse { + /// AWS CCM Config response data. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSCcmConfigResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfigResponse { + pub fn new(data: crate::datadogV2::model::AWSCcmConfigResponseData) -> AWSCcmConfigResponse { + AWSCcmConfigResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigResponseVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigResponseVisitor { + type Value = AWSCcmConfigResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = AWSCcmConfigResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_response_attributes.rs b/src/datadogV2/model/model_aws_ccm_config_response_attributes.rs new file mode 100644 index 0000000000..a5c2396b87 --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_response_attributes.rs @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS CCM Config response attributes. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfigResponseAttributes { + /// List of data export configurations for Cost and Usage Reports. + #[serde(rename = "data_export_configs")] + pub data_export_configs: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfigResponseAttributes { + pub fn new() -> AWSCcmConfigResponseAttributes { + AWSCcmConfigResponseAttributes { + data_export_configs: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn data_export_configs( + mut self, + value: Vec, + ) -> Self { + self.data_export_configs = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSCcmConfigResponseAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigResponseAttributesVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigResponseAttributesVisitor { + type Value = AWSCcmConfigResponseAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data_export_configs: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data_export_configs" => { + if v.is_null() { + continue; + } + data_export_configs = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AWSCcmConfigResponseAttributes { + data_export_configs, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_response_data.rs b/src/datadogV2/model/model_aws_ccm_config_response_data.rs new file mode 100644 index 0000000000..d53cb6b992 --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_response_data.rs @@ -0,0 +1,144 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS CCM Config response data. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSCcmConfigResponseData { + /// AWS CCM Config response attributes. + #[serde(rename = "attributes")] + pub attributes: Option, + /// Unique Datadog ID of the AWS Account Integration Config. + /// To get the config ID for an account, use the + /// [List all AWS integrations]() + /// endpoint and query by AWS Account ID. + #[serde(rename = "id")] + pub id: Option, + /// AWS CCM Config resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSCcmConfigType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSCcmConfigResponseData { + pub fn new(type_: crate::datadogV2::model::AWSCcmConfigType) -> AWSCcmConfigResponseData { + AWSCcmConfigResponseData { + attributes: None, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::AWSCcmConfigResponseAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn id(mut self, value: String) -> Self { + self.id = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSCcmConfigResponseDataVisitor; + impl<'a> Visitor<'a> for AWSCcmConfigResponseDataVisitor { + type Value = AWSCcmConfigResponseData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::AWSCcmConfigResponseAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + if v.is_null() { + continue; + } + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + if v.is_null() { + continue; + } + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::AWSCcmConfigType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AWSCcmConfigResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSCcmConfigResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_ccm_config_type.rs b/src/datadogV2/model/model_aws_ccm_config_type.rs new file mode 100644 index 0000000000..fafb10545d --- /dev/null +++ b/src/datadogV2/model/model_aws_ccm_config_type.rs @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum AWSCcmConfigType { + CCM_CONFIG, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AWSCcmConfigType { + fn to_string(&self) -> String { + match self { + Self::CCM_CONFIG => String::from("ccm_config"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AWSCcmConfigType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for AWSCcmConfigType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "ccm_config" => Self::CCM_CONFIG, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_aws_lambda_forwarder_config.rs b/src/datadogV2/model/model_aws_lambda_forwarder_config.rs index 3a61fb1131..573c453e60 100644 --- a/src/datadogV2/model/model_aws_lambda_forwarder_config.rs +++ b/src/datadogV2/model/model_aws_lambda_forwarder_config.rs @@ -21,7 +21,8 @@ pub struct AWSLambdaForwarderConfig { pub log_source_config: Option, /// List of service IDs set to enable automatic log collection. /// Discover the list of available services with the - /// [Get list of AWS log ready services]() + /// [Get list of AWS log ready + /// services]() /// endpoint. #[serde(rename = "sources")] pub sources: Option>, diff --git a/src/datadogV2/model/model_data_export_config.rs b/src/datadogV2/model/model_data_export_config.rs new file mode 100644 index 0000000000..c37bee0c5f --- /dev/null +++ b/src/datadogV2/model/model_data_export_config.rs @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// AWS Cost and Usage Report data export configuration. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct DataExportConfig { + /// Name of the S3 bucket where the Cost and Usage Report is stored. + #[serde(rename = "bucket_name")] + pub bucket_name: String, + /// AWS region of the S3 bucket. + #[serde(rename = "bucket_region")] + pub bucket_region: String, + /// Name of the Cost and Usage Report. + #[serde(rename = "report_name")] + pub report_name: String, + /// S3 prefix where the Cost and Usage Report is stored. + #[serde(rename = "report_prefix")] + pub report_prefix: String, + /// Type of the Cost and Usage Report. Currently only `CUR2.0` is supported. + #[serde(rename = "report_type")] + pub report_type: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl DataExportConfig { + pub fn new( + bucket_name: String, + bucket_region: String, + report_name: String, + report_prefix: String, + report_type: String, + ) -> DataExportConfig { + DataExportConfig { + bucket_name, + bucket_region, + report_name, + report_prefix, + report_type, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for DataExportConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct DataExportConfigVisitor; + impl<'a> Visitor<'a> for DataExportConfigVisitor { + type Value = DataExportConfig; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut bucket_name: Option = None; + let mut bucket_region: Option = None; + let mut report_name: Option = None; + let mut report_prefix: Option = None; + let mut report_type: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "bucket_name" => { + bucket_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "bucket_region" => { + bucket_region = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "report_name" => { + report_name = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "report_prefix" => { + report_prefix = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "report_type" => { + report_type = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let bucket_name = + bucket_name.ok_or_else(|| M::Error::missing_field("bucket_name"))?; + let bucket_region = + bucket_region.ok_or_else(|| M::Error::missing_field("bucket_region"))?; + let report_name = + report_name.ok_or_else(|| M::Error::missing_field("report_name"))?; + let report_prefix = + report_prefix.ok_or_else(|| M::Error::missing_field("report_prefix"))?; + let report_type = + report_type.ok_or_else(|| M::Error::missing_field("report_type"))?; + + let content = DataExportConfig { + bucket_name, + bucket_region, + report_name, + report_prefix, + report_type, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(DataExportConfigVisitor) + } +} diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen new file mode 100644 index 0000000000..6f32454e82 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:24.949Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json new file mode 100644 index 0000000000..17c64f3d27 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/b2087a32-4d4f-45b1-9321-1a0a48e9d7cf/ccm_config" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:24 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"ccm_config\":{\"data_export_configs\":[{\"bucket_name\":\"billing\",\"bucket_region\":\"us-east-1\",\"report_name\":\"cost-and-usage-report\",\"report_prefix\":\"reports\",\"report_type\":\"CUR2.0\"}]}},\"type\":\"ccm_config\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/b2087a32-4d4f-45b1-9321-1a0a48e9d7cf/ccm_config" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b2087a32-4d4f-45b1-9321-1a0a48e9d7cf\",\"type\":\"ccm_config\",\"attributes\":{\"data_export_configs\":[{\"report_name\":\"cost-and-usage-report\",\"report_prefix\":\"reports\",\"report_type\":\"CUR2.0\",\"bucket_name\":\"billing\",\"bucket_region\":\"us-east-1\"}]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:24 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/%7Baws_account_config_id%7D/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"400\",\"title\":\"Invalid Parameter\",\"detail\":\"invalid parameter \\\"aws_account_config_id\\\" in \\\"path\\\"; expected type \\\"uuid\\\"\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:24 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.frozen new file mode 100644 index 0000000000..58c78b7309 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:25.275Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.json new file mode 100644 index 0000000000..296067da6f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Conflict-response.json @@ -0,0 +1,73 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"ccm_config\":{\"data_export_configs\":[{\"bucket_name\":\"billing\",\"bucket_region\":\"us-east-1\",\"report_name\":\"cost-and-usage-report\",\"report_prefix\":\"reports\",\"report_type\":\"CUR2.0\"}]}},\"type\":\"ccm_config\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/b2087a32-4d4f-45b1-9321-1a0a48e9d7cf/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"409\",\"title\":\"Account already exists\",\"detail\":\"CCM config already exists for this account\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 409, + "message": "Conflict" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:25 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"ccm_config\":{\"data_export_configs\":[{\"bucket_name\":\"billing\",\"bucket_region\":\"us-east-1\",\"report_name\":\"cost-and-usage-report\",\"report_prefix\":\"reports\",\"report_type\":\"CUR2.0\"}]}},\"type\":\"ccm_config\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/b2087a32-4d4f-45b1-9321-1a0a48e9d7cf/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"409\",\"title\":\"Account already exists\",\"detail\":\"CCM config already exists for this account\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 409, + "message": "Conflict" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.frozen new file mode 100644 index 0000000000..42aaeea7fe --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:25.575Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.json new file mode 100644 index 0000000000..7e80085f8b --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-AWS-CCM-config-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"ccm_config\":{\"data_export_configs\":[{\"bucket_name\":\"billing\",\"bucket_region\":\"us-east-1\",\"report_name\":\"cost-and-usage-report\",\"report_prefix\":\"reports\",\"report_type\":\"CUR2.0\"}]}},\"type\":\"ccm_config\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/00000000-0000-0000-0000-000000000000/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Account not found\",\"detail\":\"AWS account with provided id is not integrated\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.frozen new file mode 100644 index 0000000000..45f4b0fc3e --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:25.766Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.json b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.json new file mode 100644 index 0000000000..74f62345a5 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-No-Content-response.json @@ -0,0 +1,29 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/b2087a32-4d4f-45b1-9321-1a0a48e9d7cf/ccm_config" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.frozen new file mode 100644 index 0000000000..033ac2e27a --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:25.891Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.json new file mode 100644 index 0000000000..9299bfd323 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-AWS-CCM-config-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/00000000-0000-0000-0000-000000000000/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Account not found\",\"detail\":\"AWS account with provided id is not integrated\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.frozen new file mode 100644 index 0000000000..cf986cfe94 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:25.966Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.json new file mode 100644 index 0000000000..f4a71e63d7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-AWS-CCM-config-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/00000000-0000-0000-0000-000000000000/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Account not found\",\"detail\":\"AWS account with provided id is not integrated\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:25 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen new file mode 100644 index 0000000000..db064b9a80 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:26.142Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json new file mode 100644 index 0000000000..e33c110eb5 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-AWS-CCM-Config-object-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"ccm_config\":{\"data_export_configs\":[{\"bucket_name\":\"billing-updated\",\"bucket_region\":\"us-west-2\",\"report_name\":\"cost-report-updated\",\"report_prefix\":\"reports-updated\",\"report_type\":\"CUR2.0\"}]}},\"type\":\"ccm_config\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/b2087a32-4d4f-45b1-9321-1a0a48e9d7cf/ccm_config" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b2087a32-4d4f-45b1-9321-1a0a48e9d7cf\",\"type\":\"ccm_config\",\"attributes\":{\"data_export_configs\":[{\"report_name\":\"cost-report-updated\",\"report_prefix\":\"reports-updated\",\"report_type\":\"CUR2.0\",\"bucket_name\":\"billing-updated\",\"bucket_region\":\"us-west-2\"}]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:26 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.frozen new file mode 100644 index 0000000000..418f960ea9 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-02-23T18:02:26.253Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.json new file mode 100644 index 0000000000..6f74d2e5e4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-AWS-CCM-config-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"ccm_config\":{\"data_export_configs\":[{\"bucket_name\":\"billing\",\"bucket_region\":\"us-east-1\",\"report_name\":\"cost-and-usage-report\",\"report_prefix\":\"reports\",\"report_type\":\"CUR2.0\"}]}},\"type\":\"ccm_config\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/00000000-0000-0000-0000-000000000000/ccm_config" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Account not found\",\"detail\":\"AWS account with provided id is not integrated\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 23 Feb 2026 18:02:26 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/aws_integration.feature b/tests/scenarios/features/v2/aws_integration.feature index 30ded64d73..5989319f4e 100644 --- a/tests/scenarios/features/v2/aws_integration.feature +++ b/tests/scenarios/features/v2/aws_integration.feature @@ -9,6 +9,33 @@ Feature: AWS Integration And a valid "appKeyAuth" key in the system And an instance of "AWSIntegration" API + @skip @team:DataDog/aws-integrations + Scenario: Create AWS CCM config returns "AWS CCM Config object" response + Given operation "CreateAWSAccountCCMConfig" enabled + And new "CreateAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ccm_config": {"data_export_configs": [{"bucket_name": "billing", "bucket_region": "us-east-1", "report_name": "cost-and-usage-report", "report_prefix": "reports", "report_type": "CUR2.0"}]}}, "type": "ccm_config"}} + When the request is sent + Then the response status is 200 AWS CCM Config object + + @skip @team:DataDog/aws-integrations + Scenario: Create AWS CCM config returns "Conflict" response + Given operation "CreateAWSAccountCCMConfig" enabled + And new "CreateAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ccm_config": {"data_export_configs": [{"bucket_name": "billing", "bucket_region": "us-east-1", "report_name": "cost-and-usage-report", "report_prefix": "reports", "report_type": "CUR2.0"}]}}, "type": "ccm_config"}} + When the request is sent + Then the response status is 409 Conflict + + @skip @team:DataDog/aws-integrations + Scenario: Create AWS CCM config returns "Not Found" response + Given operation "CreateAWSAccountCCMConfig" enabled + And new "CreateAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ccm_config": {"data_export_configs": [{"bucket_name": "billing", "bucket_region": "us-east-1", "report_name": "cost-and-usage-report", "report_prefix": "reports", "report_type": "CUR2.0"}]}}, "type": "ccm_config"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/aws-integrations Scenario: Create an AWS account returns "AWS Account object" response Given new "CreateAWSAccount" request @@ -59,6 +86,22 @@ Feature: AWS Integration When the request is sent Then the response status is 409 Conflict + @skip @team:DataDog/aws-integrations + Scenario: Delete AWS CCM config returns "No Content" response + Given operation "DeleteAWSAccountCCMConfig" enabled + And new "DeleteAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @skip @team:DataDog/aws-integrations + Scenario: Delete AWS CCM config returns "Not Found" response + Given operation "DeleteAWSAccountCCMConfig" enabled + And new "DeleteAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/aws-integrations Scenario: Delete an AWS integration returns "Bad Request" response Given new "DeleteAWSAccount" request @@ -108,6 +151,22 @@ Feature: AWS Integration When the request is sent Then the response status is 200 AWS External ID object + @skip @team:DataDog/aws-integrations + Scenario: Get AWS CCM config returns "AWS CCM Config object" response + Given operation "GetAWSAccountCCMConfig" enabled + And new "GetAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 AWS CCM Config object + + @skip @team:DataDog/aws-integrations + Scenario: Get AWS CCM config returns "Not Found" response + Given operation "GetAWSAccountCCMConfig" enabled + And new "GetAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/aws-integrations Scenario: Get AWS integration IAM permissions returns "AWS IAM Permissions object" response Given new "GetAWSIntegrationIAMPermissions" request @@ -190,6 +249,24 @@ Feature: AWS Integration When the request is sent Then the response status is 200 AWS Namespaces List object + @skip @team:DataDog/aws-integrations + Scenario: Update AWS CCM config returns "AWS CCM Config object" response + Given operation "UpdateAWSAccountCCMConfig" enabled + And new "UpdateAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ccm_config": {"data_export_configs": [{"bucket_name": "billing", "bucket_region": "us-east-1", "report_name": "cost-and-usage-report", "report_prefix": "reports", "report_type": "CUR2.0"}]}}, "type": "ccm_config"}} + When the request is sent + Then the response status is 200 AWS CCM Config object + + @skip @team:DataDog/aws-integrations + Scenario: Update AWS CCM config returns "Not Found" response + Given operation "UpdateAWSAccountCCMConfig" enabled + And new "UpdateAWSAccountCCMConfig" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"ccm_config": {"data_export_configs": [{"bucket_name": "billing", "bucket_region": "us-east-1", "report_name": "cost-and-usage-report", "report_prefix": "reports", "report_type": "CUR2.0"}]}}, "type": "ccm_config"}} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/aws-integrations Scenario: Update an AWS integration returns "AWS Account object" response Given there is a valid "aws_account_v2" in the system diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 09186eef67..8894551aff 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2196,6 +2196,32 @@ "type": "idempotent" } }, + "DeleteAWSAccountCCMConfig": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "GetAWSAccountCCMConfig": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "UpdateAWSAccountCCMConfig": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "CreateAWSAccountCCMConfig": { + "tag": "AWS Integration", + "undo": { + "operationId": "DeleteAWSAccountCCMConfig", + "parameters": [], + "type": "unsafe" + } + }, "ListAWSNamespaces": { "tag": "AWS Integration", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index dbafb66676..97a9ef4a5a 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -3567,6 +3567,22 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.UpdateAWSAccount".into(), test_v2_update_aws_account); + world.function_mappings.insert( + "v2.DeleteAWSAccountCCMConfig".into(), + test_v2_delete_aws_account_ccm_config, + ); + world.function_mappings.insert( + "v2.GetAWSAccountCCMConfig".into(), + test_v2_get_aws_account_ccm_config, + ); + world.function_mappings.insert( + "v2.UpdateAWSAccountCCMConfig".into(), + test_v2_update_aws_account_ccm_config, + ); + world.function_mappings.insert( + "v2.CreateAWSAccountCCMConfig".into(), + test_v2_create_aws_account_ccm_config, + ); world .function_mappings .insert("v2.ListAWSNamespaces".into(), test_v2_list_aws_namespaces); @@ -26469,6 +26485,130 @@ fn test_v2_update_aws_account(world: &mut DatadogWorld, _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let aws_account_config_id = + serde_json::from_value(_parameters.get("aws_account_config_id").unwrap().clone()).unwrap(); + let response = + match block_on(api.delete_aws_account_ccm_config_with_http_info(aws_account_config_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_aws_account_ccm_config( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let aws_account_config_id = + serde_json::from_value(_parameters.get("aws_account_config_id").unwrap().clone()).unwrap(); + let response = + match block_on(api.get_aws_account_ccm_config_with_http_info(aws_account_config_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_aws_account_ccm_config( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let aws_account_config_id = + serde_json::from_value(_parameters.get("aws_account_config_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.update_aws_account_ccm_config_with_http_info(aws_account_config_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_aws_account_ccm_config( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let aws_account_config_id = + serde_json::from_value(_parameters.get("aws_account_config_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.create_aws_account_ccm_config_with_http_info(aws_account_config_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_aws_namespaces(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances