From 231bda2eda04a6b2838c5b7b5eed2e84c891e552 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 16 Oct 2024 20:45:54 +0000 Subject: [PATCH] Regenerate client from commit 07f56b7b of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 566 ++++++++++++++++++ api/datadog/configuration.go | 5 + api/datadogV2/api_aws_integration.go | 438 ++++++++++++++ api/datadogV2/doc.go | 5 + .../model_aws_account_create_request.go | 111 ++++ ...l_aws_account_create_request_attributes.go | 410 +++++++++++++ .../model_aws_account_create_request_data.go | 149 +++++ api/datadogV2/model_aws_account_partition.go | 68 +++ .../model_aws_account_patch_request.go | 111 ++++ ...el_aws_account_patch_request_attributes.go | 418 +++++++++++++ .../model_aws_account_patch_request_data.go | 184 ++++++ api/datadogV2/model_aws_account_response.go | 111 ++++ .../model_aws_account_response_attributes.go | 489 +++++++++++++++ .../model_aws_account_response_data.go | 184 ++++++ api/datadogV2/model_aws_accounts_response.go | 102 ++++ api/datadogV2/model_aws_auth_config.go | 105 ++++ api/datadogV2/model_aws_auth_config_keys.go | 136 +++++ api/datadogV2/model_aws_auth_config_role.go | 136 +++++ .../model_aws_lambda_forwarder_config.go | 137 +++++ api/datadogV2/model_aws_logs_config.go | 111 ++++ api/datadogV2/model_aws_metrics_config.go | 277 +++++++++ api/datadogV2/model_aws_namespace_filters.go | 169 ++++++ ...model_aws_namespace_filters_exclude_all.go | 101 ++++ ...odel_aws_namespace_filters_exclude_only.go | 101 ++++ ...model_aws_namespace_filters_include_all.go | 101 ++++ ...odel_aws_namespace_filters_include_only.go | 101 ++++ .../model_aws_namespace_tag_filter.go | 148 +++++ api/datadogV2/model_aws_regions.go | 105 ++++ .../model_aws_regions_include_all.go | 101 ++++ .../model_aws_regions_include_only.go | 101 ++++ api/datadogV2/model_aws_resources_config.go | 137 +++++ api/datadogV2/model_aws_traces_config.go | 102 ++++ .../model_x_ray_services_include_all.go | 101 ++++ .../model_x_ray_services_include_only.go | 151 +++++ api/datadogV2/model_x_ray_services_list.go | 105 ++++ .../v2/aws-integration/CreateAWSAccount.go | 66 ++ .../v2/aws-integration/DeleteAWSAccount.go | 26 + examples/v2/aws-integration/GetAWSAccount.go | 30 + .../v2/aws-integration/ListAWSAccounts.go | 30 + .../v2/aws-integration/UpdateAWSAccount.go | 67 +++ tests/scenarios/api_mappings.go | 1 + ...returns_AWS_Account_object_response.freeze | 1 + ...g_returns_AWS_Account_object_response.yaml | 39 ++ ...config_returns_Bad_Request_response.freeze | 1 + ...t_config_returns_Bad_Request_response.yaml | 22 + ...tion_returns_400_API_error_response.freeze | 1 + ...tition_returns_400_API_error_response.yaml | 22 + ...returns_AWS_Account_object_response.freeze | 1 + ...g_returns_AWS_Account_object_response.yaml | 39 ++ ..._config_returns_No_Content_response.freeze | 1 + ...nt_config_returns_No_Content_response.yaml | 57 ++ ...returns_AWS_Account_object_response.freeze | 1 + ...g_returns_AWS_Account_object_response.yaml | 56 ++ ...s_AWS_Accounts_List_object_response.freeze | 1 + ...rns_AWS_Accounts_List_object_response.yaml | 56 ++ ...eturns_API_error_response._response.freeze | 1 + ..._returns_API_error_response._response.yaml | 59 ++ ...returns_AWS_Account_object_response.freeze | 1 + ...g_returns_AWS_Account_object_response.yaml | 59 ++ .../features/v1/aws_integration.feature | 52 +- .../features/v1/aws_logs_integration.feature | 26 +- .../features/v2/aws_integration.feature | 116 ++++ tests/scenarios/features/v2/given.json | 12 + tests/scenarios/features/v2/undo.json | 37 ++ 65 files changed, 6723 insertions(+), 43 deletions(-) create mode 100644 api/datadogV2/api_aws_integration.go create mode 100644 api/datadogV2/model_aws_account_create_request.go create mode 100644 api/datadogV2/model_aws_account_create_request_attributes.go create mode 100644 api/datadogV2/model_aws_account_create_request_data.go create mode 100644 api/datadogV2/model_aws_account_partition.go create mode 100644 api/datadogV2/model_aws_account_patch_request.go create mode 100644 api/datadogV2/model_aws_account_patch_request_attributes.go create mode 100644 api/datadogV2/model_aws_account_patch_request_data.go create mode 100644 api/datadogV2/model_aws_account_response.go create mode 100644 api/datadogV2/model_aws_account_response_attributes.go create mode 100644 api/datadogV2/model_aws_account_response_data.go create mode 100644 api/datadogV2/model_aws_accounts_response.go create mode 100644 api/datadogV2/model_aws_auth_config.go create mode 100644 api/datadogV2/model_aws_auth_config_keys.go create mode 100644 api/datadogV2/model_aws_auth_config_role.go create mode 100644 api/datadogV2/model_aws_lambda_forwarder_config.go create mode 100644 api/datadogV2/model_aws_logs_config.go create mode 100644 api/datadogV2/model_aws_metrics_config.go create mode 100644 api/datadogV2/model_aws_namespace_filters.go create mode 100644 api/datadogV2/model_aws_namespace_filters_exclude_all.go create mode 100644 api/datadogV2/model_aws_namespace_filters_exclude_only.go create mode 100644 api/datadogV2/model_aws_namespace_filters_include_all.go create mode 100644 api/datadogV2/model_aws_namespace_filters_include_only.go create mode 100644 api/datadogV2/model_aws_namespace_tag_filter.go create mode 100644 api/datadogV2/model_aws_regions.go create mode 100644 api/datadogV2/model_aws_regions_include_all.go create mode 100644 api/datadogV2/model_aws_regions_include_only.go create mode 100644 api/datadogV2/model_aws_resources_config.go create mode 100644 api/datadogV2/model_aws_traces_config.go create mode 100644 api/datadogV2/model_x_ray_services_include_all.go create mode 100644 api/datadogV2/model_x_ray_services_include_only.go create mode 100644 api/datadogV2/model_x_ray_services_list.go create mode 100644 examples/v2/aws-integration/CreateAWSAccount.go create mode 100644 examples/v2/aws-integration/DeleteAWSAccount.go create mode 100644 examples/v2/aws-integration/GetAWSAccount.go create mode 100644 examples/v2/aws-integration/ListAWSAccounts.go create mode 100644 examples/v2/aws-integration/UpdateAWSAccount.go create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.freeze create mode 100644 tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.yaml create mode 100644 tests/scenarios/features/v2/aws_integration.feature diff --git a/.apigentools-info b/.apigentools-info index 59823ef0932..575d6df6053 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-10 19:46:01.049645", - "spec_repo_commit": "049920eb" + "regenerated": "2024-10-16 20:44:13.790031", + "spec_repo_commit": "07f56b7b" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-10 19:46:01.068188", - "spec_repo_commit": "049920eb" + "regenerated": "2024-10-16 20:44:13.808118", + "spec_repo_commit": "07f56b7b" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c592c7ff286..7e513a7e32d 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. @@ -955,6 +962,356 @@ components: type: string x-enum-varnames: - API_KEYS + AWSAccountCreateRequest: + description: AWS Account Create Request body + properties: + data: + $ref: '#/components/schemas/AWSAccountCreateRequestData' + 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: 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 + AWSAccountPatchRequest: + description: AWS Account Patch Request body + properties: + data: + $ref: '#/components/schemas/AWSAccountPatchRequestData' + type: object + AWSAccountPatchRequestAttributes: + 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 + AWSAccountPatchRequestData: + description: AWS Account Patch Request data + properties: + attributes: + $ref: '#/components/schemas/AWSAccountPatchRequestAttributes' + id: + $ref: '#/components/schemas/AWSAccountID' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - attributes + type: object + AWSAccountResponse: + description: AWS Account response body + properties: + data: + $ref: '#/components/schemas/AWSAccountResponseData' + 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 + - aws_partition + - auth_config + type: object + AWSAccountResponseData: + description: AWS Account Response body + properties: + attributes: + $ref: '#/components/schemas/AWSAccountResponseAttributes' + id: + description: Identifier for the response type + example: get_account + type: string + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - attributes + type: object + AWSAccountTags: + description: Tags to apply to all metrics in the account + items: + type: string + nullable: true + type: array + AWSAccountType: + default: account + description: Request or response type + example: account + type: string + AWSAccountsResponse: + description: AWS Accounts response body + properties: + data: + description: List of AWS Account Integration Configs + items: + $ref: '#/components/schemas/AWSAccountResponseData' + type: array + 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: + 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 + AWSMetricsConfig: + description: AWS Metrics config + properties: + automute_enabled: + description: Enable EC2 automute for AWS metrics + type: boolean + collect_cloudwatch_alarms: + description: Enable CloudWatch alarms collection + type: boolean + collect_custom_metrics: + description: Enable custom metrics collection + type: boolean + enabled: + description: Enable AWS metrics collection + 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: + type: string + nullable: true + type: array + type: object + 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 AWSRelatedAccount: description: AWS related account. properties: @@ -998,6 +1355,26 @@ components: $ref: '#/components/schemas/AWSRelatedAccount' type: array type: object + 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: @@ -25615,6 +25992,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. @@ -30427,6 +30832,162 @@ 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: + - 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: AWS Integration - Get all account configs + tags: + - AWS Integration + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: AWS Integration - Create account config + tags: + - AWS Integration + x-codegen-request-body-name: body + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: AWS Integration - Delete account config + tags: + - AWS Integration + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: AWS Integration - Get account config + tags: + - AWS Integration + 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/AWSAccountPatchRequest' + 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' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: AWS Integration - Patch account config + tags: + - AWS Integration + x-codegen-request-body-name: body + 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 @@ -41311,6 +41872,11 @@ 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: 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/api/datadog/configuration.go b/api/datadog/configuration.go index bf2c11cd763..d35f7e4eb87 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -350,6 +350,11 @@ func NewConfiguration() *Configuration { "v2.UpdateIncidentAttachments": false, "v2.UpdateIncidentIntegration": false, "v2.UpdateIncidentTodo": false, + "v2.CreateAWSAccount": false, + "v2.DeleteAWSAccount": false, + "v2.GetAWSAccount": false, + "v2.ListAWSAccounts": false, + "v2.UpdateAWSAccount": false, "v2.QueryScalarData": false, "v2.QueryTimeseriesData": false, "v2.GetFinding": false, diff --git a/api/datadogV2/api_aws_integration.go b/api/datadogV2/api_aws_integration.go new file mode 100644 index 00000000000..e755a8a37c1 --- /dev/null +++ b/api/datadogV2/api_aws_integration.go @@ -0,0 +1,438 @@ +// 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. + +package datadogV2 + +import ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSIntegrationApi service type +type AWSIntegrationApi datadog.Service + +// CreateAWSAccount AWS Integration - Create account config. +// Create a new AWS Account Integration Config. +func (a *AWSIntegrationApi) CreateAWSAccount(ctx _context.Context, body AWSAccountCreateRequest) (AWSAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AWSAccountResponse + ) + + operationId := "v2.CreateAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.CreateAWSAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// DeleteAWSAccount AWS Integration - Delete account config. +// Delete an AWS Account Integration Config +func (a *AWSIntegrationApi) DeleteAWSAccount(ctx _context.Context, awsAccountConfigId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.DeleteAWSAccount") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetAWSAccount AWS Integration - Get account config. +// Get an AWS Account Integration Config +func (a *AWSIntegrationApi) GetAWSAccount(ctx _context.Context, awsAccountConfigId string) (AWSAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSAccountResponse + ) + + operationId := "v2.GetAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.GetAWSAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListAWSAccountsOptionalParameters holds optional parameters for ListAWSAccounts. +type ListAWSAccountsOptionalParameters struct { + AwsAccountId *string +} + +// NewListAWSAccountsOptionalParameters creates an empty struct for parameters. +func NewListAWSAccountsOptionalParameters() *ListAWSAccountsOptionalParameters { + this := ListAWSAccountsOptionalParameters{} + return &this +} + +// WithAwsAccountId sets the corresponding parameter name and returns the struct. +func (r *ListAWSAccountsOptionalParameters) WithAwsAccountId(awsAccountId string) *ListAWSAccountsOptionalParameters { + r.AwsAccountId = &awsAccountId + return r +} + +// ListAWSAccounts AWS Integration - Get all account configs. +// Get a list of AWS Account Integration Configs. +func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context, o ...ListAWSAccountsOptionalParameters) (AWSAccountsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSAccountsResponse + optionalParams ListAWSAccountsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListAWSAccountsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListAWSAccounts" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.ListAWSAccounts") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.AwsAccountId != nil { + localVarQueryParams.Add("aws_account_id", datadog.ParameterToString(*optionalParams.AwsAccountId, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// UpdateAWSAccount AWS Integration - Patch account config. +// Update an AWS Account Integration Config +func (a *AWSIntegrationApi) UpdateAWSAccount(ctx _context.Context, awsAccountConfigId string, body AWSAccountPatchRequest) (AWSAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue AWSAccountResponse + ) + + operationId := "v2.UpdateAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.UpdateAWSAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAWSIntegrationApi Returns NewAWSIntegrationApi. +func NewAWSIntegrationApi(client *datadog.APIClient) *AWSIntegrationApi { + return &AWSIntegrationApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 8a27584b8b8..ad2fa70d217 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -14,6 +14,11 @@ // - [APMRetentionFiltersApi.ListApmRetentionFilters] // - [APMRetentionFiltersApi.ReorderApmRetentionFilters] // - [APMRetentionFiltersApi.UpdateApmRetentionFilter] +// - [AWSIntegrationApi.CreateAWSAccount] +// - [AWSIntegrationApi.DeleteAWSAccount] +// - [AWSIntegrationApi.GetAWSAccount] +// - [AWSIntegrationApi.ListAWSAccounts] +// - [AWSIntegrationApi.UpdateAWSAccount] // - [AuditApi.ListAuditLogs] // - [AuditApi.SearchAuditLogs] // - [AuthNMappingsApi.CreateAuthNMapping] diff --git a/api/datadogV2/model_aws_account_create_request.go b/api/datadogV2/model_aws_account_create_request.go new file mode 100644 index 00000000000..cf0bfd17956 --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request.go @@ -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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountCreateRequest AWS Account Create Request body +type AWSAccountCreateRequest struct { + // AWS Account Create Request data + Data *AWSAccountCreateRequestData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountCreateRequest instantiates a new AWSAccountCreateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountCreateRequest() *AWSAccountCreateRequest { + this := AWSAccountCreateRequest{} + return &this +} + +// NewAWSAccountCreateRequestWithDefaults instantiates a new AWSAccountCreateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountCreateRequestWithDefaults() *AWSAccountCreateRequest { + this := AWSAccountCreateRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AWSAccountCreateRequest) GetData() AWSAccountCreateRequestData { + if o == nil || o.Data == nil { + var ret AWSAccountCreateRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequest) GetDataOk() (*AWSAccountCreateRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AWSAccountCreateRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given AWSAccountCreateRequestData and assigns it to the Data field. +func (o *AWSAccountCreateRequest) SetData(v AWSAccountCreateRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSAccountCreateRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_create_request_attributes.go b/api/datadogV2/model_aws_account_create_request_attributes.go new file mode 100644 index 00000000000..8a31606de0a --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request_attributes.go @@ -0,0 +1,410 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountCreateRequestAttributes The AWS Account Integration Config to be created +type AWSAccountCreateRequestAttributes struct { + // Tags to apply to all metrics in the account + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + // AWS Authentication config + AuthConfig AWSAuthConfig `json:"auth_config"` + // AWS Account ID + AwsAccountId string `json:"aws_account_id"` + // AWS Account partition + AwsPartition AWSAccountPartition `json:"aws_partition"` + // AWS Regions to collect data from + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + // AWS Logs config + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + // AWS Metrics config + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + // AWS Resources config + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + // AWS Traces config + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountCreateRequestAttributes instantiates a new AWSAccountCreateRequestAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountCreateRequestAttributes(authConfig AWSAuthConfig, awsAccountId string, awsPartition AWSAccountPartition) *AWSAccountCreateRequestAttributes { + this := AWSAccountCreateRequestAttributes{} + this.AuthConfig = authConfig + this.AwsAccountId = awsAccountId + this.AwsPartition = awsPartition + return &this +} + +// NewAWSAccountCreateRequestAttributesWithDefaults instantiates a new AWSAccountCreateRequestAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountCreateRequestAttributesWithDefaults() *AWSAccountCreateRequestAttributes { + this := AWSAccountCreateRequestAttributes{} + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = awsPartition + return &this +} + +// GetAccountTags returns the AccountTags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AWSAccountCreateRequestAttributes) GetAccountTags() []string { + if o == nil || o.AccountTags.Get() == nil { + var ret []string + return ret + } + return *o.AccountTags.Get() +} + +// GetAccountTagsOk returns a tuple with the AccountTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AWSAccountCreateRequestAttributes) GetAccountTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.AccountTags.Get(), o.AccountTags.IsSet() +} + +// HasAccountTags returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasAccountTags() bool { + return o != nil && o.AccountTags.IsSet() +} + +// SetAccountTags gets a reference to the given datadog.NullableList[string] and assigns it to the AccountTags field. +func (o *AWSAccountCreateRequestAttributes) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountCreateRequestAttributes) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountCreateRequestAttributes) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value. +func (o *AWSAccountCreateRequestAttributes) GetAuthConfig() AWSAuthConfig { + if o == nil { + var ret AWSAuthConfig + return ret + } + return o.AuthConfig +} + +// GetAuthConfigOk returns a tuple with the AuthConfig field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAuthConfigOk() (*AWSAuthConfig, bool) { + if o == nil { + return nil, false + } + return &o.AuthConfig, true +} + +// SetAuthConfig sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountCreateRequestAttributes) GetAwsAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AwsAccountId +} + +// GetAwsAccountIdOk returns a tuple with the AwsAccountId field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value. +func (o *AWSAccountCreateRequestAttributes) GetAwsPartition() AWSAccountPartition { + if o == nil { + var ret AWSAccountPartition + return ret + } + return o.AwsPartition +} + +// GetAwsPartitionOk returns a tuple with the AwsPartition field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsPartitionOk() (*AWSAccountPartition, bool) { + if o == nil { + return nil, false + } + return &o.AwsPartition, true +} + +// SetAwsPartition sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetAwsRegions() AWSRegions { + if o == nil || o.AwsRegions == nil { + var ret AWSRegions + return ret + } + return *o.AwsRegions +} + +// GetAwsRegionsOk returns a tuple with the AwsRegions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsRegionsOk() (*AWSRegions, bool) { + if o == nil || o.AwsRegions == nil { + return nil, false + } + return o.AwsRegions, true +} + +// HasAwsRegions returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasAwsRegions() bool { + return o != nil && o.AwsRegions != nil +} + +// SetAwsRegions gets a reference to the given AWSRegions and assigns it to the AwsRegions field. +func (o *AWSAccountCreateRequestAttributes) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetLogsConfig() AWSLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret AWSLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetLogsConfigOk() (*AWSLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given AWSLogsConfig and assigns it to the LogsConfig field. +func (o *AWSAccountCreateRequestAttributes) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetMetricsConfig() AWSMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret AWSMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetMetricsConfigOk() (*AWSMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given AWSMetricsConfig and assigns it to the MetricsConfig field. +func (o *AWSAccountCreateRequestAttributes) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetResourcesConfig() AWSResourcesConfig { + if o == nil || o.ResourcesConfig == nil { + var ret AWSResourcesConfig + return ret + } + return *o.ResourcesConfig +} + +// GetResourcesConfigOk returns a tuple with the ResourcesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetResourcesConfigOk() (*AWSResourcesConfig, bool) { + if o == nil || o.ResourcesConfig == nil { + return nil, false + } + return o.ResourcesConfig, true +} + +// HasResourcesConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasResourcesConfig() bool { + return o != nil && o.ResourcesConfig != nil +} + +// SetResourcesConfig gets a reference to the given AWSResourcesConfig and assigns it to the ResourcesConfig field. +func (o *AWSAccountCreateRequestAttributes) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetTracesConfig() AWSTracesConfig { + if o == nil || o.TracesConfig == nil { + var ret AWSTracesConfig + return ret + } + return *o.TracesConfig +} + +// GetTracesConfigOk returns a tuple with the TracesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetTracesConfigOk() (*AWSTracesConfig, bool) { + if o == nil || o.TracesConfig == nil { + return nil, false + } + return o.TracesConfig, true +} + +// HasTracesConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasTracesConfig() bool { + return o != nil && o.TracesConfig != nil +} + +// SetTracesConfig gets a reference to the given AWSTracesConfig and assigns it to the TracesConfig field. +func (o *AWSAccountCreateRequestAttributes) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountTags.IsSet() { + toSerialize["account_tags"] = o.AccountTags.Get() + } + toSerialize["auth_config"] = o.AuthConfig + toSerialize["aws_account_id"] = o.AwsAccountId + toSerialize["aws_partition"] = o.AwsPartition + if o.AwsRegions != nil { + toSerialize["aws_regions"] = o.AwsRegions + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.ResourcesConfig != nil { + toSerialize["resources_config"] = o.ResourcesConfig + } + if o.TracesConfig != nil { + toSerialize["traces_config"] = o.TracesConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + AuthConfig *AWSAuthConfig `json:"auth_config"` + AwsAccountId *string `json:"aws_account_id"` + AwsPartition *AWSAccountPartition `json:"aws_partition"` + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AuthConfig == nil { + return fmt.Errorf("required field auth_config missing") + } + if all.AwsAccountId == nil { + return fmt.Errorf("required field aws_account_id missing") + } + if all.AwsPartition == nil { + return fmt.Errorf("required field aws_partition missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_tags", "auth_config", "aws_account_id", "aws_partition", "aws_regions", "logs_config", "metrics_config", "resources_config", "traces_config"}) + } else { + return err + } + + hasInvalidField := false + o.AccountTags = all.AccountTags + o.AuthConfig = *all.AuthConfig + o.AwsAccountId = *all.AwsAccountId + if !all.AwsPartition.IsValid() { + hasInvalidField = true + } else { + o.AwsPartition = *all.AwsPartition + } + o.AwsRegions = all.AwsRegions + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + if all.ResourcesConfig != nil && all.ResourcesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ResourcesConfig = all.ResourcesConfig + if all.TracesConfig != nil && all.TracesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TracesConfig = all.TracesConfig + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_create_request_data.go b/api/datadogV2/model_aws_account_create_request_data.go new file mode 100644 index 00000000000..7e6eef8186b --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request_data.go @@ -0,0 +1,149 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountCreateRequestData AWS Account Create Request data +type AWSAccountCreateRequestData struct { + // The AWS Account Integration Config to be created + Attributes AWSAccountCreateRequestAttributes `json:"attributes"` + // Request or response type + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountCreateRequestData instantiates a new AWSAccountCreateRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountCreateRequestData(attributes AWSAccountCreateRequestAttributes) *AWSAccountCreateRequestData { + this := AWSAccountCreateRequestData{} + this.Attributes = attributes + var typeVar string = "account" + this.Type = &typeVar + return &this +} + +// NewAWSAccountCreateRequestDataWithDefaults instantiates a new AWSAccountCreateRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountCreateRequestDataWithDefaults() *AWSAccountCreateRequestData { + this := AWSAccountCreateRequestData{} + var typeVar string = "account" + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSAccountCreateRequestData) GetAttributes() AWSAccountCreateRequestAttributes { + if o == nil { + var ret AWSAccountCreateRequestAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestData) GetAttributesOk() (*AWSAccountCreateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSAccountCreateRequestData) SetAttributes(v AWSAccountCreateRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *AWSAccountCreateRequestData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountCreateRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountCreateRequestAttributes `json:"attributes"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_partition.go b/api/datadogV2/model_aws_account_partition.go new file mode 100644 index 00000000000..3bcc7beb3fc --- /dev/null +++ b/api/datadogV2/model_aws_account_partition.go @@ -0,0 +1,68 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountPartition AWS Account partition +type AWSAccountPartition string + +// List of AWSAccountPartition. +const ( + AWSACCOUNTPARTITION_AWS AWSAccountPartition = "aws" + AWSACCOUNTPARTITION_AWS_CN AWSAccountPartition = "aws-cn" + AWSACCOUNTPARTITION_AWS_US_GOV AWSAccountPartition = "aws-us-gov" +) + +var allowedAWSAccountPartitionEnumValues = []AWSAccountPartition{ + AWSACCOUNTPARTITION_AWS, + AWSACCOUNTPARTITION_AWS_CN, + AWSACCOUNTPARTITION_AWS_US_GOV, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSAccountPartition) GetAllowedValues() []AWSAccountPartition { + return allowedAWSAccountPartitionEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSAccountPartition) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSAccountPartition(value) + return nil +} + +// NewAWSAccountPartitionFromValue returns a pointer to a valid AWSAccountPartition +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSAccountPartitionFromValue(v string) (*AWSAccountPartition, error) { + ev := AWSAccountPartition(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSAccountPartition: valid values are %v", v, allowedAWSAccountPartitionEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSAccountPartition) IsValid() bool { + for _, existing := range allowedAWSAccountPartitionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSAccountPartition value. +func (v AWSAccountPartition) Ptr() *AWSAccountPartition { + return &v +} diff --git a/api/datadogV2/model_aws_account_patch_request.go b/api/datadogV2/model_aws_account_patch_request.go new file mode 100644 index 00000000000..1fd57b5e06c --- /dev/null +++ b/api/datadogV2/model_aws_account_patch_request.go @@ -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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountPatchRequest AWS Account Patch Request body +type AWSAccountPatchRequest struct { + // AWS Account Patch Request data + Data *AWSAccountPatchRequestData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountPatchRequest instantiates a new AWSAccountPatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountPatchRequest() *AWSAccountPatchRequest { + this := AWSAccountPatchRequest{} + return &this +} + +// NewAWSAccountPatchRequestWithDefaults instantiates a new AWSAccountPatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountPatchRequestWithDefaults() *AWSAccountPatchRequest { + this := AWSAccountPatchRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AWSAccountPatchRequest) GetData() AWSAccountPatchRequestData { + if o == nil || o.Data == nil { + var ret AWSAccountPatchRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequest) GetDataOk() (*AWSAccountPatchRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AWSAccountPatchRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given AWSAccountPatchRequestData and assigns it to the Data field. +func (o *AWSAccountPatchRequest) SetData(v AWSAccountPatchRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountPatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountPatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSAccountPatchRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_patch_request_attributes.go b/api/datadogV2/model_aws_account_patch_request_attributes.go new file mode 100644 index 00000000000..ad40690b0f2 --- /dev/null +++ b/api/datadogV2/model_aws_account_patch_request_attributes.go @@ -0,0 +1,418 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountPatchRequestAttributes The AWS Account Integration Config to be updated +type AWSAccountPatchRequestAttributes struct { + // Tags to apply to all metrics in the account + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + // AWS Authentication config + AuthConfig *AWSAuthConfig `json:"auth_config,omitempty"` + // AWS Account ID + AwsAccountId string `json:"aws_account_id"` + // AWS Account partition + AwsPartition *AWSAccountPartition `json:"aws_partition,omitempty"` + // AWS Regions to collect data from + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + // AWS Logs config + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + // AWS Metrics config + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + // AWS Resources config + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + // AWS Traces config + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountPatchRequestAttributes instantiates a new AWSAccountPatchRequestAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountPatchRequestAttributes(awsAccountId string) *AWSAccountPatchRequestAttributes { + this := AWSAccountPatchRequestAttributes{} + this.AwsAccountId = awsAccountId + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = &awsPartition + return &this +} + +// NewAWSAccountPatchRequestAttributesWithDefaults instantiates a new AWSAccountPatchRequestAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountPatchRequestAttributesWithDefaults() *AWSAccountPatchRequestAttributes { + this := AWSAccountPatchRequestAttributes{} + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = &awsPartition + return &this +} + +// GetAccountTags returns the AccountTags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AWSAccountPatchRequestAttributes) GetAccountTags() []string { + if o == nil || o.AccountTags.Get() == nil { + var ret []string + return ret + } + return *o.AccountTags.Get() +} + +// GetAccountTagsOk returns a tuple with the AccountTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AWSAccountPatchRequestAttributes) GetAccountTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.AccountTags.Get(), o.AccountTags.IsSet() +} + +// HasAccountTags returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasAccountTags() bool { + return o != nil && o.AccountTags.IsSet() +} + +// SetAccountTags gets a reference to the given datadog.NullableList[string] and assigns it to the AccountTags field. +func (o *AWSAccountPatchRequestAttributes) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountPatchRequestAttributes) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountPatchRequestAttributes) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetAuthConfig() AWSAuthConfig { + if o == nil || o.AuthConfig == nil { + var ret AWSAuthConfig + return ret + } + return *o.AuthConfig +} + +// GetAuthConfigOk returns a tuple with the AuthConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetAuthConfigOk() (*AWSAuthConfig, bool) { + if o == nil || o.AuthConfig == nil { + return nil, false + } + return o.AuthConfig, true +} + +// HasAuthConfig returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasAuthConfig() bool { + return o != nil && o.AuthConfig != nil +} + +// SetAuthConfig gets a reference to the given AWSAuthConfig and assigns it to the AuthConfig field. +func (o *AWSAccountPatchRequestAttributes) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = &v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountPatchRequestAttributes) GetAwsAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AwsAccountId +} + +// GetAwsAccountIdOk returns a tuple with the AwsAccountId field value +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountPatchRequestAttributes) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetAwsPartition() AWSAccountPartition { + if o == nil || o.AwsPartition == nil { + var ret AWSAccountPartition + return ret + } + return *o.AwsPartition +} + +// GetAwsPartitionOk returns a tuple with the AwsPartition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetAwsPartitionOk() (*AWSAccountPartition, bool) { + if o == nil || o.AwsPartition == nil { + return nil, false + } + return o.AwsPartition, true +} + +// HasAwsPartition returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasAwsPartition() bool { + return o != nil && o.AwsPartition != nil +} + +// SetAwsPartition gets a reference to the given AWSAccountPartition and assigns it to the AwsPartition field. +func (o *AWSAccountPatchRequestAttributes) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = &v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetAwsRegions() AWSRegions { + if o == nil || o.AwsRegions == nil { + var ret AWSRegions + return ret + } + return *o.AwsRegions +} + +// GetAwsRegionsOk returns a tuple with the AwsRegions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetAwsRegionsOk() (*AWSRegions, bool) { + if o == nil || o.AwsRegions == nil { + return nil, false + } + return o.AwsRegions, true +} + +// HasAwsRegions returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasAwsRegions() bool { + return o != nil && o.AwsRegions != nil +} + +// SetAwsRegions gets a reference to the given AWSRegions and assigns it to the AwsRegions field. +func (o *AWSAccountPatchRequestAttributes) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetLogsConfig() AWSLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret AWSLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetLogsConfigOk() (*AWSLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given AWSLogsConfig and assigns it to the LogsConfig field. +func (o *AWSAccountPatchRequestAttributes) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetMetricsConfig() AWSMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret AWSMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetMetricsConfigOk() (*AWSMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given AWSMetricsConfig and assigns it to the MetricsConfig field. +func (o *AWSAccountPatchRequestAttributes) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetResourcesConfig() AWSResourcesConfig { + if o == nil || o.ResourcesConfig == nil { + var ret AWSResourcesConfig + return ret + } + return *o.ResourcesConfig +} + +// GetResourcesConfigOk returns a tuple with the ResourcesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetResourcesConfigOk() (*AWSResourcesConfig, bool) { + if o == nil || o.ResourcesConfig == nil { + return nil, false + } + return o.ResourcesConfig, true +} + +// HasResourcesConfig returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasResourcesConfig() bool { + return o != nil && o.ResourcesConfig != nil +} + +// SetResourcesConfig gets a reference to the given AWSResourcesConfig and assigns it to the ResourcesConfig field. +func (o *AWSAccountPatchRequestAttributes) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestAttributes) GetTracesConfig() AWSTracesConfig { + if o == nil || o.TracesConfig == nil { + var ret AWSTracesConfig + return ret + } + return *o.TracesConfig +} + +// GetTracesConfigOk returns a tuple with the TracesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetTracesConfigOk() (*AWSTracesConfig, bool) { + if o == nil || o.TracesConfig == nil { + return nil, false + } + return o.TracesConfig, true +} + +// HasTracesConfig returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestAttributes) HasTracesConfig() bool { + return o != nil && o.TracesConfig != nil +} + +// SetTracesConfig gets a reference to the given AWSTracesConfig and assigns it to the TracesConfig field. +func (o *AWSAccountPatchRequestAttributes) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountPatchRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountTags.IsSet() { + toSerialize["account_tags"] = o.AccountTags.Get() + } + if o.AuthConfig != nil { + toSerialize["auth_config"] = o.AuthConfig + } + toSerialize["aws_account_id"] = o.AwsAccountId + if o.AwsPartition != nil { + toSerialize["aws_partition"] = o.AwsPartition + } + if o.AwsRegions != nil { + toSerialize["aws_regions"] = o.AwsRegions + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.ResourcesConfig != nil { + toSerialize["resources_config"] = o.ResourcesConfig + } + if o.TracesConfig != nil { + toSerialize["traces_config"] = o.TracesConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountPatchRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + AuthConfig *AWSAuthConfig `json:"auth_config,omitempty"` + AwsAccountId *string `json:"aws_account_id"` + AwsPartition *AWSAccountPartition `json:"aws_partition,omitempty"` + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AwsAccountId == nil { + return fmt.Errorf("required field aws_account_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_tags", "auth_config", "aws_account_id", "aws_partition", "aws_regions", "logs_config", "metrics_config", "resources_config", "traces_config"}) + } else { + return err + } + + hasInvalidField := false + o.AccountTags = all.AccountTags + o.AuthConfig = all.AuthConfig + o.AwsAccountId = *all.AwsAccountId + if all.AwsPartition != nil && !all.AwsPartition.IsValid() { + hasInvalidField = true + } else { + o.AwsPartition = all.AwsPartition + } + o.AwsRegions = all.AwsRegions + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + if all.ResourcesConfig != nil && all.ResourcesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ResourcesConfig = all.ResourcesConfig + if all.TracesConfig != nil && all.TracesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TracesConfig = all.TracesConfig + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_patch_request_data.go b/api/datadogV2/model_aws_account_patch_request_data.go new file mode 100644 index 00000000000..987184da262 --- /dev/null +++ b/api/datadogV2/model_aws_account_patch_request_data.go @@ -0,0 +1,184 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountPatchRequestData AWS Account Patch Request data +type AWSAccountPatchRequestData struct { + // The AWS Account Integration Config to be updated + Attributes AWSAccountPatchRequestAttributes `json:"attributes"` + // AWS Account ID + Id *string `json:"id,omitempty"` + // Request or response type + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountPatchRequestData instantiates a new AWSAccountPatchRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountPatchRequestData(attributes AWSAccountPatchRequestAttributes) *AWSAccountPatchRequestData { + this := AWSAccountPatchRequestData{} + this.Attributes = attributes + var typeVar string = "account" + this.Type = &typeVar + return &this +} + +// NewAWSAccountPatchRequestDataWithDefaults instantiates a new AWSAccountPatchRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountPatchRequestDataWithDefaults() *AWSAccountPatchRequestData { + this := AWSAccountPatchRequestData{} + var typeVar string = "account" + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSAccountPatchRequestData) GetAttributes() AWSAccountPatchRequestAttributes { + if o == nil { + var ret AWSAccountPatchRequestAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestData) GetAttributesOk() (*AWSAccountPatchRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSAccountPatchRequestData) SetAttributes(v AWSAccountPatchRequestAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AWSAccountPatchRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AWSAccountPatchRequestData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *AWSAccountPatchRequestData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountPatchRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountPatchRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountPatchRequestAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_response.go b/api/datadogV2/model_aws_account_response.go new file mode 100644 index 00000000000..c04203b53fb --- /dev/null +++ b/api/datadogV2/model_aws_account_response.go @@ -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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountResponse AWS Account response body +type AWSAccountResponse struct { + // AWS Account Response body + Data *AWSAccountResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountResponse instantiates a new AWSAccountResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountResponse() *AWSAccountResponse { + this := AWSAccountResponse{} + return &this +} + +// NewAWSAccountResponseWithDefaults instantiates a new AWSAccountResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountResponseWithDefaults() *AWSAccountResponse { + this := AWSAccountResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AWSAccountResponse) GetData() AWSAccountResponseData { + if o == nil || o.Data == nil { + var ret AWSAccountResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponse) GetDataOk() (*AWSAccountResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AWSAccountResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given AWSAccountResponseData and assigns it to the Data field. +func (o *AWSAccountResponse) SetData(v AWSAccountResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSAccountResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_response_attributes.go b/api/datadogV2/model_aws_account_response_attributes.go new file mode 100644 index 00000000000..7c2ee9f683d --- /dev/null +++ b/api/datadogV2/model_aws_account_response_attributes.go @@ -0,0 +1,489 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountResponseAttributes The AWS Account Integration Config +type AWSAccountResponseAttributes struct { + // Tags to apply to all metrics in the account + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + // AWS Authentication config + AuthConfig AWSAuthConfig `json:"auth_config"` + // AWS Account ID + AwsAccountId string `json:"aws_account_id"` + // AWS Account partition + AwsPartition AWSAccountPartition `json:"aws_partition"` + // AWS Regions to collect data from + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + // Timestamp of when the account integration was created + CreatedAt *time.Time `json:"created_at,omitempty"` + // AWS Logs config + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + // AWS Metrics config + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + // Timestamp of when the account integration was updated + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // AWS Resources config + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + // AWS Traces config + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountResponseAttributes instantiates a new AWSAccountResponseAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountResponseAttributes(authConfig AWSAuthConfig, awsAccountId string, awsPartition AWSAccountPartition) *AWSAccountResponseAttributes { + this := AWSAccountResponseAttributes{} + this.AuthConfig = authConfig + this.AwsAccountId = awsAccountId + this.AwsPartition = awsPartition + return &this +} + +// NewAWSAccountResponseAttributesWithDefaults instantiates a new AWSAccountResponseAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountResponseAttributesWithDefaults() *AWSAccountResponseAttributes { + this := AWSAccountResponseAttributes{} + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = awsPartition + return &this +} + +// GetAccountTags returns the AccountTags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AWSAccountResponseAttributes) GetAccountTags() []string { + if o == nil || o.AccountTags.Get() == nil { + var ret []string + return ret + } + return *o.AccountTags.Get() +} + +// GetAccountTagsOk returns a tuple with the AccountTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AWSAccountResponseAttributes) GetAccountTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.AccountTags.Get(), o.AccountTags.IsSet() +} + +// HasAccountTags returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasAccountTags() bool { + return o != nil && o.AccountTags.IsSet() +} + +// SetAccountTags gets a reference to the given datadog.NullableList[string] and assigns it to the AccountTags field. +func (o *AWSAccountResponseAttributes) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountResponseAttributes) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountResponseAttributes) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value. +func (o *AWSAccountResponseAttributes) GetAuthConfig() AWSAuthConfig { + if o == nil { + var ret AWSAuthConfig + return ret + } + return o.AuthConfig +} + +// GetAuthConfigOk returns a tuple with the AuthConfig field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAuthConfigOk() (*AWSAuthConfig, bool) { + if o == nil { + return nil, false + } + return &o.AuthConfig, true +} + +// SetAuthConfig sets field value. +func (o *AWSAccountResponseAttributes) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountResponseAttributes) GetAwsAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AwsAccountId +} + +// GetAwsAccountIdOk returns a tuple with the AwsAccountId field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountResponseAttributes) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value. +func (o *AWSAccountResponseAttributes) GetAwsPartition() AWSAccountPartition { + if o == nil { + var ret AWSAccountPartition + return ret + } + return o.AwsPartition +} + +// GetAwsPartitionOk returns a tuple with the AwsPartition field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAwsPartitionOk() (*AWSAccountPartition, bool) { + if o == nil { + return nil, false + } + return &o.AwsPartition, true +} + +// SetAwsPartition sets field value. +func (o *AWSAccountResponseAttributes) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetAwsRegions() AWSRegions { + if o == nil || o.AwsRegions == nil { + var ret AWSRegions + return ret + } + return *o.AwsRegions +} + +// GetAwsRegionsOk returns a tuple with the AwsRegions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAwsRegionsOk() (*AWSRegions, bool) { + if o == nil || o.AwsRegions == nil { + return nil, false + } + return o.AwsRegions, true +} + +// HasAwsRegions returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasAwsRegions() bool { + return o != nil && o.AwsRegions != nil +} + +// SetAwsRegions gets a reference to the given AWSRegions and assigns it to the AwsRegions field. +func (o *AWSAccountResponseAttributes) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AWSAccountResponseAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetLogsConfig() AWSLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret AWSLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetLogsConfigOk() (*AWSLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given AWSLogsConfig and assigns it to the LogsConfig field. +func (o *AWSAccountResponseAttributes) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetMetricsConfig() AWSMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret AWSMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetMetricsConfigOk() (*AWSMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given AWSMetricsConfig and assigns it to the MetricsConfig field. +func (o *AWSAccountResponseAttributes) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *AWSAccountResponseAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetResourcesConfig() AWSResourcesConfig { + if o == nil || o.ResourcesConfig == nil { + var ret AWSResourcesConfig + return ret + } + return *o.ResourcesConfig +} + +// GetResourcesConfigOk returns a tuple with the ResourcesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetResourcesConfigOk() (*AWSResourcesConfig, bool) { + if o == nil || o.ResourcesConfig == nil { + return nil, false + } + return o.ResourcesConfig, true +} + +// HasResourcesConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasResourcesConfig() bool { + return o != nil && o.ResourcesConfig != nil +} + +// SetResourcesConfig gets a reference to the given AWSResourcesConfig and assigns it to the ResourcesConfig field. +func (o *AWSAccountResponseAttributes) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetTracesConfig() AWSTracesConfig { + if o == nil || o.TracesConfig == nil { + var ret AWSTracesConfig + return ret + } + return *o.TracesConfig +} + +// GetTracesConfigOk returns a tuple with the TracesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetTracesConfigOk() (*AWSTracesConfig, bool) { + if o == nil || o.TracesConfig == nil { + return nil, false + } + return o.TracesConfig, true +} + +// HasTracesConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasTracesConfig() bool { + return o != nil && o.TracesConfig != nil +} + +// SetTracesConfig gets a reference to the given AWSTracesConfig and assigns it to the TracesConfig field. +func (o *AWSAccountResponseAttributes) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountTags.IsSet() { + toSerialize["account_tags"] = o.AccountTags.Get() + } + toSerialize["auth_config"] = o.AuthConfig + toSerialize["aws_account_id"] = o.AwsAccountId + toSerialize["aws_partition"] = o.AwsPartition + if o.AwsRegions != nil { + toSerialize["aws_regions"] = o.AwsRegions + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ResourcesConfig != nil { + toSerialize["resources_config"] = o.ResourcesConfig + } + if o.TracesConfig != nil { + toSerialize["traces_config"] = o.TracesConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + AuthConfig *AWSAuthConfig `json:"auth_config"` + AwsAccountId *string `json:"aws_account_id"` + AwsPartition *AWSAccountPartition `json:"aws_partition"` + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AuthConfig == nil { + return fmt.Errorf("required field auth_config missing") + } + if all.AwsAccountId == nil { + return fmt.Errorf("required field aws_account_id missing") + } + if all.AwsPartition == nil { + return fmt.Errorf("required field aws_partition missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_tags", "auth_config", "aws_account_id", "aws_partition", "aws_regions", "created_at", "logs_config", "metrics_config", "modified_at", "resources_config", "traces_config"}) + } else { + return err + } + + hasInvalidField := false + o.AccountTags = all.AccountTags + o.AuthConfig = *all.AuthConfig + o.AwsAccountId = *all.AwsAccountId + if !all.AwsPartition.IsValid() { + hasInvalidField = true + } else { + o.AwsPartition = *all.AwsPartition + } + o.AwsRegions = all.AwsRegions + o.CreatedAt = all.CreatedAt + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + o.ModifiedAt = all.ModifiedAt + if all.ResourcesConfig != nil && all.ResourcesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ResourcesConfig = all.ResourcesConfig + if all.TracesConfig != nil && all.TracesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TracesConfig = all.TracesConfig + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_response_data.go b/api/datadogV2/model_aws_account_response_data.go new file mode 100644 index 00000000000..57ec0eaf8af --- /dev/null +++ b/api/datadogV2/model_aws_account_response_data.go @@ -0,0 +1,184 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountResponseData AWS Account Response body +type AWSAccountResponseData struct { + // The AWS Account Integration Config + Attributes AWSAccountResponseAttributes `json:"attributes"` + // Identifier for the response type + Id *string `json:"id,omitempty"` + // Request or response type + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountResponseData instantiates a new AWSAccountResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountResponseData(attributes AWSAccountResponseAttributes) *AWSAccountResponseData { + this := AWSAccountResponseData{} + this.Attributes = attributes + var typeVar string = "account" + this.Type = &typeVar + return &this +} + +// NewAWSAccountResponseDataWithDefaults instantiates a new AWSAccountResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountResponseDataWithDefaults() *AWSAccountResponseData { + this := AWSAccountResponseData{} + var typeVar string = "account" + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSAccountResponseData) GetAttributes() AWSAccountResponseAttributes { + if o == nil { + var ret AWSAccountResponseAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseData) GetAttributesOk() (*AWSAccountResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSAccountResponseData) SetAttributes(v AWSAccountResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSAccountResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AWSAccountResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AWSAccountResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AWSAccountResponseData) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseData) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *AWSAccountResponseData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *AWSAccountResponseData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountResponseAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_accounts_response.go b/api/datadogV2/model_aws_accounts_response.go new file mode 100644 index 00000000000..c7710fd4ae5 --- /dev/null +++ b/api/datadogV2/model_aws_accounts_response.go @@ -0,0 +1,102 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountsResponse AWS Accounts response body +type AWSAccountsResponse struct { + // List of AWS Account Integration Configs + Data []AWSAccountResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountsResponse instantiates a new AWSAccountsResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountsResponse() *AWSAccountsResponse { + this := AWSAccountsResponse{} + return &this +} + +// NewAWSAccountsResponseWithDefaults instantiates a new AWSAccountsResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountsResponseWithDefaults() *AWSAccountsResponse { + this := AWSAccountsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AWSAccountsResponse) GetData() []AWSAccountResponseData { + if o == nil || o.Data == nil { + var ret []AWSAccountResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountsResponse) GetDataOk() (*[]AWSAccountResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AWSAccountsResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []AWSAccountResponseData and assigns it to the Data field. +func (o *AWSAccountsResponse) SetData(v []AWSAccountResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []AWSAccountResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_auth_config.go b/api/datadogV2/model_aws_auth_config.go new file mode 100644 index 00000000000..37187c14616 --- /dev/null +++ b/api/datadogV2/model_aws_auth_config.go @@ -0,0 +1,105 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAuthConfig - AWS Authentication config +type AWSAuthConfig struct { + AWSAuthConfigKeys *AWSAuthConfigKeys + AWSAuthConfigRole *AWSAuthConfigRole + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AWSAuthConfigKeysAsAWSAuthConfig is a convenience function that returns AWSAuthConfigKeys wrapped in AWSAuthConfig. +func AWSAuthConfigKeysAsAWSAuthConfig(v *AWSAuthConfigKeys) AWSAuthConfig { + return AWSAuthConfig{AWSAuthConfigKeys: v} +} + +// AWSAuthConfigRoleAsAWSAuthConfig is a convenience function that returns AWSAuthConfigRole wrapped in AWSAuthConfig. +func AWSAuthConfigRoleAsAWSAuthConfig(v *AWSAuthConfigRole) AWSAuthConfig { + return AWSAuthConfig{AWSAuthConfigRole: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AWSAuthConfig) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AWSAuthConfigKeys + err = datadog.Unmarshal(data, &obj.AWSAuthConfigKeys) + if err == nil { + if obj.AWSAuthConfigKeys != nil && obj.AWSAuthConfigKeys.UnparsedObject == nil { + jsonAWSAuthConfigKeys, _ := datadog.Marshal(obj.AWSAuthConfigKeys) + if string(jsonAWSAuthConfigKeys) == "{}" { // empty struct + obj.AWSAuthConfigKeys = nil + } else { + match++ + } + } else { + obj.AWSAuthConfigKeys = nil + } + } else { + obj.AWSAuthConfigKeys = nil + } + + // try to unmarshal data into AWSAuthConfigRole + err = datadog.Unmarshal(data, &obj.AWSAuthConfigRole) + if err == nil { + if obj.AWSAuthConfigRole != nil && obj.AWSAuthConfigRole.UnparsedObject == nil { + jsonAWSAuthConfigRole, _ := datadog.Marshal(obj.AWSAuthConfigRole) + if string(jsonAWSAuthConfigRole) == "{}" { // empty struct + obj.AWSAuthConfigRole = nil + } else { + match++ + } + } else { + obj.AWSAuthConfigRole = nil + } + } else { + obj.AWSAuthConfigRole = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AWSAuthConfigKeys = nil + obj.AWSAuthConfigRole = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AWSAuthConfig) MarshalJSON() ([]byte, error) { + if obj.AWSAuthConfigKeys != nil { + return datadog.Marshal(&obj.AWSAuthConfigKeys) + } + + if obj.AWSAuthConfigRole != nil { + return datadog.Marshal(&obj.AWSAuthConfigRole) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AWSAuthConfig) GetActualInstance() interface{} { + if obj.AWSAuthConfigKeys != nil { + return obj.AWSAuthConfigKeys + } + + if obj.AWSAuthConfigRole != nil { + return obj.AWSAuthConfigRole + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_aws_auth_config_keys.go b/api/datadogV2/model_aws_auth_config_keys.go new file mode 100644 index 00000000000..7de951222a4 --- /dev/null +++ b/api/datadogV2/model_aws_auth_config_keys.go @@ -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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAuthConfigKeys AWS Authentication config for key-based account +type AWSAuthConfigKeys struct { + // AWS Access Key ID + AccessKeyId string `json:"access_key_id"` + // AWS Secret Access Key + SecretAccessKey *string `json:"secret_access_key,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAuthConfigKeys instantiates a new AWSAuthConfigKeys object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAuthConfigKeys(accessKeyId string) *AWSAuthConfigKeys { + this := AWSAuthConfigKeys{} + this.AccessKeyId = accessKeyId + return &this +} + +// NewAWSAuthConfigKeysWithDefaults instantiates a new AWSAuthConfigKeys object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAuthConfigKeysWithDefaults() *AWSAuthConfigKeys { + this := AWSAuthConfigKeys{} + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value. +func (o *AWSAuthConfigKeys) GetAccessKeyId() string { + if o == nil { + var ret string + return ret + } + return o.AccessKeyId +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigKeys) GetAccessKeyIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessKeyId, true +} + +// SetAccessKeyId sets field value. +func (o *AWSAuthConfigKeys) SetAccessKeyId(v string) { + o.AccessKeyId = v +} + +// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise. +func (o *AWSAuthConfigKeys) GetSecretAccessKey() string { + if o == nil || o.SecretAccessKey == nil { + var ret string + return ret + } + return *o.SecretAccessKey +} + +// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigKeys) GetSecretAccessKeyOk() (*string, bool) { + if o == nil || o.SecretAccessKey == nil { + return nil, false + } + return o.SecretAccessKey, true +} + +// HasSecretAccessKey returns a boolean if a field has been set. +func (o *AWSAuthConfigKeys) HasSecretAccessKey() bool { + return o != nil && o.SecretAccessKey != nil +} + +// SetSecretAccessKey gets a reference to the given string and assigns it to the SecretAccessKey field. +func (o *AWSAuthConfigKeys) SetSecretAccessKey(v string) { + o.SecretAccessKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAuthConfigKeys) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["access_key_id"] = o.AccessKeyId + if o.SecretAccessKey != nil { + toSerialize["secret_access_key"] = o.SecretAccessKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAuthConfigKeys) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccessKeyId *string `json:"access_key_id"` + SecretAccessKey *string `json:"secret_access_key,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AccessKeyId == nil { + return fmt.Errorf("required field access_key_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"access_key_id", "secret_access_key"}) + } else { + return err + } + o.AccessKeyId = *all.AccessKeyId + o.SecretAccessKey = all.SecretAccessKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_auth_config_role.go b/api/datadogV2/model_aws_auth_config_role.go new file mode 100644 index 00000000000..c465b7e85b5 --- /dev/null +++ b/api/datadogV2/model_aws_auth_config_role.go @@ -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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAuthConfigRole AWS Authentication config for role-based account +type AWSAuthConfigRole struct { + // AWS IAM External ID for associated role + ExternalId *string `json:"external_id,omitempty"` + // AWS IAM Role name + RoleName string `json:"role_name"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAuthConfigRole instantiates a new AWSAuthConfigRole object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAuthConfigRole(roleName string) *AWSAuthConfigRole { + this := AWSAuthConfigRole{} + this.RoleName = roleName + return &this +} + +// NewAWSAuthConfigRoleWithDefaults instantiates a new AWSAuthConfigRole object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAuthConfigRoleWithDefaults() *AWSAuthConfigRole { + this := AWSAuthConfigRole{} + return &this +} + +// GetExternalId returns the ExternalId field value if set, zero value otherwise. +func (o *AWSAuthConfigRole) GetExternalId() string { + if o == nil || o.ExternalId == nil { + var ret string + return ret + } + return *o.ExternalId +} + +// GetExternalIdOk returns a tuple with the ExternalId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigRole) GetExternalIdOk() (*string, bool) { + if o == nil || o.ExternalId == nil { + return nil, false + } + return o.ExternalId, true +} + +// HasExternalId returns a boolean if a field has been set. +func (o *AWSAuthConfigRole) HasExternalId() bool { + return o != nil && o.ExternalId != nil +} + +// SetExternalId gets a reference to the given string and assigns it to the ExternalId field. +func (o *AWSAuthConfigRole) SetExternalId(v string) { + o.ExternalId = &v +} + +// GetRoleName returns the RoleName field value. +func (o *AWSAuthConfigRole) GetRoleName() string { + if o == nil { + var ret string + return ret + } + return o.RoleName +} + +// GetRoleNameOk returns a tuple with the RoleName field value +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigRole) GetRoleNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RoleName, true +} + +// SetRoleName sets field value. +func (o *AWSAuthConfigRole) SetRoleName(v string) { + o.RoleName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAuthConfigRole) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExternalId != nil { + toSerialize["external_id"] = o.ExternalId + } + toSerialize["role_name"] = o.RoleName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAuthConfigRole) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExternalId *string `json:"external_id,omitempty"` + RoleName *string `json:"role_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.RoleName == nil { + return fmt.Errorf("required field role_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"external_id", "role_name"}) + } else { + return err + } + o.ExternalId = all.ExternalId + o.RoleName = *all.RoleName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_lambda_forwarder_config.go b/api/datadogV2/model_aws_lambda_forwarder_config.go new file mode 100644 index 00000000000..634d728fdce --- /dev/null +++ b/api/datadogV2/model_aws_lambda_forwarder_config.go @@ -0,0 +1,137 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSLambdaForwarderConfig AWS Lambda forwarder +type AWSLambdaForwarderConfig struct { + // List of Datadog Lambda Log Forwarder ARNs + Lambdas []string `json:"lambdas,omitempty"` + // List of AWS services that will send logs to the Datadog Lambda Log Forwarder + Sources []string `json:"sources,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSLambdaForwarderConfig instantiates a new AWSLambdaForwarderConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSLambdaForwarderConfig() *AWSLambdaForwarderConfig { + this := AWSLambdaForwarderConfig{} + return &this +} + +// NewAWSLambdaForwarderConfigWithDefaults instantiates a new AWSLambdaForwarderConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSLambdaForwarderConfigWithDefaults() *AWSLambdaForwarderConfig { + this := AWSLambdaForwarderConfig{} + return &this +} + +// GetLambdas returns the Lambdas field value if set, zero value otherwise. +func (o *AWSLambdaForwarderConfig) GetLambdas() []string { + if o == nil || o.Lambdas == nil { + var ret []string + return ret + } + return o.Lambdas +} + +// GetLambdasOk returns a tuple with the Lambdas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLambdaForwarderConfig) GetLambdasOk() (*[]string, bool) { + if o == nil || o.Lambdas == nil { + return nil, false + } + return &o.Lambdas, true +} + +// HasLambdas returns a boolean if a field has been set. +func (o *AWSLambdaForwarderConfig) HasLambdas() bool { + return o != nil && o.Lambdas != nil +} + +// SetLambdas gets a reference to the given []string and assigns it to the Lambdas field. +func (o *AWSLambdaForwarderConfig) SetLambdas(v []string) { + o.Lambdas = v +} + +// GetSources returns the Sources field value if set, zero value otherwise. +func (o *AWSLambdaForwarderConfig) GetSources() []string { + if o == nil || o.Sources == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLambdaForwarderConfig) GetSourcesOk() (*[]string, bool) { + if o == nil || o.Sources == nil { + return nil, false + } + return &o.Sources, true +} + +// HasSources returns a boolean if a field has been set. +func (o *AWSLambdaForwarderConfig) HasSources() bool { + return o != nil && o.Sources != nil +} + +// SetSources gets a reference to the given []string and assigns it to the Sources field. +func (o *AWSLambdaForwarderConfig) SetSources(v []string) { + o.Sources = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLambdaForwarderConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Lambdas != nil { + toSerialize["lambdas"] = o.Lambdas + } + if o.Sources != nil { + toSerialize["sources"] = o.Sources + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLambdaForwarderConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Lambdas []string `json:"lambdas,omitempty"` + Sources []string `json:"sources,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"lambdas", "sources"}) + } else { + return err + } + o.Lambdas = all.Lambdas + o.Sources = all.Sources + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_logs_config.go b/api/datadogV2/model_aws_logs_config.go new file mode 100644 index 00000000000..d323364340e --- /dev/null +++ b/api/datadogV2/model_aws_logs_config.go @@ -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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSLogsConfig AWS Logs config +type AWSLogsConfig struct { + // AWS Lambda forwarder + LambdaForwarder *AWSLambdaForwarderConfig `json:"lambda_forwarder,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSLogsConfig instantiates a new AWSLogsConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSLogsConfig() *AWSLogsConfig { + this := AWSLogsConfig{} + return &this +} + +// NewAWSLogsConfigWithDefaults instantiates a new AWSLogsConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSLogsConfigWithDefaults() *AWSLogsConfig { + this := AWSLogsConfig{} + return &this +} + +// GetLambdaForwarder returns the LambdaForwarder field value if set, zero value otherwise. +func (o *AWSLogsConfig) GetLambdaForwarder() AWSLambdaForwarderConfig { + if o == nil || o.LambdaForwarder == nil { + var ret AWSLambdaForwarderConfig + return ret + } + return *o.LambdaForwarder +} + +// GetLambdaForwarderOk returns a tuple with the LambdaForwarder field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsConfig) GetLambdaForwarderOk() (*AWSLambdaForwarderConfig, bool) { + if o == nil || o.LambdaForwarder == nil { + return nil, false + } + return o.LambdaForwarder, true +} + +// HasLambdaForwarder returns a boolean if a field has been set. +func (o *AWSLogsConfig) HasLambdaForwarder() bool { + return o != nil && o.LambdaForwarder != nil +} + +// SetLambdaForwarder gets a reference to the given AWSLambdaForwarderConfig and assigns it to the LambdaForwarder field. +func (o *AWSLogsConfig) SetLambdaForwarder(v AWSLambdaForwarderConfig) { + o.LambdaForwarder = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.LambdaForwarder != nil { + toSerialize["lambda_forwarder"] = o.LambdaForwarder + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + LambdaForwarder *AWSLambdaForwarderConfig `json:"lambda_forwarder,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"lambda_forwarder"}) + } else { + return err + } + + hasInvalidField := false + if all.LambdaForwarder != nil && all.LambdaForwarder.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LambdaForwarder = all.LambdaForwarder + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_metrics_config.go b/api/datadogV2/model_aws_metrics_config.go new file mode 100644 index 00000000000..13cbe121a5e --- /dev/null +++ b/api/datadogV2/model_aws_metrics_config.go @@ -0,0 +1,277 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSMetricsConfig AWS Metrics config +type AWSMetricsConfig struct { + // Enable EC2 automute for AWS metrics + AutomuteEnabled *bool `json:"automute_enabled,omitempty"` + // Enable CloudWatch alarms collection + CollectCloudwatchAlarms *bool `json:"collect_cloudwatch_alarms,omitempty"` + // Enable custom metrics collection + CollectCustomMetrics *bool `json:"collect_custom_metrics,omitempty"` + // Enable AWS metrics collection + Enabled *bool `json:"enabled,omitempty"` + // AWS Metrics namespace filters + NamespaceFilters *AWSNamespaceFilters `json:"namespace_filters,omitempty"` + // AWS Metrics tag filters list + TagFilters []AWSNamespaceTagFilter `json:"tag_filters,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSMetricsConfig instantiates a new AWSMetricsConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSMetricsConfig() *AWSMetricsConfig { + this := AWSMetricsConfig{} + return &this +} + +// NewAWSMetricsConfigWithDefaults instantiates a new AWSMetricsConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSMetricsConfigWithDefaults() *AWSMetricsConfig { + this := AWSMetricsConfig{} + return &this +} + +// GetAutomuteEnabled returns the AutomuteEnabled field value if set, zero value otherwise. +func (o *AWSMetricsConfig) GetAutomuteEnabled() bool { + if o == nil || o.AutomuteEnabled == nil { + var ret bool + return ret + } + return *o.AutomuteEnabled +} + +// GetAutomuteEnabledOk returns a tuple with the AutomuteEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSMetricsConfig) GetAutomuteEnabledOk() (*bool, bool) { + if o == nil || o.AutomuteEnabled == nil { + return nil, false + } + return o.AutomuteEnabled, true +} + +// HasAutomuteEnabled returns a boolean if a field has been set. +func (o *AWSMetricsConfig) HasAutomuteEnabled() bool { + return o != nil && o.AutomuteEnabled != nil +} + +// SetAutomuteEnabled gets a reference to the given bool and assigns it to the AutomuteEnabled field. +func (o *AWSMetricsConfig) SetAutomuteEnabled(v bool) { + o.AutomuteEnabled = &v +} + +// GetCollectCloudwatchAlarms returns the CollectCloudwatchAlarms field value if set, zero value otherwise. +func (o *AWSMetricsConfig) GetCollectCloudwatchAlarms() bool { + if o == nil || o.CollectCloudwatchAlarms == nil { + var ret bool + return ret + } + return *o.CollectCloudwatchAlarms +} + +// GetCollectCloudwatchAlarmsOk returns a tuple with the CollectCloudwatchAlarms field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSMetricsConfig) GetCollectCloudwatchAlarmsOk() (*bool, bool) { + if o == nil || o.CollectCloudwatchAlarms == nil { + return nil, false + } + return o.CollectCloudwatchAlarms, true +} + +// HasCollectCloudwatchAlarms returns a boolean if a field has been set. +func (o *AWSMetricsConfig) HasCollectCloudwatchAlarms() bool { + return o != nil && o.CollectCloudwatchAlarms != nil +} + +// SetCollectCloudwatchAlarms gets a reference to the given bool and assigns it to the CollectCloudwatchAlarms field. +func (o *AWSMetricsConfig) SetCollectCloudwatchAlarms(v bool) { + o.CollectCloudwatchAlarms = &v +} + +// GetCollectCustomMetrics returns the CollectCustomMetrics field value if set, zero value otherwise. +func (o *AWSMetricsConfig) GetCollectCustomMetrics() bool { + if o == nil || o.CollectCustomMetrics == nil { + var ret bool + return ret + } + return *o.CollectCustomMetrics +} + +// GetCollectCustomMetricsOk returns a tuple with the CollectCustomMetrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSMetricsConfig) GetCollectCustomMetricsOk() (*bool, bool) { + if o == nil || o.CollectCustomMetrics == nil { + return nil, false + } + return o.CollectCustomMetrics, true +} + +// HasCollectCustomMetrics returns a boolean if a field has been set. +func (o *AWSMetricsConfig) HasCollectCustomMetrics() bool { + return o != nil && o.CollectCustomMetrics != nil +} + +// SetCollectCustomMetrics gets a reference to the given bool and assigns it to the CollectCustomMetrics field. +func (o *AWSMetricsConfig) SetCollectCustomMetrics(v bool) { + o.CollectCustomMetrics = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *AWSMetricsConfig) GetEnabled() bool { + if o == nil || o.Enabled == nil { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSMetricsConfig) GetEnabledOk() (*bool, bool) { + if o == nil || o.Enabled == nil { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *AWSMetricsConfig) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *AWSMetricsConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetNamespaceFilters returns the NamespaceFilters field value if set, zero value otherwise. +func (o *AWSMetricsConfig) GetNamespaceFilters() AWSNamespaceFilters { + if o == nil || o.NamespaceFilters == nil { + var ret AWSNamespaceFilters + return ret + } + return *o.NamespaceFilters +} + +// GetNamespaceFiltersOk returns a tuple with the NamespaceFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSMetricsConfig) GetNamespaceFiltersOk() (*AWSNamespaceFilters, bool) { + if o == nil || o.NamespaceFilters == nil { + return nil, false + } + return o.NamespaceFilters, true +} + +// HasNamespaceFilters returns a boolean if a field has been set. +func (o *AWSMetricsConfig) HasNamespaceFilters() bool { + return o != nil && o.NamespaceFilters != nil +} + +// SetNamespaceFilters gets a reference to the given AWSNamespaceFilters and assigns it to the NamespaceFilters field. +func (o *AWSMetricsConfig) SetNamespaceFilters(v AWSNamespaceFilters) { + o.NamespaceFilters = &v +} + +// GetTagFilters returns the TagFilters field value if set, zero value otherwise. +func (o *AWSMetricsConfig) GetTagFilters() []AWSNamespaceTagFilter { + if o == nil || o.TagFilters == nil { + var ret []AWSNamespaceTagFilter + return ret + } + return o.TagFilters +} + +// GetTagFiltersOk returns a tuple with the TagFilters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSMetricsConfig) GetTagFiltersOk() (*[]AWSNamespaceTagFilter, bool) { + if o == nil || o.TagFilters == nil { + return nil, false + } + return &o.TagFilters, true +} + +// HasTagFilters returns a boolean if a field has been set. +func (o *AWSMetricsConfig) HasTagFilters() bool { + return o != nil && o.TagFilters != nil +} + +// SetTagFilters gets a reference to the given []AWSNamespaceTagFilter and assigns it to the TagFilters field. +func (o *AWSMetricsConfig) SetTagFilters(v []AWSNamespaceTagFilter) { + o.TagFilters = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSMetricsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AutomuteEnabled != nil { + toSerialize["automute_enabled"] = o.AutomuteEnabled + } + if o.CollectCloudwatchAlarms != nil { + toSerialize["collect_cloudwatch_alarms"] = o.CollectCloudwatchAlarms + } + if o.CollectCustomMetrics != nil { + toSerialize["collect_custom_metrics"] = o.CollectCustomMetrics + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.NamespaceFilters != nil { + toSerialize["namespace_filters"] = o.NamespaceFilters + } + if o.TagFilters != nil { + toSerialize["tag_filters"] = o.TagFilters + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSMetricsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AutomuteEnabled *bool `json:"automute_enabled,omitempty"` + CollectCloudwatchAlarms *bool `json:"collect_cloudwatch_alarms,omitempty"` + CollectCustomMetrics *bool `json:"collect_custom_metrics,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + NamespaceFilters *AWSNamespaceFilters `json:"namespace_filters,omitempty"` + TagFilters []AWSNamespaceTagFilter `json:"tag_filters,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"automute_enabled", "collect_cloudwatch_alarms", "collect_custom_metrics", "enabled", "namespace_filters", "tag_filters"}) + } else { + return err + } + o.AutomuteEnabled = all.AutomuteEnabled + o.CollectCloudwatchAlarms = all.CollectCloudwatchAlarms + o.CollectCustomMetrics = all.CollectCustomMetrics + o.Enabled = all.Enabled + o.NamespaceFilters = all.NamespaceFilters + o.TagFilters = all.TagFilters + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_namespace_filters.go b/api/datadogV2/model_aws_namespace_filters.go new file mode 100644 index 00000000000..ee5c6792d24 --- /dev/null +++ b/api/datadogV2/model_aws_namespace_filters.go @@ -0,0 +1,169 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSNamespaceFilters - AWS Metrics namespace filters +type AWSNamespaceFilters struct { + AWSNamespaceFiltersExcludeAll *AWSNamespaceFiltersExcludeAll + AWSNamespaceFiltersExcludeOnly *AWSNamespaceFiltersExcludeOnly + AWSNamespaceFiltersIncludeAll *AWSNamespaceFiltersIncludeAll + AWSNamespaceFiltersIncludeOnly *AWSNamespaceFiltersIncludeOnly + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AWSNamespaceFiltersExcludeAllAsAWSNamespaceFilters is a convenience function that returns AWSNamespaceFiltersExcludeAll wrapped in AWSNamespaceFilters. +func AWSNamespaceFiltersExcludeAllAsAWSNamespaceFilters(v *AWSNamespaceFiltersExcludeAll) AWSNamespaceFilters { + return AWSNamespaceFilters{AWSNamespaceFiltersExcludeAll: v} +} + +// AWSNamespaceFiltersExcludeOnlyAsAWSNamespaceFilters is a convenience function that returns AWSNamespaceFiltersExcludeOnly wrapped in AWSNamespaceFilters. +func AWSNamespaceFiltersExcludeOnlyAsAWSNamespaceFilters(v *AWSNamespaceFiltersExcludeOnly) AWSNamespaceFilters { + return AWSNamespaceFilters{AWSNamespaceFiltersExcludeOnly: v} +} + +// AWSNamespaceFiltersIncludeAllAsAWSNamespaceFilters is a convenience function that returns AWSNamespaceFiltersIncludeAll wrapped in AWSNamespaceFilters. +func AWSNamespaceFiltersIncludeAllAsAWSNamespaceFilters(v *AWSNamespaceFiltersIncludeAll) AWSNamespaceFilters { + return AWSNamespaceFilters{AWSNamespaceFiltersIncludeAll: v} +} + +// AWSNamespaceFiltersIncludeOnlyAsAWSNamespaceFilters is a convenience function that returns AWSNamespaceFiltersIncludeOnly wrapped in AWSNamespaceFilters. +func AWSNamespaceFiltersIncludeOnlyAsAWSNamespaceFilters(v *AWSNamespaceFiltersIncludeOnly) AWSNamespaceFilters { + return AWSNamespaceFilters{AWSNamespaceFiltersIncludeOnly: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AWSNamespaceFilters) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AWSNamespaceFiltersExcludeAll + err = datadog.Unmarshal(data, &obj.AWSNamespaceFiltersExcludeAll) + if err == nil { + if obj.AWSNamespaceFiltersExcludeAll != nil && obj.AWSNamespaceFiltersExcludeAll.UnparsedObject == nil { + jsonAWSNamespaceFiltersExcludeAll, _ := datadog.Marshal(obj.AWSNamespaceFiltersExcludeAll) + if string(jsonAWSNamespaceFiltersExcludeAll) == "{}" { // empty struct + obj.AWSNamespaceFiltersExcludeAll = nil + } else { + match++ + } + } else { + obj.AWSNamespaceFiltersExcludeAll = nil + } + } else { + obj.AWSNamespaceFiltersExcludeAll = nil + } + + // try to unmarshal data into AWSNamespaceFiltersExcludeOnly + err = datadog.Unmarshal(data, &obj.AWSNamespaceFiltersExcludeOnly) + if err == nil { + if obj.AWSNamespaceFiltersExcludeOnly != nil && obj.AWSNamespaceFiltersExcludeOnly.UnparsedObject == nil { + jsonAWSNamespaceFiltersExcludeOnly, _ := datadog.Marshal(obj.AWSNamespaceFiltersExcludeOnly) + if string(jsonAWSNamespaceFiltersExcludeOnly) == "{}" { // empty struct + obj.AWSNamespaceFiltersExcludeOnly = nil + } else { + match++ + } + } else { + obj.AWSNamespaceFiltersExcludeOnly = nil + } + } else { + obj.AWSNamespaceFiltersExcludeOnly = nil + } + + // try to unmarshal data into AWSNamespaceFiltersIncludeAll + err = datadog.Unmarshal(data, &obj.AWSNamespaceFiltersIncludeAll) + if err == nil { + if obj.AWSNamespaceFiltersIncludeAll != nil && obj.AWSNamespaceFiltersIncludeAll.UnparsedObject == nil { + jsonAWSNamespaceFiltersIncludeAll, _ := datadog.Marshal(obj.AWSNamespaceFiltersIncludeAll) + if string(jsonAWSNamespaceFiltersIncludeAll) == "{}" { // empty struct + obj.AWSNamespaceFiltersIncludeAll = nil + } else { + match++ + } + } else { + obj.AWSNamespaceFiltersIncludeAll = nil + } + } else { + obj.AWSNamespaceFiltersIncludeAll = nil + } + + // try to unmarshal data into AWSNamespaceFiltersIncludeOnly + err = datadog.Unmarshal(data, &obj.AWSNamespaceFiltersIncludeOnly) + if err == nil { + if obj.AWSNamespaceFiltersIncludeOnly != nil && obj.AWSNamespaceFiltersIncludeOnly.UnparsedObject == nil { + jsonAWSNamespaceFiltersIncludeOnly, _ := datadog.Marshal(obj.AWSNamespaceFiltersIncludeOnly) + if string(jsonAWSNamespaceFiltersIncludeOnly) == "{}" { // empty struct + obj.AWSNamespaceFiltersIncludeOnly = nil + } else { + match++ + } + } else { + obj.AWSNamespaceFiltersIncludeOnly = nil + } + } else { + obj.AWSNamespaceFiltersIncludeOnly = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AWSNamespaceFiltersExcludeAll = nil + obj.AWSNamespaceFiltersExcludeOnly = nil + obj.AWSNamespaceFiltersIncludeAll = nil + obj.AWSNamespaceFiltersIncludeOnly = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AWSNamespaceFilters) MarshalJSON() ([]byte, error) { + if obj.AWSNamespaceFiltersExcludeAll != nil { + return datadog.Marshal(&obj.AWSNamespaceFiltersExcludeAll) + } + + if obj.AWSNamespaceFiltersExcludeOnly != nil { + return datadog.Marshal(&obj.AWSNamespaceFiltersExcludeOnly) + } + + if obj.AWSNamespaceFiltersIncludeAll != nil { + return datadog.Marshal(&obj.AWSNamespaceFiltersIncludeAll) + } + + if obj.AWSNamespaceFiltersIncludeOnly != nil { + return datadog.Marshal(&obj.AWSNamespaceFiltersIncludeOnly) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AWSNamespaceFilters) GetActualInstance() interface{} { + if obj.AWSNamespaceFiltersExcludeAll != nil { + return obj.AWSNamespaceFiltersExcludeAll + } + + if obj.AWSNamespaceFiltersExcludeOnly != nil { + return obj.AWSNamespaceFiltersExcludeOnly + } + + if obj.AWSNamespaceFiltersIncludeAll != nil { + return obj.AWSNamespaceFiltersIncludeAll + } + + if obj.AWSNamespaceFiltersIncludeOnly != nil { + return obj.AWSNamespaceFiltersIncludeOnly + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_aws_namespace_filters_exclude_all.go b/api/datadogV2/model_aws_namespace_filters_exclude_all.go new file mode 100644 index 00000000000..0350363f161 --- /dev/null +++ b/api/datadogV2/model_aws_namespace_filters_exclude_all.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSNamespaceFiltersExcludeAll Exclude all namespaces +type AWSNamespaceFiltersExcludeAll struct { + // Exclude all namespaces + ExcludeAll bool `json:"exclude_all"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSNamespaceFiltersExcludeAll instantiates a new AWSNamespaceFiltersExcludeAll object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSNamespaceFiltersExcludeAll(excludeAll bool) *AWSNamespaceFiltersExcludeAll { + this := AWSNamespaceFiltersExcludeAll{} + this.ExcludeAll = excludeAll + return &this +} + +// NewAWSNamespaceFiltersExcludeAllWithDefaults instantiates a new AWSNamespaceFiltersExcludeAll object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSNamespaceFiltersExcludeAllWithDefaults() *AWSNamespaceFiltersExcludeAll { + this := AWSNamespaceFiltersExcludeAll{} + return &this +} + +// GetExcludeAll returns the ExcludeAll field value. +func (o *AWSNamespaceFiltersExcludeAll) GetExcludeAll() bool { + if o == nil { + var ret bool + return ret + } + return o.ExcludeAll +} + +// GetExcludeAllOk returns a tuple with the ExcludeAll field value +// and a boolean to check if the value has been set. +func (o *AWSNamespaceFiltersExcludeAll) GetExcludeAllOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.ExcludeAll, true +} + +// SetExcludeAll sets field value. +func (o *AWSNamespaceFiltersExcludeAll) SetExcludeAll(v bool) { + o.ExcludeAll = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespaceFiltersExcludeAll) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["exclude_all"] = o.ExcludeAll + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespaceFiltersExcludeAll) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExcludeAll *bool `json:"exclude_all"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ExcludeAll == nil { + return fmt.Errorf("required field exclude_all missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"exclude_all"}) + } else { + return err + } + o.ExcludeAll = *all.ExcludeAll + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_namespace_filters_exclude_only.go b/api/datadogV2/model_aws_namespace_filters_exclude_only.go new file mode 100644 index 00000000000..72dda110d38 --- /dev/null +++ b/api/datadogV2/model_aws_namespace_filters_exclude_only.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSNamespaceFiltersExcludeOnly Exclude only these namespaces +type AWSNamespaceFiltersExcludeOnly struct { + // Exclude only these namespaces + ExcludeOnly []string `json:"exclude_only"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSNamespaceFiltersExcludeOnly instantiates a new AWSNamespaceFiltersExcludeOnly object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSNamespaceFiltersExcludeOnly(excludeOnly []string) *AWSNamespaceFiltersExcludeOnly { + this := AWSNamespaceFiltersExcludeOnly{} + this.ExcludeOnly = excludeOnly + return &this +} + +// NewAWSNamespaceFiltersExcludeOnlyWithDefaults instantiates a new AWSNamespaceFiltersExcludeOnly object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSNamespaceFiltersExcludeOnlyWithDefaults() *AWSNamespaceFiltersExcludeOnly { + this := AWSNamespaceFiltersExcludeOnly{} + return &this +} + +// GetExcludeOnly returns the ExcludeOnly field value. +func (o *AWSNamespaceFiltersExcludeOnly) GetExcludeOnly() []string { + if o == nil { + var ret []string + return ret + } + return o.ExcludeOnly +} + +// GetExcludeOnlyOk returns a tuple with the ExcludeOnly field value +// and a boolean to check if the value has been set. +func (o *AWSNamespaceFiltersExcludeOnly) GetExcludeOnlyOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.ExcludeOnly, true +} + +// SetExcludeOnly sets field value. +func (o *AWSNamespaceFiltersExcludeOnly) SetExcludeOnly(v []string) { + o.ExcludeOnly = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespaceFiltersExcludeOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["exclude_only"] = o.ExcludeOnly + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespaceFiltersExcludeOnly) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExcludeOnly *[]string `json:"exclude_only"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ExcludeOnly == nil { + return fmt.Errorf("required field exclude_only missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"exclude_only"}) + } else { + return err + } + o.ExcludeOnly = *all.ExcludeOnly + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_namespace_filters_include_all.go b/api/datadogV2/model_aws_namespace_filters_include_all.go new file mode 100644 index 00000000000..71cd4cf0fcb --- /dev/null +++ b/api/datadogV2/model_aws_namespace_filters_include_all.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSNamespaceFiltersIncludeAll Include all namespaces +type AWSNamespaceFiltersIncludeAll struct { + // Include all namespaces + IncludeAll bool `json:"include_all"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSNamespaceFiltersIncludeAll instantiates a new AWSNamespaceFiltersIncludeAll object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSNamespaceFiltersIncludeAll(includeAll bool) *AWSNamespaceFiltersIncludeAll { + this := AWSNamespaceFiltersIncludeAll{} + this.IncludeAll = includeAll + return &this +} + +// NewAWSNamespaceFiltersIncludeAllWithDefaults instantiates a new AWSNamespaceFiltersIncludeAll object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSNamespaceFiltersIncludeAllWithDefaults() *AWSNamespaceFiltersIncludeAll { + this := AWSNamespaceFiltersIncludeAll{} + return &this +} + +// GetIncludeAll returns the IncludeAll field value. +func (o *AWSNamespaceFiltersIncludeAll) GetIncludeAll() bool { + if o == nil { + var ret bool + return ret + } + return o.IncludeAll +} + +// GetIncludeAllOk returns a tuple with the IncludeAll field value +// and a boolean to check if the value has been set. +func (o *AWSNamespaceFiltersIncludeAll) GetIncludeAllOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IncludeAll, true +} + +// SetIncludeAll sets field value. +func (o *AWSNamespaceFiltersIncludeAll) SetIncludeAll(v bool) { + o.IncludeAll = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespaceFiltersIncludeAll) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_all"] = o.IncludeAll + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespaceFiltersIncludeAll) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeAll *bool `json:"include_all"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeAll == nil { + return fmt.Errorf("required field include_all missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_all"}) + } else { + return err + } + o.IncludeAll = *all.IncludeAll + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_namespace_filters_include_only.go b/api/datadogV2/model_aws_namespace_filters_include_only.go new file mode 100644 index 00000000000..0c7d8c99712 --- /dev/null +++ b/api/datadogV2/model_aws_namespace_filters_include_only.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSNamespaceFiltersIncludeOnly Include only these namespaces +type AWSNamespaceFiltersIncludeOnly struct { + // Include only these namespaces + IncludeOnly []string `json:"include_only"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSNamespaceFiltersIncludeOnly instantiates a new AWSNamespaceFiltersIncludeOnly object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSNamespaceFiltersIncludeOnly(includeOnly []string) *AWSNamespaceFiltersIncludeOnly { + this := AWSNamespaceFiltersIncludeOnly{} + this.IncludeOnly = includeOnly + return &this +} + +// NewAWSNamespaceFiltersIncludeOnlyWithDefaults instantiates a new AWSNamespaceFiltersIncludeOnly object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSNamespaceFiltersIncludeOnlyWithDefaults() *AWSNamespaceFiltersIncludeOnly { + this := AWSNamespaceFiltersIncludeOnly{} + return &this +} + +// GetIncludeOnly returns the IncludeOnly field value. +func (o *AWSNamespaceFiltersIncludeOnly) GetIncludeOnly() []string { + if o == nil { + var ret []string + return ret + } + return o.IncludeOnly +} + +// GetIncludeOnlyOk returns a tuple with the IncludeOnly field value +// and a boolean to check if the value has been set. +func (o *AWSNamespaceFiltersIncludeOnly) GetIncludeOnlyOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.IncludeOnly, true +} + +// SetIncludeOnly sets field value. +func (o *AWSNamespaceFiltersIncludeOnly) SetIncludeOnly(v []string) { + o.IncludeOnly = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespaceFiltersIncludeOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_only"] = o.IncludeOnly + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespaceFiltersIncludeOnly) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeOnly *[]string `json:"include_only"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeOnly == nil { + return fmt.Errorf("required field include_only missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_only"}) + } else { + return err + } + o.IncludeOnly = *all.IncludeOnly + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_namespace_tag_filter.go b/api/datadogV2/model_aws_namespace_tag_filter.go new file mode 100644 index 00000000000..e4a81d19688 --- /dev/null +++ b/api/datadogV2/model_aws_namespace_tag_filter.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSNamespaceTagFilter AWS Metrics tag filters +type AWSNamespaceTagFilter struct { + // The AWS Namespace to apply the tag filters against + Namespace *string `json:"namespace,omitempty"` + // The tags to filter based on + Tags datadog.NullableList[string] `json:"tags,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSNamespaceTagFilter instantiates a new AWSNamespaceTagFilter object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSNamespaceTagFilter() *AWSNamespaceTagFilter { + this := AWSNamespaceTagFilter{} + return &this +} + +// NewAWSNamespaceTagFilterWithDefaults instantiates a new AWSNamespaceTagFilter object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSNamespaceTagFilterWithDefaults() *AWSNamespaceTagFilter { + this := AWSNamespaceTagFilter{} + return &this +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *AWSNamespaceTagFilter) GetNamespace() string { + if o == nil || o.Namespace == nil { + var ret string + return ret + } + return *o.Namespace +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSNamespaceTagFilter) GetNamespaceOk() (*string, bool) { + if o == nil || o.Namespace == nil { + return nil, false + } + return o.Namespace, true +} + +// HasNamespace returns a boolean if a field has been set. +func (o *AWSNamespaceTagFilter) HasNamespace() bool { + return o != nil && o.Namespace != nil +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *AWSNamespaceTagFilter) SetNamespace(v string) { + o.Namespace = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AWSNamespaceTagFilter) GetTags() []string { + if o == nil || o.Tags.Get() == nil { + var ret []string + return ret + } + return *o.Tags.Get() +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AWSNamespaceTagFilter) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.Tags.Get(), o.Tags.IsSet() +} + +// HasTags returns a boolean if a field has been set. +func (o *AWSNamespaceTagFilter) HasTags() bool { + return o != nil && o.Tags.IsSet() +} + +// SetTags gets a reference to the given datadog.NullableList[string] and assigns it to the Tags field. +func (o *AWSNamespaceTagFilter) SetTags(v []string) { + o.Tags.Set(&v) +} + +// SetTagsNil sets the value for Tags to be an explicit nil. +func (o *AWSNamespaceTagFilter) SetTagsNil() { + o.Tags.Set(nil) +} + +// UnsetTags ensures that no value is present for Tags, not even an explicit nil. +func (o *AWSNamespaceTagFilter) UnsetTags() { + o.Tags.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespaceTagFilter) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Namespace != nil { + toSerialize["namespace"] = o.Namespace + } + if o.Tags.IsSet() { + toSerialize["tags"] = o.Tags.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespaceTagFilter) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Namespace *string `json:"namespace,omitempty"` + Tags datadog.NullableList[string] `json:"tags,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"namespace", "tags"}) + } else { + return err + } + o.Namespace = all.Namespace + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_regions.go b/api/datadogV2/model_aws_regions.go new file mode 100644 index 00000000000..192f771388a --- /dev/null +++ b/api/datadogV2/model_aws_regions.go @@ -0,0 +1,105 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSRegions - AWS Regions to collect data from +type AWSRegions struct { + AWSRegionsIncludeAll *AWSRegionsIncludeAll + AWSRegionsIncludeOnly *AWSRegionsIncludeOnly + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AWSRegionsIncludeAllAsAWSRegions is a convenience function that returns AWSRegionsIncludeAll wrapped in AWSRegions. +func AWSRegionsIncludeAllAsAWSRegions(v *AWSRegionsIncludeAll) AWSRegions { + return AWSRegions{AWSRegionsIncludeAll: v} +} + +// AWSRegionsIncludeOnlyAsAWSRegions is a convenience function that returns AWSRegionsIncludeOnly wrapped in AWSRegions. +func AWSRegionsIncludeOnlyAsAWSRegions(v *AWSRegionsIncludeOnly) AWSRegions { + return AWSRegions{AWSRegionsIncludeOnly: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AWSRegions) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AWSRegionsIncludeAll + err = datadog.Unmarshal(data, &obj.AWSRegionsIncludeAll) + if err == nil { + if obj.AWSRegionsIncludeAll != nil && obj.AWSRegionsIncludeAll.UnparsedObject == nil { + jsonAWSRegionsIncludeAll, _ := datadog.Marshal(obj.AWSRegionsIncludeAll) + if string(jsonAWSRegionsIncludeAll) == "{}" { // empty struct + obj.AWSRegionsIncludeAll = nil + } else { + match++ + } + } else { + obj.AWSRegionsIncludeAll = nil + } + } else { + obj.AWSRegionsIncludeAll = nil + } + + // try to unmarshal data into AWSRegionsIncludeOnly + err = datadog.Unmarshal(data, &obj.AWSRegionsIncludeOnly) + if err == nil { + if obj.AWSRegionsIncludeOnly != nil && obj.AWSRegionsIncludeOnly.UnparsedObject == nil { + jsonAWSRegionsIncludeOnly, _ := datadog.Marshal(obj.AWSRegionsIncludeOnly) + if string(jsonAWSRegionsIncludeOnly) == "{}" { // empty struct + obj.AWSRegionsIncludeOnly = nil + } else { + match++ + } + } else { + obj.AWSRegionsIncludeOnly = nil + } + } else { + obj.AWSRegionsIncludeOnly = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AWSRegionsIncludeAll = nil + obj.AWSRegionsIncludeOnly = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AWSRegions) MarshalJSON() ([]byte, error) { + if obj.AWSRegionsIncludeAll != nil { + return datadog.Marshal(&obj.AWSRegionsIncludeAll) + } + + if obj.AWSRegionsIncludeOnly != nil { + return datadog.Marshal(&obj.AWSRegionsIncludeOnly) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AWSRegions) GetActualInstance() interface{} { + if obj.AWSRegionsIncludeAll != nil { + return obj.AWSRegionsIncludeAll + } + + if obj.AWSRegionsIncludeOnly != nil { + return obj.AWSRegionsIncludeOnly + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_aws_regions_include_all.go b/api/datadogV2/model_aws_regions_include_all.go new file mode 100644 index 00000000000..f135e379766 --- /dev/null +++ b/api/datadogV2/model_aws_regions_include_all.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSRegionsIncludeAll Include all regions +type AWSRegionsIncludeAll struct { + // Include all regions + IncludeAll bool `json:"include_all"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSRegionsIncludeAll instantiates a new AWSRegionsIncludeAll object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSRegionsIncludeAll(includeAll bool) *AWSRegionsIncludeAll { + this := AWSRegionsIncludeAll{} + this.IncludeAll = includeAll + return &this +} + +// NewAWSRegionsIncludeAllWithDefaults instantiates a new AWSRegionsIncludeAll object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSRegionsIncludeAllWithDefaults() *AWSRegionsIncludeAll { + this := AWSRegionsIncludeAll{} + return &this +} + +// GetIncludeAll returns the IncludeAll field value. +func (o *AWSRegionsIncludeAll) GetIncludeAll() bool { + if o == nil { + var ret bool + return ret + } + return o.IncludeAll +} + +// GetIncludeAllOk returns a tuple with the IncludeAll field value +// and a boolean to check if the value has been set. +func (o *AWSRegionsIncludeAll) GetIncludeAllOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IncludeAll, true +} + +// SetIncludeAll sets field value. +func (o *AWSRegionsIncludeAll) SetIncludeAll(v bool) { + o.IncludeAll = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSRegionsIncludeAll) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_all"] = o.IncludeAll + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSRegionsIncludeAll) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeAll *bool `json:"include_all"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeAll == nil { + return fmt.Errorf("required field include_all missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_all"}) + } else { + return err + } + o.IncludeAll = *all.IncludeAll + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_regions_include_only.go b/api/datadogV2/model_aws_regions_include_only.go new file mode 100644 index 00000000000..48086b79986 --- /dev/null +++ b/api/datadogV2/model_aws_regions_include_only.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSRegionsIncludeOnly Include only these regions +type AWSRegionsIncludeOnly struct { + // Include only these regions + IncludeOnly []string `json:"include_only"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSRegionsIncludeOnly instantiates a new AWSRegionsIncludeOnly object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSRegionsIncludeOnly(includeOnly []string) *AWSRegionsIncludeOnly { + this := AWSRegionsIncludeOnly{} + this.IncludeOnly = includeOnly + return &this +} + +// NewAWSRegionsIncludeOnlyWithDefaults instantiates a new AWSRegionsIncludeOnly object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSRegionsIncludeOnlyWithDefaults() *AWSRegionsIncludeOnly { + this := AWSRegionsIncludeOnly{} + return &this +} + +// GetIncludeOnly returns the IncludeOnly field value. +func (o *AWSRegionsIncludeOnly) GetIncludeOnly() []string { + if o == nil { + var ret []string + return ret + } + return o.IncludeOnly +} + +// GetIncludeOnlyOk returns a tuple with the IncludeOnly field value +// and a boolean to check if the value has been set. +func (o *AWSRegionsIncludeOnly) GetIncludeOnlyOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.IncludeOnly, true +} + +// SetIncludeOnly sets field value. +func (o *AWSRegionsIncludeOnly) SetIncludeOnly(v []string) { + o.IncludeOnly = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSRegionsIncludeOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_only"] = o.IncludeOnly + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSRegionsIncludeOnly) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeOnly *[]string `json:"include_only"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeOnly == nil { + return fmt.Errorf("required field include_only missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_only"}) + } else { + return err + } + o.IncludeOnly = *all.IncludeOnly + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_resources_config.go b/api/datadogV2/model_aws_resources_config.go new file mode 100644 index 00000000000..1fccf6099ff --- /dev/null +++ b/api/datadogV2/model_aws_resources_config.go @@ -0,0 +1,137 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSResourcesConfig AWS Resources config +type AWSResourcesConfig struct { + // Whether Datadog collects cloud security posture management resources from your AWS account. + CloudSecurityPostureManagementCollection *bool `json:"cloud_security_posture_management_collection,omitempty"` + // Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Required for `cspm_resource_collection`. + ExtendedCollection *bool `json:"extended_collection,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSResourcesConfig instantiates a new AWSResourcesConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSResourcesConfig() *AWSResourcesConfig { + this := AWSResourcesConfig{} + return &this +} + +// NewAWSResourcesConfigWithDefaults instantiates a new AWSResourcesConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSResourcesConfigWithDefaults() *AWSResourcesConfig { + this := AWSResourcesConfig{} + return &this +} + +// GetCloudSecurityPostureManagementCollection returns the CloudSecurityPostureManagementCollection field value if set, zero value otherwise. +func (o *AWSResourcesConfig) GetCloudSecurityPostureManagementCollection() bool { + if o == nil || o.CloudSecurityPostureManagementCollection == nil { + var ret bool + return ret + } + return *o.CloudSecurityPostureManagementCollection +} + +// GetCloudSecurityPostureManagementCollectionOk returns a tuple with the CloudSecurityPostureManagementCollection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSResourcesConfig) GetCloudSecurityPostureManagementCollectionOk() (*bool, bool) { + if o == nil || o.CloudSecurityPostureManagementCollection == nil { + return nil, false + } + return o.CloudSecurityPostureManagementCollection, true +} + +// HasCloudSecurityPostureManagementCollection returns a boolean if a field has been set. +func (o *AWSResourcesConfig) HasCloudSecurityPostureManagementCollection() bool { + return o != nil && o.CloudSecurityPostureManagementCollection != nil +} + +// SetCloudSecurityPostureManagementCollection gets a reference to the given bool and assigns it to the CloudSecurityPostureManagementCollection field. +func (o *AWSResourcesConfig) SetCloudSecurityPostureManagementCollection(v bool) { + o.CloudSecurityPostureManagementCollection = &v +} + +// GetExtendedCollection returns the ExtendedCollection field value if set, zero value otherwise. +func (o *AWSResourcesConfig) GetExtendedCollection() bool { + if o == nil || o.ExtendedCollection == nil { + var ret bool + return ret + } + return *o.ExtendedCollection +} + +// GetExtendedCollectionOk returns a tuple with the ExtendedCollection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSResourcesConfig) GetExtendedCollectionOk() (*bool, bool) { + if o == nil || o.ExtendedCollection == nil { + return nil, false + } + return o.ExtendedCollection, true +} + +// HasExtendedCollection returns a boolean if a field has been set. +func (o *AWSResourcesConfig) HasExtendedCollection() bool { + return o != nil && o.ExtendedCollection != nil +} + +// SetExtendedCollection gets a reference to the given bool and assigns it to the ExtendedCollection field. +func (o *AWSResourcesConfig) SetExtendedCollection(v bool) { + o.ExtendedCollection = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSResourcesConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CloudSecurityPostureManagementCollection != nil { + toSerialize["cloud_security_posture_management_collection"] = o.CloudSecurityPostureManagementCollection + } + if o.ExtendedCollection != nil { + toSerialize["extended_collection"] = o.ExtendedCollection + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSResourcesConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CloudSecurityPostureManagementCollection *bool `json:"cloud_security_posture_management_collection,omitempty"` + ExtendedCollection *bool `json:"extended_collection,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cloud_security_posture_management_collection", "extended_collection"}) + } else { + return err + } + o.CloudSecurityPostureManagementCollection = all.CloudSecurityPostureManagementCollection + o.ExtendedCollection = all.ExtendedCollection + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_traces_config.go b/api/datadogV2/model_aws_traces_config.go new file mode 100644 index 00000000000..319cb1a4363 --- /dev/null +++ b/api/datadogV2/model_aws_traces_config.go @@ -0,0 +1,102 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSTracesConfig AWS Traces config +type AWSTracesConfig struct { + // AWS X-Ray services to collect traces from + XrayServices *XRayServicesList `json:"xray_services,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSTracesConfig instantiates a new AWSTracesConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSTracesConfig() *AWSTracesConfig { + this := AWSTracesConfig{} + return &this +} + +// NewAWSTracesConfigWithDefaults instantiates a new AWSTracesConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSTracesConfigWithDefaults() *AWSTracesConfig { + this := AWSTracesConfig{} + return &this +} + +// GetXrayServices returns the XrayServices field value if set, zero value otherwise. +func (o *AWSTracesConfig) GetXrayServices() XRayServicesList { + if o == nil || o.XrayServices == nil { + var ret XRayServicesList + return ret + } + return *o.XrayServices +} + +// GetXrayServicesOk returns a tuple with the XrayServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTracesConfig) GetXrayServicesOk() (*XRayServicesList, bool) { + if o == nil || o.XrayServices == nil { + return nil, false + } + return o.XrayServices, true +} + +// HasXrayServices returns a boolean if a field has been set. +func (o *AWSTracesConfig) HasXrayServices() bool { + return o != nil && o.XrayServices != nil +} + +// SetXrayServices gets a reference to the given XRayServicesList and assigns it to the XrayServices field. +func (o *AWSTracesConfig) SetXrayServices(v XRayServicesList) { + o.XrayServices = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSTracesConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.XrayServices != nil { + toSerialize["xray_services"] = o.XrayServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSTracesConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + XrayServices *XRayServicesList `json:"xray_services,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"xray_services"}) + } else { + return err + } + o.XrayServices = all.XrayServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_x_ray_services_include_all.go b/api/datadogV2/model_x_ray_services_include_all.go new file mode 100644 index 00000000000..89dbdaf70a2 --- /dev/null +++ b/api/datadogV2/model_x_ray_services_include_all.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// XRayServicesIncludeAll Include all services +type XRayServicesIncludeAll struct { + // Include all services + IncludeAll bool `json:"include_all"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewXRayServicesIncludeAll instantiates a new XRayServicesIncludeAll object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewXRayServicesIncludeAll(includeAll bool) *XRayServicesIncludeAll { + this := XRayServicesIncludeAll{} + this.IncludeAll = includeAll + return &this +} + +// NewXRayServicesIncludeAllWithDefaults instantiates a new XRayServicesIncludeAll object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewXRayServicesIncludeAllWithDefaults() *XRayServicesIncludeAll { + this := XRayServicesIncludeAll{} + return &this +} + +// GetIncludeAll returns the IncludeAll field value. +func (o *XRayServicesIncludeAll) GetIncludeAll() bool { + if o == nil { + var ret bool + return ret + } + return o.IncludeAll +} + +// GetIncludeAllOk returns a tuple with the IncludeAll field value +// and a boolean to check if the value has been set. +func (o *XRayServicesIncludeAll) GetIncludeAllOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IncludeAll, true +} + +// SetIncludeAll sets field value. +func (o *XRayServicesIncludeAll) SetIncludeAll(v bool) { + o.IncludeAll = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o XRayServicesIncludeAll) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_all"] = o.IncludeAll + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *XRayServicesIncludeAll) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeAll *bool `json:"include_all"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeAll == nil { + return fmt.Errorf("required field include_all missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_all"}) + } else { + return err + } + o.IncludeAll = *all.IncludeAll + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_x_ray_services_include_only.go b/api/datadogV2/model_x_ray_services_include_only.go new file mode 100644 index 00000000000..47fc8e80fed --- /dev/null +++ b/api/datadogV2/model_x_ray_services_include_only.go @@ -0,0 +1,151 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// XRayServicesIncludeOnly Include only these services +type XRayServicesIncludeOnly struct { + // Include only these services + IncludeOnly []string `json:"include_only"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewXRayServicesIncludeOnly instantiates a new XRayServicesIncludeOnly object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewXRayServicesIncludeOnly(includeOnly []string) *XRayServicesIncludeOnly { + this := XRayServicesIncludeOnly{} + this.IncludeOnly = includeOnly + return &this +} + +// NewXRayServicesIncludeOnlyWithDefaults instantiates a new XRayServicesIncludeOnly object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewXRayServicesIncludeOnlyWithDefaults() *XRayServicesIncludeOnly { + this := XRayServicesIncludeOnly{} + return &this +} + +// GetIncludeOnly returns the IncludeOnly field value. +func (o *XRayServicesIncludeOnly) GetIncludeOnly() []string { + if o == nil { + var ret []string + return ret + } + return o.IncludeOnly +} + +// GetIncludeOnlyOk returns a tuple with the IncludeOnly field value +// and a boolean to check if the value has been set. +func (o *XRayServicesIncludeOnly) GetIncludeOnlyOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.IncludeOnly, true +} + +// SetIncludeOnly sets field value. +func (o *XRayServicesIncludeOnly) SetIncludeOnly(v []string) { + o.IncludeOnly = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o XRayServicesIncludeOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_only"] = o.IncludeOnly + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *XRayServicesIncludeOnly) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeOnly *[]string `json:"include_only"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeOnly == nil { + return fmt.Errorf("required field include_only missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_only"}) + } else { + return err + } + o.IncludeOnly = *all.IncludeOnly + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} + +// NullableXRayServicesIncludeOnly handles when a null is used for XRayServicesIncludeOnly. +type NullableXRayServicesIncludeOnly struct { + value *XRayServicesIncludeOnly + isSet bool +} + +// Get returns the associated value. +func (v NullableXRayServicesIncludeOnly) Get() *XRayServicesIncludeOnly { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableXRayServicesIncludeOnly) Set(val *XRayServicesIncludeOnly) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableXRayServicesIncludeOnly) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableXRayServicesIncludeOnly) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableXRayServicesIncludeOnly initializes the struct as if Set has been called. +func NewNullableXRayServicesIncludeOnly(val *XRayServicesIncludeOnly) *NullableXRayServicesIncludeOnly { + return &NullableXRayServicesIncludeOnly{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableXRayServicesIncludeOnly) MarshalJSON() ([]byte, error) { + return datadog.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableXRayServicesIncludeOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return datadog.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_x_ray_services_list.go b/api/datadogV2/model_x_ray_services_list.go new file mode 100644 index 00000000000..3063c4ab99f --- /dev/null +++ b/api/datadogV2/model_x_ray_services_list.go @@ -0,0 +1,105 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// XRayServicesList - AWS X-Ray services to collect traces from +type XRayServicesList struct { + XRayServicesIncludeAll *XRayServicesIncludeAll + XRayServicesIncludeOnly *XRayServicesIncludeOnly + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// XRayServicesIncludeAllAsXRayServicesList is a convenience function that returns XRayServicesIncludeAll wrapped in XRayServicesList. +func XRayServicesIncludeAllAsXRayServicesList(v *XRayServicesIncludeAll) XRayServicesList { + return XRayServicesList{XRayServicesIncludeAll: v} +} + +// XRayServicesIncludeOnlyAsXRayServicesList is a convenience function that returns XRayServicesIncludeOnly wrapped in XRayServicesList. +func XRayServicesIncludeOnlyAsXRayServicesList(v *XRayServicesIncludeOnly) XRayServicesList { + return XRayServicesList{XRayServicesIncludeOnly: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *XRayServicesList) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into XRayServicesIncludeAll + err = datadog.Unmarshal(data, &obj.XRayServicesIncludeAll) + if err == nil { + if obj.XRayServicesIncludeAll != nil && obj.XRayServicesIncludeAll.UnparsedObject == nil { + jsonXRayServicesIncludeAll, _ := datadog.Marshal(obj.XRayServicesIncludeAll) + if string(jsonXRayServicesIncludeAll) == "{}" { // empty struct + obj.XRayServicesIncludeAll = nil + } else { + match++ + } + } else { + obj.XRayServicesIncludeAll = nil + } + } else { + obj.XRayServicesIncludeAll = nil + } + + // try to unmarshal data into XRayServicesIncludeOnly + err = datadog.Unmarshal(data, &obj.XRayServicesIncludeOnly) + if err == nil { + if obj.XRayServicesIncludeOnly != nil && obj.XRayServicesIncludeOnly.UnparsedObject == nil { + jsonXRayServicesIncludeOnly, _ := datadog.Marshal(obj.XRayServicesIncludeOnly) + if string(jsonXRayServicesIncludeOnly) == "{}" { // empty struct + obj.XRayServicesIncludeOnly = nil + } else { + match++ + } + } else { + obj.XRayServicesIncludeOnly = nil + } + } else { + obj.XRayServicesIncludeOnly = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.XRayServicesIncludeAll = nil + obj.XRayServicesIncludeOnly = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj XRayServicesList) MarshalJSON() ([]byte, error) { + if obj.XRayServicesIncludeAll != nil { + return datadog.Marshal(&obj.XRayServicesIncludeAll) + } + + if obj.XRayServicesIncludeOnly != nil { + return datadog.Marshal(&obj.XRayServicesIncludeOnly) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *XRayServicesList) GetActualInstance() interface{} { + if obj.XRayServicesIncludeAll != nil { + return obj.XRayServicesIncludeAll + } + + if obj.XRayServicesIncludeOnly != nil { + return obj.XRayServicesIncludeOnly + } + + // all schemas are nil + return nil +} diff --git a/examples/v2/aws-integration/CreateAWSAccount.go b/examples/v2/aws-integration/CreateAWSAccount.go new file mode 100644 index 00000000000..2ac75e19853 --- /dev/null +++ b/examples/v2/aws-integration/CreateAWSAccount.go @@ -0,0 +1,66 @@ +// AWS Integration - Create account config returns "AWS Account object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AWSAccountCreateRequest{ + Data: &datadogV2.AWSAccountCreateRequestData{ + Attributes: datadogV2.AWSAccountCreateRequestAttributes{ + AccountTags: *datadog.NewNullableList(&[]string{}), + AuthConfig: datadogV2.AWSAuthConfig{ + AWSAuthConfigKeys: &datadogV2.AWSAuthConfigKeys{ + AccessKeyId: "AKIAIOSFODNN7EXAMPLE", + SecretAccessKey: datadog.PtrString("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), + }}, + AwsAccountId: "123456789012", + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS, + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{}, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{}), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{ + CloudSecurityPostureManagementCollection: datadog.PtrBool(false), + ExtendedCollection: datadog.PtrBool(false), + }, + TracesConfig: &datadogV2.AWSTracesConfig{}, + }, + Type: datadog.PtrString("account"), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateAWSAccount", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.CreateAWSAccount(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.CreateAWSAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.CreateAWSAccount`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/DeleteAWSAccount.go b/examples/v2/aws-integration/DeleteAWSAccount.go new file mode 100644 index 00000000000..ad3e920fc23 --- /dev/null +++ b/examples/v2/aws-integration/DeleteAWSAccount.go @@ -0,0 +1,26 @@ +// AWS Integration - Delete account config returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteAWSAccount", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + r, err := api.DeleteAWSAccount(ctx, "aws_account_config_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.DeleteAWSAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/aws-integration/GetAWSAccount.go b/examples/v2/aws-integration/GetAWSAccount.go new file mode 100644 index 00000000000..3d8eb4898ec --- /dev/null +++ b/examples/v2/aws-integration/GetAWSAccount.go @@ -0,0 +1,30 @@ +// AWS Integration - Get account config returns "AWS Account object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetAWSAccount", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.GetAWSAccount(ctx, "aws_account_config_id") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.GetAWSAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.GetAWSAccount`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/ListAWSAccounts.go b/examples/v2/aws-integration/ListAWSAccounts.go new file mode 100644 index 00000000000..1791d36e3c4 --- /dev/null +++ b/examples/v2/aws-integration/ListAWSAccounts.go @@ -0,0 +1,30 @@ +// AWS Integration - Get all account configs returns "AWS Accounts List object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListAWSAccounts", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.ListAWSAccounts(ctx, *datadogV2.NewListAWSAccountsOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.ListAWSAccounts`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.ListAWSAccounts`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/UpdateAWSAccount.go b/examples/v2/aws-integration/UpdateAWSAccount.go new file mode 100644 index 00000000000..769bb04fb7f --- /dev/null +++ b/examples/v2/aws-integration/UpdateAWSAccount.go @@ -0,0 +1,67 @@ +// AWS Integration - Patch account config returns "AWS Account object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AWSAccountPatchRequest{ + Data: &datadogV2.AWSAccountPatchRequestData{ + Attributes: datadogV2.AWSAccountPatchRequestAttributes{ + AccountTags: *datadog.NewNullableList(&[]string{}), + AuthConfig: &datadogV2.AWSAuthConfig{ + AWSAuthConfigKeys: &datadogV2.AWSAuthConfigKeys{ + AccessKeyId: "AKIAIOSFODNN7EXAMPLE", + SecretAccessKey: datadog.PtrString("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), + }}, + AwsAccountId: "123456789012", + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS.Ptr(), + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{}, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{}), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{ + CloudSecurityPostureManagementCollection: datadog.PtrBool(false), + ExtendedCollection: datadog.PtrBool(false), + }, + TracesConfig: &datadogV2.AWSTracesConfig{}, + }, + Id: datadog.PtrString("123456789012"), + Type: datadog.PtrString("account"), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateAWSAccount", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.UpdateAWSAccount(ctx, "aws_account_config_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.UpdateAWSAccount`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.UpdateAWSAccount`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index fcd6d96bcfa..9301ddb7ecb 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -63,6 +63,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "DowntimesApi": reflect.ValueOf(datadogV2.NewDowntimesApi), "EventsApi": reflect.ValueOf(datadogV2.NewEventsApi), "IncidentsApi": reflect.ValueOf(datadogV2.NewIncidentsApi), + "AWSIntegrationApi": reflect.ValueOf(datadogV2.NewAWSIntegrationApi), "GCPIntegrationApi": reflect.ValueOf(datadogV2.NewGCPIntegrationApi), "MicrosoftTeamsIntegrationApi": reflect.ValueOf(datadogV2.NewMicrosoftTeamsIntegrationApi), "OpsgenieIntegrationApi": reflect.ValueOf(datadogV2.NewOpsgenieIntegrationApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..8b93508ca43 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:49.547Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..2b4b17bad30 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":[],"auth_config":{"role_name":"test"},"aws_account_id":"123456789012","aws_partition":"aws","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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":{"id":"7cd9c604-8bc9-4491-8b17-3754d09a0370","type":"account","attributes":{"account_tags":null,"auth_config":{"role_name":"test","external_id":"1c94fa9639fd4266b96ce33e03277ce1"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-08-21T20:16:50.202384947Z","logs_config":{"lambda_forwarder":{"sources":["s3"]}},"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"]}},"modified_at":"2024-08-21T20:16:50.202388738Z","resources_config":{"cloud_security_posture_management_collection":false}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..71e66a196ba --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:50.495Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..d51d17c3637 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"errors":[{"title":"Generic Error","detail":"invalid partition: aws-test"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.freeze new file mode 100644 index 00000000000..520064df1eb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.freeze @@ -0,0 +1 @@ +2024-08-09T18:59:51.401Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.yaml new file mode 100644 index 00000000000..85f5f0e9075 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_invalid_aws_partition_returns_400_API_error_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"errors":[{"title":"Generic Error","detail":"invalid partition: aws-test"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..2e16a115a03 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-08-09T18:59:51.926Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..813a8ac6fbc --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_with_valid_config_returns_AWS_Account_object_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"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}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/172322422800 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.freeze new file mode 100644 index 00000000000..64f46e14455 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:50.548Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.yaml new file mode 100644 index 00000000000..cd16d7a8bab --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_No_Content_response.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":{"id":"8d2160c4-bdaa-4ea5-b7f1-409397c37b95","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"dde1d3976baf4142afe77d6de69f7e0a"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:50.894308437Z","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:50.894312466Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '{"errors":[{"status":"404","title":"Account not found","detail":"AWS account + with provided id is not integrated"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..0fe9c2b7abb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:51.232Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..365f7048bf6 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_AWS_Account_object_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":{"id":"c59a664c-db34-477f-8a3c-583598fb2aba","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"cea32c6830d7418e8d44c1f5b75b5952"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:51.577022335Z","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:51.577025805Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '{"data":{"id":"c59a664c-db34-477f-8a3c-583598fb2aba","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"cea32c6830d7418e8d44c1f5b75b5952"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:51.577022Z","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:51.577026Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.freeze new file mode 100644 index 00000000000..2d33a4c3c40 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:51.957Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.yaml new file mode 100644 index 00000000000..e1df8406b41 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_all_account_configs_returns_AWS_Accounts_List_object_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":{"id":"7b9eec48-fb24-465b-bebf-e063c87296cc","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"c3a51b8c3e5147da85b520a33acf1a52"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:52.289116699Z","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:52.28912346Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":[{"id":"4b3caadb-530b-4bfc-893e-55e7681fb39a","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723651405"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"32774b5310a047b7b0ee29448c42f399"},"aws_account_id":"491029950495","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:03:27.13777Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:03:27.137774Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"99b96f98-0e1f-4940-bc75-f6431b7d8ab1","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723651394"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"13c3066bac474fe5aa2b98fafab7ccbd"},"aws_account_id":"971029752565","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:03:17.022908Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:03:17.022913Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"18c92e1a-56b8-4aa6-8e1e-ff482824b3a6","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723651400"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"fe7a101024234b46af4f3b3f07a5a969"},"aws_account_id":"100551011015","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:03:21.773669Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:03:21.773674Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"d84eac73-abfe-4c0c-9abb-96f0c081afcf","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652070"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"768ba133513445ae96dfa439baa694d8"},"aws_account_id":"575554569949","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:14:32.002676Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:14:32.00268Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"bab03a9e-7a61-402b-ac1d-51388b3487f7","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652074"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"116bd1f039ba436cbf14f6858c8725c2"},"aws_account_id":"489955505155","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:14:36.433368Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:14:36.433373Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"e69bcc2a-de44-4674-a599-86d5fa2884ab","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652079"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"28f9c60b14b945a7bb9d74d47d2dd74e"},"aws_account_id":"535051554910","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:14:40.903898Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:14:40.903902Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"ab9ee599-8aea-46f6-a8b4-f5407ab80965","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652325"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"188ef13911894f83991feb3172d13461"},"aws_account_id":"539810098100","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:18:46.625393Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:18:46.625397Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"47364fac-c2d2-47d2-99a6-1c625652becc","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652329"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"b9ae83a208384803b0067d29b213bdc9"},"aws_account_id":"102985551501","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:18:51.141181Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:18:51.141185Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"2d5be80a-cfed-4273-94d8-640c845d40dd","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652334"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"989b30e951f24195ad65dc3c194011d0"},"aws_account_id":"504997535199","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T16:18:55.653203Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T16:18:55.653208Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"a1f86e4a-c358-4a2c-be55-ab7ad97e4bd8","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663289"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"84a2faf38d09423384d45f45edf25110"},"aws_account_id":"544910010251","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:21:32.915998Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:21:32.916003Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"9244eb20-29af-4ccc-abd7-3febcf42825f","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663296"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"2f94cbf336454bfd9279000d07406314"},"aws_account_id":"985154499910","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:21:38.524154Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:21:38.52416Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"81233214-e56e-442d-ad5e-d46535c9d8c2","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663301"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"29ad17858683418cb2a9353676e69760"},"aws_account_id":"565654100555","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:21:43.183098Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:21:43.183102Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"bb2d69b1-53e4-4b18-937e-f2c9bd7a28a0","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663351"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"7a72d4f167434063b5a56a762095c1ee"},"aws_account_id":"985656100100","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:22:34.264824Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:22:34.264829Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"18a6608e-f002-4881-9e38-8f7f23a51847","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663358"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"ae2d4d1b231f4ac1b3923d42a0a5bab5"},"aws_account_id":"101975251995","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:22:40.136147Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:22:40.136152Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"7dba8e9b-a140-4ef6-92a3-4c500e4315b3","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663363"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"79c8da69b177497d9d7400ff599cd81f"},"aws_account_id":"525257495254","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:22:44.776388Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:22:44.776392Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"02a5f1f5-15ea-48bf-b1e1-4797f0ab5092","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663978"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"17e16f140c544003a48ab212ccb47483"},"aws_account_id":"501015050989","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:33:00.639214Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:33:00.639218Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"582c74ee-e938-4a24-8810-d3bcc5840487","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663983"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e78952ff022c4449a7e7cc9ad145a611"},"aws_account_id":"505452565298","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:33:05.436943Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:33:05.436947Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"e40105e8-0e02-44c3-8a7e-586be07ea239","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723663988"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"4e1dbd2df6944274a00bb0abd6ee65c3"},"aws_account_id":"975157102102","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:33:10.190987Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:33:10.190993Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"87efc664-4d92-4020-b700-40d6d430147e","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664043"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e8be3356a0ca497e86dcbff1dcf8a209"},"aws_account_id":"561001021021","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:34:05.109384Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:34:05.109388Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"850c632b-aa06-4759-9bc8-7325814151aa","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664048"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"eda6905d589942c3a53911b044e50a2b"},"aws_account_id":"571005510154","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:34:09.883997Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:34:09.884002Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"d264b0c4-9b3b-487a-9670-5b4dc1dd2b9c","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664052"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"cb158545233c4ea8b13009e91ca1de95"},"aws_account_id":"555499100509","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:34:14.198109Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:34:14.198115Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"c674d1c8-3dce-4d44-b124-308c1cacac7a","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664158"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"aba5477d3579405ebd50f590f2202681"},"aws_account_id":"574848101100","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:36:00.364727Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:36:00.364732Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"be6360de-5c67-45fb-83de-f5af69362906","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664163"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"b8e306b6f51946c59b421d0588185f78"},"aws_account_id":"565555985010","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:36:04.979037Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:36:04.979042Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"d3ddd5a4-29b2-4605-a780-ce5d3fa4b90d","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664167"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"95e8a93e8c2c4221a57ed3af2e776a53"},"aws_account_id":"971025210152","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:36:09.458003Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:36:09.458007Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"00c1f28b-2a21-4db6-85eb-0f98fc134948","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664757"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e5795d7b7f724bafb01a5c0c91902a88"},"aws_account_id":"541005597100","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:45:59.09343Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:45:59.093435Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"36733cd1-fbcf-484b-bb4a-213fe5f10402","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664762"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"d8ae8d56f4f44a7c99521623f50b6e37"},"aws_account_id":"571015049489","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:46:03.698466Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:46:03.698472Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"20ada868-0e95-4285-af31-d6770a923fb3","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664767"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"830168aa11d64ba9b69a37927492f706"},"aws_account_id":"102100974852","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:46:08.942554Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:46:08.942558Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"020f7c35-c18b-468c-81b5-e64c6d68c645","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664855"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"ae4fc348b0f24fab96bdc1756278321b"},"aws_account_id":"529756575054","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:47:37.36374Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:47:37.363744Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"bfbef746-4acb-4f5d-befd-f30365b13401","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664860"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"3b5fe428e2254c9ea9b7ac0537d53ddf"},"aws_account_id":"494850521014","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:47:41.810189Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:47:41.810194Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"2c72a0ae-7389-4d2c-8433-fb1f4d60fd4a","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664864"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"685fb54445e24d2297e23d4583ec8569"},"aws_account_id":"489899484849","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:47:46.137682Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:47:46.137686Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"d4df7e40-ea43-4aa4-bcae-4f69213b1dc5","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664972"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"4899fbfeceab4d68a45d7e7a754b490a"},"aws_account_id":"974810010248","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:49:34.412446Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:49:34.412451Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"9ebd8973-a6eb-4cf5-a8db-86525c1b3358","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664977"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"014a4def58b14526b34ba9988f2b9599"},"aws_account_id":"525555995354","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:49:39.454533Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:49:39.454537Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"20931833-df77-4107-bd06-4ca650ab5738","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723664982"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"3b2f0e5a390d448b8fb69a2a79cd7980"},"aws_account_id":"984897101995","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:49:44.033763Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:49:44.033767Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"5c5032e0-c243-4cf5-9f37-02f06cf2bf4b","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723665067"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"0309b2d9353248c693bb3e584b4e547f"},"aws_account_id":"545710148515","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:51:08.805857Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:51:08.805861Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"573325be-8103-454a-8b56-9db7dbf56a94","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723665071"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"bc0f4a33f3a34554bbdb86618a475651"},"aws_account_id":"561025410149","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:51:13.310149Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:51:13.310155Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"d1c93b73-3651-4cbf-a103-03015dfde90e","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723665076"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"1dc035bad0ac4697b0a2312eda585003"},"aws_account_id":"511025299565","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:51:17.799641Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:51:17.799644Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"bc0d994b-0a9d-4d54-b67d-edde2308c5ef","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723665174"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"da807dcbe42b4b48a6ba667fe6879081"},"aws_account_id":"575357485298","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:52:56.442523Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:52:56.442526Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"6af95f09-a3c0-413e-aae7-c9696aee3220","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723665179"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"c67a53956753472d8a7e298917b4fdd5"},"aws_account_id":"989753569898","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:53:01.138125Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:53:01.13813Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"f762d066-8447-435e-b733-32663e240a96","type":"account","attributes":{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723665184"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"745bac876e1f4a4db7551dd4a37b5624"},"aws_account_id":"529852100555","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-08-14T19:53:05.921379Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"modified_at":"2024-08-14T19:53:05.921383Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"0f618f7f-a3ab-43a1-a5e8-14356e1357d3","type":"account","attributes":{"auth_config":{"role_name":"test","external_id":"5305ff8c8ce24a83a67194b4fc1a8162"},"aws_account_id":"172322422800","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-08-12T17:07:16.174791Z","logs_config":{"lambda_forwarder":{"sources":["s3"]}},"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"]}},"modified_at":"2024-08-12T17:07:16.174795Z","resources_config":{"cloud_security_posture_management_collection":false}}},{"id":"376856e9-02a4-4257-835a-92ca23bc20fa","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"7e7aec3d97c44dfcb48d28f5ad456df1"},"aws_account_id":"172348305100","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-12T17:17:31.806768Z","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-12T17:17:31.806772Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"73db893a-b32a-4634-a16d-a5fae0d04218","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"cdd867b8537d44e9bcadcad22d3b9d54"},"aws_account_id":"172348305200","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-12T17:17:33.006843Z","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-12T17:17:33.006847Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"735f1e95-77fc-42ad-ab50-dbd709477844","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"ce5ead92dba74402aaab90088c569a12"},"aws_account_id":"172348305300","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-12T17:17:33.500988Z","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-12T17:17:33.500992Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"67c979dc-9614-4444-bbc2-fa19662be682","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"3a3284531f69454c8c2e91c3257f0be3"},"aws_account_id":"171092901600","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-03-20T10:03:37.258717Z","metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-03-20T10:03:38.455814Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":true}}},{"id":"95d999f7-54fc-423a-b48f-d41f06de9e94","type":"account","attributes":{"auth_config":{"access_key_id":"1011015010051561"},"aws_account_id":"101101501005","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-04-16T18:25:34.660792Z","metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-04-16T18:25:34.660797Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false}}},{"id":"07e0487c-bc0c-4738-8c17-30af9066beda","type":"account","attributes":{"auth_config":{"access_key_id":"4850102521029797"},"aws_account_id":"485010252102","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-04-16T18:25:41.126481Z","metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-04-16T18:25:41.126485Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false}}},{"id":"1b9e7c32-fd8d-4604-9be7-306d90366f21","type":"account","attributes":{"auth_config":{"role_name":"datadog-integration-role","external_id":"70aed59cbeff4d2a87d7093be5df8813"},"aws_account_id":"144234234234","aws_partition":"aws","aws_regions":{"include_only":["us-east-1","us-east-2","us-west-1","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-04-24T13:39:30.506151Z","metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-04-24T13:47:18.840472Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"96e45695-2153-4e51-a775-ed8550cde914","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"53f2e7dd4f4f437d857bdd79f995689e"},"aws_account_id":"170059471500","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-02-29T17:27:01.839658Z","metrics_config":{"enabled":false,"automute_enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-02-29T17:27:01.83966Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"8787bb7a-bc57-4051-9648-808269670c91","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e708623c7a494195a653a73cdd0d5718"},"aws_account_id":"170076337600","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-02-29T17:27:03.178839Z","metrics_config":{"enabled":false,"automute_enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-02-29T17:27:03.178841Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}},{"id":"7b9eec48-fb24-465b-bebf-e063c87296cc","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"c3a51b8c3e5147da85b520a33acf1a52"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:52.289117Z","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:52.289123Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze new file mode 100644 index 00000000000..042faedbb73 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:52.731Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml new file mode 100644 index 00000000000..3571d1e61d0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"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}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '{"errors":[{"title":"Generic Error","detail":"invalid partition: aws-test"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..c263b61a284 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:53.385Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..321f285d010 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":{"id":"5fe9d8f3-60e8-4664-b247-487a603b74fb","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"fb5c348a9a774c86b6e2c334cb43b632"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:53.732493133Z","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.732498623Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":[],"auth_config":{"role_name":"test"},"aws_account_id":"123456789012","aws_partition":"aws","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"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '{"data":{"id":"5fe9d8f3-60e8-4664-b247-487a603b74fb","type":"account","attributes":{"account_tags":null,"auth_config":{"role_name":"test","external_id":"fb5c348a9a774c86b6e2c334cb43b632"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-08-21T20:16:53.732493Z","logs_config":{"lambda_forwarder":{"sources":["s3"]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":null}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-08-21T20:16:54.178225776Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/features/v1/aws_integration.feature b/tests/scenarios/features/v1/aws_integration.feature index 017326abd32..08c57bbc61e 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 5459cbb7947..622d8d7deba 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 00000000000..0523c8ca5cb --- /dev/null +++ b/tests/scenarios/features/v2/aws_integration.feature @@ -0,0 +1,116 @@ +@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 + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Create account config returns "AWS Account object" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": [], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "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 + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Create account config returns "Bad Request" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": [], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "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 + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Create account config returns "Conflict" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": [], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "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 + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Delete account config returns "Bad Request" response + Given operation "DeleteAWSAccount" enabled + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Delete account config returns "No Content" response + Given operation "DeleteAWSAccount" enabled + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Delete account config returns "Not Found" response + Given operation "DeleteAWSAccount" enabled + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Get account config returns "AWS Account object" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 AWS Account object + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Get account config returns "Bad Request" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Get account config returns "Not Found" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Get all account configs 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 + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Patch account config returns "AWS Account object" response + Given operation "UpdateAWSAccount" enabled + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_tags": [], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "id": "123456789012", "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Patch account config returns "Bad Request" response + Given operation "UpdateAWSAccount" enabled + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_tags": [], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "id": "123456789012", "type": "account"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aws-integrations + Scenario: AWS Integration - Patch account config returns "Not Found" response + Given operation "UpdateAWSAccount" enabled + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"account_tags": [], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "id": "123456789012", "type": "account"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index efc7bed91b5..ef15a18b141 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -200,6 +200,18 @@ "tag": "Incidents", "operationId": "CreateIncidentTodo" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"account\",\n \"attributes\": {\n \"account_tags\": [\n \"test:test\"\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 \"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 \"test:test\"\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 62da7c99ef9..524118ff900 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -745,6 +745,43 @@ "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" + } + }, "ListGCPSTSAccounts": { "tag": "GCP Integration", "undo": {