From 25d69fc65992b4c977bbca1614cf397903c57f5a Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 14 Aug 2024 18:53:53 +0000 Subject: [PATCH] Regenerate client from commit db31f84c of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 591 ++++++++++++++++++ api/datadog/configuration.go | 5 + api/datadogV2/api_aws_integration.go | 410 ++++++++++++ api/datadogV2/doc.go | 5 + .../model_aws_account_create_request.go | 111 ++++ ...l_aws_account_create_request_attributes.go | 110 ++++ ...model_aws_account_create_request_config.go | 410 ++++++++++++ .../model_aws_account_create_request_data.go | 184 ++++++ api/datadogV2/model_aws_account_partition.go | 68 ++ .../model_aws_account_patch_request.go | 111 ++++ ...el_aws_account_patch_request_attributes.go | 110 ++++ .../model_aws_account_patch_request_config.go | 418 +++++++++++++ .../model_aws_account_patch_request_data.go | 184 ++++++ api/datadogV2/model_aws_account_response.go | 111 ++++ .../model_aws_account_response_attributes.go | 110 ++++ .../model_aws_account_response_config.go | 489 +++++++++++++++ .../model_aws_account_response_data.go | 184 ++++++ api/datadogV2/model_aws_accounts_response.go | 111 ++++ .../model_aws_accounts_response_attributes.go | 101 +++ .../model_aws_accounts_response_data.go | 180 ++++++ 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 | 101 +++ api/datadogV2/model_x_ray_services_list.go | 105 ++++ .../v2/aws-integration/CreateAWSAccount.go | 84 +++ .../v2/aws-integration/DeleteAWSAccount.go | 29 + examples/v2/aws-integration/GetAWSAccount.go | 33 + .../v2/aws-integration/ListAWSAccounts.go | 30 + .../v2/aws-integration/UpdateAWSAccount.go | 87 +++ 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 | 130 ++++ tests/scenarios/features/v2/given.json | 12 + tests/scenarios/features/v2/undo.json | 37 ++ 70 files changed, 7383 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_config.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_config.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_config.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_accounts_response_attributes.go create mode 100644 api/datadogV2/model_aws_accounts_response_data.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 f5dfa4ef171..1c4ef8fbc7e 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-12 20:42:10.824965", - "spec_repo_commit": "7a16d6c5" + "regenerated": "2024-08-14 18:52:05.942484", + "spec_repo_commit": "db31f84c" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-12 20:42:10.842550", - "spec_repo_commit": "7a16d6c5" + "regenerated": "2024-08-14 18:52:05.960633", + "spec_repo_commit": "db31f84c" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3a325ed5d99..b2f6164f8a7 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' + AWSAccountIDPathParameter: + description: The ID of the AWS Account Integration Config + in: path + name: aws_account_id + required: true + schema: + type: string ApplicationKeyFilterCreatedAtEndParameter: description: Only include application keys created on or before the specified date. @@ -821,6 +828,394 @@ 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: AWS Account Create Request attributes + properties: + aws_account: + $ref: '#/components/schemas/AWSAccountCreateRequestConfig' + required: + - aws_account + type: object + AWSAccountCreateRequestConfig: + 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' + id: + $ref: '#/components/schemas/AWSAccountID' + 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: AWS Account Patch Request attributes + properties: + aws_account: + $ref: '#/components/schemas/AWSAccountPatchRequestConfig' + required: + - aws_account + type: object + AWSAccountPatchRequestConfig: + 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: AWS Account Response attributes + properties: + aws_account: + $ref: '#/components/schemas/AWSAccountResponseConfig' + required: + - aws_account + type: object + AWSAccountResponseConfig: + 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: + $ref: '#/components/schemas/AWSAccountsResponseData' + type: object + AWSAccountsResponseAttributes: + description: List All AWS Account Response attributes + properties: + aws_accounts: + description: List of AWS Account Integration Configs + items: + $ref: '#/components/schemas/AWSAccountResponseConfig' + type: array + required: + - aws_accounts + type: object + AWSAccountsResponseData: + description: List All AWS Accounts Response body + properties: + attributes: + $ref: '#/components/schemas/AWSAccountsResponseAttributes' + id: + description: Identifier for the response type + example: get_all_accounts + type: string + type: + description: Type of response object + example: accounts + type: string + required: + - attributes + 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 + type: string + secret_access_key: + description: AWS Secret Access Key + 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 + 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 + type: boolean + required: + - exclude_all + AWSNamespaceFiltersExcludeOnly: + description: Exclude only these namespaces + properties: + exclude_only: + description: Exclude only these namespaces + items: + example: AWS/EC2 + type: string + type: array + required: + - exclude_only + AWSNamespaceFiltersIncludeAll: + description: Include all namespaces + properties: + include_all: + description: Include all namespaces + type: boolean + required: + - include_all + AWSNamespaceFiltersIncludeOnly: + description: Include only these namespaces + properties: + include_only: + description: Include only these namespaces + 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 + type: boolean + required: + - include_all + AWSRegionsIncludeOnly: + description: Include only these regions + properties: + include_only: + description: Include only these regions + items: + example: us-east-1 + type: string + type: array + required: + - include_only AWSRelatedAccount: description: AWS related account. properties: @@ -864,6 +1259,24 @@ 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. + 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`. + 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: @@ -24015,6 +24428,30 @@ components: description: The id of the instance. type: string type: object + XRayServicesIncludeAll: + description: Include all services + properties: + include_all: + description: Include all services + type: boolean + required: + - include_all + XRayServicesIncludeOnly: + description: Include only these services + properties: + include_only: + description: Include only these services + 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. @@ -28438,6 +28875,155 @@ 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 all AWS Account Integration Configs + operationId: ListAWSAccounts + 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_id}: + delete: + description: Delete an AWS Account Integration Config + operationId: DeleteAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountIDPathParameter' + 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/AWSAccountIDPathParameter' + 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/AWSAccountIDPathParameter' + 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 @@ -38310,6 +38896,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..6bb305449aa --- /dev/null +++ b/api/datadogV2/api_aws_integration.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 ( + _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, awsAccountId 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_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountId, "")), -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, awsAccountId 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_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountId, "")), -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 +} + +// ListAWSAccounts AWS Integration - Get all account configs. +// Get all AWS Account Integration Configs +func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context) (AWSAccountsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSAccountsResponse + ) + + 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{} + 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, awsAccountId 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_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountId, "")), -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 381029a65d6..ab901c5fa7f 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..91d283745b7 --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request_attributes.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountCreateRequestAttributes AWS Account Create Request attributes +type AWSAccountCreateRequestAttributes struct { + // The AWS Account Integration Config to be created + AwsAccount AWSAccountCreateRequestConfig `json:"aws_account"` + // 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(awsAccount AWSAccountCreateRequestConfig) *AWSAccountCreateRequestAttributes { + this := AWSAccountCreateRequestAttributes{} + this.AwsAccount = awsAccount + 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{} + return &this +} + +// GetAwsAccount returns the AwsAccount field value. +func (o *AWSAccountCreateRequestAttributes) GetAwsAccount() AWSAccountCreateRequestConfig { + if o == nil { + var ret AWSAccountCreateRequestConfig + return ret + } + return o.AwsAccount +} + +// GetAwsAccountOk returns a tuple with the AwsAccount field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsAccountOk() (*AWSAccountCreateRequestConfig, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccount, true +} + +// SetAwsAccount sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAwsAccount(v AWSAccountCreateRequestConfig) { + o.AwsAccount = 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) + } + toSerialize["aws_account"] = o.AwsAccount + + 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 { + AwsAccount *AWSAccountCreateRequestConfig `json:"aws_account"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AwsAccount == nil { + return fmt.Errorf("required field aws_account missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aws_account"}) + } else { + return err + } + + hasInvalidField := false + if all.AwsAccount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AwsAccount = *all.AwsAccount + + 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_config.go b/api/datadogV2/model_aws_account_create_request_config.go new file mode 100644 index 00000000000..51abe3fc8eb --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request_config.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" +) + +// AWSAccountCreateRequestConfig The AWS Account Integration Config to be created +type AWSAccountCreateRequestConfig 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:"-"` +} + +// NewAWSAccountCreateRequestConfig instantiates a new AWSAccountCreateRequestConfig 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 NewAWSAccountCreateRequestConfig(authConfig AWSAuthConfig, awsAccountId string, awsPartition AWSAccountPartition) *AWSAccountCreateRequestConfig { + this := AWSAccountCreateRequestConfig{} + this.AuthConfig = authConfig + this.AwsAccountId = awsAccountId + this.AwsPartition = awsPartition + return &this +} + +// NewAWSAccountCreateRequestConfigWithDefaults instantiates a new AWSAccountCreateRequestConfig 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 NewAWSAccountCreateRequestConfigWithDefaults() *AWSAccountCreateRequestConfig { + this := AWSAccountCreateRequestConfig{} + 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountCreateRequestConfig) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountCreateRequestConfig) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) GetAuthConfigOk() (*AWSAuthConfig, bool) { + if o == nil { + return nil, false + } + return &o.AuthConfig, true +} + +// SetAuthConfig sets field value. +func (o *AWSAccountCreateRequestConfig) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountCreateRequestConfig) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) GetAwsPartitionOk() (*AWSAccountPartition, bool) { + if o == nil { + return nil, false + } + return &o.AwsPartition, true +} + +// SetAwsPartition sets field value. +func (o *AWSAccountCreateRequestConfig) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountCreateRequestConfig) 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 *AWSAccountCreateRequestConfig) 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..d15d7cd0671 --- /dev/null +++ b/api/datadogV2/model_aws_account_create_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" +) + +// AWSAccountCreateRequestData AWS Account Create Request data +type AWSAccountCreateRequestData struct { + // AWS Account Create Request attributes + Attributes AWSAccountCreateRequestAttributes `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:"-"` +} + +// 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 +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestData) 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 *AWSAccountCreateRequestData) 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 *AWSAccountCreateRequestData) 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 *AWSAccountCreateRequestData) SetId(v string) { + o.Id = &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.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 *AWSAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountCreateRequestAttributes `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_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..03628342f2e --- /dev/null +++ b/api/datadogV2/model_aws_account_patch_request_attributes.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountPatchRequestAttributes AWS Account Patch Request attributes +type AWSAccountPatchRequestAttributes struct { + // The AWS Account Integration Config to be updated + AwsAccount AWSAccountPatchRequestConfig `json:"aws_account"` + // 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(awsAccount AWSAccountPatchRequestConfig) *AWSAccountPatchRequestAttributes { + this := AWSAccountPatchRequestAttributes{} + this.AwsAccount = awsAccount + 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{} + return &this +} + +// GetAwsAccount returns the AwsAccount field value. +func (o *AWSAccountPatchRequestAttributes) GetAwsAccount() AWSAccountPatchRequestConfig { + if o == nil { + var ret AWSAccountPatchRequestConfig + return ret + } + return o.AwsAccount +} + +// GetAwsAccountOk returns a tuple with the AwsAccount field value +// and a boolean to check if the value has been set. +func (o *AWSAccountPatchRequestAttributes) GetAwsAccountOk() (*AWSAccountPatchRequestConfig, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccount, true +} + +// SetAwsAccount sets field value. +func (o *AWSAccountPatchRequestAttributes) SetAwsAccount(v AWSAccountPatchRequestConfig) { + o.AwsAccount = 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) + } + toSerialize["aws_account"] = o.AwsAccount + + 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 { + AwsAccount *AWSAccountPatchRequestConfig `json:"aws_account"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AwsAccount == nil { + return fmt.Errorf("required field aws_account missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aws_account"}) + } else { + return err + } + + hasInvalidField := false + if all.AwsAccount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AwsAccount = *all.AwsAccount + + 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_config.go b/api/datadogV2/model_aws_account_patch_request_config.go new file mode 100644 index 00000000000..301628ae6e7 --- /dev/null +++ b/api/datadogV2/model_aws_account_patch_request_config.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" +) + +// AWSAccountPatchRequestConfig The AWS Account Integration Config to be updated +type AWSAccountPatchRequestConfig 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:"-"` +} + +// NewAWSAccountPatchRequestConfig instantiates a new AWSAccountPatchRequestConfig 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 NewAWSAccountPatchRequestConfig(awsAccountId string) *AWSAccountPatchRequestConfig { + this := AWSAccountPatchRequestConfig{} + this.AwsAccountId = awsAccountId + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = &awsPartition + return &this +} + +// NewAWSAccountPatchRequestConfigWithDefaults instantiates a new AWSAccountPatchRequestConfig 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 NewAWSAccountPatchRequestConfigWithDefaults() *AWSAccountPatchRequestConfig { + this := AWSAccountPatchRequestConfig{} + 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountPatchRequestConfig) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountPatchRequestConfig) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = &v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountPatchRequestConfig) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = &v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountPatchRequestConfig) 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 *AWSAccountPatchRequestConfig) 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..7d2da68b057 --- /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 { + // AWS Account Patch Request attributes + 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..c9a7cd48fb2 --- /dev/null +++ b/api/datadogV2/model_aws_account_response_attributes.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountResponseAttributes AWS Account Response attributes +type AWSAccountResponseAttributes struct { + // The AWS Account Integration Config + AwsAccount AWSAccountResponseConfig `json:"aws_account"` + // 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(awsAccount AWSAccountResponseConfig) *AWSAccountResponseAttributes { + this := AWSAccountResponseAttributes{} + this.AwsAccount = awsAccount + 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{} + return &this +} + +// GetAwsAccount returns the AwsAccount field value. +func (o *AWSAccountResponseAttributes) GetAwsAccount() AWSAccountResponseConfig { + if o == nil { + var ret AWSAccountResponseConfig + return ret + } + return o.AwsAccount +} + +// GetAwsAccountOk returns a tuple with the AwsAccount field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAwsAccountOk() (*AWSAccountResponseConfig, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccount, true +} + +// SetAwsAccount sets field value. +func (o *AWSAccountResponseAttributes) SetAwsAccount(v AWSAccountResponseConfig) { + o.AwsAccount = 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) + } + toSerialize["aws_account"] = o.AwsAccount + + 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 { + AwsAccount *AWSAccountResponseConfig `json:"aws_account"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AwsAccount == nil { + return fmt.Errorf("required field aws_account missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aws_account"}) + } else { + return err + } + + hasInvalidField := false + if all.AwsAccount.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AwsAccount = *all.AwsAccount + + 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_config.go b/api/datadogV2/model_aws_account_response_config.go new file mode 100644 index 00000000000..dac1bf96881 --- /dev/null +++ b/api/datadogV2/model_aws_account_response_config.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" +) + +// AWSAccountResponseConfig The AWS Account Integration Config +type AWSAccountResponseConfig 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:"-"` +} + +// NewAWSAccountResponseConfig instantiates a new AWSAccountResponseConfig 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 NewAWSAccountResponseConfig(authConfig AWSAuthConfig, awsAccountId string, awsPartition AWSAccountPartition) *AWSAccountResponseConfig { + this := AWSAccountResponseConfig{} + this.AuthConfig = authConfig + this.AwsAccountId = awsAccountId + this.AwsPartition = awsPartition + return &this +} + +// NewAWSAccountResponseConfigWithDefaults instantiates a new AWSAccountResponseConfig 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 NewAWSAccountResponseConfigWithDefaults() *AWSAccountResponseConfig { + this := AWSAccountResponseConfig{} + 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountResponseConfig) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountResponseConfig) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) GetAuthConfigOk() (*AWSAuthConfig, bool) { + if o == nil { + return nil, false + } + return &o.AuthConfig, true +} + +// SetAuthConfig sets field value. +func (o *AWSAccountResponseConfig) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountResponseConfig) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) GetAwsPartitionOk() (*AWSAccountPartition, bool) { + if o == nil { + return nil, false + } + return &o.AwsPartition, true +} + +// SetAwsPartition sets field value. +func (o *AWSAccountResponseConfig) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountResponseConfig) 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 *AWSAccountResponseConfig) 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..fe6e2b0f582 --- /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 { + // AWS Account Response attributes + 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..d170de2b5dd --- /dev/null +++ b/api/datadogV2/model_aws_accounts_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" +) + +// AWSAccountsResponse AWS Accounts response body +type AWSAccountsResponse struct { + // List All AWS Accounts Response body + Data *AWSAccountsResponseData `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() AWSAccountsResponseData { + if o == nil || o.Data == nil { + var ret AWSAccountsResponseData + 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() (*AWSAccountsResponseData, 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 AWSAccountsResponseData and assigns it to the Data field. +func (o *AWSAccountsResponse) SetData(v AWSAccountsResponseData) { + 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 *AWSAccountsResponseData `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_accounts_response_attributes.go b/api/datadogV2/model_aws_accounts_response_attributes.go new file mode 100644 index 00000000000..db1422bfec5 --- /dev/null +++ b/api/datadogV2/model_aws_accounts_response_attributes.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" +) + +// AWSAccountsResponseAttributes List All AWS Account Response attributes +type AWSAccountsResponseAttributes struct { + // List of AWS Account Integration Configs + AwsAccounts []AWSAccountResponseConfig `json:"aws_accounts"` + // 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:"-"` +} + +// NewAWSAccountsResponseAttributes instantiates a new AWSAccountsResponseAttributes 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 NewAWSAccountsResponseAttributes(awsAccounts []AWSAccountResponseConfig) *AWSAccountsResponseAttributes { + this := AWSAccountsResponseAttributes{} + this.AwsAccounts = awsAccounts + return &this +} + +// NewAWSAccountsResponseAttributesWithDefaults instantiates a new AWSAccountsResponseAttributes 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 NewAWSAccountsResponseAttributesWithDefaults() *AWSAccountsResponseAttributes { + this := AWSAccountsResponseAttributes{} + return &this +} + +// GetAwsAccounts returns the AwsAccounts field value. +func (o *AWSAccountsResponseAttributes) GetAwsAccounts() []AWSAccountResponseConfig { + if o == nil { + var ret []AWSAccountResponseConfig + return ret + } + return o.AwsAccounts +} + +// GetAwsAccountsOk returns a tuple with the AwsAccounts field value +// and a boolean to check if the value has been set. +func (o *AWSAccountsResponseAttributes) GetAwsAccountsOk() (*[]AWSAccountResponseConfig, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccounts, true +} + +// SetAwsAccounts sets field value. +func (o *AWSAccountsResponseAttributes) SetAwsAccounts(v []AWSAccountResponseConfig) { + o.AwsAccounts = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountsResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["aws_accounts"] = o.AwsAccounts + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountsResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AwsAccounts *[]AWSAccountResponseConfig `json:"aws_accounts"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AwsAccounts == nil { + return fmt.Errorf("required field aws_accounts missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aws_accounts"}) + } else { + return err + } + o.AwsAccounts = *all.AwsAccounts + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_accounts_response_data.go b/api/datadogV2/model_aws_accounts_response_data.go new file mode 100644 index 00000000000..e7ab9cb9deb --- /dev/null +++ b/api/datadogV2/model_aws_accounts_response_data.go @@ -0,0 +1,180 @@ +// 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" +) + +// AWSAccountsResponseData List All AWS Accounts Response body +type AWSAccountsResponseData struct { + // List All AWS Account Response attributes + Attributes AWSAccountsResponseAttributes `json:"attributes"` + // Identifier for the response type + Id *string `json:"id,omitempty"` + // Type of response object + 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:"-"` +} + +// NewAWSAccountsResponseData instantiates a new AWSAccountsResponseData 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 NewAWSAccountsResponseData(attributes AWSAccountsResponseAttributes) *AWSAccountsResponseData { + this := AWSAccountsResponseData{} + this.Attributes = attributes + return &this +} + +// NewAWSAccountsResponseDataWithDefaults instantiates a new AWSAccountsResponseData 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 NewAWSAccountsResponseDataWithDefaults() *AWSAccountsResponseData { + this := AWSAccountsResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSAccountsResponseData) GetAttributes() AWSAccountsResponseAttributes { + if o == nil { + var ret AWSAccountsResponseAttributes + 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 *AWSAccountsResponseData) GetAttributesOk() (*AWSAccountsResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSAccountsResponseData) SetAttributes(v AWSAccountsResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSAccountsResponseData) 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 *AWSAccountsResponseData) 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 *AWSAccountsResponseData) 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 *AWSAccountsResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *AWSAccountsResponseData) 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 *AWSAccountsResponseData) 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 *AWSAccountsResponseData) 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 *AWSAccountsResponseData) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountsResponseData) 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 *AWSAccountsResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountsResponseAttributes `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_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..2da223685f9 --- /dev/null +++ b/api/datadogV2/model_x_ray_services_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" +) + +// 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 +} 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..f9cca61d3c1 --- /dev/null +++ b/examples/v2/aws-integration/CreateAWSAccount.go @@ -0,0 +1,84 @@ +// 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{ + AwsAccount: datadogV2.AWSAccountCreateRequestConfig{ + AccountTags: *datadog.NewNullableList(&[]string{}), + AuthConfig: datadogV2.AWSAuthConfig{ + AWSAuthConfigRole: &datadogV2.AWSAuthConfigRole{ + RoleName: "test", + }}, + AwsAccountId: "123456789012", + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS, + AwsRegions: &datadogV2.AWSRegions{ + AWSRegionsIncludeOnly: &datadogV2.AWSRegionsIncludeOnly{ + IncludeOnly: []string{ + "us-east-1", + }, + }}, + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{}, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + NamespaceFilters: &datadogV2.AWSNamespaceFilters{ + AWSNamespaceFiltersIncludeOnly: &datadogV2.AWSNamespaceFiltersIncludeOnly{ + IncludeOnly: []string{ + "AWS/EC2", + }, + }}, + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{}), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{}, + TracesConfig: &datadogV2.AWSTracesConfig{ + XrayServices: &datadogV2.XRayServicesList{ + XRayServicesIncludeOnly: &datadogV2.XRayServicesIncludeOnly{ + IncludeOnly: []string{ + "AWS/AppSync", + }, + }}, + }, + }, + }, + Id: datadog.PtrString("123456789012"), + 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..8d5f6ec63a1 --- /dev/null +++ b/examples/v2/aws-integration/DeleteAWSAccount.go @@ -0,0 +1,29 @@ +// 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() { + // there is a valid "aws_account_v2" in the system + AwsAccountV2DataAttributesAwsAccountAwsAccountID := os.Getenv("AWS_ACCOUNT_V2_DATA_ATTRIBUTES_AWS_ACCOUNT_AWS_ACCOUNT_ID") + + 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, AwsAccountV2DataAttributesAwsAccountAwsAccountID) + + 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..1a9347c87fa --- /dev/null +++ b/examples/v2/aws-integration/GetAWSAccount.go @@ -0,0 +1,33 @@ +// 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() { + // there is a valid "aws_account_v2" in the system + AwsAccountV2DataAttributesAwsAccountAwsAccountID := os.Getenv("AWS_ACCOUNT_V2_DATA_ATTRIBUTES_AWS_ACCOUNT_AWS_ACCOUNT_ID") + + 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, AwsAccountV2DataAttributesAwsAccountAwsAccountID) + + 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..7de114e21e2 --- /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) + + 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..8763c48088f --- /dev/null +++ b/examples/v2/aws-integration/UpdateAWSAccount.go @@ -0,0 +1,87 @@ +// 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() { + // there is a valid "aws_account_v2" in the system + AwsAccountV2DataAttributesAwsAccountAwsAccountID := os.Getenv("AWS_ACCOUNT_V2_DATA_ATTRIBUTES_AWS_ACCOUNT_AWS_ACCOUNT_ID") + + body := datadogV2.AWSAccountPatchRequest{ + Data: &datadogV2.AWSAccountPatchRequestData{ + Attributes: datadogV2.AWSAccountPatchRequestAttributes{ + AwsAccount: datadogV2.AWSAccountPatchRequestConfig{ + AccountTags: *datadog.NewNullableList(&[]string{}), + AuthConfig: &datadogV2.AWSAuthConfig{ + AWSAuthConfigRole: &datadogV2.AWSAuthConfigRole{ + RoleName: "test", + }}, + AwsAccountId: AwsAccountV2DataAttributesAwsAccountAwsAccountID, + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS.Ptr(), + AwsRegions: &datadogV2.AWSRegions{ + AWSRegionsIncludeOnly: &datadogV2.AWSRegionsIncludeOnly{ + IncludeOnly: []string{ + "us-east-1", + }, + }}, + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{}, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + NamespaceFilters: &datadogV2.AWSNamespaceFilters{ + AWSNamespaceFiltersIncludeOnly: &datadogV2.AWSNamespaceFiltersIncludeOnly{ + IncludeOnly: []string{ + "AWS/EC2", + }, + }}, + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{}), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{}, + TracesConfig: &datadogV2.AWSTracesConfig{ + XrayServices: &datadogV2.XRayServicesList{ + XRayServicesIncludeOnly: &datadogV2.XRayServicesIncludeOnly{ + IncludeOnly: []string{ + "AWS/AppSync", + }, + }}, + }, + }, + }, + Id: datadog.PtrString(AwsAccountV2DataAttributesAwsAccountAwsAccountID), + 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, AwsAccountV2DataAttributesAwsAccountAwsAccountID, 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 f3833fa4683..33759afb240 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -62,6 +62,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), "OpsgenieIntegrationApi": reflect.ValueOf(datadogV2.NewOpsgenieIntegrationApi), "CloudflareIntegrationApi": reflect.ValueOf(datadogV2.NewCloudflareIntegrationApi), 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..6d430116e12 --- /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-14T16:50:30.230Z \ 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..e453314277c --- /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":{"aws_account":{"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":"create_account","type":"account","attributes":{"aws_account":{"account_tags":null,"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"auth_config":{"role_name":"test","external_id":"8589249d3860460f8684b0b448222783"},"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},"modified_at":"2024-08-14T16:50:30.903341243Z","created_at":"2024-08-14T16:50:30.90333746Z"}}}}' + 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..bd8214fed73 --- /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-14T16:50:31.189Z \ 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..8bea5315557 --- /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":{"aws_account":{"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..d4cd8f72d73 --- /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-14T18:36:53.411Z \ 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..2395448f858 --- /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":{"aws_account":{"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":"create_account","type":"account","attributes":{"aws_account":{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"1af8b0bdd43d462e8f92b5023269d550"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:54.01539218Z","created_at":"2024-08-14T18:36:54.015387388Z"}}}}' + 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..5e13fc7ba56 --- /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-14T18:36:54.393Z \ 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..aa496b48676 --- /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":{"aws_account":{"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":"create_account","type":"account","attributes":{"aws_account":{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"18390423f89a4e2185298bcbdfad77b1"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:54.796269437Z","created_at":"2024-08-14T18:36:54.796264407Z"}}}}' + 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":"get_account","type":"account","attributes":{"aws_account":{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"18390423f89a4e2185298bcbdfad77b1"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:54.796269Z","created_at":"2024-08-14T18:36:54.796264Z"}}}}' + 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..2c482456543 --- /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-14T18:36:55.221Z \ 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..b8b08627180 --- /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":{"aws_account":{"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":"create_account","type":"account","attributes":{"aws_account":{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"809a338f176c42938a4bd0f885ff044d"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:55.564316186Z","created_at":"2024-08-14T18:36:55.564312379Z"}}}}' + 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":"get_all_accounts","type":"accounts","attributes":{"aws_accounts":[{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723651405"],"aws_account_id":"491029950495","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"32774b5310a047b7b0ee29448c42f399"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:03:27.137774Z","created_at":"2024-08-14T16:03:27.13777Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723651394"],"aws_account_id":"971029752565","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"13c3066bac474fe5aa2b98fafab7ccbd"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:03:17.022913Z","created_at":"2024-08-14T16:03:17.022908Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723651400"],"aws_account_id":"100551011015","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"fe7a101024234b46af4f3b3f07a5a969"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:03:21.773674Z","created_at":"2024-08-14T16:03:21.773669Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652070"],"aws_account_id":"575554569949","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"768ba133513445ae96dfa439baa694d8"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:14:32.00268Z","created_at":"2024-08-14T16:14:32.002676Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652074"],"aws_account_id":"489955505155","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"116bd1f039ba436cbf14f6858c8725c2"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:14:36.433373Z","created_at":"2024-08-14T16:14:36.433368Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652079"],"aws_account_id":"535051554910","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"28f9c60b14b945a7bb9d74d47d2dd74e"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:14:40.903902Z","created_at":"2024-08-14T16:14:40.903898Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652325"],"aws_account_id":"539810098100","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"188ef13911894f83991feb3172d13461"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:18:46.625397Z","created_at":"2024-08-14T16:18:46.625393Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652329"],"aws_account_id":"102985551501","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"b9ae83a208384803b0067d29b213bdc9"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:18:51.141185Z","created_at":"2024-08-14T16:18:51.141181Z"},{"account_tags":["tf-TestAccIntegrationAwsV2Basic-local-1723652334"],"aws_account_id":"504997535199","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"989b30e951f24195ad65dc3c194011d0"},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"namespace_filters":{"include_all":true}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_all":true}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T16:18:55.653208Z","created_at":"2024-08-14T16:18:55.653203Z"},{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"809a338f176c42938a4bd0f885ff044d"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:55.564316Z","created_at":"2024-08-14T18:36:55.564312Z"},{"account_tags":[],"aws_account_id":"172322422800","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"auth_config":{"role_name":"test","external_id":"5305ff8c8ce24a83a67194b4fc1a8162"},"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},"modified_at":"2024-08-12T17:07:16.174795Z","created_at":"2024-08-12T17:07:16.174791Z"},{"account_tags":["$KEY:$VALUE"],"aws_account_id":"172348305100","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"7e7aec3d97c44dfcb48d28f5ad456df1"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-12T17:17:31.806772Z","created_at":"2024-08-12T17:17:31.806768Z"},{"account_tags":["$KEY:$VALUE"],"aws_account_id":"172348305200","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"cdd867b8537d44e9bcadcad22d3b9d54"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-12T17:17:33.006847Z","created_at":"2024-08-12T17:17:33.006843Z"},{"account_tags":["$KEY:$VALUE"],"aws_account_id":"172348305300","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"ce5ead92dba74402aaab90088c569a12"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-12T17:17:33.500992Z","created_at":"2024-08-12T17:17:33.500988Z"},{"account_tags":["$KEY:$VALUE"],"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"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"3a3284531f69454c8c2e91c3257f0be3"},"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"]}},"logs_config":{},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":true},"modified_at":"2024-03-20T10:03:38.455814Z","created_at":"2024-03-20T10:03:37.258717Z"},{"account_tags":[],"aws_account_id":"101101501005","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"access_key_id":"1011015010051561"},"metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"logs_config":{},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"modified_at":"2024-04-16T18:25:34.660797Z","created_at":"2024-04-16T18:25:34.660792Z"},{"account_tags":[],"aws_account_id":"485010252102","aws_partition":"aws","aws_regions":{"include_all":true},"auth_config":{"access_key_id":"4850102521029797"},"metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"logs_config":{},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"modified_at":"2024-04-16T18:25:41.126485Z","created_at":"2024-04-16T18:25:41.126481Z"},{"account_tags":[],"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"]},"auth_config":{"role_name":"datadog-integration-role","external_id":"70aed59cbeff4d2a87d7093be5df8813"},"metrics_config":{"enabled":true,"automute_enabled":true,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"logs_config":{},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-04-24T13:47:18.840472Z","created_at":"2024-04-24T13:39:30.506151Z"},{"account_tags":["$KEY:$VALUE"],"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"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"53f2e7dd4f4f437d857bdd79f995689e"},"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"]}},"logs_config":{},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-02-29T17:27:01.83966Z","created_at":"2024-02-29T17:27:01.839658Z"},{"account_tags":["$KEY:$VALUE"],"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"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e708623c7a494195a653a73cdd0d5718"},"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"]}},"logs_config":{},"traces_config":{"xray_services":{"include_only":null}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-02-29T17:27:03.178841Z","created_at":"2024-02-29T17:27:03.178839Z"}]}}}' + 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..a887ffff89e --- /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-14T18:36:56.066Z \ 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..3bbe4923c5a --- /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":{"aws_account":{"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":"create_account","type":"account","attributes":{"aws_account":{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"095f103e908448d2b4fe4e018111b757"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:56.42509738Z","created_at":"2024-08-14T18:36:56.425090939Z"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"aws_account":{"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..1074ae23a29 --- /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-14T18:36:56.736Z \ 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..079e5e2ed4b --- /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":{"aws_account":{"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":"create_account","type":"account","attributes":{"aws_account":{"account_tags":["$KEY:$VALUE"],"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"cdcaf2441874423e8454064cf244df58"},"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"]}},"logs_config":{"lambda_forwarder":{}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:57.173439176Z","created_at":"2024-08-14T18:36:57.173434122Z"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"aws_account":{"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":"update_account","type":"account","attributes":{"aws_account":{"account_tags":null,"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"auth_config":{"role_name":"test","external_id":"cdcaf2441874423e8454064cf244df58"},"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"]}},"logs_config":{"lambda_forwarder":{"sources":["s3"]}},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"modified_at":"2024-08-14T18:36:57.645242583Z","created_at":"2024-08-14T18:36:57.173434Z"}}}}' + 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..d5597e8d7c9 --- /dev/null +++ b/tests/scenarios/features/v2/aws_integration.feature @@ -0,0 +1,130 @@ +@endpoint(aws-integration) @endpoint(aws-integration-v2) +Feature: AWS Integration + Configure your Datadog-AWS integration directly through the Datadog API. + For more information, see the [AWS integration + page](https://docs.datadoghq.com/integrations/amazon_web_services). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AWSIntegration" API + + @team:DataDog/aws-integrations + Scenario: AWS Integration - Create account config returns "AWS Account object" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"aws_account": {"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"}} + When the request is sent + Then the response status is 200 AWS Account object + + @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": {"aws_account": {"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"}} + 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": {"aws_account": {"account_tags": [], "auth_config": {}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "resources_config": {}, "traces_config": {}}}, "id": "123456789012", "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_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: AWS Integration - Delete account config returns "No Content" response + Given operation "DeleteAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "DeleteAWSAccount" request + And request contains "aws_account_id" parameter from "aws_account_v2.data.attributes.aws_account.aws_account_id" + 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_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/aws-integrations + Scenario: AWS Integration - Get account config returns "AWS Account object" response + Given operation "GetAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "GetAWSAccount" request + And request contains "aws_account_id" parameter from "aws_account_v2.data.attributes.aws_account.aws_account_id" + 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_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_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/aws-integrations + Scenario: AWS Integration - Get all account configs returns "AWS Accounts List object" response + Given operation "ListAWSAccounts" enabled + And there is a valid "aws_account_v2" in the system + And new "ListAWSAccounts" request + When the request is sent + Then the response status is 200 AWS Accounts List object + + @team:DataDog/aws-integrations + Scenario: AWS Integration - Patch account config returns "API error response." response + Given operation "UpdateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "UpdateAWSAccount" request + And request contains "aws_account_id" parameter from "aws_account_v2.data.attributes.aws_account.aws_account_id" + And body with value {"data": {"attributes": {"aws_account": {"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"}} + When the request is sent + Then the response status is 400 API error response. + + @team:DataDog/aws-integrations + Scenario: AWS Integration - Patch account config returns "AWS Account object" response + Given operation "UpdateAWSAccount" enabled + And new "UpdateAWSAccount" request + And there is a valid "aws_account_v2" in the system + And request contains "aws_account_id" parameter from "aws_account_v2.data.attributes.aws_account.aws_account_id" + And body with value {"data": {"attributes": {"aws_account": {"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"}} + 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_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"aws_account": {"account_tags": [], "auth_config": {}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "resources_config": {}, "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_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"aws_account": {"account_tags": [], "auth_config": {}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": [], "sources": ["s3"]}}, "metrics_config": {"tag_filters": [{"namespace": "AWS/EC2", "tags": []}]}, "resources_config": {}, "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 3b444e16d27..bb8bf02f167 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -188,6 +188,18 @@ "tag": "Incidents", "operationId": "CreateIncidentTodo" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"id\": \"123456789012\",\n \"type\": \"account\",\n \"attributes\": {\n \"aws_account\": {\n \"account_tags\": [\n \"$KEY:$VALUE\"\n ],\n \"aws_account_id\": \"123456789012\",\n \"aws_partition\": \"aws\",\n \"aws_regions\": {\n \"include_only\": [\n \"us-east-2\",\n \"us-west-1\"\n ]\n },\n \"auth_config\": {\n \"role_name\": \"DatadogAWSIntegrationRole\"\n },\n \"metrics_config\": {\n \"enabled\": false,\n \"automute_enabled\": true,\n \"tag_filters\": [\n {\n \"namespace\": \"AWS/EC2\",\n \"tags\": [\n \"$KEY:$VALUE\"\n ]\n }\n ],\n \"namespace_filters\": {\n \"exclude_only\": [\n \"AWS/AutoScaling\",\n \"AWS/ElasticMapReduce\",\n \"AWS/SQS\"\n ]\n }\n },\n \"logs_config\": {},\n \"traces_config\": {\n \"xray_services\": {\n \"include_only\": [\"AWS/AppSync\"]\n }\n },\n \"resources_config\": {\n \"cloud_security_posture_management_collection\": true,\n \"extended_collection\": true\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 dc362a26a8d..1a42af8058c 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -720,6 +720,43 @@ "type": "idempotent" } }, + "ListAWSAccounts": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "CreateAWSAccount": { + "tag": "AWS Integration", + "undo": { + "operationId": "DeleteAWSAccount", + "parameters": [ + { + "name": "aws_account_id", + "source": "data.attributes.aws_account.aws_account_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": {