From 03f26175a2cf54e3e7c0c787be872fe51313cbc9 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 12 Nov 2024 20:22:23 +0000 Subject: [PATCH] Regenerate client from commit 9a869b6b of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 815 +++++++++++++ .../v2_aws-integration_CreateAWSAccount.rs | 67 ++ ...integration_CreateAWSAccount_1716720881.rs | 66 ++ ..._aws-integration_CreateNewAWSExternalID.rs | 16 + ...ration_CreateNewAWSExternalID_364713854.rs | 16 + .../v2_aws-integration_DeleteAWSAccount.rs | 18 + examples/v2_aws-integration_GetAWSAccount.rs | 18 + .../v2_aws-integration_ListAWSAccounts.rs | 19 + .../v2_aws-integration_ListAWSNamespaces.rs | 16 + ...ntegration_ListAWSNamespaces_3031307873.rs | 16 + .../v2_aws-integration_UpdateAWSAccount.rs | 79 ++ ...ws-logs-integration_ListAWSLogsServices.rs | 17 + src/datadog/configuration.rs | 8 + src/datadogV2/api/api_aws_integration.rs | 1044 +++++++++++++++++ src/datadogV2/api/api_aws_logs_integration.rs | 196 ++++ src/datadogV2/api/mod.rs | 2 + src/datadogV2/mod.rs | 2 + src/datadogV2/model/mod.rs | 88 ++ .../model/model_aws_account_create_request.rs | 94 ++ ...l_aws_account_create_request_attributes.rs | 260 ++++ .../model_aws_account_create_request_data.rs | 117 ++ .../model/model_aws_account_partition.rs | 54 + .../model/model_aws_account_response.rs | 92 ++ .../model_aws_account_response_attributes.rs | 303 +++++ .../model/model_aws_account_response_data.rs | 136 +++ src/datadogV2/model/model_aws_account_type.rs | 48 + .../model/model_aws_account_update_request.rs | 94 ++ ...l_aws_account_update_request_attributes.rs | 268 +++++ .../model_aws_account_update_request_data.rs | 134 +++ .../model/model_aws_accounts_response.rs | 92 ++ src/datadogV2/model/model_aws_auth_config.rs | 41 + .../model/model_aws_auth_config_keys.rs | 112 ++ .../model/model_aws_auth_config_role.rs | 110 ++ .../model_aws_lambda_forwarder_config.rs | 122 ++ src/datadogV2/model/model_aws_logs_config.rs | 111 ++ .../model/model_aws_logs_services_response.rs | 94 ++ ...l_aws_logs_services_response_attributes.rs | 94 ++ .../model_aws_logs_services_response_data.rs | 136 +++ ...el_aws_logs_services_response_data_type.rs | 48 + .../model/model_aws_metrics_config.rs | 211 ++++ .../model/model_aws_namespace_filters.rs | 61 + ...model_aws_namespace_filters_exclude_all.rs | 94 ++ ...odel_aws_namespace_filters_exclude_only.rs | 94 ++ ...model_aws_namespace_filters_include_all.rs | 94 ++ ...odel_aws_namespace_filters_include_only.rs | 94 ++ .../model/model_aws_namespace_tag_filter.rs | 119 ++ .../model/model_aws_namespaces_response.rs | 92 ++ ...odel_aws_namespaces_response_attributes.rs | 92 ++ .../model_aws_namespaces_response_data.rs | 136 +++ ...model_aws_namespaces_response_data_type.rs | 48 + .../model_aws_new_external_id_response.rs | 94 ++ ...aws_new_external_id_response_attributes.rs | 94 ++ ...model_aws_new_external_id_response_data.rs | 136 +++ ..._aws_new_external_id_response_data_type.rs | 48 + src/datadogV2/model/model_aws_regions.rs | 41 + .../model/model_aws_regions_include_all.rs | 94 ++ .../model/model_aws_regions_include_only.rs | 94 ++ .../model/model_aws_resources_config.rs | 124 ++ .../model/model_aws_traces_config.rs | 116 ++ .../model/model_x_ray_services_include_all.rs | 94 ++ .../model_x_ray_services_include_only.rs | 94 ++ .../model/model_x_ray_services_list.rs | 42 + ...returns-AWS-Account-object-response.frozen | 1 + ...g-returns-AWS-Account-object-response.json | 63 + ...config-returns-Bad-Request-response.frozen | 1 + ...t-config-returns-Bad-Request-response.json | 39 + ...nt-config-returns-Conflict-response.frozen | 1 + ...ount-config-returns-Conflict-response.json | 97 ++ ...tion-returns-400-API-error-response.frozen | 1 + ...tition-returns-400-API-error-response.json | 39 + ...returns-AWS-Account-object-response.frozen | 1 + ...g-returns-AWS-Account-object-response.json | 67 ++ ...config-returns-Bad-Request-response.frozen | 1 + ...t-config-returns-Bad-Request-response.json | 33 + ...-config-returns-No-Content-response.frozen | 1 + ...nt-config-returns-No-Content-response.json | 91 ++ ...t-config-returns-Not-Found-response.frozen | 1 + ...unt-config-returns-Not-Found-response.json | 91 ++ ...rns-AWS-External-ID-object-response.frozen | 1 + ...turns-AWS-External-ID-object-response.json | 33 + ...returns-AWS-Account-object-response.frozen | 1 + ...g-returns-AWS-Account-object-response.json | 91 ++ ...config-returns-Bad-Request-response.frozen | 1 + ...t-config-returns-Bad-Request-response.json | 33 + ...t-config-returns-Not-Found-response.frozen | 1 + ...unt-config-returns-Not-Found-response.json | 33 + ...s-AWS-Accounts-List-object-response.frozen | 1 + ...rns-AWS-Accounts-List-object-response.json | 33 + ...AWS-Namespaces-List-object-response.frozen | 1 + ...s-AWS-Namespaces-List-object-response.json | 33 + ...-Logs-Services-List-object-response.frozen | 1 + ...WS-Logs-Services-List-object-response.json | 33 + ...AWS-Namespaces-List-object-response.frozen | 1 + ...s-AWS-Namespaces-List-object-response.json | 33 + ...returns-API-error-response-response.frozen | 1 + ...g-returns-API-error-response-response.json | 101 ++ ...returns-AWS-Account-object-response.frozen | 1 + ...g-returns-AWS-Account-object-response.json | 97 ++ ...config-returns-Bad-Request-response.frozen | 1 + ...t-config-returns-Bad-Request-response.json | 97 ++ ...t-config-returns-Not-Found-response.frozen | 1 + ...unt-config-returns-Not-Found-response.json | 39 + ...returns-AWS-Account-object-response.frozen | 1 + ...t-returns-AWS-Account-object-response.json | 63 + ...returns-AWS-Account-object-response.frozen | 1 + ...n-returns-AWS-Account-object-response.json | 63 + ...ration-returns-Bad-Request-response.frozen | 1 + ...egration-returns-Bad-Request-response.json | 39 + ...tegration-returns-Conflict-response.frozen | 1 + ...integration-returns-Conflict-response.json | 97 ++ ...ration-returns-Bad-Request-response.frozen | 1 + ...egration-returns-Bad-Request-response.json | 33 + ...gration-returns-No-Content-response.frozen | 1 + ...tegration-returns-No-Content-response.json | 91 ++ ...egration-returns-Not-Found-response.frozen | 1 + ...ntegration-returns-Not-Found-response.json | 91 ++ ...rns-AWS-External-ID-object-response.frozen | 1 + ...turns-AWS-External-ID-object-response.json | 33 + ...rns-AWS-External-ID-object-response.frozen | 1 + ...turns-AWS-External-ID-object-response.json | 33 + ...returns-AWS-Account-object-response.frozen | 1 + ...D-returns-AWS-Account-object-response.json | 91 ++ ...fig-ID-returns-Bad-Request-response.frozen | 1 + ...onfig-ID-returns-Bad-Request-response.json | 33 + ...onfig-ID-returns-Not-Found-response.frozen | 1 + ...-config-ID-returns-Not-Found-response.json | 33 + ...s-AWS-Accounts-List-object-response.frozen | 1 + ...rns-AWS-Accounts-List-object-response.json | 33 + ...AWS-Namespaces-List-object-response.frozen | 1 + ...s-AWS-Namespaces-List-object-response.json | 33 + ...-Logs-Services-List-object-response.frozen | 1 + ...WS-Logs-Services-List-object-response.json | 33 + ...AWS-Namespaces-List-object-response.frozen | 1 + ...s-AWS-Namespaces-List-object-response.json | 33 + ...returns-AWS-Account-object-response.frozen | 1 + ...n-returns-AWS-Account-object-response.json | 97 ++ ...ration-returns-Bad-Request-response.frozen | 1 + ...egration-returns-Bad-Request-response.json | 97 ++ ...egration-returns-Not-Found-response.frozen | 1 + ...ntegration-returns-Not-Found-response.json | 39 + ...-Logs-Services-List-object-response.frozen | 1 + ...WS-Logs-Services-List-object-response.json | 33 + .../features/v1/aws_integration.feature | 52 +- .../features/v1/aws_logs_integration.feature | 26 +- .../features/v2/aws_integration.feature | 158 +++ .../features/v2/aws_logs_integration.feature | 16 + tests/scenarios/features/v2/given.json | 12 + tests/scenarios/features/v2/undo.json | 55 + tests/scenarios/function_mappings.rs | 250 ++++ 150 files changed, 10117 insertions(+), 43 deletions(-) create mode 100644 examples/v2_aws-integration_CreateAWSAccount.rs create mode 100644 examples/v2_aws-integration_CreateAWSAccount_1716720881.rs create mode 100644 examples/v2_aws-integration_CreateNewAWSExternalID.rs create mode 100644 examples/v2_aws-integration_CreateNewAWSExternalID_364713854.rs create mode 100644 examples/v2_aws-integration_DeleteAWSAccount.rs create mode 100644 examples/v2_aws-integration_GetAWSAccount.rs create mode 100644 examples/v2_aws-integration_ListAWSAccounts.rs create mode 100644 examples/v2_aws-integration_ListAWSNamespaces.rs create mode 100644 examples/v2_aws-integration_ListAWSNamespaces_3031307873.rs create mode 100644 examples/v2_aws-integration_UpdateAWSAccount.rs create mode 100644 examples/v2_aws-logs-integration_ListAWSLogsServices.rs create mode 100644 src/datadogV2/api/api_aws_integration.rs create mode 100644 src/datadogV2/api/api_aws_logs_integration.rs create mode 100644 src/datadogV2/model/model_aws_account_create_request.rs create mode 100644 src/datadogV2/model/model_aws_account_create_request_attributes.rs create mode 100644 src/datadogV2/model/model_aws_account_create_request_data.rs create mode 100644 src/datadogV2/model/model_aws_account_partition.rs create mode 100644 src/datadogV2/model/model_aws_account_response.rs create mode 100644 src/datadogV2/model/model_aws_account_response_attributes.rs create mode 100644 src/datadogV2/model/model_aws_account_response_data.rs create mode 100644 src/datadogV2/model/model_aws_account_type.rs create mode 100644 src/datadogV2/model/model_aws_account_update_request.rs create mode 100644 src/datadogV2/model/model_aws_account_update_request_attributes.rs create mode 100644 src/datadogV2/model/model_aws_account_update_request_data.rs create mode 100644 src/datadogV2/model/model_aws_accounts_response.rs create mode 100644 src/datadogV2/model/model_aws_auth_config.rs create mode 100644 src/datadogV2/model/model_aws_auth_config_keys.rs create mode 100644 src/datadogV2/model/model_aws_auth_config_role.rs create mode 100644 src/datadogV2/model/model_aws_lambda_forwarder_config.rs create mode 100644 src/datadogV2/model/model_aws_logs_config.rs create mode 100644 src/datadogV2/model/model_aws_logs_services_response.rs create mode 100644 src/datadogV2/model/model_aws_logs_services_response_attributes.rs create mode 100644 src/datadogV2/model/model_aws_logs_services_response_data.rs create mode 100644 src/datadogV2/model/model_aws_logs_services_response_data_type.rs create mode 100644 src/datadogV2/model/model_aws_metrics_config.rs create mode 100644 src/datadogV2/model/model_aws_namespace_filters.rs create mode 100644 src/datadogV2/model/model_aws_namespace_filters_exclude_all.rs create mode 100644 src/datadogV2/model/model_aws_namespace_filters_exclude_only.rs create mode 100644 src/datadogV2/model/model_aws_namespace_filters_include_all.rs create mode 100644 src/datadogV2/model/model_aws_namespace_filters_include_only.rs create mode 100644 src/datadogV2/model/model_aws_namespace_tag_filter.rs create mode 100644 src/datadogV2/model/model_aws_namespaces_response.rs create mode 100644 src/datadogV2/model/model_aws_namespaces_response_attributes.rs create mode 100644 src/datadogV2/model/model_aws_namespaces_response_data.rs create mode 100644 src/datadogV2/model/model_aws_namespaces_response_data_type.rs create mode 100644 src/datadogV2/model/model_aws_new_external_id_response.rs create mode 100644 src/datadogV2/model/model_aws_new_external_id_response_attributes.rs create mode 100644 src/datadogV2/model/model_aws_new_external_id_response_data.rs create mode 100644 src/datadogV2/model/model_aws_new_external_id_response_data_type.rs create mode 100644 src/datadogV2/model/model_aws_regions.rs create mode 100644 src/datadogV2/model/model_aws_regions_include_all.rs create mode 100644 src/datadogV2/model/model_aws_regions_include_only.rs create mode 100644 src/datadogV2/model/model_aws_resources_config.rs create mode 100644 src/datadogV2/model/model_aws_traces_config.rs create mode 100644 src/datadogV2/model/model_x_ray_services_include_all.rs create mode 100644 src/datadogV2/model/model_x_ray_services_include_only.rs create mode 100644 src/datadogV2/model/model_x_ray_services_list.rs create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.json create mode 100644 tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.frozen create mode 100644 tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.json create mode 100644 tests/scenarios/features/v2/aws_integration.feature create mode 100644 tests/scenarios/features/v2/aws_logs_integration.feature diff --git a/.apigentools-info b/.apigentools-info index 1726930c0..6498c4016 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-12 10:03:21.532003", - "spec_repo_commit": "67b7e114" + "regenerated": "2024-11-12 20:16:32.921285", + "spec_repo_commit": "9a869b6b" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-12 10:03:21.551643", - "spec_repo_commit": "67b7e114" + "regenerated": "2024-11-12 20:16:32.939333", + "spec_repo_commit": "9a869b6b" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a3a38ebca..ad1dba70f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -84,6 +84,13 @@ components: required: false schema: $ref: '#/components/schemas/APIKeysSort' + AWSAccountConfigIDPathParameter: + description: Unique Datadog ID of the AWS Account Integration Config + in: path + name: aws_account_config_id + required: true + schema: + type: string ApplicationKeyFilterCreatedAtEndParameter: description: Only include application keys created on or before the specified date. @@ -983,6 +990,536 @@ components: type: string x-enum-varnames: - API_KEYS + AWSAccountConfigID: + description: Unique Datadog ID of the AWS Account Integration Config + example: 00000000-abcd-0001-0000-000000000000 + type: string + AWSAccountCreateRequest: + description: AWS Account Create Request body + properties: + data: + $ref: '#/components/schemas/AWSAccountCreateRequestData' + required: + - data + type: object + AWSAccountCreateRequestAttributes: + description: The AWS Account Integration Config to be created + properties: + account_tags: + $ref: '#/components/schemas/AWSAccountTags' + auth_config: + $ref: '#/components/schemas/AWSAuthConfig' + aws_account_id: + $ref: '#/components/schemas/AWSAccountID' + aws_partition: + $ref: '#/components/schemas/AWSAccountPartition' + aws_regions: + $ref: '#/components/schemas/AWSRegions' + logs_config: + $ref: '#/components/schemas/AWSLogsConfig' + metrics_config: + $ref: '#/components/schemas/AWSMetricsConfig' + resources_config: + $ref: '#/components/schemas/AWSResourcesConfig' + traces_config: + $ref: '#/components/schemas/AWSTracesConfig' + required: + - aws_account_id + - aws_partition + - auth_config + type: object + AWSAccountCreateRequestData: + description: AWS Account Create Request data + properties: + attributes: + $ref: '#/components/schemas/AWSAccountCreateRequestAttributes' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - attributes + - type + type: object + AWSAccountID: + description: AWS Account ID + example: '123456789012' + type: string + AWSAccountPartition: + default: aws + description: AWS Account partition + enum: + - aws + - aws-cn + - aws-us-gov + example: aws + type: string + x-enum-varnames: + - AWS + - AWS_CN + - AWS_US_GOV + AWSAccountResponse: + description: AWS Account response body + properties: + data: + $ref: '#/components/schemas/AWSAccountResponseData' + required: + - data + type: object + AWSAccountResponseAttributes: + description: The AWS Account Integration Config + properties: + account_tags: + $ref: '#/components/schemas/AWSAccountTags' + auth_config: + $ref: '#/components/schemas/AWSAuthConfig' + aws_account_id: + $ref: '#/components/schemas/AWSAccountID' + aws_partition: + $ref: '#/components/schemas/AWSAccountPartition' + aws_regions: + $ref: '#/components/schemas/AWSRegions' + created_at: + description: Timestamp of when the account integration was created + format: date-time + readOnly: true + type: string + logs_config: + $ref: '#/components/schemas/AWSLogsConfig' + metrics_config: + $ref: '#/components/schemas/AWSMetricsConfig' + modified_at: + description: Timestamp of when the account integration was updated + format: date-time + readOnly: true + type: string + resources_config: + $ref: '#/components/schemas/AWSResourcesConfig' + traces_config: + $ref: '#/components/schemas/AWSTracesConfig' + required: + - aws_account_id + type: object + AWSAccountResponseData: + description: AWS Account Response body + properties: + attributes: + $ref: '#/components/schemas/AWSAccountResponseAttributes' + id: + $ref: '#/components/schemas/AWSAccountConfigID' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - id + - type + type: object + AWSAccountTags: + description: Tags to apply to all metrics in the account + items: + description: Tag to apply to all metrics in the account + example: key:value + type: string + nullable: true + type: array + AWSAccountType: + default: account + description: AWS Account resource type. + enum: + - account + example: account + type: string + x-enum-varnames: + - ACCOUNT + AWSAccountUpdateRequest: + description: AWS Account Update Request body + properties: + data: + $ref: '#/components/schemas/AWSAccountUpdateRequestData' + required: + - data + type: object + AWSAccountUpdateRequestAttributes: + description: The AWS Account Integration Config to be updated + properties: + account_tags: + $ref: '#/components/schemas/AWSAccountTags' + auth_config: + $ref: '#/components/schemas/AWSAuthConfig' + aws_account_id: + $ref: '#/components/schemas/AWSAccountID' + aws_partition: + $ref: '#/components/schemas/AWSAccountPartition' + aws_regions: + $ref: '#/components/schemas/AWSRegions' + logs_config: + $ref: '#/components/schemas/AWSLogsConfig' + metrics_config: + $ref: '#/components/schemas/AWSMetricsConfig' + resources_config: + $ref: '#/components/schemas/AWSResourcesConfig' + traces_config: + $ref: '#/components/schemas/AWSTracesConfig' + required: + - aws_account_id + type: object + AWSAccountUpdateRequestData: + description: AWS Account Update Request data + properties: + attributes: + $ref: '#/components/schemas/AWSAccountUpdateRequestAttributes' + id: + $ref: '#/components/schemas/AWSAccountConfigID' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - attributes + - type + type: object + AWSAccountsResponse: + description: AWS Accounts response body + properties: + data: + description: List of AWS Account Integration Configs + items: + $ref: '#/components/schemas/AWSAccountResponseData' + type: array + required: + - data + type: object + AWSAuthConfig: + description: AWS Authentication config + oneOf: + - $ref: '#/components/schemas/AWSAuthConfigKeys' + - $ref: '#/components/schemas/AWSAuthConfigRole' + AWSAuthConfigKeys: + description: AWS Authentication config for key-based account + properties: + access_key_id: + description: AWS Access Key ID + example: AKIAIOSFODNN7EXAMPLE + type: string + secret_access_key: + description: AWS Secret Access Key + example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY + minLength: 1 + type: string + writeOnly: true + required: + - access_key_id + type: object + AWSAuthConfigRole: + description: AWS Authentication config for role-based account + properties: + external_id: + description: AWS IAM External ID for associated role + type: string + role_name: + description: AWS IAM Role name + example: DatadogIntegrationRole + maxLength: 576 + minLength: 1 + type: string + required: + - role_name + type: object + AWSLambdaForwarderConfig: + description: AWS Lambda forwarder + properties: + lambdas: + description: List of Datadog Lambda Log Forwarder ARNs + items: + example: arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder + type: string + type: array + sources: + description: List of AWS services that will send logs to the Datadog Lambda + Log Forwarder + items: + example: s3 + type: string + type: array + type: object + AWSLogsConfig: + description: AWS Logs config + properties: + lambda_forwarder: + $ref: '#/components/schemas/AWSLambdaForwarderConfig' + type: object + AWSLogsServicesResponse: + description: AWS Logs Services response body + properties: + data: + $ref: '#/components/schemas/AWSLogsServicesResponseData' + required: + - data + type: object + AWSLogsServicesResponseAttributes: + description: AWS Logs Services response body + properties: + logs_services: + description: List of AWS services that can send logs to Datadog + example: + - s3 + items: + example: s3 + type: string + type: array + required: + - logs_services + type: object + AWSLogsServicesResponseData: + description: AWS Logs Services response body + properties: + attributes: + $ref: '#/components/schemas/AWSLogsServicesResponseAttributes' + id: + default: logs_services + description: The `AWSLogsServicesResponseData` `id`. + example: logs_services + type: string + type: + $ref: '#/components/schemas/AWSLogsServicesResponseDataType' + required: + - id + - type + type: object + AWSLogsServicesResponseDataType: + default: logs_services + description: The `AWSLogsServicesResponseData` `type`. + enum: + - logs_services + example: logs_services + type: string + x-enum-varnames: + - LOGS_SERVICES + AWSMetricsConfig: + description: AWS Metrics config + properties: + automute_enabled: + description: Enable EC2 automute for AWS metrics + example: true + type: boolean + collect_cloudwatch_alarms: + description: Enable CloudWatch alarms collection + example: true + type: boolean + collect_custom_metrics: + description: Enable custom metrics collection + example: true + type: boolean + enabled: + description: Enable AWS metrics collection + example: true + type: boolean + namespace_filters: + $ref: '#/components/schemas/AWSNamespaceFilters' + tag_filters: + description: AWS Metrics tag filters list + items: + $ref: '#/components/schemas/AWSNamespaceTagFilter' + type: array + type: object + AWSNamespaceFilters: + description: AWS Metrics namespace filters + oneOf: + - $ref: '#/components/schemas/AWSNamespaceFiltersExcludeAll' + - $ref: '#/components/schemas/AWSNamespaceFiltersExcludeOnly' + - $ref: '#/components/schemas/AWSNamespaceFiltersIncludeAll' + - $ref: '#/components/schemas/AWSNamespaceFiltersIncludeOnly' + AWSNamespaceFiltersExcludeAll: + description: Exclude all namespaces + properties: + exclude_all: + description: Exclude all namespaces + example: false + type: boolean + required: + - exclude_all + AWSNamespaceFiltersExcludeOnly: + description: Exclude only these namespaces + properties: + exclude_only: + description: Exclude only these namespaces + example: + - AWS/EC2 + items: + example: AWS/EC2 + type: string + type: array + required: + - exclude_only + AWSNamespaceFiltersIncludeAll: + description: Include all namespaces + properties: + include_all: + description: Include all namespaces + example: false + type: boolean + required: + - include_all + AWSNamespaceFiltersIncludeOnly: + description: Include only these namespaces + properties: + include_only: + description: Include only these namespaces + example: + - AWS/EC2 + items: + example: AWS/EC2 + type: string + type: array + required: + - include_only + AWSNamespaceTagFilter: + description: AWS Metrics tag filters + properties: + namespace: + description: The AWS Namespace to apply the tag filters against + example: AWS/EC2 + type: string + tags: + description: The tags to filter based on + items: + example: key:value + type: string + nullable: true + type: array + type: object + AWSNamespacesResponse: + description: AWS Namespaces response body + properties: + data: + $ref: '#/components/schemas/AWSNamespacesResponseData' + required: + - data + type: object + AWSNamespacesResponseAttributes: + description: AWS Namespaces response body + properties: + namespaces: + description: AWS CloudWatch namespace + example: + - AWS/ApiGateway + items: + example: AWS/ApiGateway + type: string + type: array + required: + - namespaces + type: object + AWSNamespacesResponseData: + description: AWS Namespaces response body + properties: + attributes: + $ref: '#/components/schemas/AWSNamespacesResponseAttributes' + id: + default: namespaces + description: The `AWSNamespacesResponseData` `id`. + example: namespaces + type: string + type: + $ref: '#/components/schemas/AWSNamespacesResponseDataType' + required: + - id + - type + type: object + AWSNamespacesResponseDataType: + default: namespaces + description: The `AWSNamespacesResponseData` `type`. + enum: + - namespaces + example: namespaces + type: string + x-enum-varnames: + - NAMESPACES + AWSNewExternalIDResponse: + description: AWS External ID response body + properties: + data: + $ref: '#/components/schemas/AWSNewExternalIDResponseData' + required: + - data + type: object + AWSNewExternalIDResponseAttributes: + description: AWS External ID response body + properties: + external_id: + description: AWS IAM External ID for associated role + example: acb8f6b8a844443dbb726d07dcb1a870 + type: string + required: + - external_id + type: object + AWSNewExternalIDResponseData: + description: AWS External ID response body + properties: + attributes: + $ref: '#/components/schemas/AWSNewExternalIDResponseAttributes' + id: + default: external_id + description: The `AWSNewExternalIDResponseData` `id`. + example: external_id + type: string + type: + $ref: '#/components/schemas/AWSNewExternalIDResponseDataType' + required: + - id + - type + type: object + AWSNewExternalIDResponseDataType: + default: external_id + description: The `AWSNewExternalIDResponseData` `type`. + enum: + - external_id + example: external_id + type: string + x-enum-varnames: + - EXTERNAL_ID + AWSRegions: + description: AWS Regions to collect data from + oneOf: + - $ref: '#/components/schemas/AWSRegionsIncludeAll' + - $ref: '#/components/schemas/AWSRegionsIncludeOnly' + AWSRegionsIncludeAll: + description: Include all regions + properties: + include_all: + description: Include all regions + example: false + type: boolean + required: + - include_all + AWSRegionsIncludeOnly: + description: Include only these regions + properties: + include_only: + description: Include only these regions + example: + - us-east-1 + items: + example: us-east-1 + type: string + type: array + required: + - include_only + AWSResourcesConfig: + description: AWS Resources config + properties: + cloud_security_posture_management_collection: + description: Whether Datadog collects cloud security posture management + resources from your AWS account. + example: false + type: boolean + extended_collection: + description: Whether Datadog collects additional attributes and configuration + information about the resources in your AWS account. Required for `cspm_resource_collection`. + example: false + type: boolean + type: object + AWSTracesConfig: + description: AWS Traces config + properties: + xray_services: + $ref: '#/components/schemas/XRayServicesList' + type: object ActiveBillingDimensionsAttributes: description: List of active billing dimensions. properties: @@ -26567,6 +27104,34 @@ components: description: The id of the instance. type: string type: object + XRayServicesIncludeAll: + description: Include all services + properties: + include_all: + description: Include all services + example: false + type: boolean + required: + - include_all + XRayServicesIncludeOnly: + description: Include only these services + nullable: true + properties: + include_only: + description: Include only these services + example: + - AWS/AppSync + items: + example: AWS/AppSync + type: string + type: array + required: + - include_only + XRayServicesList: + description: AWS X-Ray services to collect traces from + oneOf: + - $ref: '#/components/schemas/XRayServicesIncludeAll' + - $ref: '#/components/schemas/XRayServicesIncludeOnly' securitySchemes: AuthZ: description: This API uses OAuth 2 with the implicit grant flow. @@ -31589,6 +32154,244 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/integration/aws/accounts: + get: + description: Get a list of AWS Account Integration Configs. + operationId: ListAWSAccounts + parameters: + - description: Optional query filter accounts by AWS Account ID + example: '123456789012' + in: query + name: aws_account_id + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountsResponse' + description: AWS Accounts List object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List all AWS integrations + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + post: + description: Create a new AWS Account Integration Config. + operationId: CreateAWSAccount + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountResponse' + description: AWS Account object + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create an AWS integration + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - aws_configurations_manage + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/accounts/{aws_account_config_id}: + delete: + description: Delete an AWS Account Integration Config + operationId: DeleteAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an AWS integration + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configurations_manage + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + get: + description: Get an AWS Account Integration Config + operationId: GetAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountResponse' + description: AWS Account object + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get an AWS integration by config ID + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + patch: + description: Update an AWS Account Integration Config + operationId: UpdateAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountResponse' + description: AWS Account object + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update an AWS integration + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note: This endpoint is in public beta. 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 + metrics to Datadog. + operationId: ListAWSNamespaces + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSNamespacesResponse' + description: AWS Namespaces List object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List available namespaces + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/generate_new_external_id: + post: + description: Generate a new external ID for AWS role-based authentication. + operationId: CreateNewAWSExternalID + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSNewExternalIDResponse' + description: AWS External ID object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Generate a new external ID + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/logs/services: + get: + description: Get a list of AWS services that can send logs to Datadog. + operationId: ListAWSLogsServices + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSLogsServicesResponse' + description: AWS Logs Services List object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get list of AWS log ready services + tags: + - AWS Logs Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/integration/gcp/accounts: get: description: List all GCP STS-enabled service accounts configured in your Datadog @@ -42857,6 +43660,18 @@ tags: description: Find out more at url: https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/ name: APM Retention Filters +- description: 'Configure your Datadog-AWS integration directly through the Datadog + API. + + For more information, see the [AWS integration page](https://docs.datadoghq.com/integrations/amazon_web_services).' + name: AWS Integration +- description: 'Configure your Datadog-AWS-Logs integration directly through Datadog + API. + + For more information, see the [AWS integration page](https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection).' + externalDocs: + url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection + name: AWS Logs Integration - description: Search your Audit Logs events over HTTP. name: Audit - description: '[The AuthN Mappings API](https://docs.datadoghq.com/account_management/authn_mapping/?tab=example) diff --git a/examples/v2_aws-integration_CreateAWSAccount.rs b/examples/v2_aws-integration_CreateAWSAccount.rs new file mode 100644 index 000000000..340321c69 --- /dev/null +++ b/examples/v2_aws-integration_CreateAWSAccount.rs @@ -0,0 +1,67 @@ +// Create an AWS integration returns "AWS Account object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; +use datadog_api_client::datadogV2::model::AWSAccountCreateRequest; +use datadog_api_client::datadogV2::model::AWSAccountCreateRequestAttributes; +use datadog_api_client::datadogV2::model::AWSAccountCreateRequestData; +use datadog_api_client::datadogV2::model::AWSAccountPartition; +use datadog_api_client::datadogV2::model::AWSAccountType; +use datadog_api_client::datadogV2::model::AWSAuthConfig; +use datadog_api_client::datadogV2::model::AWSAuthConfigKeys; +use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfig; +use datadog_api_client::datadogV2::model::AWSLogsConfig; +use datadog_api_client::datadogV2::model::AWSMetricsConfig; +use datadog_api_client::datadogV2::model::AWSNamespaceTagFilter; +use datadog_api_client::datadogV2::model::AWSResourcesConfig; +use datadog_api_client::datadogV2::model::AWSTracesConfig; + +#[tokio::main] +async fn main() { + let body = AWSAccountCreateRequest::new(AWSAccountCreateRequestData::new( + AWSAccountCreateRequestAttributes::new( + AWSAuthConfig::AWSAuthConfigKeys(Box::new( + AWSAuthConfigKeys::new("AKIAIOSFODNN7EXAMPLE".to_string()) + .secret_access_key("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY".to_string()), + )), + "123456789012".to_string(), + AWSAccountPartition::AWS, + ) + .account_tags(Some(vec!["key:value".to_string()])) + .logs_config( + AWSLogsConfig::new().lambda_forwarder( + AWSLambdaForwarderConfig::new() + .lambdas(vec![ + "arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder" + .to_string(), + ]) + .sources(vec!["s3".to_string()]), + ), + ) + .metrics_config( + AWSMetricsConfig::new() + .automute_enabled(true) + .collect_cloudwatch_alarms(true) + .collect_custom_metrics(true) + .enabled(true) + .tag_filters(vec![AWSNamespaceTagFilter::new() + .namespace("AWS/EC2".to_string()) + .tags(Some(vec!["key:value".to_string()]))]), + ) + .resources_config( + AWSResourcesConfig::new() + .cloud_security_posture_management_collection(false) + .extended_collection(false), + ) + .traces_config(AWSTracesConfig::new()), + AWSAccountType::ACCOUNT, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateAWSAccount", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.create_aws_account(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_CreateAWSAccount_1716720881.rs b/examples/v2_aws-integration_CreateAWSAccount_1716720881.rs new file mode 100644 index 000000000..5abbbe927 --- /dev/null +++ b/examples/v2_aws-integration_CreateAWSAccount_1716720881.rs @@ -0,0 +1,66 @@ +// Create an AWS account returns "AWS Account object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; +use datadog_api_client::datadogV2::model::AWSAccountCreateRequest; +use datadog_api_client::datadogV2::model::AWSAccountCreateRequestAttributes; +use datadog_api_client::datadogV2::model::AWSAccountCreateRequestData; +use datadog_api_client::datadogV2::model::AWSAccountPartition; +use datadog_api_client::datadogV2::model::AWSAccountType; +use datadog_api_client::datadogV2::model::AWSAuthConfig; +use datadog_api_client::datadogV2::model::AWSAuthConfigRole; +use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfig; +use datadog_api_client::datadogV2::model::AWSLogsConfig; +use datadog_api_client::datadogV2::model::AWSMetricsConfig; +use datadog_api_client::datadogV2::model::AWSNamespaceTagFilter; +use datadog_api_client::datadogV2::model::AWSResourcesConfig; +use datadog_api_client::datadogV2::model::AWSTracesConfig; + +#[tokio::main] +async fn main() { + let body = AWSAccountCreateRequest::new(AWSAccountCreateRequestData::new( + AWSAccountCreateRequestAttributes::new( + AWSAuthConfig::AWSAuthConfigRole(Box::new(AWSAuthConfigRole::new( + "DatadogIntegrationRole".to_string(), + ))), + "123456789012".to_string(), + AWSAccountPartition::AWS, + ) + .account_tags(Some(vec!["key:value".to_string()])) + .logs_config( + AWSLogsConfig::new().lambda_forwarder( + AWSLambdaForwarderConfig::new() + .lambdas(vec![ + "arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder" + .to_string(), + ]) + .sources(vec!["s3".to_string()]), + ), + ) + .metrics_config( + AWSMetricsConfig::new() + .automute_enabled(true) + .collect_cloudwatch_alarms(true) + .collect_custom_metrics(true) + .enabled(true) + .tag_filters(vec![AWSNamespaceTagFilter::new() + .namespace("AWS/EC2".to_string()) + .tags(Some(vec!["key:value".to_string()]))]), + ) + .resources_config( + AWSResourcesConfig::new() + .cloud_security_posture_management_collection(false) + .extended_collection(false), + ) + .traces_config(AWSTracesConfig::new()), + AWSAccountType::ACCOUNT, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateAWSAccount", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.create_aws_account(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_CreateNewAWSExternalID.rs b/examples/v2_aws-integration_CreateNewAWSExternalID.rs new file mode 100644 index 000000000..fb30fe1f7 --- /dev/null +++ b/examples/v2_aws-integration_CreateNewAWSExternalID.rs @@ -0,0 +1,16 @@ +// Generate a new external ID returns "AWS External ID 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.CreateNewAWSExternalID", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.create_new_aws_external_id().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_CreateNewAWSExternalID_364713854.rs b/examples/v2_aws-integration_CreateNewAWSExternalID_364713854.rs new file mode 100644 index 000000000..00edf199a --- /dev/null +++ b/examples/v2_aws-integration_CreateNewAWSExternalID_364713854.rs @@ -0,0 +1,16 @@ +// Generate new external ID returns "AWS External ID 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.CreateNewAWSExternalID", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.create_new_aws_external_id().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_DeleteAWSAccount.rs b/examples/v2_aws-integration_DeleteAWSAccount.rs new file mode 100644 index 000000000..852b9218b --- /dev/null +++ b/examples/v2_aws-integration_DeleteAWSAccount.rs @@ -0,0 +1,18 @@ +// Delete an AWS integration returns "No Content" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; + +#[tokio::main] +async fn main() { + // there is a valid "aws_account_v2" in the system + let aws_account_v2_data_id = std::env::var("AWS_ACCOUNT_V2_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteAWSAccount", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.delete_aws_account(aws_account_v2_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_GetAWSAccount.rs b/examples/v2_aws-integration_GetAWSAccount.rs new file mode 100644 index 000000000..644ca5c98 --- /dev/null +++ b/examples/v2_aws-integration_GetAWSAccount.rs @@ -0,0 +1,18 @@ +// Get an AWS integration by config ID returns "AWS Account object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; + +#[tokio::main] +async fn main() { + // there is a valid "aws_account_v2" in the system + let aws_account_v2_data_id = std::env::var("AWS_ACCOUNT_V2_DATA_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetAWSAccount", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.get_aws_account(aws_account_v2_data_id.clone()).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_ListAWSAccounts.rs b/examples/v2_aws-integration_ListAWSAccounts.rs new file mode 100644 index 000000000..853219531 --- /dev/null +++ b/examples/v2_aws-integration_ListAWSAccounts.rs @@ -0,0 +1,19 @@ +// List all AWS integrations returns "AWS Accounts List object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; +use datadog_api_client::datadogV2::api_aws_integration::ListAWSAccountsOptionalParams; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListAWSAccounts", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api + .list_aws_accounts(ListAWSAccountsOptionalParams::default()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_ListAWSNamespaces.rs b/examples/v2_aws-integration_ListAWSNamespaces.rs new file mode 100644 index 000000000..58e3d9c8b --- /dev/null +++ b/examples/v2_aws-integration_ListAWSNamespaces.rs @@ -0,0 +1,16 @@ +// List available namespaces returns "AWS Namespaces List 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.ListAWSNamespaces", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.list_aws_namespaces().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_ListAWSNamespaces_3031307873.rs b/examples/v2_aws-integration_ListAWSNamespaces_3031307873.rs new file mode 100644 index 000000000..05e6a82bd --- /dev/null +++ b/examples/v2_aws-integration_ListAWSNamespaces_3031307873.rs @@ -0,0 +1,16 @@ +// List namespaces returns "AWS Namespaces List 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.ListAWSNamespaces", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api.list_aws_namespaces().await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-integration_UpdateAWSAccount.rs b/examples/v2_aws-integration_UpdateAWSAccount.rs new file mode 100644 index 000000000..95099ad9b --- /dev/null +++ b/examples/v2_aws-integration_UpdateAWSAccount.rs @@ -0,0 +1,79 @@ +// Update an AWS integration returns "AWS Account object" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_integration::AWSIntegrationAPI; +use datadog_api_client::datadogV2::model::AWSAccountPartition; +use datadog_api_client::datadogV2::model::AWSAccountType; +use datadog_api_client::datadogV2::model::AWSAccountUpdateRequest; +use datadog_api_client::datadogV2::model::AWSAccountUpdateRequestAttributes; +use datadog_api_client::datadogV2::model::AWSAccountUpdateRequestData; +use datadog_api_client::datadogV2::model::AWSAuthConfig; +use datadog_api_client::datadogV2::model::AWSAuthConfigRole; +use datadog_api_client::datadogV2::model::AWSLambdaForwarderConfig; +use datadog_api_client::datadogV2::model::AWSLogsConfig; +use datadog_api_client::datadogV2::model::AWSMetricsConfig; +use datadog_api_client::datadogV2::model::AWSNamespaceTagFilter; +use datadog_api_client::datadogV2::model::AWSResourcesConfig; +use datadog_api_client::datadogV2::model::AWSTracesConfig; + +#[tokio::main] +async fn main() { + // there is a valid "aws_account_v2" in the system + let aws_account_v2_data_id = std::env::var("AWS_ACCOUNT_V2_DATA_ID").unwrap(); + let body = + AWSAccountUpdateRequest::new( + AWSAccountUpdateRequestData::new( + AWSAccountUpdateRequestAttributes::new("123456789012".to_string()) + .account_tags(Some(vec!["key:value".to_string()])) + .auth_config( + AWSAuthConfig::AWSAuthConfigRole( + Box::new(AWSAuthConfigRole::new("DatadogIntegrationRole".to_string())), + ), + ) + .aws_partition(AWSAccountPartition::AWS) + .logs_config( + AWSLogsConfig + ::new().lambda_forwarder( + AWSLambdaForwarderConfig::new() + .lambdas( + vec![ + "arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder".to_string() + ], + ) + .sources(vec!["s3".to_string()]), + ), + ) + .metrics_config( + AWSMetricsConfig::new() + .automute_enabled(true) + .collect_cloudwatch_alarms(true) + .collect_custom_metrics(true) + .enabled(true) + .tag_filters( + vec![ + AWSNamespaceTagFilter::new() + .namespace("AWS/EC2".to_string()) + .tags(Some(vec!["key:value".to_string()])) + ], + ), + ) + .resources_config( + AWSResourcesConfig::new() + .cloud_security_posture_management_collection(false) + .extended_collection(false), + ) + .traces_config(AWSTracesConfig::new()), + AWSAccountType::ACCOUNT, + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateAWSAccount", true); + let api = AWSIntegrationAPI::with_config(configuration); + let resp = api + .update_aws_account(aws_account_v2_data_id.clone(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_aws-logs-integration_ListAWSLogsServices.rs b/examples/v2_aws-logs-integration_ListAWSLogsServices.rs new file mode 100644 index 000000000..80aef3080 --- /dev/null +++ b/examples/v2_aws-logs-integration_ListAWSLogsServices.rs @@ -0,0 +1,17 @@ +// Get list of AWS log ready services returns "AWS Logs Services List object" +// response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_aws_logs_integration::AWSLogsIntegrationAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListAWSLogsServices", true); + let api = AWSLogsIntegrationAPI::with_config(configuration); + let resp = api.list_aws_logs_services().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 faade5650..2672d6143 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -162,6 +162,14 @@ impl Default for Configuration { ("v2.update_incident_integration".to_owned(), false), ("v2.update_incident_todo".to_owned(), false), ("v2.update_incident_type".to_owned(), false), + ("v2.create_aws_account".to_owned(), false), + ("v2.create_new_aws_external_id".to_owned(), false), + ("v2.delete_aws_account".to_owned(), false), + ("v2.get_aws_account".to_owned(), false), + ("v2.list_aws_accounts".to_owned(), false), + ("v2.list_aws_namespaces".to_owned(), false), + ("v2.update_aws_account".to_owned(), false), + ("v2.list_aws_logs_services".to_owned(), false), ("v2.cancel_historical_job".to_owned(), false), ("v2.convert_job_result_to_signal".to_owned(), false), ("v2.delete_historical_job".to_owned(), false), diff --git a/src/datadogV2/api/api_aws_integration.rs b/src/datadogV2/api/api_aws_integration.rs new file mode 100644 index 000000000..bb1be25a8 --- /dev/null +++ b/src/datadogV2/api/api_aws_integration.rs @@ -0,0 +1,1044 @@ +// 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 crate::datadog; +use flate2::{ + write::{GzEncoder, ZlibEncoder}, + Compression, +}; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; +use std::io::Write; + +/// ListAWSAccountsOptionalParams is a struct for passing parameters to the method [`AWSIntegrationAPI::list_aws_accounts`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListAWSAccountsOptionalParams { + /// Optional query filter accounts by AWS Account ID + pub aws_account_id: Option, +} + +impl ListAWSAccountsOptionalParams { + /// Optional query filter accounts by AWS Account ID + pub fn aws_account_id(mut self, value: String) -> Self { + self.aws_account_id = Some(value); + self + } +} + +/// CreateAWSAccountError is a struct for typed errors of method [`AWSIntegrationAPI::create_aws_account`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateAWSAccountError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// CreateNewAWSExternalIDError is a struct for typed errors of method [`AWSIntegrationAPI::create_new_aws_external_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateNewAWSExternalIDError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteAWSAccountError is a struct for typed errors of method [`AWSIntegrationAPI::delete_aws_account`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteAWSAccountError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetAWSAccountError is a struct for typed errors of method [`AWSIntegrationAPI::get_aws_account`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAWSAccountError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListAWSAccountsError is a struct for typed errors of method [`AWSIntegrationAPI::list_aws_accounts`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAWSAccountsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListAWSNamespacesError is a struct for typed errors of method [`AWSIntegrationAPI::list_aws_namespaces`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAWSNamespacesError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateAWSAccountError is a struct for typed errors of method [`AWSIntegrationAPI::update_aws_account`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateAWSAccountError { + 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)] +pub struct AWSIntegrationAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for AWSIntegrationAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl AWSIntegrationAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Create a new AWS Account Integration Config. + pub async fn create_aws_account( + &self, + body: crate::datadogV2::model::AWSAccountCreateRequest, + ) -> Result> + { + match self.create_aws_account_with_http_info(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 a new AWS Account Integration Config. + pub async fn create_aws_account_with_http_info( + &self, + body: crate::datadogV2::model::AWSAccountCreateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_aws_account"; + 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' 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", + local_configuration.get_operation_host(operation_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)) + } + } + + /// Generate a new external ID for AWS role-based authentication. + pub async fn create_new_aws_external_id( + &self, + ) -> Result< + crate::datadogV2::model::AWSNewExternalIDResponse, + datadog::Error, + > { + match self.create_new_aws_external_id_with_http_info().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), + } + } + + /// Generate a new external ID for AWS role-based authentication. + pub async fn create_new_aws_external_id_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_new_aws_external_id"; + 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_new_aws_external_id' 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/generate_new_external_id", + local_configuration.get_operation_host(operation_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("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)) + } + } + + /// Delete an AWS Account Integration Config + pub async fn delete_aws_account( + &self, + aws_account_config_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_aws_account_with_http_info(aws_account_config_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete an AWS Account Integration Config + pub async fn delete_aws_account_with_http_info( + &self, + aws_account_config_id: String, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_aws_account"; + 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' 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}", + 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)) + } + } + + /// Get an AWS Account Integration Config + pub async fn get_aws_account( + &self, + aws_account_config_id: String, + ) -> Result> + { + match self + .get_aws_account_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 an AWS Account Integration Config + pub async fn get_aws_account_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"; + 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' 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}", + 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 a list of AWS Account Integration Configs. + pub async fn list_aws_accounts( + &self, + params: ListAWSAccountsOptionalParams, + ) -> Result> + { + match self.list_aws_accounts_with_http_info(params).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 a list of AWS Account Integration Configs. + pub async fn list_aws_accounts_with_http_info( + &self, + params: ListAWSAccountsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_aws_accounts"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_aws_accounts' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let aws_account_id = params.aws_account_id; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/integration/aws/accounts", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = aws_account_id { + local_req_builder = + local_req_builder.query(&[("aws_account_id", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &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 a list of available AWS CloudWatch namespaces that can send metrics to Datadog. + pub async fn list_aws_namespaces( + &self, + ) -> Result< + crate::datadogV2::model::AWSNamespacesResponse, + datadog::Error, + > { + match self.list_aws_namespaces_with_http_info().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 a list of available AWS CloudWatch namespaces that can send metrics to Datadog. + pub async fn list_aws_namespaces_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_aws_namespaces"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_aws_namespaces' 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/available_namespaces", + local_configuration.get_operation_host(operation_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)) + } + } + + /// Update an AWS Account Integration Config + pub async fn update_aws_account( + &self, + aws_account_config_id: String, + body: crate::datadogV2::model::AWSAccountUpdateRequest, + ) -> Result> + { + match self + .update_aws_account_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 an AWS Account Integration Config + pub async fn update_aws_account_with_http_info( + &self, + aws_account_config_id: String, + body: crate::datadogV2::model::AWSAccountUpdateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_aws_account"; + 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' 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}", + 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/api/api_aws_logs_integration.rs b/src/datadogV2/api/api_aws_logs_integration.rs new file mode 100644 index 000000000..336edae41 --- /dev/null +++ b/src/datadogV2/api/api_aws_logs_integration.rs @@ -0,0 +1,196 @@ +// 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 crate::datadog; +use log::warn; +use reqwest::header::{HeaderMap, HeaderValue}; +use serde::{Deserialize, Serialize}; + +/// ListAWSLogsServicesError is a struct for typed errors of method [`AWSLogsIntegrationAPI::list_aws_logs_services`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListAWSLogsServicesError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// Configure your Datadog-AWS-Logs integration directly through Datadog API. +/// For more information, see the [AWS integration page](). +#[derive(Debug, Clone)] +pub struct AWSLogsIntegrationAPI { + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, +} + +impl Default for AWSLogsIntegrationAPI { + fn default() -> Self { + Self::with_config(datadog::Configuration::default()) + } +} + +impl AWSLogsIntegrationAPI { + pub fn new() -> Self { + Self::default() + } + pub fn with_config(config: datadog::Configuration) -> Self { + let mut reqwest_client_builder = reqwest::Client::builder(); + + if let Some(proxy_url) = &config.proxy_url { + let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); + reqwest_client_builder = reqwest_client_builder.proxy(proxy); + } + + let mut middleware_client_builder = + reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); + + if config.enable_retry { + struct RetryableStatus; + impl reqwest_retry::RetryableStrategy for RetryableStatus { + fn handle( + &self, + res: &Result, + ) -> Option { + match res { + Ok(success) => reqwest_retry::default_on_request_success(success), + Err(_) => None, + } + } + } + let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() + .build_with_max_retries(config.max_retries); + + let retry_middleware = + reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( + backoff_policy, + RetryableStatus, + ); + + middleware_client_builder = middleware_client_builder.with(retry_middleware); + } + + let client = middleware_client_builder.build(); + + Self { config, client } + } + + pub fn with_client_and_config( + config: datadog::Configuration, + client: reqwest_middleware::ClientWithMiddleware, + ) -> Self { + Self { config, client } + } + + /// Get a list of AWS services that can send logs to Datadog. + pub async fn list_aws_logs_services( + &self, + ) -> Result< + crate::datadogV2::model::AWSLogsServicesResponse, + datadog::Error, + > { + match self.list_aws_logs_services_with_http_info().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 a list of AWS services that can send logs to Datadog. + pub async fn list_aws_logs_services_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_aws_logs_services"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_aws_logs_services' 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/logs/services", + local_configuration.get_operation_host(operation_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)) + } + } +} diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index d1ea3bf57..2904bc5b3 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -6,6 +6,8 @@ pub mod api_api_management; pub mod api_apm_retention_filters; pub mod api_audit; pub mod api_authn_mappings; +pub mod api_aws_integration; +pub mod api_aws_logs_integration; pub mod api_case_management; pub mod api_ci_visibility_pipelines; pub mod api_ci_visibility_tests; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index 7a53f39bd..4034d7dcd 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -7,6 +7,8 @@ pub use self::api::api_api_management; pub use self::api::api_apm_retention_filters; pub use self::api::api_audit; pub use self::api::api_authn_mappings; +pub use self::api::api_aws_integration; +pub use self::api::api_aws_logs_integration; pub use self::api::api_case_management; pub use self::api::api_ci_visibility_pipelines; pub use self::api::api_ci_visibility_tests; diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index fa4f1a8e5..44651cd97 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -1290,6 +1290,94 @@ pub mod model_incident_todo_patch_request; pub use self::model_incident_todo_patch_request::IncidentTodoPatchRequest; pub mod model_incident_todo_patch_data; pub use self::model_incident_todo_patch_data::IncidentTodoPatchData; +pub mod model_aws_accounts_response; +pub use self::model_aws_accounts_response::AWSAccountsResponse; +pub mod model_aws_account_response_data; +pub use self::model_aws_account_response_data::AWSAccountResponseData; +pub mod model_aws_account_response_attributes; +pub use self::model_aws_account_response_attributes::AWSAccountResponseAttributes; +pub mod model_aws_auth_config_keys; +pub use self::model_aws_auth_config_keys::AWSAuthConfigKeys; +pub mod model_aws_auth_config_role; +pub use self::model_aws_auth_config_role::AWSAuthConfigRole; +pub mod model_aws_auth_config; +pub use self::model_aws_auth_config::AWSAuthConfig; +pub mod model_aws_account_partition; +pub use self::model_aws_account_partition::AWSAccountPartition; +pub mod model_aws_regions_include_all; +pub use self::model_aws_regions_include_all::AWSRegionsIncludeAll; +pub mod model_aws_regions_include_only; +pub use self::model_aws_regions_include_only::AWSRegionsIncludeOnly; +pub mod model_aws_regions; +pub use self::model_aws_regions::AWSRegions; +pub mod model_aws_logs_config; +pub use self::model_aws_logs_config::AWSLogsConfig; +pub mod model_aws_lambda_forwarder_config; +pub use self::model_aws_lambda_forwarder_config::AWSLambdaForwarderConfig; +pub mod model_aws_metrics_config; +pub use self::model_aws_metrics_config::AWSMetricsConfig; +pub mod model_aws_namespace_filters_exclude_all; +pub use self::model_aws_namespace_filters_exclude_all::AWSNamespaceFiltersExcludeAll; +pub mod model_aws_namespace_filters_exclude_only; +pub use self::model_aws_namespace_filters_exclude_only::AWSNamespaceFiltersExcludeOnly; +pub mod model_aws_namespace_filters_include_all; +pub use self::model_aws_namespace_filters_include_all::AWSNamespaceFiltersIncludeAll; +pub mod model_aws_namespace_filters_include_only; +pub use self::model_aws_namespace_filters_include_only::AWSNamespaceFiltersIncludeOnly; +pub mod model_aws_namespace_filters; +pub use self::model_aws_namespace_filters::AWSNamespaceFilters; +pub mod model_aws_namespace_tag_filter; +pub use self::model_aws_namespace_tag_filter::AWSNamespaceTagFilter; +pub mod model_aws_resources_config; +pub use self::model_aws_resources_config::AWSResourcesConfig; +pub mod model_aws_traces_config; +pub use self::model_aws_traces_config::AWSTracesConfig; +pub mod model_x_ray_services_include_all; +pub use self::model_x_ray_services_include_all::XRayServicesIncludeAll; +pub mod model_x_ray_services_include_only; +pub use self::model_x_ray_services_include_only::XRayServicesIncludeOnly; +pub mod model_x_ray_services_list; +pub use self::model_x_ray_services_list::XRayServicesList; +pub mod model_aws_account_type; +pub use self::model_aws_account_type::AWSAccountType; +pub mod model_aws_account_create_request; +pub use self::model_aws_account_create_request::AWSAccountCreateRequest; +pub mod model_aws_account_create_request_data; +pub use self::model_aws_account_create_request_data::AWSAccountCreateRequestData; +pub mod model_aws_account_create_request_attributes; +pub use self::model_aws_account_create_request_attributes::AWSAccountCreateRequestAttributes; +pub mod model_aws_account_response; +pub use self::model_aws_account_response::AWSAccountResponse; +pub mod model_aws_account_update_request; +pub use self::model_aws_account_update_request::AWSAccountUpdateRequest; +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_namespaces_response; +pub use self::model_aws_namespaces_response::AWSNamespacesResponse; +pub mod model_aws_namespaces_response_data; +pub use self::model_aws_namespaces_response_data::AWSNamespacesResponseData; +pub mod model_aws_namespaces_response_attributes; +pub use self::model_aws_namespaces_response_attributes::AWSNamespacesResponseAttributes; +pub mod model_aws_namespaces_response_data_type; +pub use self::model_aws_namespaces_response_data_type::AWSNamespacesResponseDataType; +pub mod model_aws_new_external_id_response; +pub use self::model_aws_new_external_id_response::AWSNewExternalIDResponse; +pub mod model_aws_new_external_id_response_data; +pub use self::model_aws_new_external_id_response_data::AWSNewExternalIDResponseData; +pub mod model_aws_new_external_id_response_attributes; +pub use self::model_aws_new_external_id_response_attributes::AWSNewExternalIDResponseAttributes; +pub mod model_aws_new_external_id_response_data_type; +pub use self::model_aws_new_external_id_response_data_type::AWSNewExternalIDResponseDataType; +pub mod model_aws_logs_services_response; +pub use self::model_aws_logs_services_response::AWSLogsServicesResponse; +pub mod model_aws_logs_services_response_data; +pub use self::model_aws_logs_services_response_data::AWSLogsServicesResponseData; +pub mod model_aws_logs_services_response_attributes; +pub use self::model_aws_logs_services_response_attributes::AWSLogsServicesResponseAttributes; +pub mod model_aws_logs_services_response_data_type; +pub use self::model_aws_logs_services_response_data_type::AWSLogsServicesResponseDataType; pub mod model_gcpsts_service_accounts_response; pub use self::model_gcpsts_service_accounts_response::GCPSTSServiceAccountsResponse; pub mod model_gcpsts_service_account; diff --git a/src/datadogV2/model/model_aws_account_create_request.rs b/src/datadogV2/model/model_aws_account_create_request.rs new file mode 100644 index 000000000..42d80528e --- /dev/null +++ b/src/datadogV2/model/model_aws_account_create_request.rs @@ -0,0 +1,94 @@ +// 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 Account Create Request body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountCreateRequest { + /// AWS Account Create Request data + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSAccountCreateRequestData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountCreateRequest { + pub fn new( + data: crate::datadogV2::model::AWSAccountCreateRequestData, + ) -> AWSAccountCreateRequest { + AWSAccountCreateRequest { + 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 AWSAccountCreateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountCreateRequestVisitor; + impl<'a> Visitor<'a> for AWSAccountCreateRequestVisitor { + type Value = AWSAccountCreateRequest; + + 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 = AWSAccountCreateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountCreateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_create_request_attributes.rs b/src/datadogV2/model/model_aws_account_create_request_attributes.rs new file mode 100644 index 000000000..794814ab4 --- /dev/null +++ b/src/datadogV2/model/model_aws_account_create_request_attributes.rs @@ -0,0 +1,260 @@ +// 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}; + +/// The AWS Account Integration Config to be created +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountCreateRequestAttributes { + /// Tags to apply to all metrics in the account + #[serde( + rename = "account_tags", + default, + with = "::serde_with::rust::double_option" + )] + pub account_tags: Option>>, + /// AWS Authentication config + #[serde(rename = "auth_config")] + pub auth_config: crate::datadogV2::model::AWSAuthConfig, + /// AWS Account ID + #[serde(rename = "aws_account_id")] + pub aws_account_id: String, + /// AWS Account partition + #[serde(rename = "aws_partition")] + pub aws_partition: crate::datadogV2::model::AWSAccountPartition, + /// AWS Regions to collect data from + #[serde(rename = "aws_regions")] + pub aws_regions: Option, + /// AWS Logs config + #[serde(rename = "logs_config")] + pub logs_config: Option, + /// AWS Metrics config + #[serde(rename = "metrics_config")] + pub metrics_config: Option, + /// AWS Resources config + #[serde(rename = "resources_config")] + pub resources_config: Option, + /// AWS Traces config + #[serde(rename = "traces_config")] + pub traces_config: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountCreateRequestAttributes { + pub fn new( + auth_config: crate::datadogV2::model::AWSAuthConfig, + aws_account_id: String, + aws_partition: crate::datadogV2::model::AWSAccountPartition, + ) -> AWSAccountCreateRequestAttributes { + AWSAccountCreateRequestAttributes { + account_tags: None, + auth_config, + aws_account_id, + aws_partition, + aws_regions: None, + logs_config: None, + metrics_config: None, + resources_config: None, + traces_config: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn account_tags(mut self, value: Option>) -> Self { + self.account_tags = Some(value); + self + } + + pub fn aws_regions(mut self, value: crate::datadogV2::model::AWSRegions) -> Self { + self.aws_regions = Some(value); + self + } + + pub fn logs_config(mut self, value: crate::datadogV2::model::AWSLogsConfig) -> Self { + self.logs_config = Some(value); + self + } + + pub fn metrics_config(mut self, value: crate::datadogV2::model::AWSMetricsConfig) -> Self { + self.metrics_config = Some(value); + self + } + + pub fn resources_config(mut self, value: crate::datadogV2::model::AWSResourcesConfig) -> Self { + self.resources_config = Some(value); + self + } + + pub fn traces_config(mut self, value: crate::datadogV2::model::AWSTracesConfig) -> Self { + self.traces_config = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSAccountCreateRequestAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountCreateRequestAttributesVisitor; + impl<'a> Visitor<'a> for AWSAccountCreateRequestAttributesVisitor { + type Value = AWSAccountCreateRequestAttributes; + + 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 account_tags: Option>> = None; + let mut auth_config: Option = None; + let mut aws_account_id: Option = None; + let mut aws_partition: Option = None; + let mut aws_regions: Option = None; + let mut logs_config: Option = None; + let mut metrics_config: Option = None; + let mut resources_config: Option = + None; + let mut traces_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() { + "account_tags" => { + account_tags = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "auth_config" => { + auth_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _auth_config) = auth_config { + match _auth_config { + crate::datadogV2::model::AWSAuthConfig::UnparsedObject( + _auth_config, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "aws_account_id" => { + aws_account_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "aws_partition" => { + aws_partition = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _aws_partition) = aws_partition { + match _aws_partition { + crate::datadogV2::model::AWSAccountPartition::UnparsedObject(_aws_partition) => { + _unparsed = true; + }, + _ => {} + } + } + } + "aws_regions" => { + if v.is_null() { + continue; + } + aws_regions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _aws_regions) = aws_regions { + match _aws_regions { + crate::datadogV2::model::AWSRegions::UnparsedObject( + _aws_regions, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "logs_config" => { + if v.is_null() { + continue; + } + logs_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "metrics_config" => { + if v.is_null() { + continue; + } + metrics_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "resources_config" => { + if v.is_null() { + continue; + } + resources_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "traces_config" => { + if v.is_null() { + continue; + } + traces_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 auth_config = + auth_config.ok_or_else(|| M::Error::missing_field("auth_config"))?; + let aws_account_id = + aws_account_id.ok_or_else(|| M::Error::missing_field("aws_account_id"))?; + let aws_partition = + aws_partition.ok_or_else(|| M::Error::missing_field("aws_partition"))?; + + let content = AWSAccountCreateRequestAttributes { + account_tags, + auth_config, + aws_account_id, + aws_partition, + aws_regions, + logs_config, + metrics_config, + resources_config, + traces_config, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountCreateRequestAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_create_request_data.rs b/src/datadogV2/model/model_aws_account_create_request_data.rs new file mode 100644 index 000000000..f2380816f --- /dev/null +++ b/src/datadogV2/model/model_aws_account_create_request_data.rs @@ -0,0 +1,117 @@ +// 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 Account Create Request data +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountCreateRequestData { + /// The AWS Account Integration Config to be created + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::AWSAccountCreateRequestAttributes, + /// AWS Account resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSAccountType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountCreateRequestData { + pub fn new( + attributes: crate::datadogV2::model::AWSAccountCreateRequestAttributes, + type_: crate::datadogV2::model::AWSAccountType, + ) -> AWSAccountCreateRequestData { + AWSAccountCreateRequestData { + 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 AWSAccountCreateRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountCreateRequestDataVisitor; + impl<'a> Visitor<'a> for AWSAccountCreateRequestDataVisitor { + type Value = AWSAccountCreateRequestData; + + 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::AWSAccountCreateRequestAttributes, + > = 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::AWSAccountType::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 = AWSAccountCreateRequestData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountCreateRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_partition.rs b/src/datadogV2/model/model_aws_account_partition.rs new file mode 100644 index 000000000..6c53432da --- /dev/null +++ b/src/datadogV2/model/model_aws_account_partition.rs @@ -0,0 +1,54 @@ +// 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 AWSAccountPartition { + AWS, + AWS_CN, + AWS_US_GOV, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AWSAccountPartition { + fn to_string(&self) -> String { + match self { + Self::AWS => String::from("aws"), + Self::AWS_CN => String::from("aws-cn"), + Self::AWS_US_GOV => String::from("aws-us-gov"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AWSAccountPartition { + 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 AWSAccountPartition { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "aws" => Self::AWS, + "aws-cn" => Self::AWS_CN, + "aws-us-gov" => Self::AWS_US_GOV, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_aws_account_response.rs b/src/datadogV2/model/model_aws_account_response.rs new file mode 100644 index 000000000..57694f662 --- /dev/null +++ b/src/datadogV2/model/model_aws_account_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 Account response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountResponse { + /// AWS Account Response body + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSAccountResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountResponse { + pub fn new(data: crate::datadogV2::model::AWSAccountResponseData) -> AWSAccountResponse { + AWSAccountResponse { + 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 AWSAccountResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountResponseVisitor; + impl<'a> Visitor<'a> for AWSAccountResponseVisitor { + type Value = AWSAccountResponse; + + 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 = AWSAccountResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_response_attributes.rs b/src/datadogV2/model/model_aws_account_response_attributes.rs new file mode 100644 index 000000000..e56b4d908 --- /dev/null +++ b/src/datadogV2/model/model_aws_account_response_attributes.rs @@ -0,0 +1,303 @@ +// 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}; + +/// The AWS Account Integration Config +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountResponseAttributes { + /// Tags to apply to all metrics in the account + #[serde( + rename = "account_tags", + default, + with = "::serde_with::rust::double_option" + )] + pub account_tags: Option>>, + /// AWS Authentication config + #[serde(rename = "auth_config")] + pub auth_config: Option, + /// AWS Account ID + #[serde(rename = "aws_account_id")] + pub aws_account_id: String, + /// AWS Account partition + #[serde(rename = "aws_partition")] + pub aws_partition: Option, + /// AWS Regions to collect data from + #[serde(rename = "aws_regions")] + pub aws_regions: Option, + /// Timestamp of when the account integration was created + #[serde(rename = "created_at")] + pub created_at: Option>, + /// AWS Logs config + #[serde(rename = "logs_config")] + pub logs_config: Option, + /// AWS Metrics config + #[serde(rename = "metrics_config")] + pub metrics_config: Option, + /// Timestamp of when the account integration was updated + #[serde(rename = "modified_at")] + pub modified_at: Option>, + /// AWS Resources config + #[serde(rename = "resources_config")] + pub resources_config: Option, + /// AWS Traces config + #[serde(rename = "traces_config")] + pub traces_config: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountResponseAttributes { + pub fn new(aws_account_id: String) -> AWSAccountResponseAttributes { + AWSAccountResponseAttributes { + account_tags: None, + auth_config: None, + aws_account_id, + aws_partition: None, + aws_regions: None, + created_at: None, + logs_config: None, + metrics_config: None, + modified_at: None, + resources_config: None, + traces_config: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn account_tags(mut self, value: Option>) -> Self { + self.account_tags = Some(value); + self + } + + pub fn auth_config(mut self, value: crate::datadogV2::model::AWSAuthConfig) -> Self { + self.auth_config = Some(value); + self + } + + pub fn aws_partition(mut self, value: crate::datadogV2::model::AWSAccountPartition) -> Self { + self.aws_partition = Some(value); + self + } + + pub fn aws_regions(mut self, value: crate::datadogV2::model::AWSRegions) -> Self { + self.aws_regions = Some(value); + self + } + + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + pub fn logs_config(mut self, value: crate::datadogV2::model::AWSLogsConfig) -> Self { + self.logs_config = Some(value); + self + } + + pub fn metrics_config(mut self, value: crate::datadogV2::model::AWSMetricsConfig) -> Self { + self.metrics_config = Some(value); + self + } + + pub fn modified_at(mut self, value: chrono::DateTime) -> Self { + self.modified_at = Some(value); + self + } + + pub fn resources_config(mut self, value: crate::datadogV2::model::AWSResourcesConfig) -> Self { + self.resources_config = Some(value); + self + } + + pub fn traces_config(mut self, value: crate::datadogV2::model::AWSTracesConfig) -> Self { + self.traces_config = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSAccountResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountResponseAttributesVisitor; + impl<'a> Visitor<'a> for AWSAccountResponseAttributesVisitor { + type Value = AWSAccountResponseAttributes; + + 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 account_tags: Option>> = None; + let mut auth_config: Option = None; + let mut aws_account_id: Option = None; + let mut aws_partition: Option = None; + let mut aws_regions: Option = None; + let mut created_at: Option> = None; + let mut logs_config: Option = None; + let mut metrics_config: Option = None; + let mut modified_at: Option> = None; + let mut resources_config: Option = + None; + let mut traces_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() { + "account_tags" => { + account_tags = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "auth_config" => { + if v.is_null() { + continue; + } + auth_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _auth_config) = auth_config { + match _auth_config { + crate::datadogV2::model::AWSAuthConfig::UnparsedObject( + _auth_config, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "aws_account_id" => { + aws_account_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "aws_partition" => { + if v.is_null() { + continue; + } + aws_partition = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _aws_partition) = aws_partition { + match _aws_partition { + crate::datadogV2::model::AWSAccountPartition::UnparsedObject(_aws_partition) => { + _unparsed = true; + }, + _ => {} + } + } + } + "aws_regions" => { + if v.is_null() { + continue; + } + aws_regions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _aws_regions) = aws_regions { + match _aws_regions { + crate::datadogV2::model::AWSRegions::UnparsedObject( + _aws_regions, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "logs_config" => { + if v.is_null() { + continue; + } + logs_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "metrics_config" => { + if v.is_null() { + continue; + } + metrics_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + if v.is_null() { + continue; + } + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "resources_config" => { + if v.is_null() { + continue; + } + resources_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "traces_config" => { + if v.is_null() { + continue; + } + traces_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 aws_account_id = + aws_account_id.ok_or_else(|| M::Error::missing_field("aws_account_id"))?; + + let content = AWSAccountResponseAttributes { + account_tags, + auth_config, + aws_account_id, + aws_partition, + aws_regions, + created_at, + logs_config, + metrics_config, + modified_at, + resources_config, + traces_config, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_response_data.rs b/src/datadogV2/model/model_aws_account_response_data.rs new file mode 100644 index 000000000..11fe49c91 --- /dev/null +++ b/src/datadogV2/model/model_aws_account_response_data.rs @@ -0,0 +1,136 @@ +// 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 Account Response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountResponseData { + /// The AWS Account Integration Config + #[serde(rename = "attributes")] + pub attributes: Option, + /// Unique Datadog ID of the AWS Account Integration Config + #[serde(rename = "id")] + pub id: String, + /// AWS Account resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSAccountType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::AWSAccountType, + ) -> AWSAccountResponseData { + AWSAccountResponseData { + attributes: None, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::AWSAccountResponseAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSAccountResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountResponseDataVisitor; + impl<'a> Visitor<'a> for AWSAccountResponseDataVisitor { + type Value = AWSAccountResponseData; + + 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 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" => { + 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::AWSAccountType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AWSAccountResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_type.rs b/src/datadogV2/model/model_aws_account_type.rs new file mode 100644 index 000000000..9da605d24 --- /dev/null +++ b/src/datadogV2/model/model_aws_account_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 AWSAccountType { + ACCOUNT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AWSAccountType { + fn to_string(&self) -> String { + match self { + Self::ACCOUNT => String::from("account"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AWSAccountType { + 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 AWSAccountType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "account" => Self::ACCOUNT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_aws_account_update_request.rs b/src/datadogV2/model/model_aws_account_update_request.rs new file mode 100644 index 000000000..7651d72ab --- /dev/null +++ b/src/datadogV2/model/model_aws_account_update_request.rs @@ -0,0 +1,94 @@ +// 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 Account Update Request body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountUpdateRequest { + /// AWS Account Update Request data + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSAccountUpdateRequestData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountUpdateRequest { + pub fn new( + data: crate::datadogV2::model::AWSAccountUpdateRequestData, + ) -> AWSAccountUpdateRequest { + AWSAccountUpdateRequest { + 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 AWSAccountUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountUpdateRequestVisitor; + impl<'a> Visitor<'a> for AWSAccountUpdateRequestVisitor { + type Value = AWSAccountUpdateRequest; + + 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 = AWSAccountUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_update_request_attributes.rs b/src/datadogV2/model/model_aws_account_update_request_attributes.rs new file mode 100644 index 000000000..30d236050 --- /dev/null +++ b/src/datadogV2/model/model_aws_account_update_request_attributes.rs @@ -0,0 +1,268 @@ +// 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}; + +/// The AWS Account Integration Config to be updated +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountUpdateRequestAttributes { + /// Tags to apply to all metrics in the account + #[serde( + rename = "account_tags", + default, + with = "::serde_with::rust::double_option" + )] + pub account_tags: Option>>, + /// AWS Authentication config + #[serde(rename = "auth_config")] + pub auth_config: Option, + /// AWS Account ID + #[serde(rename = "aws_account_id")] + pub aws_account_id: String, + /// AWS Account partition + #[serde(rename = "aws_partition")] + pub aws_partition: Option, + /// AWS Regions to collect data from + #[serde(rename = "aws_regions")] + pub aws_regions: Option, + /// AWS Logs config + #[serde(rename = "logs_config")] + pub logs_config: Option, + /// AWS Metrics config + #[serde(rename = "metrics_config")] + pub metrics_config: Option, + /// AWS Resources config + #[serde(rename = "resources_config")] + pub resources_config: Option, + /// AWS Traces config + #[serde(rename = "traces_config")] + pub traces_config: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountUpdateRequestAttributes { + pub fn new(aws_account_id: String) -> AWSAccountUpdateRequestAttributes { + AWSAccountUpdateRequestAttributes { + account_tags: None, + auth_config: None, + aws_account_id, + aws_partition: None, + aws_regions: None, + logs_config: None, + metrics_config: None, + resources_config: None, + traces_config: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn account_tags(mut self, value: Option>) -> Self { + self.account_tags = Some(value); + self + } + + pub fn auth_config(mut self, value: crate::datadogV2::model::AWSAuthConfig) -> Self { + self.auth_config = Some(value); + self + } + + pub fn aws_partition(mut self, value: crate::datadogV2::model::AWSAccountPartition) -> Self { + self.aws_partition = Some(value); + self + } + + pub fn aws_regions(mut self, value: crate::datadogV2::model::AWSRegions) -> Self { + self.aws_regions = Some(value); + self + } + + pub fn logs_config(mut self, value: crate::datadogV2::model::AWSLogsConfig) -> Self { + self.logs_config = Some(value); + self + } + + pub fn metrics_config(mut self, value: crate::datadogV2::model::AWSMetricsConfig) -> Self { + self.metrics_config = Some(value); + self + } + + pub fn resources_config(mut self, value: crate::datadogV2::model::AWSResourcesConfig) -> Self { + self.resources_config = Some(value); + self + } + + pub fn traces_config(mut self, value: crate::datadogV2::model::AWSTracesConfig) -> Self { + self.traces_config = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSAccountUpdateRequestAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountUpdateRequestAttributesVisitor; + impl<'a> Visitor<'a> for AWSAccountUpdateRequestAttributesVisitor { + type Value = AWSAccountUpdateRequestAttributes; + + 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 account_tags: Option>> = None; + let mut auth_config: Option = None; + let mut aws_account_id: Option = None; + let mut aws_partition: Option = None; + let mut aws_regions: Option = None; + let mut logs_config: Option = None; + let mut metrics_config: Option = None; + let mut resources_config: Option = + None; + let mut traces_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() { + "account_tags" => { + account_tags = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "auth_config" => { + if v.is_null() { + continue; + } + auth_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _auth_config) = auth_config { + match _auth_config { + crate::datadogV2::model::AWSAuthConfig::UnparsedObject( + _auth_config, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "aws_account_id" => { + aws_account_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "aws_partition" => { + if v.is_null() { + continue; + } + aws_partition = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _aws_partition) = aws_partition { + match _aws_partition { + crate::datadogV2::model::AWSAccountPartition::UnparsedObject(_aws_partition) => { + _unparsed = true; + }, + _ => {} + } + } + } + "aws_regions" => { + if v.is_null() { + continue; + } + aws_regions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _aws_regions) = aws_regions { + match _aws_regions { + crate::datadogV2::model::AWSRegions::UnparsedObject( + _aws_regions, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + "logs_config" => { + if v.is_null() { + continue; + } + logs_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "metrics_config" => { + if v.is_null() { + continue; + } + metrics_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "resources_config" => { + if v.is_null() { + continue; + } + resources_config = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "traces_config" => { + if v.is_null() { + continue; + } + traces_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 aws_account_id = + aws_account_id.ok_or_else(|| M::Error::missing_field("aws_account_id"))?; + + let content = AWSAccountUpdateRequestAttributes { + account_tags, + auth_config, + aws_account_id, + aws_partition, + aws_regions, + logs_config, + metrics_config, + resources_config, + traces_config, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountUpdateRequestAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_account_update_request_data.rs b/src/datadogV2/model/model_aws_account_update_request_data.rs new file mode 100644 index 000000000..07bfa726e --- /dev/null +++ b/src/datadogV2/model/model_aws_account_update_request_data.rs @@ -0,0 +1,134 @@ +// 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 Account Update Request data +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountUpdateRequestData { + /// The AWS Account Integration Config to be updated + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::AWSAccountUpdateRequestAttributes, + /// Unique Datadog ID of the AWS Account Integration Config + #[serde(rename = "id")] + pub id: Option, + /// AWS Account resource type. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSAccountType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountUpdateRequestData { + pub fn new( + attributes: crate::datadogV2::model::AWSAccountUpdateRequestAttributes, + type_: crate::datadogV2::model::AWSAccountType, + ) -> AWSAccountUpdateRequestData { + AWSAccountUpdateRequestData { + attributes, + id: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + 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 AWSAccountUpdateRequestData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountUpdateRequestDataVisitor; + impl<'a> Visitor<'a> for AWSAccountUpdateRequestDataVisitor { + type Value = AWSAccountUpdateRequestData; + + 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::AWSAccountUpdateRequestAttributes, + > = 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" => { + 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::AWSAccountType::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 = AWSAccountUpdateRequestData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountUpdateRequestDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_accounts_response.rs b/src/datadogV2/model/model_aws_accounts_response.rs new file mode 100644 index 000000000..5884b78a6 --- /dev/null +++ b/src/datadogV2/model/model_aws_accounts_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 Accounts response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAccountsResponse { + /// List of AWS Account Integration Configs + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAccountsResponse { + pub fn new(data: Vec) -> AWSAccountsResponse { + AWSAccountsResponse { + 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 AWSAccountsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAccountsResponseVisitor; + impl<'a> Visitor<'a> for AWSAccountsResponseVisitor { + type Value = AWSAccountsResponse; + + 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 = AWSAccountsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAccountsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_auth_config.rs b/src/datadogV2/model/model_aws_auth_config.rs new file mode 100644 index 000000000..edba37738 --- /dev/null +++ b/src/datadogV2/model/model_aws_auth_config.rs @@ -0,0 +1,41 @@ +// 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}; + +/// AWS Authentication config +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AWSAuthConfig { + AWSAuthConfigKeys(Box), + AWSAuthConfigRole(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AWSAuthConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(AWSAuthConfig::AWSAuthConfigKeys(_v)); + } + } + if let Ok(_v) = + serde_json::from_value::>(value.clone()) + { + if !_v._unparsed { + return Ok(AWSAuthConfig::AWSAuthConfigRole(_v)); + } + } + + return Ok(AWSAuthConfig::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_aws_auth_config_keys.rs b/src/datadogV2/model/model_aws_auth_config_keys.rs new file mode 100644 index 000000000..7d9cea4ce --- /dev/null +++ b/src/datadogV2/model/model_aws_auth_config_keys.rs @@ -0,0 +1,112 @@ +// 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 Authentication config for key-based account +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAuthConfigKeys { + /// AWS Access Key ID + #[serde(rename = "access_key_id")] + pub access_key_id: String, + /// AWS Secret Access Key + #[serde(rename = "secret_access_key")] + pub secret_access_key: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAuthConfigKeys { + pub fn new(access_key_id: String) -> AWSAuthConfigKeys { + AWSAuthConfigKeys { + access_key_id, + secret_access_key: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn secret_access_key(mut self, value: String) -> Self { + self.secret_access_key = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSAuthConfigKeys { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAuthConfigKeysVisitor; + impl<'a> Visitor<'a> for AWSAuthConfigKeysVisitor { + type Value = AWSAuthConfigKeys; + + 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 access_key_id: Option = None; + let mut secret_access_key: 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() { + "access_key_id" => { + access_key_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "secret_access_key" => { + if v.is_null() { + continue; + } + secret_access_key = + 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 access_key_id = + access_key_id.ok_or_else(|| M::Error::missing_field("access_key_id"))?; + + let content = AWSAuthConfigKeys { + access_key_id, + secret_access_key, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAuthConfigKeysVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_auth_config_role.rs b/src/datadogV2/model/model_aws_auth_config_role.rs new file mode 100644 index 000000000..13c28622b --- /dev/null +++ b/src/datadogV2/model/model_aws_auth_config_role.rs @@ -0,0 +1,110 @@ +// 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 Authentication config for role-based account +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSAuthConfigRole { + /// AWS IAM External ID for associated role + #[serde(rename = "external_id")] + pub external_id: Option, + /// AWS IAM Role name + #[serde(rename = "role_name")] + pub role_name: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSAuthConfigRole { + pub fn new(role_name: String) -> AWSAuthConfigRole { + AWSAuthConfigRole { + external_id: None, + role_name, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn external_id(mut self, value: String) -> Self { + self.external_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 AWSAuthConfigRole { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSAuthConfigRoleVisitor; + impl<'a> Visitor<'a> for AWSAuthConfigRoleVisitor { + type Value = AWSAuthConfigRole; + + 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 external_id: Option = None; + let mut role_name: 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() { + "external_id" => { + if v.is_null() { + continue; + } + external_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "role_name" => { + role_name = 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 role_name = role_name.ok_or_else(|| M::Error::missing_field("role_name"))?; + + let content = AWSAuthConfigRole { + external_id, + role_name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSAuthConfigRoleVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_lambda_forwarder_config.rs b/src/datadogV2/model/model_aws_lambda_forwarder_config.rs new file mode 100644 index 000000000..48857f1c8 --- /dev/null +++ b/src/datadogV2/model/model_aws_lambda_forwarder_config.rs @@ -0,0 +1,122 @@ +// 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 Lambda forwarder +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSLambdaForwarderConfig { + /// List of Datadog Lambda Log Forwarder ARNs + #[serde(rename = "lambdas")] + pub lambdas: Option>, + /// List of AWS services that will send logs to the Datadog Lambda Log Forwarder + #[serde(rename = "sources")] + pub sources: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSLambdaForwarderConfig { + pub fn new() -> AWSLambdaForwarderConfig { + AWSLambdaForwarderConfig { + lambdas: None, + sources: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn lambdas(mut self, value: Vec) -> Self { + self.lambdas = Some(value); + self + } + + pub fn sources(mut self, value: Vec) -> Self { + self.sources = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSLambdaForwarderConfig { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSLambdaForwarderConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSLambdaForwarderConfigVisitor; + impl<'a> Visitor<'a> for AWSLambdaForwarderConfigVisitor { + type Value = AWSLambdaForwarderConfig; + + 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 lambdas: Option> = None; + let mut sources: 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() { + "lambdas" => { + if v.is_null() { + continue; + } + lambdas = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "sources" => { + if v.is_null() { + continue; + } + sources = 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 = AWSLambdaForwarderConfig { + lambdas, + sources, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSLambdaForwarderConfigVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_logs_config.rs b/src/datadogV2/model/model_aws_logs_config.rs new file mode 100644 index 000000000..307b4735b --- /dev/null +++ b/src/datadogV2/model/model_aws_logs_config.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 Logs config +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSLogsConfig { + /// AWS Lambda forwarder + #[serde(rename = "lambda_forwarder")] + pub lambda_forwarder: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSLogsConfig { + pub fn new() -> AWSLogsConfig { + AWSLogsConfig { + lambda_forwarder: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn lambda_forwarder( + mut self, + value: crate::datadogV2::model::AWSLambdaForwarderConfig, + ) -> Self { + self.lambda_forwarder = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSLogsConfig { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSLogsConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSLogsConfigVisitor; + impl<'a> Visitor<'a> for AWSLogsConfigVisitor { + type Value = AWSLogsConfig; + + 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 lambda_forwarder: Option< + crate::datadogV2::model::AWSLambdaForwarderConfig, + > = 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() { + "lambda_forwarder" => { + if v.is_null() { + continue; + } + lambda_forwarder = + 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 = AWSLogsConfig { + lambda_forwarder, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSLogsConfigVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_logs_services_response.rs b/src/datadogV2/model/model_aws_logs_services_response.rs new file mode 100644 index 000000000..8a347a8a1 --- /dev/null +++ b/src/datadogV2/model/model_aws_logs_services_response.rs @@ -0,0 +1,94 @@ +// 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 Logs Services response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSLogsServicesResponse { + /// AWS Logs Services response body + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSLogsServicesResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSLogsServicesResponse { + pub fn new( + data: crate::datadogV2::model::AWSLogsServicesResponseData, + ) -> AWSLogsServicesResponse { + AWSLogsServicesResponse { + 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 AWSLogsServicesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSLogsServicesResponseVisitor; + impl<'a> Visitor<'a> for AWSLogsServicesResponseVisitor { + type Value = AWSLogsServicesResponse; + + 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 = AWSLogsServicesResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSLogsServicesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_logs_services_response_attributes.rs b/src/datadogV2/model/model_aws_logs_services_response_attributes.rs new file mode 100644 index 000000000..3d1f63b3a --- /dev/null +++ b/src/datadogV2/model/model_aws_logs_services_response_attributes.rs @@ -0,0 +1,94 @@ +// 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 Logs Services response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSLogsServicesResponseAttributes { + /// List of AWS services that can send logs to Datadog + #[serde(rename = "logs_services")] + pub logs_services: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSLogsServicesResponseAttributes { + pub fn new(logs_services: Vec) -> AWSLogsServicesResponseAttributes { + AWSLogsServicesResponseAttributes { + logs_services, + 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 AWSLogsServicesResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSLogsServicesResponseAttributesVisitor; + impl<'a> Visitor<'a> for AWSLogsServicesResponseAttributesVisitor { + type Value = AWSLogsServicesResponseAttributes; + + 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 logs_services: 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() { + "logs_services" => { + logs_services = + 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 logs_services = + logs_services.ok_or_else(|| M::Error::missing_field("logs_services"))?; + + let content = AWSLogsServicesResponseAttributes { + logs_services, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSLogsServicesResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_logs_services_response_data.rs b/src/datadogV2/model/model_aws_logs_services_response_data.rs new file mode 100644 index 000000000..3b13b81d9 --- /dev/null +++ b/src/datadogV2/model/model_aws_logs_services_response_data.rs @@ -0,0 +1,136 @@ +// 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 Logs Services response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSLogsServicesResponseData { + /// AWS Logs Services response body + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `AWSLogsServicesResponseData` `id`. + #[serde(rename = "id")] + pub id: String, + /// The `AWSLogsServicesResponseData` `type`. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSLogsServicesResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSLogsServicesResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::AWSLogsServicesResponseDataType, + ) -> AWSLogsServicesResponseData { + AWSLogsServicesResponseData { + attributes: None, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::AWSLogsServicesResponseAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSLogsServicesResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSLogsServicesResponseDataVisitor; + impl<'a> Visitor<'a> for AWSLogsServicesResponseDataVisitor { + type Value = AWSLogsServicesResponseData; + + 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::AWSLogsServicesResponseAttributes, + > = 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" => { + 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::AWSLogsServicesResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AWSLogsServicesResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSLogsServicesResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_logs_services_response_data_type.rs b/src/datadogV2/model/model_aws_logs_services_response_data_type.rs new file mode 100644 index 000000000..d8ef62349 --- /dev/null +++ b/src/datadogV2/model/model_aws_logs_services_response_data_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 AWSLogsServicesResponseDataType { + LOGS_SERVICES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AWSLogsServicesResponseDataType { + fn to_string(&self) -> String { + match self { + Self::LOGS_SERVICES => String::from("logs_services"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AWSLogsServicesResponseDataType { + 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 AWSLogsServicesResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "logs_services" => Self::LOGS_SERVICES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_aws_metrics_config.rs b/src/datadogV2/model/model_aws_metrics_config.rs new file mode 100644 index 000000000..eb8fc9251 --- /dev/null +++ b/src/datadogV2/model/model_aws_metrics_config.rs @@ -0,0 +1,211 @@ +// 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 Metrics config +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSMetricsConfig { + /// Enable EC2 automute for AWS metrics + #[serde(rename = "automute_enabled")] + pub automute_enabled: Option, + /// Enable CloudWatch alarms collection + #[serde(rename = "collect_cloudwatch_alarms")] + pub collect_cloudwatch_alarms: Option, + /// Enable custom metrics collection + #[serde(rename = "collect_custom_metrics")] + pub collect_custom_metrics: Option, + /// Enable AWS metrics collection + #[serde(rename = "enabled")] + pub enabled: Option, + /// AWS Metrics namespace filters + #[serde(rename = "namespace_filters")] + pub namespace_filters: Option, + /// AWS Metrics tag filters list + #[serde(rename = "tag_filters")] + pub tag_filters: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSMetricsConfig { + pub fn new() -> AWSMetricsConfig { + AWSMetricsConfig { + automute_enabled: None, + collect_cloudwatch_alarms: None, + collect_custom_metrics: None, + enabled: None, + namespace_filters: None, + tag_filters: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn automute_enabled(mut self, value: bool) -> Self { + self.automute_enabled = Some(value); + self + } + + pub fn collect_cloudwatch_alarms(mut self, value: bool) -> Self { + self.collect_cloudwatch_alarms = Some(value); + self + } + + pub fn collect_custom_metrics(mut self, value: bool) -> Self { + self.collect_custom_metrics = Some(value); + self + } + + pub fn enabled(mut self, value: bool) -> Self { + self.enabled = Some(value); + self + } + + pub fn namespace_filters( + mut self, + value: crate::datadogV2::model::AWSNamespaceFilters, + ) -> Self { + self.namespace_filters = Some(value); + self + } + + pub fn tag_filters( + mut self, + value: Vec, + ) -> Self { + self.tag_filters = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSMetricsConfig { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSMetricsConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSMetricsConfigVisitor; + impl<'a> Visitor<'a> for AWSMetricsConfigVisitor { + type Value = AWSMetricsConfig; + + 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 automute_enabled: Option = None; + let mut collect_cloudwatch_alarms: Option = None; + let mut collect_custom_metrics: Option = None; + let mut enabled: Option = None; + let mut namespace_filters: Option = + None; + let mut tag_filters: 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() { + "automute_enabled" => { + if v.is_null() { + continue; + } + automute_enabled = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "collect_cloudwatch_alarms" => { + if v.is_null() { + continue; + } + collect_cloudwatch_alarms = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "collect_custom_metrics" => { + if v.is_null() { + continue; + } + collect_custom_metrics = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "enabled" => { + if v.is_null() { + continue; + } + enabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "namespace_filters" => { + if v.is_null() { + continue; + } + namespace_filters = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _namespace_filters) = namespace_filters { + match _namespace_filters { + crate::datadogV2::model::AWSNamespaceFilters::UnparsedObject(_namespace_filters) => { + _unparsed = true; + }, + _ => {} + } + } + } + "tag_filters" => { + if v.is_null() { + continue; + } + tag_filters = + 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 = AWSMetricsConfig { + automute_enabled, + collect_cloudwatch_alarms, + collect_custom_metrics, + enabled, + namespace_filters, + tag_filters, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSMetricsConfigVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespace_filters.rs b/src/datadogV2/model/model_aws_namespace_filters.rs new file mode 100644 index 000000000..962c163ff --- /dev/null +++ b/src/datadogV2/model/model_aws_namespace_filters.rs @@ -0,0 +1,61 @@ +// 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}; + +/// AWS Metrics namespace filters +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AWSNamespaceFilters { + AWSNamespaceFiltersExcludeAll(Box), + AWSNamespaceFiltersExcludeOnly(Box), + AWSNamespaceFiltersIncludeAll(Box), + AWSNamespaceFiltersIncludeOnly(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AWSNamespaceFilters { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(AWSNamespaceFilters::AWSNamespaceFiltersExcludeAll(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(AWSNamespaceFilters::AWSNamespaceFiltersExcludeOnly(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(AWSNamespaceFilters::AWSNamespaceFiltersIncludeAll(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(AWSNamespaceFilters::AWSNamespaceFiltersIncludeOnly(_v)); + } + } + + return Ok(AWSNamespaceFilters::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_aws_namespace_filters_exclude_all.rs b/src/datadogV2/model/model_aws_namespace_filters_exclude_all.rs new file mode 100644 index 000000000..85b478ddd --- /dev/null +++ b/src/datadogV2/model/model_aws_namespace_filters_exclude_all.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Exclude all namespaces +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespaceFiltersExcludeAll { + /// Exclude all namespaces + #[serde(rename = "exclude_all")] + pub exclude_all: bool, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespaceFiltersExcludeAll { + pub fn new(exclude_all: bool) -> AWSNamespaceFiltersExcludeAll { + AWSNamespaceFiltersExcludeAll { + exclude_all, + 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 AWSNamespaceFiltersExcludeAll { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespaceFiltersExcludeAllVisitor; + impl<'a> Visitor<'a> for AWSNamespaceFiltersExcludeAllVisitor { + type Value = AWSNamespaceFiltersExcludeAll; + + 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 exclude_all: 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() { + "exclude_all" => { + exclude_all = + 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 exclude_all = + exclude_all.ok_or_else(|| M::Error::missing_field("exclude_all"))?; + + let content = AWSNamespaceFiltersExcludeAll { + exclude_all, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespaceFiltersExcludeAllVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespace_filters_exclude_only.rs b/src/datadogV2/model/model_aws_namespace_filters_exclude_only.rs new file mode 100644 index 000000000..79557d5c4 --- /dev/null +++ b/src/datadogV2/model/model_aws_namespace_filters_exclude_only.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Exclude only these namespaces +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespaceFiltersExcludeOnly { + /// Exclude only these namespaces + #[serde(rename = "exclude_only")] + pub exclude_only: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespaceFiltersExcludeOnly { + pub fn new(exclude_only: Vec) -> AWSNamespaceFiltersExcludeOnly { + AWSNamespaceFiltersExcludeOnly { + exclude_only, + 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 AWSNamespaceFiltersExcludeOnly { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespaceFiltersExcludeOnlyVisitor; + impl<'a> Visitor<'a> for AWSNamespaceFiltersExcludeOnlyVisitor { + type Value = AWSNamespaceFiltersExcludeOnly; + + 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 exclude_only: 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() { + "exclude_only" => { + exclude_only = + 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 exclude_only = + exclude_only.ok_or_else(|| M::Error::missing_field("exclude_only"))?; + + let content = AWSNamespaceFiltersExcludeOnly { + exclude_only, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespaceFiltersExcludeOnlyVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespace_filters_include_all.rs b/src/datadogV2/model/model_aws_namespace_filters_include_all.rs new file mode 100644 index 000000000..f66f0c381 --- /dev/null +++ b/src/datadogV2/model/model_aws_namespace_filters_include_all.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Include all namespaces +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespaceFiltersIncludeAll { + /// Include all namespaces + #[serde(rename = "include_all")] + pub include_all: bool, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespaceFiltersIncludeAll { + pub fn new(include_all: bool) -> AWSNamespaceFiltersIncludeAll { + AWSNamespaceFiltersIncludeAll { + include_all, + 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 AWSNamespaceFiltersIncludeAll { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespaceFiltersIncludeAllVisitor; + impl<'a> Visitor<'a> for AWSNamespaceFiltersIncludeAllVisitor { + type Value = AWSNamespaceFiltersIncludeAll; + + 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 include_all: 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() { + "include_all" => { + include_all = + 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 include_all = + include_all.ok_or_else(|| M::Error::missing_field("include_all"))?; + + let content = AWSNamespaceFiltersIncludeAll { + include_all, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespaceFiltersIncludeAllVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespace_filters_include_only.rs b/src/datadogV2/model/model_aws_namespace_filters_include_only.rs new file mode 100644 index 000000000..c448964ea --- /dev/null +++ b/src/datadogV2/model/model_aws_namespace_filters_include_only.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Include only these namespaces +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespaceFiltersIncludeOnly { + /// Include only these namespaces + #[serde(rename = "include_only")] + pub include_only: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespaceFiltersIncludeOnly { + pub fn new(include_only: Vec) -> AWSNamespaceFiltersIncludeOnly { + AWSNamespaceFiltersIncludeOnly { + include_only, + 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 AWSNamespaceFiltersIncludeOnly { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespaceFiltersIncludeOnlyVisitor; + impl<'a> Visitor<'a> for AWSNamespaceFiltersIncludeOnlyVisitor { + type Value = AWSNamespaceFiltersIncludeOnly; + + 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 include_only: 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() { + "include_only" => { + include_only = + 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 include_only = + include_only.ok_or_else(|| M::Error::missing_field("include_only"))?; + + let content = AWSNamespaceFiltersIncludeOnly { + include_only, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespaceFiltersIncludeOnlyVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespace_tag_filter.rs b/src/datadogV2/model/model_aws_namespace_tag_filter.rs new file mode 100644 index 000000000..691812b7c --- /dev/null +++ b/src/datadogV2/model/model_aws_namespace_tag_filter.rs @@ -0,0 +1,119 @@ +// 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 Metrics tag filters +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespaceTagFilter { + /// The AWS Namespace to apply the tag filters against + #[serde(rename = "namespace")] + pub namespace: Option, + /// The tags to filter based on + #[serde(rename = "tags", default, with = "::serde_with::rust::double_option")] + pub tags: Option>>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespaceTagFilter { + pub fn new() -> AWSNamespaceTagFilter { + AWSNamespaceTagFilter { + namespace: None, + tags: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn namespace(mut self, value: String) -> Self { + self.namespace = Some(value); + self + } + + pub fn tags(mut self, value: Option>) -> Self { + self.tags = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSNamespaceTagFilter { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSNamespaceTagFilter { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespaceTagFilterVisitor; + impl<'a> Visitor<'a> for AWSNamespaceTagFilterVisitor { + type Value = AWSNamespaceTagFilter; + + 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 namespace: Option = None; + let mut tags: 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() { + "namespace" => { + if v.is_null() { + continue; + } + namespace = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + tags = 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 = AWSNamespaceTagFilter { + namespace, + tags, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespaceTagFilterVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespaces_response.rs b/src/datadogV2/model/model_aws_namespaces_response.rs new file mode 100644 index 000000000..a389b0041 --- /dev/null +++ b/src/datadogV2/model/model_aws_namespaces_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 Namespaces response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespacesResponse { + /// AWS Namespaces response body + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSNamespacesResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespacesResponse { + pub fn new(data: crate::datadogV2::model::AWSNamespacesResponseData) -> AWSNamespacesResponse { + AWSNamespacesResponse { + 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 AWSNamespacesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespacesResponseVisitor; + impl<'a> Visitor<'a> for AWSNamespacesResponseVisitor { + type Value = AWSNamespacesResponse; + + 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 = AWSNamespacesResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespacesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespaces_response_attributes.rs b/src/datadogV2/model/model_aws_namespaces_response_attributes.rs new file mode 100644 index 000000000..202a9afb5 --- /dev/null +++ b/src/datadogV2/model/model_aws_namespaces_response_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 Namespaces response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespacesResponseAttributes { + /// AWS CloudWatch namespace + #[serde(rename = "namespaces")] + pub namespaces: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespacesResponseAttributes { + pub fn new(namespaces: Vec) -> AWSNamespacesResponseAttributes { + AWSNamespacesResponseAttributes { + namespaces, + 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 AWSNamespacesResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespacesResponseAttributesVisitor; + impl<'a> Visitor<'a> for AWSNamespacesResponseAttributesVisitor { + type Value = AWSNamespacesResponseAttributes; + + 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 namespaces: 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() { + "namespaces" => { + namespaces = 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 namespaces = namespaces.ok_or_else(|| M::Error::missing_field("namespaces"))?; + + let content = AWSNamespacesResponseAttributes { + namespaces, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespacesResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespaces_response_data.rs b/src/datadogV2/model/model_aws_namespaces_response_data.rs new file mode 100644 index 000000000..b0fe47bdf --- /dev/null +++ b/src/datadogV2/model/model_aws_namespaces_response_data.rs @@ -0,0 +1,136 @@ +// 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 Namespaces response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNamespacesResponseData { + /// AWS Namespaces response body + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `AWSNamespacesResponseData` `id`. + #[serde(rename = "id")] + pub id: String, + /// The `AWSNamespacesResponseData` `type`. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSNamespacesResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNamespacesResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::AWSNamespacesResponseDataType, + ) -> AWSNamespacesResponseData { + AWSNamespacesResponseData { + attributes: None, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::AWSNamespacesResponseAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSNamespacesResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNamespacesResponseDataVisitor; + impl<'a> Visitor<'a> for AWSNamespacesResponseDataVisitor { + type Value = AWSNamespacesResponseData; + + 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::AWSNamespacesResponseAttributes, + > = 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" => { + 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::AWSNamespacesResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AWSNamespacesResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNamespacesResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_namespaces_response_data_type.rs b/src/datadogV2/model/model_aws_namespaces_response_data_type.rs new file mode 100644 index 000000000..4e0cca46d --- /dev/null +++ b/src/datadogV2/model/model_aws_namespaces_response_data_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 AWSNamespacesResponseDataType { + NAMESPACES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AWSNamespacesResponseDataType { + fn to_string(&self) -> String { + match self { + Self::NAMESPACES => String::from("namespaces"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AWSNamespacesResponseDataType { + 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 AWSNamespacesResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "namespaces" => Self::NAMESPACES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_aws_new_external_id_response.rs b/src/datadogV2/model/model_aws_new_external_id_response.rs new file mode 100644 index 000000000..caf81f08e --- /dev/null +++ b/src/datadogV2/model/model_aws_new_external_id_response.rs @@ -0,0 +1,94 @@ +// 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 External ID response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNewExternalIDResponse { + /// AWS External ID response body + #[serde(rename = "data")] + pub data: crate::datadogV2::model::AWSNewExternalIDResponseData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNewExternalIDResponse { + pub fn new( + data: crate::datadogV2::model::AWSNewExternalIDResponseData, + ) -> AWSNewExternalIDResponse { + AWSNewExternalIDResponse { + 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 AWSNewExternalIDResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNewExternalIDResponseVisitor; + impl<'a> Visitor<'a> for AWSNewExternalIDResponseVisitor { + type Value = AWSNewExternalIDResponse; + + 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 = AWSNewExternalIDResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNewExternalIDResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_new_external_id_response_attributes.rs b/src/datadogV2/model/model_aws_new_external_id_response_attributes.rs new file mode 100644 index 000000000..c7e739a89 --- /dev/null +++ b/src/datadogV2/model/model_aws_new_external_id_response_attributes.rs @@ -0,0 +1,94 @@ +// 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 External ID response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNewExternalIDResponseAttributes { + /// AWS IAM External ID for associated role + #[serde(rename = "external_id")] + pub external_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNewExternalIDResponseAttributes { + pub fn new(external_id: String) -> AWSNewExternalIDResponseAttributes { + AWSNewExternalIDResponseAttributes { + external_id, + 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 AWSNewExternalIDResponseAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNewExternalIDResponseAttributesVisitor; + impl<'a> Visitor<'a> for AWSNewExternalIDResponseAttributesVisitor { + type Value = AWSNewExternalIDResponseAttributes; + + 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 external_id: 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() { + "external_id" => { + external_id = + 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 external_id = + external_id.ok_or_else(|| M::Error::missing_field("external_id"))?; + + let content = AWSNewExternalIDResponseAttributes { + external_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNewExternalIDResponseAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_new_external_id_response_data.rs b/src/datadogV2/model/model_aws_new_external_id_response_data.rs new file mode 100644 index 000000000..73574fe18 --- /dev/null +++ b/src/datadogV2/model/model_aws_new_external_id_response_data.rs @@ -0,0 +1,136 @@ +// 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 External ID response body +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSNewExternalIDResponseData { + /// AWS External ID response body + #[serde(rename = "attributes")] + pub attributes: Option, + /// The `AWSNewExternalIDResponseData` `id`. + #[serde(rename = "id")] + pub id: String, + /// The `AWSNewExternalIDResponseData` `type`. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::AWSNewExternalIDResponseDataType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSNewExternalIDResponseData { + pub fn new( + id: String, + type_: crate::datadogV2::model::AWSNewExternalIDResponseDataType, + ) -> AWSNewExternalIDResponseData { + AWSNewExternalIDResponseData { + attributes: None, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn attributes( + mut self, + value: crate::datadogV2::model::AWSNewExternalIDResponseAttributes, + ) -> Self { + self.attributes = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for AWSNewExternalIDResponseData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSNewExternalIDResponseDataVisitor; + impl<'a> Visitor<'a> for AWSNewExternalIDResponseDataVisitor { + type Value = AWSNewExternalIDResponseData; + + 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::AWSNewExternalIDResponseAttributes, + > = 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" => { + 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::AWSNewExternalIDResponseDataType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = AWSNewExternalIDResponseData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSNewExternalIDResponseDataVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_new_external_id_response_data_type.rs b/src/datadogV2/model/model_aws_new_external_id_response_data_type.rs new file mode 100644 index 000000000..6002cd41d --- /dev/null +++ b/src/datadogV2/model/model_aws_new_external_id_response_data_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 AWSNewExternalIDResponseDataType { + EXTERNAL_ID, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for AWSNewExternalIDResponseDataType { + fn to_string(&self) -> String { + match self { + Self::EXTERNAL_ID => String::from("external_id"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for AWSNewExternalIDResponseDataType { + 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 AWSNewExternalIDResponseDataType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "external_id" => Self::EXTERNAL_ID, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_aws_regions.rs b/src/datadogV2/model/model_aws_regions.rs new file mode 100644 index 000000000..fe05fd639 --- /dev/null +++ b/src/datadogV2/model/model_aws_regions.rs @@ -0,0 +1,41 @@ +// 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}; + +/// AWS Regions to collect data from +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum AWSRegions { + AWSRegionsIncludeAll(Box), + AWSRegionsIncludeOnly(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for AWSRegions { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(AWSRegions::AWSRegionsIncludeAll(_v)); + } + } + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(AWSRegions::AWSRegionsIncludeOnly(_v)); + } + } + + return Ok(AWSRegions::UnparsedObject(crate::datadog::UnparsedObject { + value, + })); + } +} diff --git a/src/datadogV2/model/model_aws_regions_include_all.rs b/src/datadogV2/model/model_aws_regions_include_all.rs new file mode 100644 index 000000000..56a046c64 --- /dev/null +++ b/src/datadogV2/model/model_aws_regions_include_all.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Include all regions +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSRegionsIncludeAll { + /// Include all regions + #[serde(rename = "include_all")] + pub include_all: bool, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSRegionsIncludeAll { + pub fn new(include_all: bool) -> AWSRegionsIncludeAll { + AWSRegionsIncludeAll { + include_all, + 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 AWSRegionsIncludeAll { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSRegionsIncludeAllVisitor; + impl<'a> Visitor<'a> for AWSRegionsIncludeAllVisitor { + type Value = AWSRegionsIncludeAll; + + 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 include_all: 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() { + "include_all" => { + include_all = + 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 include_all = + include_all.ok_or_else(|| M::Error::missing_field("include_all"))?; + + let content = AWSRegionsIncludeAll { + include_all, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSRegionsIncludeAllVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_regions_include_only.rs b/src/datadogV2/model/model_aws_regions_include_only.rs new file mode 100644 index 000000000..9c1c9dd81 --- /dev/null +++ b/src/datadogV2/model/model_aws_regions_include_only.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Include only these regions +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSRegionsIncludeOnly { + /// Include only these regions + #[serde(rename = "include_only")] + pub include_only: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSRegionsIncludeOnly { + pub fn new(include_only: Vec) -> AWSRegionsIncludeOnly { + AWSRegionsIncludeOnly { + include_only, + 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 AWSRegionsIncludeOnly { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSRegionsIncludeOnlyVisitor; + impl<'a> Visitor<'a> for AWSRegionsIncludeOnlyVisitor { + type Value = AWSRegionsIncludeOnly; + + 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 include_only: 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() { + "include_only" => { + include_only = + 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 include_only = + include_only.ok_or_else(|| M::Error::missing_field("include_only"))?; + + let content = AWSRegionsIncludeOnly { + include_only, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSRegionsIncludeOnlyVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_resources_config.rs b/src/datadogV2/model/model_aws_resources_config.rs new file mode 100644 index 000000000..183d90e1f --- /dev/null +++ b/src/datadogV2/model/model_aws_resources_config.rs @@ -0,0 +1,124 @@ +// 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 Resources config +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSResourcesConfig { + /// Whether Datadog collects cloud security posture management resources from your AWS account. + #[serde(rename = "cloud_security_posture_management_collection")] + pub cloud_security_posture_management_collection: Option, + /// Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Required for `cspm_resource_collection`. + #[serde(rename = "extended_collection")] + pub extended_collection: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSResourcesConfig { + pub fn new() -> AWSResourcesConfig { + AWSResourcesConfig { + cloud_security_posture_management_collection: None, + extended_collection: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn cloud_security_posture_management_collection(mut self, value: bool) -> Self { + self.cloud_security_posture_management_collection = Some(value); + self + } + + pub fn extended_collection(mut self, value: bool) -> Self { + self.extended_collection = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSResourcesConfig { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSResourcesConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSResourcesConfigVisitor; + impl<'a> Visitor<'a> for AWSResourcesConfigVisitor { + type Value = AWSResourcesConfig; + + 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 cloud_security_posture_management_collection: Option = None; + let mut extended_collection: 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() { + "cloud_security_posture_management_collection" => { + if v.is_null() { + continue; + } + cloud_security_posture_management_collection = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "extended_collection" => { + if v.is_null() { + continue; + } + extended_collection = + 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 = AWSResourcesConfig { + cloud_security_posture_management_collection, + extended_collection, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSResourcesConfigVisitor) + } +} diff --git a/src/datadogV2/model/model_aws_traces_config.rs b/src/datadogV2/model/model_aws_traces_config.rs new file mode 100644 index 000000000..abb1f7849 --- /dev/null +++ b/src/datadogV2/model/model_aws_traces_config.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 Traces config +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct AWSTracesConfig { + /// AWS X-Ray services to collect traces from + #[serde(rename = "xray_services")] + pub xray_services: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl AWSTracesConfig { + pub fn new() -> AWSTracesConfig { + AWSTracesConfig { + xray_services: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn xray_services(mut self, value: crate::datadogV2::model::XRayServicesList) -> Self { + self.xray_services = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for AWSTracesConfig { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for AWSTracesConfig { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct AWSTracesConfigVisitor; + impl<'a> Visitor<'a> for AWSTracesConfigVisitor { + type Value = AWSTracesConfig; + + 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 xray_services: 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() { + "xray_services" => { + if v.is_null() { + continue; + } + xray_services = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _xray_services) = xray_services { + match _xray_services { + crate::datadogV2::model::XRayServicesList::UnparsedObject( + _xray_services, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = AWSTracesConfig { + xray_services, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(AWSTracesConfigVisitor) + } +} diff --git a/src/datadogV2/model/model_x_ray_services_include_all.rs b/src/datadogV2/model/model_x_ray_services_include_all.rs new file mode 100644 index 000000000..513ddd6c5 --- /dev/null +++ b/src/datadogV2/model/model_x_ray_services_include_all.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Include all services +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct XRayServicesIncludeAll { + /// Include all services + #[serde(rename = "include_all")] + pub include_all: bool, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl XRayServicesIncludeAll { + pub fn new(include_all: bool) -> XRayServicesIncludeAll { + XRayServicesIncludeAll { + include_all, + 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 XRayServicesIncludeAll { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct XRayServicesIncludeAllVisitor; + impl<'a> Visitor<'a> for XRayServicesIncludeAllVisitor { + type Value = XRayServicesIncludeAll; + + 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 include_all: 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() { + "include_all" => { + include_all = + 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 include_all = + include_all.ok_or_else(|| M::Error::missing_field("include_all"))?; + + let content = XRayServicesIncludeAll { + include_all, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(XRayServicesIncludeAllVisitor) + } +} diff --git a/src/datadogV2/model/model_x_ray_services_include_only.rs b/src/datadogV2/model/model_x_ray_services_include_only.rs new file mode 100644 index 000000000..0ccd43ad6 --- /dev/null +++ b/src/datadogV2/model/model_x_ray_services_include_only.rs @@ -0,0 +1,94 @@ +// 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}; + +/// Include only these services +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct XRayServicesIncludeOnly { + /// Include only these services + #[serde(rename = "include_only")] + pub include_only: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl XRayServicesIncludeOnly { + pub fn new(include_only: Vec) -> XRayServicesIncludeOnly { + XRayServicesIncludeOnly { + include_only, + 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 XRayServicesIncludeOnly { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct XRayServicesIncludeOnlyVisitor; + impl<'a> Visitor<'a> for XRayServicesIncludeOnlyVisitor { + type Value = XRayServicesIncludeOnly; + + 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 include_only: 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() { + "include_only" => { + include_only = + 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 include_only = + include_only.ok_or_else(|| M::Error::missing_field("include_only"))?; + + let content = XRayServicesIncludeOnly { + include_only, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(XRayServicesIncludeOnlyVisitor) + } +} diff --git a/src/datadogV2/model/model_x_ray_services_list.rs b/src/datadogV2/model/model_x_ray_services_list.rs new file mode 100644 index 000000000..e488b5763 --- /dev/null +++ b/src/datadogV2/model/model_x_ray_services_list.rs @@ -0,0 +1,42 @@ +// 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}; + +/// AWS X-Ray services to collect traces from +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum XRayServicesList { + XRayServicesIncludeAll(Box), + XRayServicesIncludeOnly(Box), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for XRayServicesList { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::>( + value.clone(), + ) { + if !_v._unparsed { + return Ok(XRayServicesList::XRayServicesIncludeAll(_v)); + } + } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(XRayServicesList::XRayServicesIncludeOnly(_v)); + } + } + + return Ok(XRayServicesList::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..466a5f735 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:00.419Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..fc5a870d6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-AWS-Account-object-response.json @@ -0,0 +1,63 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"83eacdb0-09e6-4e72-bf2e-b2fbcdf438b7\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"2803c423184c499dbd123d346e5bd16f\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_all\":true},\"created_at\":\"2024-10-28T14:43:01.065460229Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":true,\"collect_cloudwatch_alarms\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/SQS\",\"AWS/ElasticMapReduce\"]}},\"modified_at\":\"2024-10-28T14:43:01.065463823Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:00 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/83eacdb0-09e6-4e72-bf2e-b2fbcdf438b7" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:00 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..225e608e0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:01.350Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.json new file mode 100644 index 000000000..c6528e8a4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws-invalid\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid partition: aws-invalid\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:01 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.frozen new file mode 100644 index 000000000..0dbdfb536 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:01.458Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.json new file mode 100644 index 000000000..b4e7f48b8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-config-returns-Conflict-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"00000000-abcd-0001-0000-000000000000\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"fa9e70b4-5fbb-499d-ba36-b802512cbc83\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"7fca00b8e534405e990889d4960d23f6\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:02.014523417Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:02.014527511Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:01 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"409\",\"title\":\"Account already exists\",\"detail\":\"AWS account with provided id already exists\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 409, + "message": "Conflict" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:01 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/fa9e70b4-5fbb-499d-ba36-b802512cbc83" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:01 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.frozen new file mode 100644 index 000000000..520064df1 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.frozen @@ -0,0 +1 @@ +2024-08-09T18:59:51.401Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.json new file mode 100644 index 000000000..1c6a1f5e5 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-invalid-aws-partition-returns-400-API-error-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"aws_account\":{\"account_tags\":[],\"auth_config\":{\"role_name\":\"test\"},\"aws_account_id\":\"172322422800\",\"aws_partition\":\"aws-test\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[\"s3\"]}},\"metrics_config\":{\"namespace_filters\":{\"exclude_only\":[\"AWS/EC2\"],\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[]}]},\"resources_config\":{},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}},\"id\":\"172322422800\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid partition: aws-test\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Fri, 09 Aug 2024 18:59:51 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..2e16a115a --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-08-09T18:59:51.926Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..ced3f00d8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Create-account-with-valid-config-returns-AWS-Account-object-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"aws_account\":{\"account_tags\":[],\"auth_config\":{\"role_name\":\"test\"},\"aws_account_id\":\"172322422800\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[\"s3\"]}},\"metrics_config\":{\"namespace_filters\":{\"exclude_only\":[\"AWS/EC2\"],\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[]}]},\"resources_config\":{},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}},\"id\":\"172322422800\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"create_account\",\"type\":\"account\",\"attributes\":{\"aws_account\":{\"account_tags\":null,\"aws_account_id\":\"172322422800\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"auth_config\":{\"role_name\":\"test\",\"external_id\":\"08df61ab19794766a0df51fa344ef31c\"},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":null}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"logs_config\":{\"lambda_forwarder\":{\"sources\":[\"s3\"]}},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}},\"resources_config\":{\"cloud_security_posture_management_collection\":false}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Fri, 09 Aug 2024 18:59:51 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/172322422800" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Fri, 09 Aug 2024 18:59:51 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..279b77d56 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:02.940Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.json new file mode 100644 index 000000000..d815b8b81 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/not-a-uuid" + }, + "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, 28 Oct 2024 14:43:02 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.frozen new file mode 100644 index 000000000..f5fe1a6f0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:03.036Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.json new file mode 100644 index 000000000..dad019df5 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-No-Content-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"00000000-abcd-0001-0000-000000000000\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"ea195e91-95f9-4811-9161-cbcce608b8ed\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"cd09f429becf46babb7f30a4da51b5fb\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:03.638813736Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:03.638829687Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:03 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/ea195e91-95f9-4811-9161-cbcce608b8ed" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:03 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/ea195e91-95f9-4811-9161-cbcce608b8ed" + }, + "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, 28 Oct 2024 14:43:03 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.frozen new file mode 100644 index 000000000..b8c3c7fbd --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:04.053Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.json new file mode 100644 index 000000000..cfef26746 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Delete-account-config-returns-Not-Found-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"00000000-abcd-0001-0000-000000000000\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"615cc571-774b-4e40-bc94-ad3f178cbfc8\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"b4966eed30af4b1ba9f62a4a3e841cb8\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:04.618588959Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:04.618593611Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a" + }, + "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, 28 Oct 2024 14:43:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/615cc571-774b-4e40-bc94-ad3f178cbfc8" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:04 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen new file mode 100644 index 000000000..b9c80bdbb --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:05.063Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.json new file mode 100644 index 000000000..7c73789f2 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Generate-new-external-ID-returns-AWS-External-ID-object-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/generate_new_external_id" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"external_id\",\"type\":\"external_id\",\"attributes\":{\"external_id\":\"46c7ca9418564d478f52b94479b3aae2\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:05 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..ae44c8d58 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:05.156Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..cdeb34a2c --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-AWS-Account-object-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"00000000-abcd-0001-0000-000000000000\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"34c9dbc0f2934cebb5d7a0690f3f333f\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:05.736496681Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:05.736509432Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:05 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"34c9dbc0f2934cebb5d7a0690f3f333f\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:05.736497Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:05.736509Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:05 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:05 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..3602f01ba --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.192Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-response.json new file mode 100644 index 000000000..fa4a2e573 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Bad-Request-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/not-a-uuid" + }, + "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, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.frozen new file mode 100644 index 000000000..b4eaf0851 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.335Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-config-returns-Not-Found-response.json new file mode 100644 index 000000000..a008b220f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-account-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/448169a8-251c-4344-abee-1c4edef39f7a" + }, + "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, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.frozen new file mode 100644 index 000000000..684ec896f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.477Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-response.json new file mode 100644 index 000000000..cf6763da6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Get-all-account-configs-returns-AWS-Accounts-List-object-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" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"e6daa8c4-58b6-42e1-970e-44e6fa812ce0\",\"type\":\"account\",\"attributes\":{\"account_tags\":[],\"auth_config\":{\"access_key_id\":\"AKIA514950102505\"},\"aws_account_id\":\"514950102505\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_all\":true},\"created_at\":\"2024-09-06T00:18:12.382448Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder\"],\"sources\":[]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[],\"namespace_filters\":{\"exclude_only\":[\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-06T00:18:17.536561Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"a0c7f96e-a471-488e-84be-c3336e7ab693\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"859ffc73702c40f589cc3b74c5967e27\"},\"aws_account_id\":\"172830950700\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-10-07T13:58:28.577522Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-10-07T13:58:28.577526Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"3a3d5b83-2ad8-41d8-b82e-a3ba972a9783\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"be10a93f33a64b0ea872da2f48348979\"},\"aws_account_id\":\"172704974400\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-23T00:02:26.306293Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-23T00:02:26.306297Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"89a9dae5-cbe3-4fba-b1b2-aae8775ed319\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"filter:one\",\"filtertwo\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"e31ada331546486f9099cd5c01eef257\"},\"aws_account_id\":\"001725901256\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-2\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-09T17:00:58.823444Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"testTag\",\"test:Tag2\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-10-16T14:55:17.947931Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"7e1d660d-1142-45b1-a795-dc3900b6bd17\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"f61b52d768394db6851aed2f887ac6f6\"},\"aws_account_id\":\"172830950701\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"me-south-1\"]},\"created_at\":\"2024-10-17T15:08:40.917209Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-10-18T20:19:53.960435Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"d52e151c-c608-4e14-9f29-dfeff876bb39\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"c2909403ca9949db82c36adf6e8cdcfa\"},\"aws_account_id\":\"172772261200\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-30T18:56:55.042771Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-30T18:56:55.042775Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"d7d74617-832d-4c4d-a8c3-1e69d509ea52\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"2b1dd9fd35b0440ca4bf98ff70ac2e63\"},\"aws_account_id\":\"172772275700\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-30T18:59:18.175722Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-30T18:59:18.175727Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"7e5acac6-3ac8-4762-8100-479f03ccffc8\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"04548a334583412aa4e6f5548f4e9989\"},\"aws_account_id\":\"172532181900\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-03T00:03:40.248176Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-03T00:03:40.24818Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen new file mode 100644 index 000000000..cce707248 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.671Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-response.json new file mode 100644 index 000000000..fe2953d27 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-available-namespaces-returns-AWS-Namespaces-List-object-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/available_namespaces" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"namespaces\",\"type\":\"namespaces\",\"attributes\":{\"namespaces\":[\"AWS/ApiGateway\",\"AWS/AppRunner\",\"AWS/AppStream\",\"AWS/AppSync\",\"AWS/ApplicationELB\",\"AWS/Athena\",\"AWS/AutoScaling\",\"AWS/Backup\",\"AWS/Bedrock\",\"AWS/Billing\",\"AWS/CertificateManager\",\"AWS/ELB\",\"AWS/CloudFront\",\"AWS/CloudHSM\",\"AWS/CloudSearch\",\"AWS/CodeBuild\",\"AWS/CodeWhisperer\",\"AWS/Cognito\",\"AWS/Config\",\"AWS/Connect\",\"AWS/DMS\",\"AWS/DX\",\"AWS/DocDB\",\"AWS/DynamoDB\",\"AWS/DAX\",\"AWS/EC2\",\"AWS/EC2/API\",\"AWS/EC2/InfrastructurePerformance\",\"AWS/EC2Spot\",\"AWS/ElasticMapReduce\",\"AWS/ElastiCache\",\"AWS/ElasticBeanstalk\",\"AWS/EBS\",\"AWS/ECR\",\"AWS/ECS\",\"AWS/EFS\",\"AWS/ElasticTranscoder\",\"AWS/MediaConnect\",\"AWS/MediaConvert\",\"AWS/MediaLive\",\"AWS/MediaPackage\",\"AWS/MediaStore\",\"AWS/MediaTailor\",\"AWS/Events\",\"AWS/FSx\",\"AWS/GameLift\",\"AWS/GlobalAccelerator\",\"Glue\",\"AWS/Inspector\",\"AWS/IoT\",\"AWS/KMS\",\"AWS/Cassandra\",\"AWS/Kinesis\",\"AWS/KinesisAnalytics\",\"AWS/Firehose\",\"AWS/Lambda\",\"AWS/Lex\",\"AWS/AmazonMQ\",\"AWS/ML\",\"AWS/Kafka\",\"AmazonMWAA\",\"AWS/MemoryDB\",\"AWS/NATGateway\",\"AWS/Neptune\",\"AWS/NetworkFirewall\",\"AWS/NetworkELB\",\"AWS/Network Manager\",\"AWS/NetworkMonitor\",\"AWS/ES\",\"AWS/AOSS\",\"AWS/OpsWorks\",\"AWS/Polly\",\"AWS/PrivateLinkEndpoints\",\"AWS/PrivateLinkServices\",\"AWS/RDS\",\"AWS/RDS/Proxy\",\"AWS/Redshift\",\"AWS/Rekognition\",\"AWS/Route53\",\"AWS/Route53Resolver\",\"AWS/S3\",\"AWS/S3/Storage-Lens\",\"AWS/SageMaker\",\"/aws/sagemaker/Endpoints\",\"AWS/Sagemaker/LabelingJobs\",\"AWS/Sagemaker/ModelBuildingPipeline\",\"/aws/sagemaker/ProcessingJobs\",\"/aws/sagemaker/TrainingJobs\",\"/aws/sagemaker/TransformJobs\",\"AWS/SageMaker/Workteam\",\"AWS/ServiceQuotas\",\"AWS/DDoSProtection\",\"AWS/SES\",\"AWS/SNS\",\"AWS/SQS\",\"AWS/SWF\",\"AWS/States\",\"AWS/StorageGateway\",\"AWS/Textract\",\"AWS/TransitGateway\",\"AWS/Translate\",\"AWS/TrustedAdvisor\",\"AWS/VPN\",\"WAF\",\"AWS/WAFV2\",\"AWS/WorkSpaces\",\"AWS/X-Ray\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.frozen new file mode 100644 index 000000000..c1c6a30de --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.777Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-response.json new file mode 100644 index 000000000..d96c8902c --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-log-services-returns-AWS-Logs-Services-List-object-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/logs/services" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"logs_services\",\"type\":\"logs_services\",\"attributes\":{\"logs_services\":[\"apigw-access-logs\",\"apigw-execution-logs\",\"cloudfront\",\"elb\",\"elbv2\",\"lambda\",\"redshift\",\"s3\",\"states\",\"waf\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.frozen new file mode 100644 index 000000000..9053e7504 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.862Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-response.json new file mode 100644 index 000000000..fe2953d27 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-List-namespaces-returns-AWS-Namespaces-List-object-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/available_namespaces" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"namespaces\",\"type\":\"namespaces\",\"attributes\":{\"namespaces\":[\"AWS/ApiGateway\",\"AWS/AppRunner\",\"AWS/AppStream\",\"AWS/AppSync\",\"AWS/ApplicationELB\",\"AWS/Athena\",\"AWS/AutoScaling\",\"AWS/Backup\",\"AWS/Bedrock\",\"AWS/Billing\",\"AWS/CertificateManager\",\"AWS/ELB\",\"AWS/CloudFront\",\"AWS/CloudHSM\",\"AWS/CloudSearch\",\"AWS/CodeBuild\",\"AWS/CodeWhisperer\",\"AWS/Cognito\",\"AWS/Config\",\"AWS/Connect\",\"AWS/DMS\",\"AWS/DX\",\"AWS/DocDB\",\"AWS/DynamoDB\",\"AWS/DAX\",\"AWS/EC2\",\"AWS/EC2/API\",\"AWS/EC2/InfrastructurePerformance\",\"AWS/EC2Spot\",\"AWS/ElasticMapReduce\",\"AWS/ElastiCache\",\"AWS/ElasticBeanstalk\",\"AWS/EBS\",\"AWS/ECR\",\"AWS/ECS\",\"AWS/EFS\",\"AWS/ElasticTranscoder\",\"AWS/MediaConnect\",\"AWS/MediaConvert\",\"AWS/MediaLive\",\"AWS/MediaPackage\",\"AWS/MediaStore\",\"AWS/MediaTailor\",\"AWS/Events\",\"AWS/FSx\",\"AWS/GameLift\",\"AWS/GlobalAccelerator\",\"Glue\",\"AWS/Inspector\",\"AWS/IoT\",\"AWS/KMS\",\"AWS/Cassandra\",\"AWS/Kinesis\",\"AWS/KinesisAnalytics\",\"AWS/Firehose\",\"AWS/Lambda\",\"AWS/Lex\",\"AWS/AmazonMQ\",\"AWS/ML\",\"AWS/Kafka\",\"AmazonMWAA\",\"AWS/MemoryDB\",\"AWS/NATGateway\",\"AWS/Neptune\",\"AWS/NetworkFirewall\",\"AWS/NetworkELB\",\"AWS/Network Manager\",\"AWS/NetworkMonitor\",\"AWS/ES\",\"AWS/AOSS\",\"AWS/OpsWorks\",\"AWS/Polly\",\"AWS/PrivateLinkEndpoints\",\"AWS/PrivateLinkServices\",\"AWS/RDS\",\"AWS/RDS/Proxy\",\"AWS/Redshift\",\"AWS/Rekognition\",\"AWS/Route53\",\"AWS/Route53Resolver\",\"AWS/S3\",\"AWS/S3/Storage-Lens\",\"AWS/SageMaker\",\"/aws/sagemaker/Endpoints\",\"AWS/Sagemaker/LabelingJobs\",\"AWS/Sagemaker/ModelBuildingPipeline\",\"/aws/sagemaker/ProcessingJobs\",\"/aws/sagemaker/TrainingJobs\",\"/aws/sagemaker/TransformJobs\",\"AWS/SageMaker/Workteam\",\"AWS/ServiceQuotas\",\"AWS/DDoSProtection\",\"AWS/SES\",\"AWS/SNS\",\"AWS/SQS\",\"AWS/SWF\",\"AWS/States\",\"AWS/StorageGateway\",\"AWS/Textract\",\"AWS/TransitGateway\",\"AWS/Translate\",\"AWS/TrustedAdvisor\",\"AWS/VPN\",\"WAF\",\"AWS/WAFV2\",\"AWS/WorkSpaces\",\"AWS/X-Ray\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.frozen new file mode 100644 index 000000000..042faedbb --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.frozen @@ -0,0 +1 @@ +2024-08-21T20:16:52.731Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.json new file mode 100644 index 000000000..69933522b --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-API-error-response-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\"]},\"logs_config\":{},\"metrics_config\":{\"automute_enabled\":true,\"enabled\":false,\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"123456789012\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b5333e91-03e0-4a3f-9bd6-07e2d83cb85f\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"aa55eef398064c1ab1937f6f008b7184\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\"]},\"created_at\":\"2024-08-21T20:16:53.079170523Z\",\"logs_config\":{\"lambda_forwarder\":{}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":true,\"collect_cloudwatch_alarms\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-08-21T20:16:53.079176907Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 21 Aug 2024 20:16:52 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[],\"auth_config\":{\"role_name\":\"test\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws-test\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[\"s3\"]}},\"metrics_config\":{\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[]}]},\"resources_config\":{},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"123456789012\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid partition: aws-test\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Wed, 21 Aug 2024 20:16:52 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 21 Aug 2024 20:16:52 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..3736f4c8c --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:06.952Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..37e7c6cb7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-AWS-Account-object-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"00000000-abcd-0001-0000-000000000000\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"28a2004c-84b4-4f07-a2a4-01c9ab6a021e\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"a55061deb44b4bd28f751f150cabf912\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:07.521247459Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:07.521251841Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/28a2004c-84b4-4f07-a2a4-01c9ab6a021e" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"28a2004c-84b4-4f07-a2a4-01c9ab6a021e\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"a55061deb44b4bd28f751f150cabf912\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:07.521247Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":true,\"collect_cloudwatch_alarms\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:07.787129993Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/28a2004c-84b4-4f07-a2a4-01c9ab6a021e" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:06 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..e56f68336 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:08.012Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.json new file mode 100644 index 000000000..9620151c0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Bad-Request-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"id\":\"00000000-abcd-0001-0000-000000000000\",\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"84a5a2e9-80f6-4740-a478-c885ae8d4117\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"8e44f2912a454f59824ddcb767a6f6da\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-10-28T14:43:08.585257799Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-10-28T14:43:08.585261311Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:08 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"access_key_id\":\"AKIAIOSFODNN7EXAMPLE\",\"secret_access_key\":\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/84a5a2e9-80f6-4740-a478-c885ae8d4117" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"cannot switch between role and key based auth\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:08 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/84a5a2e9-80f6-4740-a478-c885ae8d4117" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Mon, 28 Oct 2024 14:43:08 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.frozen new file mode 100644 index 000000000..861698b97 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-10-28T14:43:08.932Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.json new file mode 100644 index 000000000..d1bd53a58 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/AWS-Integration-Patch-account-config-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a" + }, + "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, 28 Oct 2024 14:43:08 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..8da9363a4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:46.341Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..b20968be2 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-account-returns-AWS-Account-object-response.json @@ -0,0 +1,63 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"0696eb1f-06fa-40a6-a623-084a83f61623\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"32cd9dafa1d24205ba26a02d157cd16f\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_all\":true},\"created_at\":\"2024-11-06T18:44:47.20569681Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":true,\"collect_cloudwatch_alarms\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/SQS\",\"AWS/ElasticMapReduce\"]}},\"modified_at\":\"2024-11-06T18:44:47.20570138Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:46 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/0696eb1f-06fa-40a6-a623-084a83f61623" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:46 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..4adb1638a --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:47.513Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..2f4a4d9bb --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-AWS-Account-object-response.json @@ -0,0 +1,63 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"access_key_id\":\"AKIAIOSFODNN7EXAMPLE\",\"secret_access_key\":\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"5b07e0e7-013c-427e-977a-7adb94ff4b40\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"access_key_id\":\"AKIAIOSFODNN7EXAMPLE\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_all\":true},\"created_at\":\"2024-11-06T18:44:47.622908005Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":true,\"collect_cloudwatch_alarms\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/SQS\",\"AWS/ElasticMapReduce\"]}},\"modified_at\":\"2024-11-06T18:44:47.62291187Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:47 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/5b07e0e7-013c-427e-977a-7adb94ff4b40" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:47 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..26a03306f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:47.919Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.json new file mode 100644 index 000000000..dca558878 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws-invalid\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid partition: aws-invalid\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:47 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.frozen new file mode 100644 index 000000000..89901ede4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:48.024Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.json b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.json new file mode 100644 index 000000000..6a5c70369 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Create-an-AWS-integration-returns-Conflict-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7f221537-cb4f-47dc-8666-f77e5ca60750\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"8fce2f5d4975420794b61a5455bf78f2\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:48.579473724Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:48.579477654Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:48 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"409\",\"title\":\"Account already exists\",\"detail\":\"AWS account with provided id already exists\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 409, + "message": "Conflict" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:48 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/7f221537-cb4f-47dc-8666-f77e5ca60750" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:48 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..27a329cdd --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:49.460Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.json new file mode 100644 index 000000000..f883de1d1 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Bad-Request-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/not-a-uuid" + }, + "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": "Wed, 06 Nov 2024 18:44:49 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.frozen new file mode 100644 index 000000000..19dc73505 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:49.526Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.json b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.json new file mode 100644 index 000000000..40737408c --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-No-Content-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"e733f58b-b8d1-4d0c-b2f5-6438d314ca51\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"33e38eb9a16041fc8688ca9afcf82224\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:50.086633712Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:50.086637995Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:49 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/e733f58b-b8d1-4d0c-b2f5-6438d314ca51" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:49 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/e733f58b-b8d1-4d0c-b2f5-6438d314ca51" + }, + "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": "Wed, 06 Nov 2024 18:44:49 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.frozen new file mode 100644 index 000000000..abe0e4a74 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:50.507Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.json new file mode 100644 index 000000000..cb1905636 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Delete-an-AWS-integration-returns-Not-Found-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"22e02b17-0d91-46d7-a228-69f7250a9c67\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"7d448990acf04682b29cb61691bf86bc\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:51.024047931Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:51.024054618Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:50 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a" + }, + "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": "Wed, 06 Nov 2024 18:44:50 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/22e02b17-0d91-46d7-a228-69f7250a9c67" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:50 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.frozen new file mode 100644 index 000000000..6095c7802 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:51.500Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.json new file mode 100644 index 000000000..5e2ec6405 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Generate-a-new-external-ID-returns-AWS-External-ID-object-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/generate_new_external_id" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"external_id\",\"type\":\"external_id\",\"attributes\":{\"external_id\":\"96fc79a77c474e4f863a3c227fb91fef\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:51 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen new file mode 100644 index 000000000..37cfccb87 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:51.871Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.json new file mode 100644 index 000000000..162cbde45 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Generate-new-external-ID-returns-AWS-External-ID-object-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/generate_new_external_id" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"78feee6b9c374776888068593fa8c0b9\",\"type\":\"external_id\",\"attributes\":{\"external_id\":\"78feee6b9c374776888068593fa8c0b9\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:51 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..312117186 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:52.052Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..f1f0c94b5 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-AWS-Account-object-response.json @@ -0,0 +1,91 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"db6c660f-0ee0-4479-b1e6-936e5faa7266\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"f4c8000f33f94d25bcec9afd6609bb11\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:52.646520994Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:52.646525244Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:52 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/db6c660f-0ee0-4479-b1e6-936e5faa7266" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"db6c660f-0ee0-4479-b1e6-936e5faa7266\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"f4c8000f33f94d25bcec9afd6609bb11\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:52.646521Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:52.646525Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:52 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/db6c660f-0ee0-4479-b1e6-936e5faa7266" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:52 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..8de2f0fbb --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:53.120Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-response.json new file mode 100644 index 000000000..aeabd67e1 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Bad-Request-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/not-a-uuid" + }, + "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": "Wed, 06 Nov 2024 18:44:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.frozen new file mode 100644 index 000000000..2abc18523 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:53.215Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-returns-Not-Found-response.json new file mode 100644 index 000000000..3677addff --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Get-an-AWS-integration-by-config-ID-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/448169a8-251c-4344-abee-1c4edef39f7a" + }, + "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": "Wed, 06 Nov 2024 18:44:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.frozen new file mode 100644 index 000000000..293234322 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:53.338Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-response.json new file mode 100644 index 000000000..c3d2b256a --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-all-AWS-integrations-returns-AWS-Accounts-List-object-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" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"e6daa8c4-58b6-42e1-970e-44e6fa812ce0\",\"type\":\"account\",\"attributes\":{\"account_tags\":[],\"auth_config\":{\"access_key_id\":\"AKIA514950102505\"},\"aws_account_id\":\"514950102505\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_all\":true},\"created_at\":\"2024-09-06T00:18:12.382448Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder\"],\"sources\":[]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[],\"namespace_filters\":{\"exclude_only\":[\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-06T00:18:17.536561Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"a0c7f96e-a471-488e-84be-c3336e7ab693\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"859ffc73702c40f589cc3b74c5967e27\"},\"aws_account_id\":\"172830950700\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-10-07T13:58:28.577522Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-10-07T13:58:28.577526Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"3a3d5b83-2ad8-41d8-b82e-a3ba972a9783\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"be10a93f33a64b0ea872da2f48348979\"},\"aws_account_id\":\"172704974400\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-23T00:02:26.306293Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-23T00:02:26.306297Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"89a9dae5-cbe3-4fba-b1b2-aae8775ed319\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"filter:one\",\"filtertwo\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"e31ada331546486f9099cd5c01eef257\"},\"aws_account_id\":\"001725901256\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-2\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-09T17:00:58.823444Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"testTag\",\"test:Tag2\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-10-16T14:55:17.947931Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"7e1d660d-1142-45b1-a795-dc3900b6bd17\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"f61b52d768394db6851aed2f887ac6f6\"},\"aws_account_id\":\"172830950701\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"me-south-1\"]},\"created_at\":\"2024-10-17T15:08:40.917209Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-10-18T20:19:53.960435Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"d52e151c-c608-4e14-9f29-dfeff876bb39\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"c2909403ca9949db82c36adf6e8cdcfa\"},\"aws_account_id\":\"172772261200\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-30T18:56:55.042771Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-30T18:56:55.042775Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"d7d74617-832d-4c4d-a8c3-1e69d509ea52\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"2b1dd9fd35b0440ca4bf98ff70ac2e63\"},\"aws_account_id\":\"172772275700\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ap-southeast-5\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-30T18:59:18.175722Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-30T18:59:18.175727Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}},{\"id\":\"7e5acac6-3ac8-4762-8100-479f03ccffc8\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"$KEY:$VALUE\"],\"auth_config\":{\"role_name\":\"DatadogAWSIntegrationRole\",\"external_id\":\"04548a334583412aa4e6f5548f4e9989\"},\"aws_account_id\":\"172532181900\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-2\",\"us-west-1\",\"eu-west-1\",\"eu-central-1\",\"ap-southeast-1\",\"ap-southeast-2\",\"ap-northeast-1\",\"ap-northeast-2\",\"ap-northeast-3\",\"sa-east-1\",\"ap-south-1\",\"ca-central-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\"af-south-1\",\"ap-east-1\",\"ap-south-2\",\"ap-southeast-3\",\"ap-southeast-4\",\"ca-west-1\",\"eu-central-2\",\"eu-south-1\",\"eu-south-2\",\"il-central-1\",\"me-central-1\",\"me-south-1\"]},\"created_at\":\"2024-09-03T00:03:40.248176Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[],\"sources\":[]}},\"metrics_config\":{\"enabled\":false,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"$KEY:$VALUE\"]}],\"namespace_filters\":{\"exclude_only\":[\"AWS/AutoScaling\",\"AWS/ElasticMapReduce\",\"AWS/SQS\"]}},\"modified_at\":\"2024-09-03T00:03:40.24818Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":true,\"extended_collection\":true},\"traces_config\":{\"xray_services\":{\"include_only\":[]}}}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen new file mode 100644 index 000000000..e1b33d2db --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:53.502Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-response.json new file mode 100644 index 000000000..ef703ea7f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-available-namespaces-returns-AWS-Namespaces-List-object-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/available_namespaces" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"namespaces\",\"type\":\"namespaces\",\"attributes\":{\"namespaces\":[\"AWS/ApiGateway\",\"AWS/AppRunner\",\"AWS/AppStream\",\"AWS/AppSync\",\"AWS/ApplicationELB\",\"AWS/Athena\",\"AWS/AutoScaling\",\"AWS/Backup\",\"AWS/Bedrock\",\"AWS/Billing\",\"AWS/Budgeting\",\"AWS/CertificateManager\",\"AWS/ELB\",\"AWS/CloudFront\",\"AWS/CloudHSM\",\"AWS/CloudSearch\",\"AWS/Logs\",\"AWS/CodeBuild\",\"AWS/CodeWhisperer\",\"AWS/Cognito\",\"AWS/Config\",\"AWS/Connect\",\"AWS/DMS\",\"AWS/DX\",\"AWS/DocDB\",\"AWS/DynamoDB\",\"AWS/DAX\",\"AWS/EC2\",\"AWS/EC2/API\",\"AWS/EC2/InfrastructurePerformance\",\"AWS/EC2Spot\",\"AWS/ElasticMapReduce\",\"AWS/ElastiCache\",\"AWS/ElasticBeanstalk\",\"AWS/EBS\",\"AWS/ECR\",\"AWS/ECS\",\"AWS/EFS\",\"AWS/ElasticInference\",\"AWS/ElasticTranscoder\",\"AWS/MediaConnect\",\"AWS/MediaConvert\",\"AWS/MediaLive\",\"AWS/MediaPackage\",\"AWS/MediaStore\",\"AWS/MediaTailor\",\"AWS/Events\",\"AWS/FSx\",\"AWS/GameLift\",\"AWS/GlobalAccelerator\",\"Glue\",\"AWS/Inspector\",\"AWS/IoT\",\"AWS/KMS\",\"AWS/Cassandra\",\"AWS/Kinesis\",\"AWS/KinesisAnalytics\",\"AWS/Firehose\",\"AWS/Lambda\",\"AWS/Lex\",\"AWS/AmazonMQ\",\"AWS/ML\",\"AWS/Kafka\",\"AmazonMWAA\",\"AWS/MemoryDB\",\"AWS/NATGateway\",\"AWS/Neptune\",\"AWS/NetworkFirewall\",\"AWS/NetworkELB\",\"AWS/Network Manager\",\"AWS/NetworkMonitor\",\"AWS/ES\",\"AWS/AOSS\",\"AWS/OpsWorks\",\"AWS/Polly\",\"AWS/PrivateLinkEndpoints\",\"AWS/PrivateLinkServices\",\"AWS/RDS\",\"AWS/RDS/Proxy\",\"AWS/Redshift\",\"AWS/Rekognition\",\"AWS/Route53\",\"AWS/Route53Resolver\",\"AWS/S3\",\"AWS/S3/Storage-Lens\",\"AWS/SageMaker\",\"/aws/sagemaker/Endpoints\",\"AWS/Sagemaker/LabelingJobs\",\"AWS/Sagemaker/ModelBuildingPipeline\",\"/aws/sagemaker/ProcessingJobs\",\"/aws/sagemaker/TrainingJobs\",\"/aws/sagemaker/TransformJobs\",\"AWS/SageMaker/Workteam\",\"AWS/ServiceQuotas\",\"AWS/DDoSProtection\",\"AWS/SES\",\"AWS/SNS\",\"AWS/SQS\",\"AWS/SWF\",\"AWS/States\",\"AWS/StorageGateway\",\"AWS/Textract\",\"AWS/TransitGateway\",\"AWS/Translate\",\"AWS/TrustedAdvisor\",\"AWS/Usage\",\"AWS/VPN\",\"WAF\",\"AWS/WAFV2\",\"AWS/WorkSpaces\",\"AWS/X-Ray\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.frozen new file mode 100644 index 000000000..ec96db9be --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.frozen @@ -0,0 +1 @@ +2024-11-04T20:55:55.328Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-response.json new file mode 100644 index 000000000..00a023db4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-log-services-returns-AWS-Logs-Services-List-object-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/logs/services" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"logs_services\",\"type\":\"logs_services\",\"attributes\":{\"logs_services\":[\"apigw-access-logs\",\"apigw-execution-logs\",\"cloudfront\",\"elb\",\"elbv2\",\"lambda\",\"redshift\",\"s3\",\"states\",\"waf\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 04 Nov 2024 20:55:55 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.frozen new file mode 100644 index 000000000..f663dde1f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:53.574Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-response.json new file mode 100644 index 000000000..ef703ea7f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/List-namespaces-returns-AWS-Namespaces-List-object-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/available_namespaces" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"namespaces\",\"type\":\"namespaces\",\"attributes\":{\"namespaces\":[\"AWS/ApiGateway\",\"AWS/AppRunner\",\"AWS/AppStream\",\"AWS/AppSync\",\"AWS/ApplicationELB\",\"AWS/Athena\",\"AWS/AutoScaling\",\"AWS/Backup\",\"AWS/Bedrock\",\"AWS/Billing\",\"AWS/Budgeting\",\"AWS/CertificateManager\",\"AWS/ELB\",\"AWS/CloudFront\",\"AWS/CloudHSM\",\"AWS/CloudSearch\",\"AWS/Logs\",\"AWS/CodeBuild\",\"AWS/CodeWhisperer\",\"AWS/Cognito\",\"AWS/Config\",\"AWS/Connect\",\"AWS/DMS\",\"AWS/DX\",\"AWS/DocDB\",\"AWS/DynamoDB\",\"AWS/DAX\",\"AWS/EC2\",\"AWS/EC2/API\",\"AWS/EC2/InfrastructurePerformance\",\"AWS/EC2Spot\",\"AWS/ElasticMapReduce\",\"AWS/ElastiCache\",\"AWS/ElasticBeanstalk\",\"AWS/EBS\",\"AWS/ECR\",\"AWS/ECS\",\"AWS/EFS\",\"AWS/ElasticInference\",\"AWS/ElasticTranscoder\",\"AWS/MediaConnect\",\"AWS/MediaConvert\",\"AWS/MediaLive\",\"AWS/MediaPackage\",\"AWS/MediaStore\",\"AWS/MediaTailor\",\"AWS/Events\",\"AWS/FSx\",\"AWS/GameLift\",\"AWS/GlobalAccelerator\",\"Glue\",\"AWS/Inspector\",\"AWS/IoT\",\"AWS/KMS\",\"AWS/Cassandra\",\"AWS/Kinesis\",\"AWS/KinesisAnalytics\",\"AWS/Firehose\",\"AWS/Lambda\",\"AWS/Lex\",\"AWS/AmazonMQ\",\"AWS/ML\",\"AWS/Kafka\",\"AmazonMWAA\",\"AWS/MemoryDB\",\"AWS/NATGateway\",\"AWS/Neptune\",\"AWS/NetworkFirewall\",\"AWS/NetworkELB\",\"AWS/Network Manager\",\"AWS/NetworkMonitor\",\"AWS/ES\",\"AWS/AOSS\",\"AWS/OpsWorks\",\"AWS/Polly\",\"AWS/PrivateLinkEndpoints\",\"AWS/PrivateLinkServices\",\"AWS/RDS\",\"AWS/RDS/Proxy\",\"AWS/Redshift\",\"AWS/Rekognition\",\"AWS/Route53\",\"AWS/Route53Resolver\",\"AWS/S3\",\"AWS/S3/Storage-Lens\",\"AWS/SageMaker\",\"/aws/sagemaker/Endpoints\",\"AWS/Sagemaker/LabelingJobs\",\"AWS/Sagemaker/ModelBuildingPipeline\",\"/aws/sagemaker/ProcessingJobs\",\"/aws/sagemaker/TrainingJobs\",\"/aws/sagemaker/TransformJobs\",\"AWS/SageMaker/Workteam\",\"AWS/ServiceQuotas\",\"AWS/DDoSProtection\",\"AWS/SES\",\"AWS/SNS\",\"AWS/SQS\",\"AWS/SWF\",\"AWS/States\",\"AWS/StorageGateway\",\"AWS/Textract\",\"AWS/TransitGateway\",\"AWS/Translate\",\"AWS/TrustedAdvisor\",\"AWS/Usage\",\"AWS/VPN\",\"WAF\",\"AWS/WAFV2\",\"AWS/WorkSpaces\",\"AWS/X-Ray\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.frozen new file mode 100644 index 000000000..7d9884c79 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:53.669Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.json b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.json new file mode 100644 index 000000000..040ab637d --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-AWS-Account-object-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"06b62294-36d7-4bbe-a8b8-7c93736dc0ee\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"c16e1ceb4ac64293ba91f020191fa781\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:54.297075743Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:54.297079976Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:53 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/06b62294-36d7-4bbe-a8b8-7c93736dc0ee" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"06b62294-36d7-4bbe-a8b8-7c93736dc0ee\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"c16e1ceb4ac64293ba91f020191fa781\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:54.297076Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":true,\"collect_cloudwatch_alarms\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:54.489623544Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:53 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/06b62294-36d7-4bbe-a8b8-7c93736dc0ee" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..a20f0bad4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:54.767Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.json new file mode 100644 index 000000000..a90a733e2 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Bad-Request-response.json @@ -0,0 +1,97 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":false,\"collect_custom_metrics\":false,\"enabled\":true,\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]},\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"6e045c0b-458a-4ec1-8654-6ac491320939\",\"type\":\"account\",\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\",\"external_id\":\"00d5e0f623574d388e9717154bcbf7f2\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"aws_regions\":{\"include_only\":[\"us-east-1\"]},\"created_at\":\"2024-11-06T18:44:55.461251746Z\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"enabled\":true,\"automute_enabled\":true,\"collect_custom_metrics\":false,\"collect_cloudwatch_alarms\":false,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}],\"namespace_filters\":{\"include_only\":[\"AWS/EC2\"]}},\"modified_at\":\"2024-11-06T18:44:55.461256677Z\",\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{\"xray_services\":{\"include_only\":[\"AWS/AppSync\"]}}}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:54 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"access_key_id\":\"AKIAIOSFODNN7EXAMPLE\",\"secret_access_key\":\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/6e045c0b-458a-4ec1-8654-6ac491320939" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"cannot switch between role and key based auth\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:54 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "*/*" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/6e045c0b-458a-4ec1-8654-6ac491320939" + }, + "response": { + "body": { + "string": "", + "encoding": null + }, + "headers": {}, + "status": { + "code": 204, + "message": "No Content" + } + }, + "recorded_at": "Wed, 06 Nov 2024 18:44:54 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.frozen new file mode 100644 index 000000000..7d82ab53f --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2024-11-06T18:44:55.829Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.json new file mode 100644 index 000000000..19d8f40e7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_integration/Update-an-AWS-integration-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"account_tags\":[\"key:value\"],\"auth_config\":{\"role_name\":\"DatadogIntegrationRole\"},\"aws_account_id\":\"123456789012\",\"aws_partition\":\"aws\",\"logs_config\":{\"lambda_forwarder\":{\"lambdas\":[\"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"],\"sources\":[\"s3\"]}},\"metrics_config\":{\"automute_enabled\":true,\"collect_cloudwatch_alarms\":true,\"collect_custom_metrics\":true,\"enabled\":true,\"tag_filters\":[{\"namespace\":\"AWS/EC2\",\"tags\":[\"key:value\"]}]},\"resources_config\":{\"cloud_security_posture_management_collection\":false,\"extended_collection\":false},\"traces_config\":{}},\"type\":\"account\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a" + }, + "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": "Wed, 06 Nov 2024 18:44:55 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.frozen b/tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.frozen new file mode 100644 index 000000000..59066f4de --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.frozen @@ -0,0 +1 @@ +2024-11-06T15:58:53.184Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.json b/tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-response.json new file mode 100644 index 000000000..580359315 --- /dev/null +++ b/tests/scenarios/cassettes/v2/aws_logs_integration/Get-list-of-AWS-log-ready-services-returns-AWS-Logs-Services-List-object-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/logs/services" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"logs_services\",\"type\":\"logs_services\",\"attributes\":{\"logs_services\":[\"apigw-access-logs\",\"apigw-execution-logs\",\"cloudfront\",\"elb\",\"elbv2\",\"lambda\",\"redshift\",\"s3\",\"states\",\"waf\"]}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Wed, 06 Nov 2024 15:58:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v1/aws_integration.feature b/tests/scenarios/features/v1/aws_integration.feature index 017326abd..08c57bbc6 100644 --- a/tests/scenarios/features/v1/aws_integration.feature +++ b/tests/scenarios/features/v1/aws_integration.feature @@ -9,70 +9,70 @@ Feature: AWS Integration And a valid "appKeyAuth" key in the system And an instance of "AWSIntegration" API - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Create an AWS integration returns "Bad Request" response Given new "CreateAWSAccount" request And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Create an AWS integration returns "Conflict Error" response Given new "CreateAWSAccount" request And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 409 Conflict Error - @team:DataDog/cloud-integrations + @team:DataDog/aws-integrations Scenario: Create an AWS integration returns "OK" response Given new "CreateAWSAccount" request And body with value {"account_id": "{{ timestamp("now") }}00", "account_specific_namespace_rules": {"auto_scaling": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Create an Amazon EventBridge source returns "Bad Request" response Given new "CreateAWSEventBridgeSource" request And body with value {"account_id": "123456789012", "create_event_bus": true, "event_generator_name": "app-alerts", "region": "us-east-1"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Create an Amazon EventBridge source returns "OK" response Given new "CreateAWSEventBridgeSource" request And body with value {"account_id": "123456789012", "create_event_bus": true, "event_generator_name": "app-alerts", "region": "us-east-1"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete a tag filtering entry returns "Bad Request" response Given new "DeleteAWSTagFilter" request And body with value {"account_id": "FAKEAC0FAKEAC2FAKEAC", "namespace": "elb"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete a tag filtering entry returns "OK" response Given new "DeleteAWSTagFilter" request And body with value {"account_id": "FAKEAC0FAKEAC2FAKEAC", "namespace": "elb"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete an AWS integration returns "Bad Request" response Given new "DeleteAWSAccount" request And body with value {"account_id": "123456789012", "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete an AWS integration returns "Conflict Error" response Given new "DeleteAWSAccount" request And body with value {"account_id": "123456789012", "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 409 Conflict Error - @team:DataDog/cloud-integrations + @team:DataDog/aws-integrations Scenario: Delete an AWS integration returns "OK" response Given there is a valid "aws_account" in the system And new "DeleteAWSAccount" request @@ -80,107 +80,107 @@ Feature: AWS Integration When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete an Amazon EventBridge source returns "Bad Request" response Given new "DeleteAWSEventBridgeSource" request And body with value {"account_id": "123456789012", "event_generator_name": "app-alerts-zyxw3210", "region": "us-east-1"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete an Amazon EventBridge source returns "OK" response Given new "DeleteAWSEventBridgeSource" request And body with value {"account_id": "123456789012", "event_generator_name": "app-alerts-zyxw3210", "region": "us-east-1"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Generate a new external ID returns "Bad Request" response Given new "CreateNewAWSExternalID" request And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Generate a new external ID returns "OK" response Given new "CreateNewAWSExternalID" request And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Get all AWS tag filters returns "Bad Request" response Given new "ListAWSTagFilters" request And request contains "account_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Get all AWS tag filters returns "OK" response Given new "ListAWSTagFilters" request And request contains "account_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Get all Amazon EventBridge sources returns "Bad Request" response Given new "ListAWSEventBridgeSources" request When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Get all Amazon EventBridge sources returns "OK" response Given new "ListAWSEventBridgeSources" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: List all AWS integrations returns "Bad Request" response Given new "ListAWSAccounts" request When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: List all AWS integrations returns "OK" response Given new "ListAWSAccounts" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: List namespace rules returns "OK" response Given new "ListAvailableAWSNamespaces" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Set an AWS tag filter returns "Bad Request" response Given new "CreateAWSTagFilter" request And body with value {"account_id": "123456789012", "namespace": "elb", "tag_filter_str": "prod*"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Set an AWS tag filter returns "OK" response Given new "CreateAWSTagFilter" request And body with value {"account_id": "123456789012", "namespace": "elb", "tag_filter_str": "prod*"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Update an AWS integration returns "Bad Request" response Given new "UpdateAWSAccount" request And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Update an AWS integration returns "Conflict Error" response Given new "UpdateAWSAccount" request And body with value {"account_id": "123456789012", "account_specific_namespace_rules": {"auto_scaling": false, "opswork": false}, "cspm_resource_collection_enabled": true, "excluded_regions": ["us-east-1", "us-west-2"], "extended_resource_collection_enabled": true, "filter_tags": ["$KEY:$VALUE"], "host_tags": ["$KEY:$VALUE"], "metrics_collection_enabled": false, "resource_collection_enabled": true, "role_name": "DatadogAWSIntegrationRole"} When the request is sent Then the response status is 409 Conflict Error - @team:DataDog/cloud-integrations + @team:DataDog/aws-integrations Scenario: Update an AWS integration returns "OK" response Given there is a valid "aws_account" in the system And new "UpdateAWSAccount" request diff --git a/tests/scenarios/features/v1/aws_logs_integration.feature b/tests/scenarios/features/v1/aws_logs_integration.feature index 5459cbb79..622d8d7de 100644 --- a/tests/scenarios/features/v1/aws_logs_integration.feature +++ b/tests/scenarios/features/v1/aws_logs_integration.feature @@ -10,89 +10,89 @@ Feature: AWS Logs Integration And a valid "appKeyAuth" key in the system And an instance of "AWSLogsIntegration" API - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Add AWS Log Lambda ARN returns "Bad Request" response Given new "CreateAWSLambdaARN" request And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Add AWS Log Lambda ARN returns "OK" response Given new "CreateAWSLambdaARN" request And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Check permissions for log services returns "Bad Request" response Given new "CheckAWSLogsServicesAsync" request And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Check permissions for log services returns "OK" response Given new "CheckAWSLogsServicesAsync" request And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Check that an AWS Lambda Function exists returns "Bad Request" response Given new "CheckAWSLogsLambdaAsync" request And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Check that an AWS Lambda Function exists returns "OK" response Given new "CheckAWSLogsLambdaAsync" request And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete an AWS Logs integration returns "Bad Request" response Given new "DeleteAWSLambdaARN" request And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Delete an AWS Logs integration returns "OK" response Given new "DeleteAWSLambdaARN" request And body with value {"account_id": "1234567", "lambda_arn": "arn:aws:lambda:us-east-1:1234567:function:LogsCollectionAPITest"} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Enable an AWS Logs integration returns "Bad Request" response Given new "EnableAWSLogServices" request And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]} When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Enable an AWS Logs integration returns "OK" response Given new "EnableAWSLogServices" request And body with value {"account_id": "1234567", "services": ["s3", "elb", "elbv2", "cloudfront", "redshift", "lambda"]} When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: Get list of AWS log ready services returns "OK" response Given new "ListAWSLogsServices" request When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: List all AWS Logs integrations returns "Bad Request" response Given new "ListAWSLogsIntegrations" request When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/cloud-integrations + @generated @skip @team:DataDog/aws-integrations Scenario: List all AWS Logs integrations returns "OK" response Given new "ListAWSLogsIntegrations" request When the request is sent diff --git a/tests/scenarios/features/v2/aws_integration.feature b/tests/scenarios/features/v2/aws_integration.feature new file mode 100644 index 000000000..3f47d837a --- /dev/null +++ b/tests/scenarios/features/v2/aws_integration.feature @@ -0,0 +1,158 @@ +@endpoint(aws-integration) @endpoint(aws-integration-v2) +Feature: AWS Integration + Configure your Datadog-AWS integration directly through the Datadog API. + For more information, see the [AWS integration + page](https://docs.datadoghq.com/integrations/amazon_web_services). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AWSIntegration" API + + @team:DataDog/aws-integrations + Scenario: Create an AWS account returns "AWS Account object" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Create an AWS integration returns "AWS Account object" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Create an AWS integration returns "Bad Request" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws-invalid", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Create an AWS integration returns "Conflict" response + Given operation "CreateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/aws-integrations + Scenario: Delete an AWS integration returns "Bad Request" response + Given operation "DeleteAWSAccount" enabled + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter with value "not-a-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Delete an AWS integration returns "No Content" response + Given operation "DeleteAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/aws-integrations + Scenario: Delete an AWS integration returns "Not Found" response + Given operation "DeleteAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter with value "448169a8-251c-4344-abee-1c4edef39f7a" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/aws-integrations + Scenario: Generate a new external ID returns "AWS External ID object" response + Given operation "CreateNewAWSExternalID" enabled + And new "CreateNewAWSExternalID" request + When the request is sent + Then the response status is 200 AWS External ID object + + @team:DataDog/aws-integrations + Scenario: Generate new external ID returns "AWS External ID object" response + Given operation "CreateNewAWSExternalID" enabled + And new "CreateNewAWSExternalID" request + When the request is sent + Then the response status is 200 AWS External ID object + + @team:DataDog/aws-integrations + Scenario: Get an AWS integration by config ID returns "AWS Account object" response + Given operation "GetAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Get an AWS integration by config ID returns "Bad Request" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter with value "not-a-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Get an AWS integration by config ID returns "Not Found" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter with value "448169a8-251c-4344-abee-1c4edef39f7a" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/aws-integrations + Scenario: List all AWS integrations returns "AWS Accounts List object" response + Given operation "ListAWSAccounts" enabled + And new "ListAWSAccounts" request + When the request is sent + Then the response status is 200 AWS Accounts List object + + @team:DataDog/aws-integrations + Scenario: List available namespaces returns "AWS Namespaces List object" response + Given operation "ListAWSNamespaces" enabled + And new "ListAWSNamespaces" request + When the request is sent + Then the response status is 200 AWS Namespaces List object + + @team:DataDog/aws-integrations + Scenario: List namespaces returns "AWS Namespaces List object" response + Given operation "ListAWSNamespaces" enabled + And new "ListAWSNamespaces" request + When the request is sent + Then the response status is 200 AWS Namespaces List object + + @team:DataDog/aws-integrations + Scenario: Update an AWS integration returns "AWS Account object" response + Given operation "UpdateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Update an AWS integration returns "Bad Request" response + Given operation "UpdateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Update an AWS integration returns "Not Found" response + Given operation "UpdateAWSAccount" enabled + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter with value "448169a8-251c-4344-abee-1c4edef39f7a" + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/tests/scenarios/features/v2/aws_logs_integration.feature b/tests/scenarios/features/v2/aws_logs_integration.feature new file mode 100644 index 000000000..7dcfb894a --- /dev/null +++ b/tests/scenarios/features/v2/aws_logs_integration.feature @@ -0,0 +1,16 @@ +@endpoint(aws-logs-integration) @endpoint(aws-logs-integration-v2) +Feature: AWS Logs Integration + Configure your Datadog-AWS-Logs integration directly through Datadog API. + For more information, see the [AWS integration + page](https://docs.datadoghq.com/integrations/amazon_web_services/#log- + collection). + + @team:DataDog/aws-integrations + Scenario: Get list of AWS log ready services returns "AWS Logs Services List object" response + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AWSLogsIntegration" API + And operation "ListAWSLogsServices" enabled + And new "ListAWSLogsServices" request + When the request is sent + Then the response status is 200 AWS Logs Services List object diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 6271eb23f..41cd8e0f2 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -212,6 +212,18 @@ "tag": "Incidents", "operationId": "CreateIncidentTodo" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"account\",\n \"attributes\": {\n \"account_tags\": [\n \"key:value\"\n ],\n \"auth_config\": {\n \"role_name\": \"DatadogIntegrationRole\"\n },\n \"aws_account_id\": \"123456789012\",\n \"aws_partition\": \"aws\",\n \"aws_regions\": {\n \"include_only\": [\n \"us-east-1\"\n ]\n },\n \"logs_config\": {\n \"lambda_forwarder\": {\n \"lambdas\": [\n \"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"\n ],\n \"sources\": [\n \"s3\"\n ]\n }\n },\n \"metrics_config\": {\n \"enabled\": true,\n \"automute_enabled\": true,\n \"collect_custom_metrics\": false,\n \"collect_cloudwatch_alarms\": false,\n \"tag_filters\": [\n {\n \"namespace\": \"AWS/EC2\",\n \"tags\": [\n \"key:value\"\n ]\n }\n ],\n \"namespace_filters\": {\n \"include_only\": [\n \"AWS/EC2\"\n ]\n }\n },\n \"resources_config\": {\n \"cloud_security_posture_management_collection\": false,\n \"extended_collection\": false\n },\n \"traces_config\": {\n \"xray_services\": {\n \"include_only\": [\n \"AWS/AppSync\"\n ]\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"aws_account_v2\" in the system", + "key": "aws_account_v2", + "tag": "AWS Integration", + "operationId": "CreateAWSAccount" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 0e2a5942a..dcb4deb9a 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -788,6 +788,61 @@ "type": "idempotent" } }, + "ListAWSAccounts": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "CreateAWSAccount": { + "tag": "AWS Integration", + "undo": { + "operationId": "DeleteAWSAccount", + "parameters": [ + { + "name": "aws_account_config_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteAWSAccount": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "GetAWSAccount": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "UpdateAWSAccount": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "ListAWSNamespaces": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "CreateNewAWSExternalID": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "ListAWSLogsServices": { + "tag": "AWS Logs Integration", + "undo": { + "type": "safe" + } + }, "ListGCPSTSAccounts": { "tag": "GCP Integration", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index d03daa4f1..edc7df4bf 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -73,6 +73,9 @@ pub struct ApiInstances { pub v2_api_downtimes: Option, pub v2_api_events: Option, pub v2_api_incidents: Option, + pub v2_api_aws_integration: Option, + pub v2_api_aws_logs_integration: + Option, pub v2_api_gcp_integration: Option, pub v2_api_microsoft_teams_integration: Option, @@ -249,6 +252,12 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone(), ), ); + world.api_instances.v2_api_aws_integration = Some( + datadogV2::api_aws_integration::AWSIntegrationAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); } "AWSLogsIntegration" => { world.api_instances.v1_api_aws_logs_integration = Some( @@ -257,6 +266,12 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone(), ), ); + world.api_instances.v2_api_aws_logs_integration = Some( + datadogV2::api_aws_logs_integration::AWSLogsIntegrationAPI::with_client_and_config( + world.config.clone(), + world.http_client.as_ref().unwrap().clone(), + ), + ); } "AzureIntegration" => { world.api_instances.v1_api_azure_integration = Some( @@ -2083,6 +2098,32 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.UpdateIncidentTodo".into(), test_v2_update_incident_todo); + world + .function_mappings + .insert("v2.ListAWSAccounts".into(), test_v2_list_aws_accounts); + world + .function_mappings + .insert("v2.CreateAWSAccount".into(), test_v2_create_aws_account); + world + .function_mappings + .insert("v2.DeleteAWSAccount".into(), test_v2_delete_aws_account); + world + .function_mappings + .insert("v2.GetAWSAccount".into(), test_v2_get_aws_account); + world + .function_mappings + .insert("v2.UpdateAWSAccount".into(), test_v2_update_aws_account); + world + .function_mappings + .insert("v2.ListAWSNamespaces".into(), test_v2_list_aws_namespaces); + world.function_mappings.insert( + "v2.CreateNewAWSExternalID".into(), + test_v2_create_new_aws_external_id, + ); + world.function_mappings.insert( + "v2.ListAWSLogsServices".into(), + test_v2_list_aws_logs_services, + ); world .function_mappings .insert("v2.ListGCPSTSAccounts".into(), test_v2_list_gcpsts_accounts); @@ -15097,6 +15138,215 @@ fn test_v2_update_incident_todo(world: &mut DatadogWorld, _parameters: &HashMap< world.response.code = response.status.as_u16(); } +fn test_v2_list_aws_accounts(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let aws_account_id = _parameters + .get("aws_account_id") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_aws_integration::ListAWSAccountsOptionalParams::default(); + params.aws_account_id = aws_account_id; + let response = match block_on(api.list_aws_accounts_with_http_info(params)) { + 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(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_aws_account_with_http_info(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_delete_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_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(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_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(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_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 + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let response = match block_on(api.list_aws_namespaces_with_http_info()) { + 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_new_aws_external_id( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_aws_integration + .as_ref() + .expect("api instance not found"); + let response = match block_on(api.create_new_aws_external_id_with_http_info()) { + 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_logs_services(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_aws_logs_integration + .as_ref() + .expect("api instance not found"); + let response = match block_on(api.list_aws_logs_services_with_http_info()) { + 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_gcpsts_accounts(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances