diff --git a/.apigentools-info b/.apigentools-info index 63c4a42b95e..5b3c0cca3c9 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-05 22:28:17.079382", - "spec_repo_commit": "2db17c21" + "regenerated": "2024-11-06 18:51:47.734391", + "spec_repo_commit": "56e7b967" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-05 22:28:17.098505", - "spec_repo_commit": "2db17c21" + "regenerated": "2024-11-06 18:51:47.752826", + "spec_repo_commit": "56e7b967" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ce1fe2fc60d..f975f26a910 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -84,6 +84,13 @@ components: required: false schema: $ref: '#/components/schemas/APIKeysSort' + AWSAccountConfigIDPathParameter: + description: Unique Datadog ID of the AWS Account Integration Config + in: path + name: aws_account_config_id + required: true + schema: + type: string ApplicationKeyFilterCreatedAtEndParameter: description: Only include application keys created on or before the specified date. @@ -976,6 +983,536 @@ components: type: string x-enum-varnames: - API_KEYS + AWSAccountConfigID: + description: Unique Datadog ID of the AWS Account Integration Config + example: 00000000-abcd-0001-0000-000000000000 + type: string + AWSAccountCreateRequest: + description: AWS Account Create Request body + properties: + data: + $ref: '#/components/schemas/AWSAccountCreateRequestData' + required: + - data + type: object + AWSAccountCreateRequestAttributes: + description: The AWS Account Integration Config to be created + properties: + account_tags: + $ref: '#/components/schemas/AWSAccountTags' + auth_config: + $ref: '#/components/schemas/AWSAuthConfig' + aws_account_id: + $ref: '#/components/schemas/AWSAccountID' + aws_partition: + $ref: '#/components/schemas/AWSAccountPartition' + aws_regions: + $ref: '#/components/schemas/AWSRegions' + logs_config: + $ref: '#/components/schemas/AWSLogsConfig' + metrics_config: + $ref: '#/components/schemas/AWSMetricsConfig' + resources_config: + $ref: '#/components/schemas/AWSResourcesConfig' + traces_config: + $ref: '#/components/schemas/AWSTracesConfig' + required: + - aws_account_id + - aws_partition + - auth_config + type: object + AWSAccountCreateRequestData: + description: AWS Account Create Request data + properties: + attributes: + $ref: '#/components/schemas/AWSAccountCreateRequestAttributes' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - attributes + - type + type: object + AWSAccountID: + description: AWS Account ID + example: '123456789012' + type: string + AWSAccountPartition: + default: aws + description: AWS Account partition + enum: + - aws + - aws-cn + - aws-us-gov + example: aws + type: string + x-enum-varnames: + - AWS + - AWS_CN + - AWS_US_GOV + AWSAccountResponse: + description: AWS Account response body + properties: + data: + $ref: '#/components/schemas/AWSAccountResponseData' + required: + - data + type: object + AWSAccountResponseAttributes: + description: The AWS Account Integration Config + properties: + account_tags: + $ref: '#/components/schemas/AWSAccountTags' + auth_config: + $ref: '#/components/schemas/AWSAuthConfig' + aws_account_id: + $ref: '#/components/schemas/AWSAccountID' + aws_partition: + $ref: '#/components/schemas/AWSAccountPartition' + aws_regions: + $ref: '#/components/schemas/AWSRegions' + created_at: + description: Timestamp of when the account integration was created + format: date-time + readOnly: true + type: string + logs_config: + $ref: '#/components/schemas/AWSLogsConfig' + metrics_config: + $ref: '#/components/schemas/AWSMetricsConfig' + modified_at: + description: Timestamp of when the account integration was updated + format: date-time + readOnly: true + type: string + resources_config: + $ref: '#/components/schemas/AWSResourcesConfig' + traces_config: + $ref: '#/components/schemas/AWSTracesConfig' + required: + - aws_account_id + type: object + AWSAccountResponseData: + description: AWS Account Response body + properties: + attributes: + $ref: '#/components/schemas/AWSAccountResponseAttributes' + id: + $ref: '#/components/schemas/AWSAccountConfigID' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - id + - type + type: object + AWSAccountTags: + description: Tags to apply to all metrics in the account + items: + description: Tag to apply to all metrics in the account + example: key:value + type: string + nullable: true + type: array + AWSAccountType: + default: account + description: AWS Account resource type. + enum: + - account + example: account + type: string + x-enum-varnames: + - ACCOUNT + AWSAccountUpdateRequest: + description: AWS Account Update Request body + properties: + data: + $ref: '#/components/schemas/AWSAccountUpdateRequestData' + required: + - data + type: object + AWSAccountUpdateRequestAttributes: + description: The AWS Account Integration Config to be updated + properties: + account_tags: + $ref: '#/components/schemas/AWSAccountTags' + auth_config: + $ref: '#/components/schemas/AWSAuthConfig' + aws_account_id: + $ref: '#/components/schemas/AWSAccountID' + aws_partition: + $ref: '#/components/schemas/AWSAccountPartition' + aws_regions: + $ref: '#/components/schemas/AWSRegions' + logs_config: + $ref: '#/components/schemas/AWSLogsConfig' + metrics_config: + $ref: '#/components/schemas/AWSMetricsConfig' + resources_config: + $ref: '#/components/schemas/AWSResourcesConfig' + traces_config: + $ref: '#/components/schemas/AWSTracesConfig' + required: + - aws_account_id + type: object + AWSAccountUpdateRequestData: + description: AWS Account Update Request data + properties: + attributes: + $ref: '#/components/schemas/AWSAccountUpdateRequestAttributes' + id: + $ref: '#/components/schemas/AWSAccountConfigID' + type: + $ref: '#/components/schemas/AWSAccountType' + required: + - attributes + - type + type: object + AWSAccountsResponse: + description: AWS Accounts response body + properties: + data: + description: List of AWS Account Integration Configs + items: + $ref: '#/components/schemas/AWSAccountResponseData' + type: array + required: + - data + type: object + AWSAuthConfig: + description: AWS Authentication config + oneOf: + - $ref: '#/components/schemas/AWSAuthConfigKeys' + - $ref: '#/components/schemas/AWSAuthConfigRole' + AWSAuthConfigKeys: + description: AWS Authentication config for key-based account + properties: + access_key_id: + description: AWS Access Key ID + example: AKIAIOSFODNN7EXAMPLE + type: string + secret_access_key: + description: AWS Secret Access Key + example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY + minLength: 1 + type: string + writeOnly: true + required: + - access_key_id + type: object + AWSAuthConfigRole: + description: AWS Authentication config for role-based account + properties: + external_id: + description: AWS IAM External ID for associated role + type: string + role_name: + description: AWS IAM Role name + example: DatadogIntegrationRole + maxLength: 576 + minLength: 1 + type: string + required: + - role_name + type: object + AWSLambdaForwarderConfig: + description: AWS Lambda forwarder + properties: + lambdas: + description: List of Datadog Lambda Log Forwarder ARNs + items: + example: arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder + type: string + type: array + sources: + description: List of AWS services that will send logs to the Datadog Lambda + Log Forwarder + items: + example: s3 + type: string + type: array + type: object + AWSLogsConfig: + description: AWS Logs config + properties: + lambda_forwarder: + $ref: '#/components/schemas/AWSLambdaForwarderConfig' + type: object + AWSLogsServicesResponse: + description: AWS Logs Services response body + properties: + data: + $ref: '#/components/schemas/AWSLogsServicesResponseData' + required: + - data + type: object + AWSLogsServicesResponseAttributes: + description: AWS Logs Services response body + properties: + logs_services: + description: List of AWS services that can send logs to Datadog + example: + - s3 + items: + example: s3 + type: string + type: array + required: + - logs_services + type: object + AWSLogsServicesResponseData: + description: AWS Logs Services response body + properties: + attributes: + $ref: '#/components/schemas/AWSLogsServicesResponseAttributes' + id: + default: logs_services + description: The `AWSLogsServicesResponseData` `id`. + example: logs_services + type: string + type: + $ref: '#/components/schemas/AWSLogsServicesResponseDataType' + required: + - id + - type + type: object + AWSLogsServicesResponseDataType: + default: logs_services + description: The `AWSLogsServicesResponseData` `type`. + enum: + - logs_services + example: logs_services + type: string + x-enum-varnames: + - LOGS_SERVICES + AWSMetricsConfig: + description: AWS Metrics config + properties: + automute_enabled: + description: Enable EC2 automute for AWS metrics + example: true + type: boolean + collect_cloudwatch_alarms: + description: Enable CloudWatch alarms collection + example: true + type: boolean + collect_custom_metrics: + description: Enable custom metrics collection + example: true + type: boolean + enabled: + description: Enable AWS metrics collection + example: true + type: boolean + namespace_filters: + $ref: '#/components/schemas/AWSNamespaceFilters' + tag_filters: + description: AWS Metrics tag filters list + items: + $ref: '#/components/schemas/AWSNamespaceTagFilter' + type: array + type: object + AWSNamespaceFilters: + description: AWS Metrics namespace filters + oneOf: + - $ref: '#/components/schemas/AWSNamespaceFiltersExcludeAll' + - $ref: '#/components/schemas/AWSNamespaceFiltersExcludeOnly' + - $ref: '#/components/schemas/AWSNamespaceFiltersIncludeAll' + - $ref: '#/components/schemas/AWSNamespaceFiltersIncludeOnly' + AWSNamespaceFiltersExcludeAll: + description: Exclude all namespaces + properties: + exclude_all: + description: Exclude all namespaces + example: false + type: boolean + required: + - exclude_all + AWSNamespaceFiltersExcludeOnly: + description: Exclude only these namespaces + properties: + exclude_only: + description: Exclude only these namespaces + example: + - AWS/EC2 + items: + example: AWS/EC2 + type: string + type: array + required: + - exclude_only + AWSNamespaceFiltersIncludeAll: + description: Include all namespaces + properties: + include_all: + description: Include all namespaces + example: false + type: boolean + required: + - include_all + AWSNamespaceFiltersIncludeOnly: + description: Include only these namespaces + properties: + include_only: + description: Include only these namespaces + example: + - AWS/EC2 + items: + example: AWS/EC2 + type: string + type: array + required: + - include_only + AWSNamespaceTagFilter: + description: AWS Metrics tag filters + properties: + namespace: + description: The AWS Namespace to apply the tag filters against + example: AWS/EC2 + type: string + tags: + description: The tags to filter based on + items: + example: key:value + type: string + nullable: true + type: array + type: object + AWSNamespacesResponse: + description: AWS Namespaces response body + properties: + data: + $ref: '#/components/schemas/AWSNamespacesResponseData' + required: + - data + type: object + AWSNamespacesResponseAttributes: + description: AWS Namespaces response body + properties: + namespaces: + description: AWS CloudWatch namespace + example: + - AWS/ApiGateway + items: + example: AWS/ApiGateway + type: string + type: array + required: + - namespaces + type: object + AWSNamespacesResponseData: + description: AWS Namespaces response body + properties: + attributes: + $ref: '#/components/schemas/AWSNamespacesResponseAttributes' + id: + default: namespaces + description: The `AWSNamespacesResponseData` `id`. + example: namespaces + type: string + type: + $ref: '#/components/schemas/AWSNamespacesResponseDataType' + required: + - id + - type + type: object + AWSNamespacesResponseDataType: + default: namespaces + description: The `AWSNamespacesResponseData` `type`. + enum: + - namespaces + example: namespaces + type: string + x-enum-varnames: + - NAMESPACES + AWSNewExternalIDResponse: + description: AWS External ID response body + properties: + data: + $ref: '#/components/schemas/AWSNewExternalIDResponseData' + required: + - data + type: object + AWSNewExternalIDResponseAttributes: + description: AWS External ID response body + properties: + external_id: + description: AWS IAM External ID for associated role + example: acb8f6b8a844443dbb726d07dcb1a870 + type: string + required: + - external_id + type: object + AWSNewExternalIDResponseData: + description: AWS External ID response body + properties: + attributes: + $ref: '#/components/schemas/AWSNewExternalIDResponseAttributes' + id: + default: external_id + description: The `AWSNewExternalIDResponseData` `id`. + example: external_id + type: string + type: + $ref: '#/components/schemas/AWSNewExternalIDResponseDataType' + required: + - id + - type + type: object + AWSNewExternalIDResponseDataType: + default: external_id + description: The `AWSNewExternalIDResponseData` `type`. + enum: + - external_id + example: external_id + type: string + x-enum-varnames: + - EXTERNAL_ID + AWSRegions: + description: AWS Regions to collect data from + oneOf: + - $ref: '#/components/schemas/AWSRegionsIncludeAll' + - $ref: '#/components/schemas/AWSRegionsIncludeOnly' + AWSRegionsIncludeAll: + description: Include all regions + properties: + include_all: + description: Include all regions + example: false + type: boolean + required: + - include_all + AWSRegionsIncludeOnly: + description: Include only these regions + properties: + include_only: + description: Include only these regions + example: + - us-east-1 + items: + example: us-east-1 + type: string + type: array + required: + - include_only + AWSResourcesConfig: + description: AWS Resources config + properties: + cloud_security_posture_management_collection: + description: Whether Datadog collects cloud security posture management + resources from your AWS account. + example: false + type: boolean + extended_collection: + description: Whether Datadog collects additional attributes and configuration + information about the resources in your AWS account. Required for `cspm_resource_collection`. + example: false + type: boolean + type: object + AWSTracesConfig: + description: AWS Traces config + properties: + xray_services: + $ref: '#/components/schemas/XRayServicesList' + type: object ActiveBillingDimensionsAttributes: description: List of active billing dimensions. properties: @@ -26254,6 +26791,34 @@ components: description: The id of the instance. type: string type: object + XRayServicesIncludeAll: + description: Include all services + properties: + include_all: + description: Include all services + example: false + type: boolean + required: + - include_all + XRayServicesIncludeOnly: + description: Include only these services + nullable: true + properties: + include_only: + description: Include only these services + example: + - AWS/AppSync + items: + example: AWS/AppSync + type: string + type: array + required: + - include_only + XRayServicesList: + description: AWS X-Ray services to collect traces from + oneOf: + - $ref: '#/components/schemas/XRayServicesIncludeAll' + - $ref: '#/components/schemas/XRayServicesIncludeOnly' securitySchemes: AuthZ: description: This API uses OAuth 2 with the implicit grant flow. @@ -31276,6 +31841,244 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/integration/aws/accounts: + get: + description: Get a list of AWS Account Integration Configs. + operationId: ListAWSAccounts + parameters: + - description: Optional query filter accounts by AWS Account ID + example: '123456789012' + in: query + name: aws_account_id + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountsResponse' + description: AWS Accounts List object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List all AWS integrations + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + post: + description: Create a new AWS Account Integration Config. + operationId: CreateAWSAccount + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountResponse' + description: AWS Account object + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create an AWS integration + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - aws_configurations_manage + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/accounts/{aws_account_config_id}: + delete: + description: Delete an AWS Account Integration Config + operationId: DeleteAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an AWS integration + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configurations_manage + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + get: + description: Get an AWS Account Integration Config + operationId: GetAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountResponse' + description: AWS Account object + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get an AWS integration by config ID + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + patch: + description: Update an AWS Account Integration Config + operationId: UpdateAWSAccount + parameters: + - $ref: '#/components/parameters/AWSAccountConfigIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSAccountResponse' + description: AWS Account object + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update an AWS integration + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/available_namespaces: + get: + description: Get a list of available AWS CloudWatch namespaces that can send + metrics to Datadog. + operationId: ListAWSNamespaces + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSNamespacesResponse' + description: AWS Namespaces List object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List available namespaces + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/generate_new_external_id: + post: + description: Generate a new external ID for AWS role-based authentication. + operationId: CreateNewAWSExternalID + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSNewExternalIDResponse' + description: AWS External ID object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Generate a new external ID + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - aws_configuration_edit + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' + /api/v2/integration/aws/logs/services: + get: + description: Get a list of AWS services that can send logs to Datadog. + operationId: ListAWSLogsServices + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSLogsServicesResponse' + description: AWS Logs Services List object + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get list of AWS log ready services + tags: + - AWS Logs Integration + x-permission: + operator: OR + permissions: + - aws_configuration_read + x-unstable: '**Note: This endpoint is in public beta. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).**' /api/v2/integration/gcp/accounts: get: description: List all GCP STS-enabled service accounts configured in your Datadog @@ -42337,6 +43140,18 @@ tags: description: Find out more at url: https://docs.datadoghq.com/tracing/trace_pipeline/trace_retention/ name: APM Retention Filters +- description: 'Configure your Datadog-AWS integration directly through the Datadog + API. + + For more information, see the [AWS integration page](https://docs.datadoghq.com/integrations/amazon_web_services).' + name: AWS Integration +- description: 'Configure your Datadog-AWS-Logs integration directly through Datadog + API. + + For more information, see the [AWS integration page](https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection).' + externalDocs: + url: https://docs.datadoghq.com/integrations/amazon_web_services/#log-collection + name: AWS Logs Integration - description: Search your Audit Logs events over HTTP. name: Audit - description: '[The AuthN Mappings API](https://docs.datadoghq.com/account_management/authn_mapping/?tab=example) diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 2e00376c789..b59fbc0d8d5 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -356,6 +356,14 @@ func NewConfiguration() *Configuration { "v2.UpdateIncidentIntegration": false, "v2.UpdateIncidentTodo": false, "v2.UpdateIncidentType": false, + "v2.CreateAWSAccount": false, + "v2.CreateNewAWSExternalID": false, + "v2.DeleteAWSAccount": false, + "v2.GetAWSAccount": false, + "v2.ListAWSAccounts": false, + "v2.ListAWSNamespaces": false, + "v2.UpdateAWSAccount": false, + "v2.ListAWSLogsServices": false, "v2.GetFinding": false, "v2.ListFindings": false, "v2.MuteFindings": false, diff --git a/api/datadogV2/api_aws_integration.go b/api/datadogV2/api_aws_integration.go new file mode 100644 index 00000000000..372b86dce6f --- /dev/null +++ b/api/datadogV2/api_aws_integration.go @@ -0,0 +1,592 @@ +// 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 Create an AWS integration. +// 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 +} + +// CreateNewAWSExternalID Generate a new external ID. +// Generate a new external ID for AWS role-based authentication. +func (a *AWSIntegrationApi) CreateNewAWSExternalID(ctx _context.Context) (AWSNewExternalIDResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AWSNewExternalIDResponse + ) + + operationId := "v2.CreateNewAWSExternalID" + 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.CreateNewAWSExternalID") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/generate_new_external_id" + + 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 +} + +// DeleteAWSAccount Delete an AWS integration. +// Delete an AWS Account Integration Config +func (a *AWSIntegrationApi) DeleteAWSAccount(ctx _context.Context, awsAccountConfigId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.DeleteAWSAccount") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetAWSAccount Get an AWS integration by config ID. +// Get an AWS Account Integration Config +func (a *AWSIntegrationApi) GetAWSAccount(ctx _context.Context, awsAccountConfigId string) (AWSAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSAccountResponse + ) + + operationId := "v2.GetAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.GetAWSAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListAWSAccountsOptionalParameters holds optional parameters for ListAWSAccounts. +type ListAWSAccountsOptionalParameters struct { + AwsAccountId *string +} + +// NewListAWSAccountsOptionalParameters creates an empty struct for parameters. +func NewListAWSAccountsOptionalParameters() *ListAWSAccountsOptionalParameters { + this := ListAWSAccountsOptionalParameters{} + return &this +} + +// WithAwsAccountId sets the corresponding parameter name and returns the struct. +func (r *ListAWSAccountsOptionalParameters) WithAwsAccountId(awsAccountId string) *ListAWSAccountsOptionalParameters { + r.AwsAccountId = &awsAccountId + return r +} + +// ListAWSAccounts List all AWS integrations. +// Get a list of AWS Account Integration Configs. +func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context, o ...ListAWSAccountsOptionalParameters) (AWSAccountsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSAccountsResponse + optionalParams ListAWSAccountsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListAWSAccountsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListAWSAccounts" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.ListAWSAccounts") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.AwsAccountId != nil { + localVarQueryParams.Add("aws_account_id", datadog.ParameterToString(*optionalParams.AwsAccountId, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListAWSNamespaces List available namespaces. +// Get a list of available AWS CloudWatch namespaces that can send metrics to Datadog. +func (a *AWSIntegrationApi) ListAWSNamespaces(ctx _context.Context) (AWSNamespacesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSNamespacesResponse + ) + + operationId := "v2.ListAWSNamespaces" + 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.ListAWSNamespaces") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/available_namespaces" + + 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 Update an AWS integration. +// Update an AWS Account Integration Config +func (a *AWSIntegrationApi) UpdateAWSAccount(ctx _context.Context, awsAccountConfigId string, body AWSAccountUpdateRequest) (AWSAccountResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue AWSAccountResponse + ) + + operationId := "v2.UpdateAWSAccount" + if a.Client.Cfg.IsUnstableOperationEnabled(operationId) { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } else { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.UpdateAWSAccount") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/accounts/{aws_account_config_id}" + localVarPath = strings.Replace(localVarPath, "{"+"aws_account_config_id"+"}", _neturl.PathEscape(datadog.ParameterToString(awsAccountConfigId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewAWSIntegrationApi Returns NewAWSIntegrationApi. +func NewAWSIntegrationApi(client *datadog.APIClient) *AWSIntegrationApi { + return &AWSIntegrationApi{ + Client: client, + } +} diff --git a/api/datadogV2/api_aws_logs_integration.go b/api/datadogV2/api_aws_logs_integration.go new file mode 100644 index 00000000000..14c5ebc57dc --- /dev/null +++ b/api/datadogV2/api_aws_logs_integration.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 ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSLogsIntegrationApi service type +type AWSLogsIntegrationApi datadog.Service + +// ListAWSLogsServices Get list of AWS log ready services. +// Get a list of AWS services that can send logs to Datadog. +func (a *AWSLogsIntegrationApi) ListAWSLogsServices(ctx _context.Context) (AWSLogsServicesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSLogsServicesResponse + ) + + operationId := "v2.ListAWSLogsServices" + 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.AWSLogsIntegrationApi.ListAWSLogsServices") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/logs/services" + + 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 +} + +// NewAWSLogsIntegrationApi Returns NewAWSLogsIntegrationApi. +func NewAWSLogsIntegrationApi(client *datadog.APIClient) *AWSLogsIntegrationApi { + return &AWSLogsIntegrationApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 25a26eb6911..22c043a6f27 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -14,6 +14,14 @@ // - [APMRetentionFiltersApi.ListApmRetentionFilters] // - [APMRetentionFiltersApi.ReorderApmRetentionFilters] // - [APMRetentionFiltersApi.UpdateApmRetentionFilter] +// - [AWSIntegrationApi.CreateAWSAccount] +// - [AWSIntegrationApi.CreateNewAWSExternalID] +// - [AWSIntegrationApi.DeleteAWSAccount] +// - [AWSIntegrationApi.GetAWSAccount] +// - [AWSIntegrationApi.ListAWSAccounts] +// - [AWSIntegrationApi.ListAWSNamespaces] +// - [AWSIntegrationApi.UpdateAWSAccount] +// - [AWSLogsIntegrationApi.ListAWSLogsServices] // - [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..27e7ba8cc47 --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request.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" +) + +// AWSAccountCreateRequest AWS Account Create Request body +type AWSAccountCreateRequest struct { + // AWS Account Create Request data + Data AWSAccountCreateRequestData `json:"data"` + // 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(data AWSAccountCreateRequestData) *AWSAccountCreateRequest { + this := AWSAccountCreateRequest{} + this.Data = data + 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. +func (o *AWSAccountCreateRequest) GetData() AWSAccountCreateRequestData { + if o == nil { + var ret AWSAccountCreateRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequest) GetDataOk() (*AWSAccountCreateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +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) + } + 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"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_create_request_attributes.go b/api/datadogV2/model_aws_account_create_request_attributes.go new file mode 100644 index 00000000000..8a31606de0a --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request_attributes.go @@ -0,0 +1,410 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountCreateRequestAttributes The AWS Account Integration Config to be created +type AWSAccountCreateRequestAttributes struct { + // Tags to apply to all metrics in the account + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + // AWS Authentication config + AuthConfig AWSAuthConfig `json:"auth_config"` + // AWS Account ID + AwsAccountId string `json:"aws_account_id"` + // AWS Account partition + AwsPartition AWSAccountPartition `json:"aws_partition"` + // AWS Regions to collect data from + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + // AWS Logs config + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + // AWS Metrics config + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + // AWS Resources config + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + // AWS Traces config + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountCreateRequestAttributes instantiates a new AWSAccountCreateRequestAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountCreateRequestAttributes(authConfig AWSAuthConfig, awsAccountId string, awsPartition AWSAccountPartition) *AWSAccountCreateRequestAttributes { + this := AWSAccountCreateRequestAttributes{} + this.AuthConfig = authConfig + this.AwsAccountId = awsAccountId + this.AwsPartition = awsPartition + return &this +} + +// NewAWSAccountCreateRequestAttributesWithDefaults instantiates a new AWSAccountCreateRequestAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountCreateRequestAttributesWithDefaults() *AWSAccountCreateRequestAttributes { + this := AWSAccountCreateRequestAttributes{} + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = awsPartition + return &this +} + +// GetAccountTags returns the AccountTags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AWSAccountCreateRequestAttributes) GetAccountTags() []string { + if o == nil || o.AccountTags.Get() == nil { + var ret []string + return ret + } + return *o.AccountTags.Get() +} + +// GetAccountTagsOk returns a tuple with the AccountTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AWSAccountCreateRequestAttributes) GetAccountTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.AccountTags.Get(), o.AccountTags.IsSet() +} + +// HasAccountTags returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasAccountTags() bool { + return o != nil && o.AccountTags.IsSet() +} + +// SetAccountTags gets a reference to the given datadog.NullableList[string] and assigns it to the AccountTags field. +func (o *AWSAccountCreateRequestAttributes) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountCreateRequestAttributes) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountCreateRequestAttributes) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value. +func (o *AWSAccountCreateRequestAttributes) GetAuthConfig() AWSAuthConfig { + if o == nil { + var ret AWSAuthConfig + return ret + } + return o.AuthConfig +} + +// GetAuthConfigOk returns a tuple with the AuthConfig field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAuthConfigOk() (*AWSAuthConfig, bool) { + if o == nil { + return nil, false + } + return &o.AuthConfig, true +} + +// SetAuthConfig sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountCreateRequestAttributes) GetAwsAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AwsAccountId +} + +// GetAwsAccountIdOk returns a tuple with the AwsAccountId field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value. +func (o *AWSAccountCreateRequestAttributes) GetAwsPartition() AWSAccountPartition { + if o == nil { + var ret AWSAccountPartition + return ret + } + return o.AwsPartition +} + +// GetAwsPartitionOk returns a tuple with the AwsPartition field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsPartitionOk() (*AWSAccountPartition, bool) { + if o == nil { + return nil, false + } + return &o.AwsPartition, true +} + +// SetAwsPartition sets field value. +func (o *AWSAccountCreateRequestAttributes) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetAwsRegions() AWSRegions { + if o == nil || o.AwsRegions == nil { + var ret AWSRegions + return ret + } + return *o.AwsRegions +} + +// GetAwsRegionsOk returns a tuple with the AwsRegions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetAwsRegionsOk() (*AWSRegions, bool) { + if o == nil || o.AwsRegions == nil { + return nil, false + } + return o.AwsRegions, true +} + +// HasAwsRegions returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasAwsRegions() bool { + return o != nil && o.AwsRegions != nil +} + +// SetAwsRegions gets a reference to the given AWSRegions and assigns it to the AwsRegions field. +func (o *AWSAccountCreateRequestAttributes) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetLogsConfig() AWSLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret AWSLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetLogsConfigOk() (*AWSLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given AWSLogsConfig and assigns it to the LogsConfig field. +func (o *AWSAccountCreateRequestAttributes) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetMetricsConfig() AWSMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret AWSMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetMetricsConfigOk() (*AWSMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given AWSMetricsConfig and assigns it to the MetricsConfig field. +func (o *AWSAccountCreateRequestAttributes) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetResourcesConfig() AWSResourcesConfig { + if o == nil || o.ResourcesConfig == nil { + var ret AWSResourcesConfig + return ret + } + return *o.ResourcesConfig +} + +// GetResourcesConfigOk returns a tuple with the ResourcesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetResourcesConfigOk() (*AWSResourcesConfig, bool) { + if o == nil || o.ResourcesConfig == nil { + return nil, false + } + return o.ResourcesConfig, true +} + +// HasResourcesConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasResourcesConfig() bool { + return o != nil && o.ResourcesConfig != nil +} + +// SetResourcesConfig gets a reference to the given AWSResourcesConfig and assigns it to the ResourcesConfig field. +func (o *AWSAccountCreateRequestAttributes) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountCreateRequestAttributes) GetTracesConfig() AWSTracesConfig { + if o == nil || o.TracesConfig == nil { + var ret AWSTracesConfig + return ret + } + return *o.TracesConfig +} + +// GetTracesConfigOk returns a tuple with the TracesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestAttributes) GetTracesConfigOk() (*AWSTracesConfig, bool) { + if o == nil || o.TracesConfig == nil { + return nil, false + } + return o.TracesConfig, true +} + +// HasTracesConfig returns a boolean if a field has been set. +func (o *AWSAccountCreateRequestAttributes) HasTracesConfig() bool { + return o != nil && o.TracesConfig != nil +} + +// SetTracesConfig gets a reference to the given AWSTracesConfig and assigns it to the TracesConfig field. +func (o *AWSAccountCreateRequestAttributes) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountTags.IsSet() { + toSerialize["account_tags"] = o.AccountTags.Get() + } + toSerialize["auth_config"] = o.AuthConfig + toSerialize["aws_account_id"] = o.AwsAccountId + toSerialize["aws_partition"] = o.AwsPartition + if o.AwsRegions != nil { + toSerialize["aws_regions"] = o.AwsRegions + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.ResourcesConfig != nil { + toSerialize["resources_config"] = o.ResourcesConfig + } + if o.TracesConfig != nil { + toSerialize["traces_config"] = o.TracesConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + AuthConfig *AWSAuthConfig `json:"auth_config"` + AwsAccountId *string `json:"aws_account_id"` + AwsPartition *AWSAccountPartition `json:"aws_partition"` + AwsRegions *AWSRegions `json:"aws_regions,omitempty"` + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AuthConfig == nil { + return fmt.Errorf("required field auth_config missing") + } + if all.AwsAccountId == nil { + return fmt.Errorf("required field aws_account_id missing") + } + if all.AwsPartition == nil { + return fmt.Errorf("required field aws_partition missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_tags", "auth_config", "aws_account_id", "aws_partition", "aws_regions", "logs_config", "metrics_config", "resources_config", "traces_config"}) + } else { + return err + } + + hasInvalidField := false + o.AccountTags = all.AccountTags + o.AuthConfig = *all.AuthConfig + o.AwsAccountId = *all.AwsAccountId + if !all.AwsPartition.IsValid() { + hasInvalidField = true + } else { + o.AwsPartition = *all.AwsPartition + } + o.AwsRegions = all.AwsRegions + if all.LogsConfig != nil && all.LogsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LogsConfig = all.LogsConfig + if all.MetricsConfig != nil && all.MetricsConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MetricsConfig = all.MetricsConfig + if all.ResourcesConfig != nil && all.ResourcesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ResourcesConfig = all.ResourcesConfig + if all.TracesConfig != nil && all.TracesConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TracesConfig = all.TracesConfig + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_account_create_request_data.go b/api/datadogV2/model_aws_account_create_request_data.go new file mode 100644 index 00000000000..5e46f1c6439 --- /dev/null +++ b/api/datadogV2/model_aws_account_create_request_data.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 ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountCreateRequestData AWS Account Create Request data +type AWSAccountCreateRequestData struct { + // The AWS Account Integration Config to be created + Attributes AWSAccountCreateRequestAttributes `json:"attributes"` + // AWS Account resource type. + Type AWSAccountType `json:"type"` + // 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, typeVar AWSAccountType) *AWSAccountCreateRequestData { + this := AWSAccountCreateRequestData{} + this.Attributes = attributes + 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 AWSAccountType = AWSACCOUNTTYPE_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSAccountCreateRequestData) GetAttributes() AWSAccountCreateRequestAttributes { + if o == nil { + var ret AWSAccountCreateRequestAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestData) GetAttributesOk() (*AWSAccountCreateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSAccountCreateRequestData) SetAttributes(v AWSAccountCreateRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AWSAccountCreateRequestData) GetType() AWSAccountType { + if o == nil { + var ret AWSAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSAccountCreateRequestData) GetTypeOk() (*AWSAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSAccountCreateRequestData) SetType(v AWSAccountType) { + 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 + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountCreateRequestAttributes `json:"attributes"` + Type *AWSAccountType `json:"type"` + }{} + 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") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_response.go b/api/datadogV2/model_aws_account_response.go new file mode 100644 index 00000000000..46efba9befc --- /dev/null +++ b/api/datadogV2/model_aws_account_response.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" +) + +// AWSAccountResponse AWS Account response body +type AWSAccountResponse struct { + // AWS Account Response body + Data AWSAccountResponseData `json:"data"` + // 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(data AWSAccountResponseData) *AWSAccountResponse { + this := AWSAccountResponse{} + this.Data = data + 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. +func (o *AWSAccountResponse) GetData() AWSAccountResponseData { + if o == nil { + var ret AWSAccountResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponse) GetDataOk() (*AWSAccountResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +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) + } + 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"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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..b18d4873d8a --- /dev/null +++ b/api/datadogV2/model_aws_account_response_attributes.go @@ -0,0 +1,497 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountResponseAttributes The AWS Account Integration Config +type AWSAccountResponseAttributes struct { + // Tags to apply to all metrics in the account + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + // AWS Authentication config + AuthConfig *AWSAuthConfig `json:"auth_config,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"` + // Timestamp of when the account integration was created + CreatedAt *time.Time `json:"created_at,omitempty"` + // AWS Logs config + LogsConfig *AWSLogsConfig `json:"logs_config,omitempty"` + // AWS Metrics config + MetricsConfig *AWSMetricsConfig `json:"metrics_config,omitempty"` + // Timestamp of when the account integration was updated + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // AWS Resources config + ResourcesConfig *AWSResourcesConfig `json:"resources_config,omitempty"` + // AWS Traces config + TracesConfig *AWSTracesConfig `json:"traces_config,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAccountResponseAttributes instantiates a new AWSAccountResponseAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAccountResponseAttributes(awsAccountId string) *AWSAccountResponseAttributes { + this := AWSAccountResponseAttributes{} + this.AwsAccountId = awsAccountId + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = &awsPartition + return &this +} + +// NewAWSAccountResponseAttributesWithDefaults instantiates a new AWSAccountResponseAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAccountResponseAttributesWithDefaults() *AWSAccountResponseAttributes { + this := AWSAccountResponseAttributes{} + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = &awsPartition + return &this +} + +// GetAccountTags returns the AccountTags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *AWSAccountResponseAttributes) GetAccountTags() []string { + if o == nil || o.AccountTags.Get() == nil { + var ret []string + return ret + } + return *o.AccountTags.Get() +} + +// GetAccountTagsOk returns a tuple with the AccountTags field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *AWSAccountResponseAttributes) GetAccountTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.AccountTags.Get(), o.AccountTags.IsSet() +} + +// HasAccountTags returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasAccountTags() bool { + return o != nil && o.AccountTags.IsSet() +} + +// SetAccountTags gets a reference to the given datadog.NullableList[string] and assigns it to the AccountTags field. +func (o *AWSAccountResponseAttributes) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountResponseAttributes) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountResponseAttributes) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) 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 *AWSAccountResponseAttributes) 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 *AWSAccountResponseAttributes) 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 *AWSAccountResponseAttributes) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = &v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountResponseAttributes) GetAwsAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AwsAccountId +} + +// GetAwsAccountIdOk returns a tuple with the AwsAccountId field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountResponseAttributes) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) 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 *AWSAccountResponseAttributes) 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 *AWSAccountResponseAttributes) 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 *AWSAccountResponseAttributes) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = &v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetAwsRegions() AWSRegions { + if o == nil || o.AwsRegions == nil { + var ret AWSRegions + return ret + } + return *o.AwsRegions +} + +// GetAwsRegionsOk returns a tuple with the AwsRegions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetAwsRegionsOk() (*AWSRegions, bool) { + if o == nil || o.AwsRegions == nil { + return nil, false + } + return o.AwsRegions, true +} + +// HasAwsRegions returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasAwsRegions() bool { + return o != nil && o.AwsRegions != nil +} + +// SetAwsRegions gets a reference to the given AWSRegions and assigns it to the AwsRegions field. +func (o *AWSAccountResponseAttributes) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AWSAccountResponseAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetLogsConfig() AWSLogsConfig { + if o == nil || o.LogsConfig == nil { + var ret AWSLogsConfig + return ret + } + return *o.LogsConfig +} + +// GetLogsConfigOk returns a tuple with the LogsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetLogsConfigOk() (*AWSLogsConfig, bool) { + if o == nil || o.LogsConfig == nil { + return nil, false + } + return o.LogsConfig, true +} + +// HasLogsConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasLogsConfig() bool { + return o != nil && o.LogsConfig != nil +} + +// SetLogsConfig gets a reference to the given AWSLogsConfig and assigns it to the LogsConfig field. +func (o *AWSAccountResponseAttributes) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetMetricsConfig() AWSMetricsConfig { + if o == nil || o.MetricsConfig == nil { + var ret AWSMetricsConfig + return ret + } + return *o.MetricsConfig +} + +// GetMetricsConfigOk returns a tuple with the MetricsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetMetricsConfigOk() (*AWSMetricsConfig, bool) { + if o == nil || o.MetricsConfig == nil { + return nil, false + } + return o.MetricsConfig, true +} + +// HasMetricsConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasMetricsConfig() bool { + return o != nil && o.MetricsConfig != nil +} + +// SetMetricsConfig gets a reference to the given AWSMetricsConfig and assigns it to the MetricsConfig field. +func (o *AWSAccountResponseAttributes) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *AWSAccountResponseAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetResourcesConfig() AWSResourcesConfig { + if o == nil || o.ResourcesConfig == nil { + var ret AWSResourcesConfig + return ret + } + return *o.ResourcesConfig +} + +// GetResourcesConfigOk returns a tuple with the ResourcesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetResourcesConfigOk() (*AWSResourcesConfig, bool) { + if o == nil || o.ResourcesConfig == nil { + return nil, false + } + return o.ResourcesConfig, true +} + +// HasResourcesConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasResourcesConfig() bool { + return o != nil && o.ResourcesConfig != nil +} + +// SetResourcesConfig gets a reference to the given AWSResourcesConfig and assigns it to the ResourcesConfig field. +func (o *AWSAccountResponseAttributes) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountResponseAttributes) GetTracesConfig() AWSTracesConfig { + if o == nil || o.TracesConfig == nil { + var ret AWSTracesConfig + return ret + } + return *o.TracesConfig +} + +// GetTracesConfigOk returns a tuple with the TracesConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseAttributes) GetTracesConfigOk() (*AWSTracesConfig, bool) { + if o == nil || o.TracesConfig == nil { + return nil, false + } + return o.TracesConfig, true +} + +// HasTracesConfig returns a boolean if a field has been set. +func (o *AWSAccountResponseAttributes) HasTracesConfig() bool { + return o != nil && o.TracesConfig != nil +} + +// SetTracesConfig gets a reference to the given AWSTracesConfig and assigns it to the TracesConfig field. +func (o *AWSAccountResponseAttributes) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountTags.IsSet() { + toSerialize["account_tags"] = o.AccountTags.Get() + } + 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.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LogsConfig != nil { + toSerialize["logs_config"] = o.LogsConfig + } + if o.MetricsConfig != nil { + toSerialize["metrics_config"] = o.MetricsConfig + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.ResourcesConfig != nil { + toSerialize["resources_config"] = o.ResourcesConfig + } + if o.TracesConfig != nil { + toSerialize["traces_config"] = o.TracesConfig + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountTags datadog.NullableList[string] `json:"account_tags,omitempty"` + AuthConfig *AWSAuthConfig `json:"auth_config,omitempty"` + AwsAccountId *string `json:"aws_account_id"` + AwsPartition *AWSAccountPartition `json:"aws_partition,omitempty"` + 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.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", "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 != nil && !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..de39dd08393 --- /dev/null +++ b/api/datadogV2/model_aws_account_response_data.go @@ -0,0 +1,183 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountResponseData AWS Account Response body +type AWSAccountResponseData struct { + // The AWS Account Integration Config + Attributes *AWSAccountResponseAttributes `json:"attributes,omitempty"` + // Unique Datadog ID of the AWS Account Integration Config + Id string `json:"id"` + // AWS Account resource type. + Type AWSAccountType `json:"type"` + // 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(id string, typeVar AWSAccountType) *AWSAccountResponseData { + this := AWSAccountResponseData{} + this.Id = id + 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 AWSAccountType = AWSACCOUNTTYPE_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AWSAccountResponseData) GetAttributes() AWSAccountResponseAttributes { + if o == nil || o.Attributes == nil { + var ret AWSAccountResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseData) GetAttributesOk() (*AWSAccountResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AWSAccountResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AWSAccountResponseAttributes and assigns it to the Attributes field. +func (o *AWSAccountResponseData) SetAttributes(v AWSAccountResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *AWSAccountResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AWSAccountResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AWSAccountResponseData) GetType() AWSAccountType { + if o == nil { + var ret AWSAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSAccountResponseData) GetTypeOk() (*AWSAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSAccountResponseData) SetType(v AWSAccountType) { + 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) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + 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,omitempty"` + Id *string `json:"id"` + Type *AWSAccountType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type 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 != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_type.go b/api/datadogV2/model_aws_account_type.go new file mode 100644 index 00000000000..a23a912f9ae --- /dev/null +++ b/api/datadogV2/model_aws_account_type.go @@ -0,0 +1,64 @@ +// 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" +) + +// AWSAccountType AWS Account resource type. +type AWSAccountType string + +// List of AWSAccountType. +const ( + AWSACCOUNTTYPE_ACCOUNT AWSAccountType = "account" +) + +var allowedAWSAccountTypeEnumValues = []AWSAccountType{ + AWSACCOUNTTYPE_ACCOUNT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSAccountType) GetAllowedValues() []AWSAccountType { + return allowedAWSAccountTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSAccountType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSAccountType(value) + return nil +} + +// NewAWSAccountTypeFromValue returns a pointer to a valid AWSAccountType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSAccountTypeFromValue(v string) (*AWSAccountType, error) { + ev := AWSAccountType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSAccountType: valid values are %v", v, allowedAWSAccountTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSAccountType) IsValid() bool { + for _, existing := range allowedAWSAccountTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSAccountType value. +func (v AWSAccountType) Ptr() *AWSAccountType { + return &v +} diff --git a/api/datadogV2/model_aws_account_update_request.go b/api/datadogV2/model_aws_account_update_request.go new file mode 100644 index 00000000000..44453ca1366 --- /dev/null +++ b/api/datadogV2/model_aws_account_update_request.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" +) + +// AWSAccountUpdateRequest AWS Account Update Request body +type AWSAccountUpdateRequest struct { + // AWS Account Update Request data + Data AWSAccountUpdateRequestData `json:"data"` + // 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:"-"` +} + +// NewAWSAccountUpdateRequest instantiates a new AWSAccountUpdateRequest 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 NewAWSAccountUpdateRequest(data AWSAccountUpdateRequestData) *AWSAccountUpdateRequest { + this := AWSAccountUpdateRequest{} + this.Data = data + return &this +} + +// NewAWSAccountUpdateRequestWithDefaults instantiates a new AWSAccountUpdateRequest 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 NewAWSAccountUpdateRequestWithDefaults() *AWSAccountUpdateRequest { + this := AWSAccountUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSAccountUpdateRequest) GetData() AWSAccountUpdateRequestData { + if o == nil { + var ret AWSAccountUpdateRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSAccountUpdateRequest) GetDataOk() (*AWSAccountUpdateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSAccountUpdateRequest) SetData(v AWSAccountUpdateRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSAccountUpdateRequestData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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_update_request_attributes.go b/api/datadogV2/model_aws_account_update_request_attributes.go new file mode 100644 index 00000000000..1246928fdf0 --- /dev/null +++ b/api/datadogV2/model_aws_account_update_request_attributes.go @@ -0,0 +1,418 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAccountUpdateRequestAttributes The AWS Account Integration Config to be updated +type AWSAccountUpdateRequestAttributes 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:"-"` +} + +// NewAWSAccountUpdateRequestAttributes instantiates a new AWSAccountUpdateRequestAttributes 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 NewAWSAccountUpdateRequestAttributes(awsAccountId string) *AWSAccountUpdateRequestAttributes { + this := AWSAccountUpdateRequestAttributes{} + this.AwsAccountId = awsAccountId + var awsPartition AWSAccountPartition = AWSACCOUNTPARTITION_AWS + this.AwsPartition = &awsPartition + return &this +} + +// NewAWSAccountUpdateRequestAttributesWithDefaults instantiates a new AWSAccountUpdateRequestAttributes 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 NewAWSAccountUpdateRequestAttributesWithDefaults() *AWSAccountUpdateRequestAttributes { + this := AWSAccountUpdateRequestAttributes{} + 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetAccountTags(v []string) { + o.AccountTags.Set(&v) +} + +// SetAccountTagsNil sets the value for AccountTags to be an explicit nil. +func (o *AWSAccountUpdateRequestAttributes) SetAccountTagsNil() { + o.AccountTags.Set(nil) +} + +// UnsetAccountTags ensures that no value is present for AccountTags, not even an explicit nil. +func (o *AWSAccountUpdateRequestAttributes) UnsetAccountTags() { + o.AccountTags.Unset() +} + +// GetAuthConfig returns the AuthConfig field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetAuthConfig(v AWSAuthConfig) { + o.AuthConfig = &v +} + +// GetAwsAccountId returns the AwsAccountId field value. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) GetAwsAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AwsAccountId, true +} + +// SetAwsAccountId sets field value. +func (o *AWSAccountUpdateRequestAttributes) SetAwsAccountId(v string) { + o.AwsAccountId = v +} + +// GetAwsPartition returns the AwsPartition field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetAwsPartition(v AWSAccountPartition) { + o.AwsPartition = &v +} + +// GetAwsRegions returns the AwsRegions field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetAwsRegions(v AWSRegions) { + o.AwsRegions = &v +} + +// GetLogsConfig returns the LogsConfig field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetLogsConfig(v AWSLogsConfig) { + o.LogsConfig = &v +} + +// GetMetricsConfig returns the MetricsConfig field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetMetricsConfig(v AWSMetricsConfig) { + o.MetricsConfig = &v +} + +// GetResourcesConfig returns the ResourcesConfig field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetResourcesConfig(v AWSResourcesConfig) { + o.ResourcesConfig = &v +} + +// GetTracesConfig returns the TracesConfig field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) SetTracesConfig(v AWSTracesConfig) { + o.TracesConfig = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountUpdateRequestAttributes) 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 *AWSAccountUpdateRequestAttributes) 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_update_request_data.go b/api/datadogV2/model_aws_account_update_request_data.go new file mode 100644 index 00000000000..2d30efcdcc1 --- /dev/null +++ b/api/datadogV2/model_aws_account_update_request_data.go @@ -0,0 +1,183 @@ +// 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" +) + +// AWSAccountUpdateRequestData AWS Account Update Request data +type AWSAccountUpdateRequestData struct { + // The AWS Account Integration Config to be updated + Attributes AWSAccountUpdateRequestAttributes `json:"attributes"` + // Unique Datadog ID of the AWS Account Integration Config + Id *string `json:"id,omitempty"` + // AWS Account resource type. + Type AWSAccountType `json:"type"` + // 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:"-"` +} + +// NewAWSAccountUpdateRequestData instantiates a new AWSAccountUpdateRequestData 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 NewAWSAccountUpdateRequestData(attributes AWSAccountUpdateRequestAttributes, typeVar AWSAccountType) *AWSAccountUpdateRequestData { + this := AWSAccountUpdateRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAWSAccountUpdateRequestDataWithDefaults instantiates a new AWSAccountUpdateRequestData 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 NewAWSAccountUpdateRequestDataWithDefaults() *AWSAccountUpdateRequestData { + this := AWSAccountUpdateRequestData{} + var typeVar AWSAccountType = AWSACCOUNTTYPE_ACCOUNT + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSAccountUpdateRequestData) GetAttributes() AWSAccountUpdateRequestAttributes { + if o == nil { + var ret AWSAccountUpdateRequestAttributes + 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 *AWSAccountUpdateRequestData) GetAttributesOk() (*AWSAccountUpdateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSAccountUpdateRequestData) SetAttributes(v AWSAccountUpdateRequestAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSAccountUpdateRequestData) 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 *AWSAccountUpdateRequestData) 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 *AWSAccountUpdateRequestData) 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 *AWSAccountUpdateRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *AWSAccountUpdateRequestData) GetType() AWSAccountType { + if o == nil { + var ret AWSAccountType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSAccountUpdateRequestData) GetTypeOk() (*AWSAccountType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSAccountUpdateRequestData) SetType(v AWSAccountType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountUpdateRequestData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountUpdateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSAccountUpdateRequestAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *AWSAccountType `json:"type"` + }{} + 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") + } + if all.Type == nil { + return fmt.Errorf("required field type 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 + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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..db9ada82aa5 --- /dev/null +++ b/api/datadogV2/model_aws_accounts_response.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" +) + +// AWSAccountsResponse AWS Accounts response body +type AWSAccountsResponse struct { + // List of AWS Account Integration Configs + Data []AWSAccountResponseData `json:"data"` + // 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(data []AWSAccountResponseData) *AWSAccountsResponse { + this := AWSAccountsResponse{} + this.Data = data + 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. +func (o *AWSAccountsResponse) GetData() []AWSAccountResponseData { + if o == nil { + var ret []AWSAccountResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSAccountsResponse) GetDataOk() (*[]AWSAccountResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSAccountsResponse) SetData(v []AWSAccountResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAccountsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAccountsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]AWSAccountResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_auth_config.go b/api/datadogV2/model_aws_auth_config.go new file mode 100644 index 00000000000..37187c14616 --- /dev/null +++ b/api/datadogV2/model_aws_auth_config.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAuthConfig - AWS Authentication config +type AWSAuthConfig struct { + AWSAuthConfigKeys *AWSAuthConfigKeys + AWSAuthConfigRole *AWSAuthConfigRole + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AWSAuthConfigKeysAsAWSAuthConfig is a convenience function that returns AWSAuthConfigKeys wrapped in AWSAuthConfig. +func AWSAuthConfigKeysAsAWSAuthConfig(v *AWSAuthConfigKeys) AWSAuthConfig { + return AWSAuthConfig{AWSAuthConfigKeys: v} +} + +// AWSAuthConfigRoleAsAWSAuthConfig is a convenience function that returns AWSAuthConfigRole wrapped in AWSAuthConfig. +func AWSAuthConfigRoleAsAWSAuthConfig(v *AWSAuthConfigRole) AWSAuthConfig { + return AWSAuthConfig{AWSAuthConfigRole: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AWSAuthConfig) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AWSAuthConfigKeys + err = datadog.Unmarshal(data, &obj.AWSAuthConfigKeys) + if err == nil { + if obj.AWSAuthConfigKeys != nil && obj.AWSAuthConfigKeys.UnparsedObject == nil { + jsonAWSAuthConfigKeys, _ := datadog.Marshal(obj.AWSAuthConfigKeys) + if string(jsonAWSAuthConfigKeys) == "{}" { // empty struct + obj.AWSAuthConfigKeys = nil + } else { + match++ + } + } else { + obj.AWSAuthConfigKeys = nil + } + } else { + obj.AWSAuthConfigKeys = nil + } + + // try to unmarshal data into AWSAuthConfigRole + err = datadog.Unmarshal(data, &obj.AWSAuthConfigRole) + if err == nil { + if obj.AWSAuthConfigRole != nil && obj.AWSAuthConfigRole.UnparsedObject == nil { + jsonAWSAuthConfigRole, _ := datadog.Marshal(obj.AWSAuthConfigRole) + if string(jsonAWSAuthConfigRole) == "{}" { // empty struct + obj.AWSAuthConfigRole = nil + } else { + match++ + } + } else { + obj.AWSAuthConfigRole = nil + } + } else { + obj.AWSAuthConfigRole = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AWSAuthConfigKeys = nil + obj.AWSAuthConfigRole = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AWSAuthConfig) MarshalJSON() ([]byte, error) { + if obj.AWSAuthConfigKeys != nil { + return datadog.Marshal(&obj.AWSAuthConfigKeys) + } + + if obj.AWSAuthConfigRole != nil { + return datadog.Marshal(&obj.AWSAuthConfigRole) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AWSAuthConfig) GetActualInstance() interface{} { + if obj.AWSAuthConfigKeys != nil { + return obj.AWSAuthConfigKeys + } + + if obj.AWSAuthConfigRole != nil { + return obj.AWSAuthConfigRole + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_aws_auth_config_keys.go b/api/datadogV2/model_aws_auth_config_keys.go new file mode 100644 index 00000000000..7de951222a4 --- /dev/null +++ b/api/datadogV2/model_aws_auth_config_keys.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAuthConfigKeys AWS Authentication config for key-based account +type AWSAuthConfigKeys struct { + // AWS Access Key ID + AccessKeyId string `json:"access_key_id"` + // AWS Secret Access Key + SecretAccessKey *string `json:"secret_access_key,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAuthConfigKeys instantiates a new AWSAuthConfigKeys object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAuthConfigKeys(accessKeyId string) *AWSAuthConfigKeys { + this := AWSAuthConfigKeys{} + this.AccessKeyId = accessKeyId + return &this +} + +// NewAWSAuthConfigKeysWithDefaults instantiates a new AWSAuthConfigKeys object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAuthConfigKeysWithDefaults() *AWSAuthConfigKeys { + this := AWSAuthConfigKeys{} + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value. +func (o *AWSAuthConfigKeys) GetAccessKeyId() string { + if o == nil { + var ret string + return ret + } + return o.AccessKeyId +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigKeys) GetAccessKeyIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessKeyId, true +} + +// SetAccessKeyId sets field value. +func (o *AWSAuthConfigKeys) SetAccessKeyId(v string) { + o.AccessKeyId = v +} + +// GetSecretAccessKey returns the SecretAccessKey field value if set, zero value otherwise. +func (o *AWSAuthConfigKeys) GetSecretAccessKey() string { + if o == nil || o.SecretAccessKey == nil { + var ret string + return ret + } + return *o.SecretAccessKey +} + +// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigKeys) GetSecretAccessKeyOk() (*string, bool) { + if o == nil || o.SecretAccessKey == nil { + return nil, false + } + return o.SecretAccessKey, true +} + +// HasSecretAccessKey returns a boolean if a field has been set. +func (o *AWSAuthConfigKeys) HasSecretAccessKey() bool { + return o != nil && o.SecretAccessKey != nil +} + +// SetSecretAccessKey gets a reference to the given string and assigns it to the SecretAccessKey field. +func (o *AWSAuthConfigKeys) SetSecretAccessKey(v string) { + o.SecretAccessKey = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAuthConfigKeys) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["access_key_id"] = o.AccessKeyId + if o.SecretAccessKey != nil { + toSerialize["secret_access_key"] = o.SecretAccessKey + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAuthConfigKeys) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccessKeyId *string `json:"access_key_id"` + SecretAccessKey *string `json:"secret_access_key,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AccessKeyId == nil { + return fmt.Errorf("required field access_key_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"access_key_id", "secret_access_key"}) + } else { + return err + } + o.AccessKeyId = *all.AccessKeyId + o.SecretAccessKey = all.SecretAccessKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_auth_config_role.go b/api/datadogV2/model_aws_auth_config_role.go new file mode 100644 index 00000000000..c465b7e85b5 --- /dev/null +++ b/api/datadogV2/model_aws_auth_config_role.go @@ -0,0 +1,136 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSAuthConfigRole AWS Authentication config for role-based account +type AWSAuthConfigRole struct { + // AWS IAM External ID for associated role + ExternalId *string `json:"external_id,omitempty"` + // AWS IAM Role name + RoleName string `json:"role_name"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSAuthConfigRole instantiates a new AWSAuthConfigRole object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSAuthConfigRole(roleName string) *AWSAuthConfigRole { + this := AWSAuthConfigRole{} + this.RoleName = roleName + return &this +} + +// NewAWSAuthConfigRoleWithDefaults instantiates a new AWSAuthConfigRole object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSAuthConfigRoleWithDefaults() *AWSAuthConfigRole { + this := AWSAuthConfigRole{} + return &this +} + +// GetExternalId returns the ExternalId field value if set, zero value otherwise. +func (o *AWSAuthConfigRole) GetExternalId() string { + if o == nil || o.ExternalId == nil { + var ret string + return ret + } + return *o.ExternalId +} + +// GetExternalIdOk returns a tuple with the ExternalId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigRole) GetExternalIdOk() (*string, bool) { + if o == nil || o.ExternalId == nil { + return nil, false + } + return o.ExternalId, true +} + +// HasExternalId returns a boolean if a field has been set. +func (o *AWSAuthConfigRole) HasExternalId() bool { + return o != nil && o.ExternalId != nil +} + +// SetExternalId gets a reference to the given string and assigns it to the ExternalId field. +func (o *AWSAuthConfigRole) SetExternalId(v string) { + o.ExternalId = &v +} + +// GetRoleName returns the RoleName field value. +func (o *AWSAuthConfigRole) GetRoleName() string { + if o == nil { + var ret string + return ret + } + return o.RoleName +} + +// GetRoleNameOk returns a tuple with the RoleName field value +// and a boolean to check if the value has been set. +func (o *AWSAuthConfigRole) GetRoleNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RoleName, true +} + +// SetRoleName sets field value. +func (o *AWSAuthConfigRole) SetRoleName(v string) { + o.RoleName = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSAuthConfigRole) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExternalId != nil { + toSerialize["external_id"] = o.ExternalId + } + toSerialize["role_name"] = o.RoleName + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSAuthConfigRole) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExternalId *string `json:"external_id,omitempty"` + RoleName *string `json:"role_name"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.RoleName == nil { + return fmt.Errorf("required field role_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"external_id", "role_name"}) + } else { + return err + } + o.ExternalId = all.ExternalId + o.RoleName = *all.RoleName + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_lambda_forwarder_config.go b/api/datadogV2/model_aws_lambda_forwarder_config.go new file mode 100644 index 00000000000..634d728fdce --- /dev/null +++ b/api/datadogV2/model_aws_lambda_forwarder_config.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSLambdaForwarderConfig AWS Lambda forwarder +type AWSLambdaForwarderConfig struct { + // List of Datadog Lambda Log Forwarder ARNs + Lambdas []string `json:"lambdas,omitempty"` + // List of AWS services that will send logs to the Datadog Lambda Log Forwarder + Sources []string `json:"sources,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSLambdaForwarderConfig instantiates a new AWSLambdaForwarderConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSLambdaForwarderConfig() *AWSLambdaForwarderConfig { + this := AWSLambdaForwarderConfig{} + return &this +} + +// NewAWSLambdaForwarderConfigWithDefaults instantiates a new AWSLambdaForwarderConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSLambdaForwarderConfigWithDefaults() *AWSLambdaForwarderConfig { + this := AWSLambdaForwarderConfig{} + return &this +} + +// GetLambdas returns the Lambdas field value if set, zero value otherwise. +func (o *AWSLambdaForwarderConfig) GetLambdas() []string { + if o == nil || o.Lambdas == nil { + var ret []string + return ret + } + return o.Lambdas +} + +// GetLambdasOk returns a tuple with the Lambdas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLambdaForwarderConfig) GetLambdasOk() (*[]string, bool) { + if o == nil || o.Lambdas == nil { + return nil, false + } + return &o.Lambdas, true +} + +// HasLambdas returns a boolean if a field has been set. +func (o *AWSLambdaForwarderConfig) HasLambdas() bool { + return o != nil && o.Lambdas != nil +} + +// SetLambdas gets a reference to the given []string and assigns it to the Lambdas field. +func (o *AWSLambdaForwarderConfig) SetLambdas(v []string) { + o.Lambdas = v +} + +// GetSources returns the Sources field value if set, zero value otherwise. +func (o *AWSLambdaForwarderConfig) GetSources() []string { + if o == nil || o.Sources == nil { + var ret []string + return ret + } + return o.Sources +} + +// GetSourcesOk returns a tuple with the Sources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLambdaForwarderConfig) GetSourcesOk() (*[]string, bool) { + if o == nil || o.Sources == nil { + return nil, false + } + return &o.Sources, true +} + +// HasSources returns a boolean if a field has been set. +func (o *AWSLambdaForwarderConfig) HasSources() bool { + return o != nil && o.Sources != nil +} + +// SetSources gets a reference to the given []string and assigns it to the Sources field. +func (o *AWSLambdaForwarderConfig) SetSources(v []string) { + o.Sources = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLambdaForwarderConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Lambdas != nil { + toSerialize["lambdas"] = o.Lambdas + } + if o.Sources != nil { + toSerialize["sources"] = o.Sources + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLambdaForwarderConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Lambdas []string `json:"lambdas,omitempty"` + Sources []string `json:"sources,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"lambdas", "sources"}) + } else { + return err + } + o.Lambdas = all.Lambdas + o.Sources = all.Sources + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_logs_config.go b/api/datadogV2/model_aws_logs_config.go new file mode 100644 index 00000000000..d323364340e --- /dev/null +++ b/api/datadogV2/model_aws_logs_config.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSLogsConfig AWS Logs config +type AWSLogsConfig struct { + // AWS Lambda forwarder + LambdaForwarder *AWSLambdaForwarderConfig `json:"lambda_forwarder,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSLogsConfig instantiates a new AWSLogsConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSLogsConfig() *AWSLogsConfig { + this := AWSLogsConfig{} + return &this +} + +// NewAWSLogsConfigWithDefaults instantiates a new AWSLogsConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSLogsConfigWithDefaults() *AWSLogsConfig { + this := AWSLogsConfig{} + return &this +} + +// GetLambdaForwarder returns the LambdaForwarder field value if set, zero value otherwise. +func (o *AWSLogsConfig) GetLambdaForwarder() AWSLambdaForwarderConfig { + if o == nil || o.LambdaForwarder == nil { + var ret AWSLambdaForwarderConfig + return ret + } + return *o.LambdaForwarder +} + +// GetLambdaForwarderOk returns a tuple with the LambdaForwarder field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsConfig) GetLambdaForwarderOk() (*AWSLambdaForwarderConfig, bool) { + if o == nil || o.LambdaForwarder == nil { + return nil, false + } + return o.LambdaForwarder, true +} + +// HasLambdaForwarder returns a boolean if a field has been set. +func (o *AWSLogsConfig) HasLambdaForwarder() bool { + return o != nil && o.LambdaForwarder != nil +} + +// SetLambdaForwarder gets a reference to the given AWSLambdaForwarderConfig and assigns it to the LambdaForwarder field. +func (o *AWSLogsConfig) SetLambdaForwarder(v AWSLambdaForwarderConfig) { + o.LambdaForwarder = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.LambdaForwarder != nil { + toSerialize["lambda_forwarder"] = o.LambdaForwarder + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + LambdaForwarder *AWSLambdaForwarderConfig `json:"lambda_forwarder,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"lambda_forwarder"}) + } else { + return err + } + + hasInvalidField := false + if all.LambdaForwarder != nil && all.LambdaForwarder.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LambdaForwarder = all.LambdaForwarder + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_logs_services_response.go b/api/datadogV2/model_aws_logs_services_response.go new file mode 100644 index 00000000000..d65043ecef9 --- /dev/null +++ b/api/datadogV2/model_aws_logs_services_response.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" +) + +// AWSLogsServicesResponse AWS Logs Services response body +type AWSLogsServicesResponse struct { + // AWS Logs Services response body + Data AWSLogsServicesResponseData `json:"data"` + // 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:"-"` +} + +// NewAWSLogsServicesResponse instantiates a new AWSLogsServicesResponse 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 NewAWSLogsServicesResponse(data AWSLogsServicesResponseData) *AWSLogsServicesResponse { + this := AWSLogsServicesResponse{} + this.Data = data + return &this +} + +// NewAWSLogsServicesResponseWithDefaults instantiates a new AWSLogsServicesResponse 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 NewAWSLogsServicesResponseWithDefaults() *AWSLogsServicesResponse { + this := AWSLogsServicesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSLogsServicesResponse) GetData() AWSLogsServicesResponseData { + if o == nil { + var ret AWSLogsServicesResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesResponse) GetDataOk() (*AWSLogsServicesResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSLogsServicesResponse) SetData(v AWSLogsServicesResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsServicesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsServicesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSLogsServicesResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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_logs_services_response_attributes.go b/api/datadogV2/model_aws_logs_services_response_attributes.go new file mode 100644 index 00000000000..694b8c3e96c --- /dev/null +++ b/api/datadogV2/model_aws_logs_services_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" +) + +// AWSLogsServicesResponseAttributes AWS Logs Services response body +type AWSLogsServicesResponseAttributes struct { + // List of AWS services that can send logs to Datadog + LogsServices []string `json:"logs_services"` + // 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:"-"` +} + +// NewAWSLogsServicesResponseAttributes instantiates a new AWSLogsServicesResponseAttributes 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 NewAWSLogsServicesResponseAttributes(logsServices []string) *AWSLogsServicesResponseAttributes { + this := AWSLogsServicesResponseAttributes{} + this.LogsServices = logsServices + return &this +} + +// NewAWSLogsServicesResponseAttributesWithDefaults instantiates a new AWSLogsServicesResponseAttributes 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 NewAWSLogsServicesResponseAttributesWithDefaults() *AWSLogsServicesResponseAttributes { + this := AWSLogsServicesResponseAttributes{} + return &this +} + +// GetLogsServices returns the LogsServices field value. +func (o *AWSLogsServicesResponseAttributes) GetLogsServices() []string { + if o == nil { + var ret []string + return ret + } + return o.LogsServices +} + +// GetLogsServicesOk returns a tuple with the LogsServices field value +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesResponseAttributes) GetLogsServicesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.LogsServices, true +} + +// SetLogsServices sets field value. +func (o *AWSLogsServicesResponseAttributes) SetLogsServices(v []string) { + o.LogsServices = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsServicesResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["logs_services"] = o.LogsServices + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsServicesResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + LogsServices *[]string `json:"logs_services"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.LogsServices == nil { + return fmt.Errorf("required field logs_services missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"logs_services"}) + } else { + return err + } + o.LogsServices = *all.LogsServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_logs_services_response_data.go b/api/datadogV2/model_aws_logs_services_response_data.go new file mode 100644 index 00000000000..2666f215aca --- /dev/null +++ b/api/datadogV2/model_aws_logs_services_response_data.go @@ -0,0 +1,185 @@ +// 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" +) + +// AWSLogsServicesResponseData AWS Logs Services response body +type AWSLogsServicesResponseData struct { + // AWS Logs Services response body + Attributes *AWSLogsServicesResponseAttributes `json:"attributes,omitempty"` + // The `AWSLogsServicesResponseData` `id`. + Id string `json:"id"` + // The `AWSLogsServicesResponseData` `type`. + Type AWSLogsServicesResponseDataType `json:"type"` + // 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:"-"` +} + +// NewAWSLogsServicesResponseData instantiates a new AWSLogsServicesResponseData 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 NewAWSLogsServicesResponseData(id string, typeVar AWSLogsServicesResponseDataType) *AWSLogsServicesResponseData { + this := AWSLogsServicesResponseData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewAWSLogsServicesResponseDataWithDefaults instantiates a new AWSLogsServicesResponseData 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 NewAWSLogsServicesResponseDataWithDefaults() *AWSLogsServicesResponseData { + this := AWSLogsServicesResponseData{} + var id string = "logs_services" + this.Id = id + var typeVar AWSLogsServicesResponseDataType = AWSLOGSSERVICESRESPONSEDATATYPE_LOGS_SERVICES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AWSLogsServicesResponseData) GetAttributes() AWSLogsServicesResponseAttributes { + if o == nil || o.Attributes == nil { + var ret AWSLogsServicesResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesResponseData) GetAttributesOk() (*AWSLogsServicesResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AWSLogsServicesResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AWSLogsServicesResponseAttributes and assigns it to the Attributes field. +func (o *AWSLogsServicesResponseData) SetAttributes(v AWSLogsServicesResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *AWSLogsServicesResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AWSLogsServicesResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AWSLogsServicesResponseData) GetType() AWSLogsServicesResponseDataType { + if o == nil { + var ret AWSLogsServicesResponseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSLogsServicesResponseData) GetTypeOk() (*AWSLogsServicesResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSLogsServicesResponseData) SetType(v AWSLogsServicesResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSLogsServicesResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSLogsServicesResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSLogsServicesResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *AWSLogsServicesResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type 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 != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_logs_services_response_data_type.go b/api/datadogV2/model_aws_logs_services_response_data_type.go new file mode 100644 index 00000000000..e6e132c383f --- /dev/null +++ b/api/datadogV2/model_aws_logs_services_response_data_type.go @@ -0,0 +1,64 @@ +// 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" +) + +// AWSLogsServicesResponseDataType The `AWSLogsServicesResponseData` `type`. +type AWSLogsServicesResponseDataType string + +// List of AWSLogsServicesResponseDataType. +const ( + AWSLOGSSERVICESRESPONSEDATATYPE_LOGS_SERVICES AWSLogsServicesResponseDataType = "logs_services" +) + +var allowedAWSLogsServicesResponseDataTypeEnumValues = []AWSLogsServicesResponseDataType{ + AWSLOGSSERVICESRESPONSEDATATYPE_LOGS_SERVICES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSLogsServicesResponseDataType) GetAllowedValues() []AWSLogsServicesResponseDataType { + return allowedAWSLogsServicesResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSLogsServicesResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSLogsServicesResponseDataType(value) + return nil +} + +// NewAWSLogsServicesResponseDataTypeFromValue returns a pointer to a valid AWSLogsServicesResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSLogsServicesResponseDataTypeFromValue(v string) (*AWSLogsServicesResponseDataType, error) { + ev := AWSLogsServicesResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSLogsServicesResponseDataType: valid values are %v", v, allowedAWSLogsServicesResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSLogsServicesResponseDataType) IsValid() bool { + for _, existing := range allowedAWSLogsServicesResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSLogsServicesResponseDataType value. +func (v AWSLogsServicesResponseDataType) Ptr() *AWSLogsServicesResponseDataType { + return &v +} 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_namespaces_response.go b/api/datadogV2/model_aws_namespaces_response.go new file mode 100644 index 00000000000..98814a7e913 --- /dev/null +++ b/api/datadogV2/model_aws_namespaces_response.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" +) + +// AWSNamespacesResponse AWS Namespaces response body +type AWSNamespacesResponse struct { + // AWS Namespaces response body + Data AWSNamespacesResponseData `json:"data"` + // 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:"-"` +} + +// NewAWSNamespacesResponse instantiates a new AWSNamespacesResponse 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 NewAWSNamespacesResponse(data AWSNamespacesResponseData) *AWSNamespacesResponse { + this := AWSNamespacesResponse{} + this.Data = data + return &this +} + +// NewAWSNamespacesResponseWithDefaults instantiates a new AWSNamespacesResponse 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 NewAWSNamespacesResponseWithDefaults() *AWSNamespacesResponse { + this := AWSNamespacesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSNamespacesResponse) GetData() AWSNamespacesResponseData { + if o == nil { + var ret AWSNamespacesResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSNamespacesResponse) GetDataOk() (*AWSNamespacesResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSNamespacesResponse) SetData(v AWSNamespacesResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespacesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespacesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSNamespacesResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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_namespaces_response_attributes.go b/api/datadogV2/model_aws_namespaces_response_attributes.go new file mode 100644 index 00000000000..eb57533bf02 --- /dev/null +++ b/api/datadogV2/model_aws_namespaces_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" +) + +// AWSNamespacesResponseAttributes AWS Namespaces response body +type AWSNamespacesResponseAttributes struct { + // AWS CloudWatch namespace + Namespaces []string `json:"namespaces"` + // 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:"-"` +} + +// NewAWSNamespacesResponseAttributes instantiates a new AWSNamespacesResponseAttributes 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 NewAWSNamespacesResponseAttributes(namespaces []string) *AWSNamespacesResponseAttributes { + this := AWSNamespacesResponseAttributes{} + this.Namespaces = namespaces + return &this +} + +// NewAWSNamespacesResponseAttributesWithDefaults instantiates a new AWSNamespacesResponseAttributes 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 NewAWSNamespacesResponseAttributesWithDefaults() *AWSNamespacesResponseAttributes { + this := AWSNamespacesResponseAttributes{} + return &this +} + +// GetNamespaces returns the Namespaces field value. +func (o *AWSNamespacesResponseAttributes) GetNamespaces() []string { + if o == nil { + var ret []string + return ret + } + return o.Namespaces +} + +// GetNamespacesOk returns a tuple with the Namespaces field value +// and a boolean to check if the value has been set. +func (o *AWSNamespacesResponseAttributes) GetNamespacesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Namespaces, true +} + +// SetNamespaces sets field value. +func (o *AWSNamespacesResponseAttributes) SetNamespaces(v []string) { + o.Namespaces = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespacesResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["namespaces"] = o.Namespaces + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespacesResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Namespaces *[]string `json:"namespaces"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Namespaces == nil { + return fmt.Errorf("required field namespaces missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"namespaces"}) + } else { + return err + } + o.Namespaces = *all.Namespaces + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_namespaces_response_data.go b/api/datadogV2/model_aws_namespaces_response_data.go new file mode 100644 index 00000000000..20d2a55652d --- /dev/null +++ b/api/datadogV2/model_aws_namespaces_response_data.go @@ -0,0 +1,185 @@ +// 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" +) + +// AWSNamespacesResponseData AWS Namespaces response body +type AWSNamespacesResponseData struct { + // AWS Namespaces response body + Attributes *AWSNamespacesResponseAttributes `json:"attributes,omitempty"` + // The `AWSNamespacesResponseData` `id`. + Id string `json:"id"` + // The `AWSNamespacesResponseData` `type`. + Type AWSNamespacesResponseDataType `json:"type"` + // 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:"-"` +} + +// NewAWSNamespacesResponseData instantiates a new AWSNamespacesResponseData 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 NewAWSNamespacesResponseData(id string, typeVar AWSNamespacesResponseDataType) *AWSNamespacesResponseData { + this := AWSNamespacesResponseData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewAWSNamespacesResponseDataWithDefaults instantiates a new AWSNamespacesResponseData 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 NewAWSNamespacesResponseDataWithDefaults() *AWSNamespacesResponseData { + this := AWSNamespacesResponseData{} + var id string = "namespaces" + this.Id = id + var typeVar AWSNamespacesResponseDataType = AWSNAMESPACESRESPONSEDATATYPE_NAMESPACES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AWSNamespacesResponseData) GetAttributes() AWSNamespacesResponseAttributes { + if o == nil || o.Attributes == nil { + var ret AWSNamespacesResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSNamespacesResponseData) GetAttributesOk() (*AWSNamespacesResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AWSNamespacesResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AWSNamespacesResponseAttributes and assigns it to the Attributes field. +func (o *AWSNamespacesResponseData) SetAttributes(v AWSNamespacesResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *AWSNamespacesResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AWSNamespacesResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AWSNamespacesResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AWSNamespacesResponseData) GetType() AWSNamespacesResponseDataType { + if o == nil { + var ret AWSNamespacesResponseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSNamespacesResponseData) GetTypeOk() (*AWSNamespacesResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSNamespacesResponseData) SetType(v AWSNamespacesResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNamespacesResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNamespacesResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSNamespacesResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *AWSNamespacesResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type 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 != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_namespaces_response_data_type.go b/api/datadogV2/model_aws_namespaces_response_data_type.go new file mode 100644 index 00000000000..f4ed10d71b6 --- /dev/null +++ b/api/datadogV2/model_aws_namespaces_response_data_type.go @@ -0,0 +1,64 @@ +// 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" +) + +// AWSNamespacesResponseDataType The `AWSNamespacesResponseData` `type`. +type AWSNamespacesResponseDataType string + +// List of AWSNamespacesResponseDataType. +const ( + AWSNAMESPACESRESPONSEDATATYPE_NAMESPACES AWSNamespacesResponseDataType = "namespaces" +) + +var allowedAWSNamespacesResponseDataTypeEnumValues = []AWSNamespacesResponseDataType{ + AWSNAMESPACESRESPONSEDATATYPE_NAMESPACES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSNamespacesResponseDataType) GetAllowedValues() []AWSNamespacesResponseDataType { + return allowedAWSNamespacesResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSNamespacesResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSNamespacesResponseDataType(value) + return nil +} + +// NewAWSNamespacesResponseDataTypeFromValue returns a pointer to a valid AWSNamespacesResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSNamespacesResponseDataTypeFromValue(v string) (*AWSNamespacesResponseDataType, error) { + ev := AWSNamespacesResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSNamespacesResponseDataType: valid values are %v", v, allowedAWSNamespacesResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSNamespacesResponseDataType) IsValid() bool { + for _, existing := range allowedAWSNamespacesResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSNamespacesResponseDataType value. +func (v AWSNamespacesResponseDataType) Ptr() *AWSNamespacesResponseDataType { + return &v +} diff --git a/api/datadogV2/model_aws_new_external_id_response.go b/api/datadogV2/model_aws_new_external_id_response.go new file mode 100644 index 00000000000..1f7624cc97a --- /dev/null +++ b/api/datadogV2/model_aws_new_external_id_response.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" +) + +// AWSNewExternalIDResponse AWS External ID response body +type AWSNewExternalIDResponse struct { + // AWS External ID response body + Data AWSNewExternalIDResponseData `json:"data"` + // 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:"-"` +} + +// NewAWSNewExternalIDResponse instantiates a new AWSNewExternalIDResponse 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 NewAWSNewExternalIDResponse(data AWSNewExternalIDResponseData) *AWSNewExternalIDResponse { + this := AWSNewExternalIDResponse{} + this.Data = data + return &this +} + +// NewAWSNewExternalIDResponseWithDefaults instantiates a new AWSNewExternalIDResponse 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 NewAWSNewExternalIDResponseWithDefaults() *AWSNewExternalIDResponse { + this := AWSNewExternalIDResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSNewExternalIDResponse) GetData() AWSNewExternalIDResponseData { + if o == nil { + var ret AWSNewExternalIDResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AWSNewExternalIDResponse) GetDataOk() (*AWSNewExternalIDResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSNewExternalIDResponse) SetData(v AWSNewExternalIDResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNewExternalIDResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNewExternalIDResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSNewExternalIDResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + 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.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_new_external_id_response_attributes.go b/api/datadogV2/model_aws_new_external_id_response_attributes.go new file mode 100644 index 00000000000..5c3c44f266c --- /dev/null +++ b/api/datadogV2/model_aws_new_external_id_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" +) + +// AWSNewExternalIDResponseAttributes AWS External ID response body +type AWSNewExternalIDResponseAttributes struct { + // AWS IAM External ID for associated role + ExternalId string `json:"external_id"` + // 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:"-"` +} + +// NewAWSNewExternalIDResponseAttributes instantiates a new AWSNewExternalIDResponseAttributes 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 NewAWSNewExternalIDResponseAttributes(externalId string) *AWSNewExternalIDResponseAttributes { + this := AWSNewExternalIDResponseAttributes{} + this.ExternalId = externalId + return &this +} + +// NewAWSNewExternalIDResponseAttributesWithDefaults instantiates a new AWSNewExternalIDResponseAttributes 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 NewAWSNewExternalIDResponseAttributesWithDefaults() *AWSNewExternalIDResponseAttributes { + this := AWSNewExternalIDResponseAttributes{} + return &this +} + +// GetExternalId returns the ExternalId field value. +func (o *AWSNewExternalIDResponseAttributes) GetExternalId() string { + if o == nil { + var ret string + return ret + } + return o.ExternalId +} + +// GetExternalIdOk returns a tuple with the ExternalId field value +// and a boolean to check if the value has been set. +func (o *AWSNewExternalIDResponseAttributes) GetExternalIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ExternalId, true +} + +// SetExternalId sets field value. +func (o *AWSNewExternalIDResponseAttributes) SetExternalId(v string) { + o.ExternalId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNewExternalIDResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["external_id"] = o.ExternalId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNewExternalIDResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExternalId *string `json:"external_id"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ExternalId == nil { + return fmt.Errorf("required field external_id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"external_id"}) + } else { + return err + } + o.ExternalId = *all.ExternalId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_new_external_id_response_data.go b/api/datadogV2/model_aws_new_external_id_response_data.go new file mode 100644 index 00000000000..9a97ea6b4c0 --- /dev/null +++ b/api/datadogV2/model_aws_new_external_id_response_data.go @@ -0,0 +1,185 @@ +// 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" +) + +// AWSNewExternalIDResponseData AWS External ID response body +type AWSNewExternalIDResponseData struct { + // AWS External ID response body + Attributes *AWSNewExternalIDResponseAttributes `json:"attributes,omitempty"` + // The `AWSNewExternalIDResponseData` `id`. + Id string `json:"id"` + // The `AWSNewExternalIDResponseData` `type`. + Type AWSNewExternalIDResponseDataType `json:"type"` + // 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:"-"` +} + +// NewAWSNewExternalIDResponseData instantiates a new AWSNewExternalIDResponseData 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 NewAWSNewExternalIDResponseData(id string, typeVar AWSNewExternalIDResponseDataType) *AWSNewExternalIDResponseData { + this := AWSNewExternalIDResponseData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewAWSNewExternalIDResponseDataWithDefaults instantiates a new AWSNewExternalIDResponseData 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 NewAWSNewExternalIDResponseDataWithDefaults() *AWSNewExternalIDResponseData { + this := AWSNewExternalIDResponseData{} + var id string = "external_id" + this.Id = id + var typeVar AWSNewExternalIDResponseDataType = AWSNEWEXTERNALIDRESPONSEDATATYPE_EXTERNAL_ID + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AWSNewExternalIDResponseData) GetAttributes() AWSNewExternalIDResponseAttributes { + if o == nil || o.Attributes == nil { + var ret AWSNewExternalIDResponseAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSNewExternalIDResponseData) GetAttributesOk() (*AWSNewExternalIDResponseAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AWSNewExternalIDResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AWSNewExternalIDResponseAttributes and assigns it to the Attributes field. +func (o *AWSNewExternalIDResponseData) SetAttributes(v AWSNewExternalIDResponseAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *AWSNewExternalIDResponseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AWSNewExternalIDResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AWSNewExternalIDResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AWSNewExternalIDResponseData) GetType() AWSNewExternalIDResponseDataType { + if o == nil { + var ret AWSNewExternalIDResponseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AWSNewExternalIDResponseData) GetTypeOk() (*AWSNewExternalIDResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSNewExternalIDResponseData) SetType(v AWSNewExternalIDResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSNewExternalIDResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSNewExternalIDResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSNewExternalIDResponseAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *AWSNewExternalIDResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type 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 != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + 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_new_external_id_response_data_type.go b/api/datadogV2/model_aws_new_external_id_response_data_type.go new file mode 100644 index 00000000000..ca5ecc4e39f --- /dev/null +++ b/api/datadogV2/model_aws_new_external_id_response_data_type.go @@ -0,0 +1,64 @@ +// 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" +) + +// AWSNewExternalIDResponseDataType The `AWSNewExternalIDResponseData` `type`. +type AWSNewExternalIDResponseDataType string + +// List of AWSNewExternalIDResponseDataType. +const ( + AWSNEWEXTERNALIDRESPONSEDATATYPE_EXTERNAL_ID AWSNewExternalIDResponseDataType = "external_id" +) + +var allowedAWSNewExternalIDResponseDataTypeEnumValues = []AWSNewExternalIDResponseDataType{ + AWSNEWEXTERNALIDRESPONSEDATATYPE_EXTERNAL_ID, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSNewExternalIDResponseDataType) GetAllowedValues() []AWSNewExternalIDResponseDataType { + return allowedAWSNewExternalIDResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSNewExternalIDResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSNewExternalIDResponseDataType(value) + return nil +} + +// NewAWSNewExternalIDResponseDataTypeFromValue returns a pointer to a valid AWSNewExternalIDResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSNewExternalIDResponseDataTypeFromValue(v string) (*AWSNewExternalIDResponseDataType, error) { + ev := AWSNewExternalIDResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSNewExternalIDResponseDataType: valid values are %v", v, allowedAWSNewExternalIDResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSNewExternalIDResponseDataType) IsValid() bool { + for _, existing := range allowedAWSNewExternalIDResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSNewExternalIDResponseDataType value. +func (v AWSNewExternalIDResponseDataType) Ptr() *AWSNewExternalIDResponseDataType { + return &v +} diff --git a/api/datadogV2/model_aws_regions.go b/api/datadogV2/model_aws_regions.go new file mode 100644 index 00000000000..192f771388a --- /dev/null +++ b/api/datadogV2/model_aws_regions.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSRegions - AWS Regions to collect data from +type AWSRegions struct { + AWSRegionsIncludeAll *AWSRegionsIncludeAll + AWSRegionsIncludeOnly *AWSRegionsIncludeOnly + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// AWSRegionsIncludeAllAsAWSRegions is a convenience function that returns AWSRegionsIncludeAll wrapped in AWSRegions. +func AWSRegionsIncludeAllAsAWSRegions(v *AWSRegionsIncludeAll) AWSRegions { + return AWSRegions{AWSRegionsIncludeAll: v} +} + +// AWSRegionsIncludeOnlyAsAWSRegions is a convenience function that returns AWSRegionsIncludeOnly wrapped in AWSRegions. +func AWSRegionsIncludeOnlyAsAWSRegions(v *AWSRegionsIncludeOnly) AWSRegions { + return AWSRegions{AWSRegionsIncludeOnly: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *AWSRegions) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into AWSRegionsIncludeAll + err = datadog.Unmarshal(data, &obj.AWSRegionsIncludeAll) + if err == nil { + if obj.AWSRegionsIncludeAll != nil && obj.AWSRegionsIncludeAll.UnparsedObject == nil { + jsonAWSRegionsIncludeAll, _ := datadog.Marshal(obj.AWSRegionsIncludeAll) + if string(jsonAWSRegionsIncludeAll) == "{}" { // empty struct + obj.AWSRegionsIncludeAll = nil + } else { + match++ + } + } else { + obj.AWSRegionsIncludeAll = nil + } + } else { + obj.AWSRegionsIncludeAll = nil + } + + // try to unmarshal data into AWSRegionsIncludeOnly + err = datadog.Unmarshal(data, &obj.AWSRegionsIncludeOnly) + if err == nil { + if obj.AWSRegionsIncludeOnly != nil && obj.AWSRegionsIncludeOnly.UnparsedObject == nil { + jsonAWSRegionsIncludeOnly, _ := datadog.Marshal(obj.AWSRegionsIncludeOnly) + if string(jsonAWSRegionsIncludeOnly) == "{}" { // empty struct + obj.AWSRegionsIncludeOnly = nil + } else { + match++ + } + } else { + obj.AWSRegionsIncludeOnly = nil + } + } else { + obj.AWSRegionsIncludeOnly = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.AWSRegionsIncludeAll = nil + obj.AWSRegionsIncludeOnly = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj AWSRegions) MarshalJSON() ([]byte, error) { + if obj.AWSRegionsIncludeAll != nil { + return datadog.Marshal(&obj.AWSRegionsIncludeAll) + } + + if obj.AWSRegionsIncludeOnly != nil { + return datadog.Marshal(&obj.AWSRegionsIncludeOnly) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *AWSRegions) GetActualInstance() interface{} { + if obj.AWSRegionsIncludeAll != nil { + return obj.AWSRegionsIncludeAll + } + + if obj.AWSRegionsIncludeOnly != nil { + return obj.AWSRegionsIncludeOnly + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_aws_regions_include_all.go b/api/datadogV2/model_aws_regions_include_all.go new file mode 100644 index 00000000000..f135e379766 --- /dev/null +++ b/api/datadogV2/model_aws_regions_include_all.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSRegionsIncludeAll Include all regions +type AWSRegionsIncludeAll struct { + // Include all regions + IncludeAll bool `json:"include_all"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSRegionsIncludeAll instantiates a new AWSRegionsIncludeAll object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSRegionsIncludeAll(includeAll bool) *AWSRegionsIncludeAll { + this := AWSRegionsIncludeAll{} + this.IncludeAll = includeAll + return &this +} + +// NewAWSRegionsIncludeAllWithDefaults instantiates a new AWSRegionsIncludeAll object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSRegionsIncludeAllWithDefaults() *AWSRegionsIncludeAll { + this := AWSRegionsIncludeAll{} + return &this +} + +// GetIncludeAll returns the IncludeAll field value. +func (o *AWSRegionsIncludeAll) GetIncludeAll() bool { + if o == nil { + var ret bool + return ret + } + return o.IncludeAll +} + +// GetIncludeAllOk returns a tuple with the IncludeAll field value +// and a boolean to check if the value has been set. +func (o *AWSRegionsIncludeAll) GetIncludeAllOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IncludeAll, true +} + +// SetIncludeAll sets field value. +func (o *AWSRegionsIncludeAll) SetIncludeAll(v bool) { + o.IncludeAll = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSRegionsIncludeAll) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_all"] = o.IncludeAll + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSRegionsIncludeAll) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeAll *bool `json:"include_all"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeAll == nil { + return fmt.Errorf("required field include_all missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_all"}) + } else { + return err + } + o.IncludeAll = *all.IncludeAll + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_regions_include_only.go b/api/datadogV2/model_aws_regions_include_only.go new file mode 100644 index 00000000000..48086b79986 --- /dev/null +++ b/api/datadogV2/model_aws_regions_include_only.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSRegionsIncludeOnly Include only these regions +type AWSRegionsIncludeOnly struct { + // Include only these regions + IncludeOnly []string `json:"include_only"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSRegionsIncludeOnly instantiates a new AWSRegionsIncludeOnly object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSRegionsIncludeOnly(includeOnly []string) *AWSRegionsIncludeOnly { + this := AWSRegionsIncludeOnly{} + this.IncludeOnly = includeOnly + return &this +} + +// NewAWSRegionsIncludeOnlyWithDefaults instantiates a new AWSRegionsIncludeOnly object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSRegionsIncludeOnlyWithDefaults() *AWSRegionsIncludeOnly { + this := AWSRegionsIncludeOnly{} + return &this +} + +// GetIncludeOnly returns the IncludeOnly field value. +func (o *AWSRegionsIncludeOnly) GetIncludeOnly() []string { + if o == nil { + var ret []string + return ret + } + return o.IncludeOnly +} + +// GetIncludeOnlyOk returns a tuple with the IncludeOnly field value +// and a boolean to check if the value has been set. +func (o *AWSRegionsIncludeOnly) GetIncludeOnlyOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.IncludeOnly, true +} + +// SetIncludeOnly sets field value. +func (o *AWSRegionsIncludeOnly) SetIncludeOnly(v []string) { + o.IncludeOnly = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSRegionsIncludeOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_only"] = o.IncludeOnly + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSRegionsIncludeOnly) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeOnly *[]string `json:"include_only"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeOnly == nil { + return fmt.Errorf("required field include_only missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_only"}) + } else { + return err + } + o.IncludeOnly = *all.IncludeOnly + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_resources_config.go b/api/datadogV2/model_aws_resources_config.go new file mode 100644 index 00000000000..1fccf6099ff --- /dev/null +++ b/api/datadogV2/model_aws_resources_config.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSResourcesConfig AWS Resources config +type AWSResourcesConfig struct { + // Whether Datadog collects cloud security posture management resources from your AWS account. + CloudSecurityPostureManagementCollection *bool `json:"cloud_security_posture_management_collection,omitempty"` + // Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Required for `cspm_resource_collection`. + ExtendedCollection *bool `json:"extended_collection,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSResourcesConfig instantiates a new AWSResourcesConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSResourcesConfig() *AWSResourcesConfig { + this := AWSResourcesConfig{} + return &this +} + +// NewAWSResourcesConfigWithDefaults instantiates a new AWSResourcesConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSResourcesConfigWithDefaults() *AWSResourcesConfig { + this := AWSResourcesConfig{} + return &this +} + +// GetCloudSecurityPostureManagementCollection returns the CloudSecurityPostureManagementCollection field value if set, zero value otherwise. +func (o *AWSResourcesConfig) GetCloudSecurityPostureManagementCollection() bool { + if o == nil || o.CloudSecurityPostureManagementCollection == nil { + var ret bool + return ret + } + return *o.CloudSecurityPostureManagementCollection +} + +// GetCloudSecurityPostureManagementCollectionOk returns a tuple with the CloudSecurityPostureManagementCollection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSResourcesConfig) GetCloudSecurityPostureManagementCollectionOk() (*bool, bool) { + if o == nil || o.CloudSecurityPostureManagementCollection == nil { + return nil, false + } + return o.CloudSecurityPostureManagementCollection, true +} + +// HasCloudSecurityPostureManagementCollection returns a boolean if a field has been set. +func (o *AWSResourcesConfig) HasCloudSecurityPostureManagementCollection() bool { + return o != nil && o.CloudSecurityPostureManagementCollection != nil +} + +// SetCloudSecurityPostureManagementCollection gets a reference to the given bool and assigns it to the CloudSecurityPostureManagementCollection field. +func (o *AWSResourcesConfig) SetCloudSecurityPostureManagementCollection(v bool) { + o.CloudSecurityPostureManagementCollection = &v +} + +// GetExtendedCollection returns the ExtendedCollection field value if set, zero value otherwise. +func (o *AWSResourcesConfig) GetExtendedCollection() bool { + if o == nil || o.ExtendedCollection == nil { + var ret bool + return ret + } + return *o.ExtendedCollection +} + +// GetExtendedCollectionOk returns a tuple with the ExtendedCollection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSResourcesConfig) GetExtendedCollectionOk() (*bool, bool) { + if o == nil || o.ExtendedCollection == nil { + return nil, false + } + return o.ExtendedCollection, true +} + +// HasExtendedCollection returns a boolean if a field has been set. +func (o *AWSResourcesConfig) HasExtendedCollection() bool { + return o != nil && o.ExtendedCollection != nil +} + +// SetExtendedCollection gets a reference to the given bool and assigns it to the ExtendedCollection field. +func (o *AWSResourcesConfig) SetExtendedCollection(v bool) { + o.ExtendedCollection = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSResourcesConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CloudSecurityPostureManagementCollection != nil { + toSerialize["cloud_security_posture_management_collection"] = o.CloudSecurityPostureManagementCollection + } + if o.ExtendedCollection != nil { + toSerialize["extended_collection"] = o.ExtendedCollection + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSResourcesConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CloudSecurityPostureManagementCollection *bool `json:"cloud_security_posture_management_collection,omitempty"` + ExtendedCollection *bool `json:"extended_collection,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"cloud_security_posture_management_collection", "extended_collection"}) + } else { + return err + } + o.CloudSecurityPostureManagementCollection = all.CloudSecurityPostureManagementCollection + o.ExtendedCollection = all.ExtendedCollection + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_traces_config.go b/api/datadogV2/model_aws_traces_config.go new file mode 100644 index 00000000000..319cb1a4363 --- /dev/null +++ b/api/datadogV2/model_aws_traces_config.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSTracesConfig AWS Traces config +type AWSTracesConfig struct { + // AWS X-Ray services to collect traces from + XrayServices *XRayServicesList `json:"xray_services,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAWSTracesConfig instantiates a new AWSTracesConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAWSTracesConfig() *AWSTracesConfig { + this := AWSTracesConfig{} + return &this +} + +// NewAWSTracesConfigWithDefaults instantiates a new AWSTracesConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAWSTracesConfigWithDefaults() *AWSTracesConfig { + this := AWSTracesConfig{} + return &this +} + +// GetXrayServices returns the XrayServices field value if set, zero value otherwise. +func (o *AWSTracesConfig) GetXrayServices() XRayServicesList { + if o == nil || o.XrayServices == nil { + var ret XRayServicesList + return ret + } + return *o.XrayServices +} + +// GetXrayServicesOk returns a tuple with the XrayServices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSTracesConfig) GetXrayServicesOk() (*XRayServicesList, bool) { + if o == nil || o.XrayServices == nil { + return nil, false + } + return o.XrayServices, true +} + +// HasXrayServices returns a boolean if a field has been set. +func (o *AWSTracesConfig) HasXrayServices() bool { + return o != nil && o.XrayServices != nil +} + +// SetXrayServices gets a reference to the given XRayServicesList and assigns it to the XrayServices field. +func (o *AWSTracesConfig) SetXrayServices(v XRayServicesList) { + o.XrayServices = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSTracesConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.XrayServices != nil { + toSerialize["xray_services"] = o.XrayServices + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSTracesConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + XrayServices *XRayServicesList `json:"xray_services,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"xray_services"}) + } else { + return err + } + o.XrayServices = all.XrayServices + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_x_ray_services_include_all.go b/api/datadogV2/model_x_ray_services_include_all.go new file mode 100644 index 00000000000..89dbdaf70a2 --- /dev/null +++ b/api/datadogV2/model_x_ray_services_include_all.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// XRayServicesIncludeAll Include all services +type XRayServicesIncludeAll struct { + // Include all services + IncludeAll bool `json:"include_all"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewXRayServicesIncludeAll instantiates a new XRayServicesIncludeAll object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewXRayServicesIncludeAll(includeAll bool) *XRayServicesIncludeAll { + this := XRayServicesIncludeAll{} + this.IncludeAll = includeAll + return &this +} + +// NewXRayServicesIncludeAllWithDefaults instantiates a new XRayServicesIncludeAll object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewXRayServicesIncludeAllWithDefaults() *XRayServicesIncludeAll { + this := XRayServicesIncludeAll{} + return &this +} + +// GetIncludeAll returns the IncludeAll field value. +func (o *XRayServicesIncludeAll) GetIncludeAll() bool { + if o == nil { + var ret bool + return ret + } + return o.IncludeAll +} + +// GetIncludeAllOk returns a tuple with the IncludeAll field value +// and a boolean to check if the value has been set. +func (o *XRayServicesIncludeAll) GetIncludeAllOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IncludeAll, true +} + +// SetIncludeAll sets field value. +func (o *XRayServicesIncludeAll) SetIncludeAll(v bool) { + o.IncludeAll = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o XRayServicesIncludeAll) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_all"] = o.IncludeAll + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *XRayServicesIncludeAll) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeAll *bool `json:"include_all"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeAll == nil { + return fmt.Errorf("required field include_all missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_all"}) + } else { + return err + } + o.IncludeAll = *all.IncludeAll + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_x_ray_services_include_only.go b/api/datadogV2/model_x_ray_services_include_only.go new file mode 100644 index 00000000000..47fc8e80fed --- /dev/null +++ b/api/datadogV2/model_x_ray_services_include_only.go @@ -0,0 +1,151 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// XRayServicesIncludeOnly Include only these services +type XRayServicesIncludeOnly struct { + // Include only these services + IncludeOnly []string `json:"include_only"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewXRayServicesIncludeOnly instantiates a new XRayServicesIncludeOnly object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewXRayServicesIncludeOnly(includeOnly []string) *XRayServicesIncludeOnly { + this := XRayServicesIncludeOnly{} + this.IncludeOnly = includeOnly + return &this +} + +// NewXRayServicesIncludeOnlyWithDefaults instantiates a new XRayServicesIncludeOnly object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewXRayServicesIncludeOnlyWithDefaults() *XRayServicesIncludeOnly { + this := XRayServicesIncludeOnly{} + return &this +} + +// GetIncludeOnly returns the IncludeOnly field value. +func (o *XRayServicesIncludeOnly) GetIncludeOnly() []string { + if o == nil { + var ret []string + return ret + } + return o.IncludeOnly +} + +// GetIncludeOnlyOk returns a tuple with the IncludeOnly field value +// and a boolean to check if the value has been set. +func (o *XRayServicesIncludeOnly) GetIncludeOnlyOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.IncludeOnly, true +} + +// SetIncludeOnly sets field value. +func (o *XRayServicesIncludeOnly) SetIncludeOnly(v []string) { + o.IncludeOnly = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o XRayServicesIncludeOnly) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["include_only"] = o.IncludeOnly + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *XRayServicesIncludeOnly) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeOnly *[]string `json:"include_only"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncludeOnly == nil { + return fmt.Errorf("required field include_only missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"include_only"}) + } else { + return err + } + o.IncludeOnly = *all.IncludeOnly + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} + +// NullableXRayServicesIncludeOnly handles when a null is used for XRayServicesIncludeOnly. +type NullableXRayServicesIncludeOnly struct { + value *XRayServicesIncludeOnly + isSet bool +} + +// Get returns the associated value. +func (v NullableXRayServicesIncludeOnly) Get() *XRayServicesIncludeOnly { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableXRayServicesIncludeOnly) Set(val *XRayServicesIncludeOnly) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableXRayServicesIncludeOnly) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableXRayServicesIncludeOnly) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableXRayServicesIncludeOnly initializes the struct as if Set has been called. +func NewNullableXRayServicesIncludeOnly(val *XRayServicesIncludeOnly) *NullableXRayServicesIncludeOnly { + return &NullableXRayServicesIncludeOnly{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableXRayServicesIncludeOnly) MarshalJSON() ([]byte, error) { + return datadog.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableXRayServicesIncludeOnly) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return datadog.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_x_ray_services_list.go b/api/datadogV2/model_x_ray_services_list.go new file mode 100644 index 00000000000..3063c4ab99f --- /dev/null +++ b/api/datadogV2/model_x_ray_services_list.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// XRayServicesList - AWS X-Ray services to collect traces from +type XRayServicesList struct { + XRayServicesIncludeAll *XRayServicesIncludeAll + XRayServicesIncludeOnly *XRayServicesIncludeOnly + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// XRayServicesIncludeAllAsXRayServicesList is a convenience function that returns XRayServicesIncludeAll wrapped in XRayServicesList. +func XRayServicesIncludeAllAsXRayServicesList(v *XRayServicesIncludeAll) XRayServicesList { + return XRayServicesList{XRayServicesIncludeAll: v} +} + +// XRayServicesIncludeOnlyAsXRayServicesList is a convenience function that returns XRayServicesIncludeOnly wrapped in XRayServicesList. +func XRayServicesIncludeOnlyAsXRayServicesList(v *XRayServicesIncludeOnly) XRayServicesList { + return XRayServicesList{XRayServicesIncludeOnly: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *XRayServicesList) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into XRayServicesIncludeAll + err = datadog.Unmarshal(data, &obj.XRayServicesIncludeAll) + if err == nil { + if obj.XRayServicesIncludeAll != nil && obj.XRayServicesIncludeAll.UnparsedObject == nil { + jsonXRayServicesIncludeAll, _ := datadog.Marshal(obj.XRayServicesIncludeAll) + if string(jsonXRayServicesIncludeAll) == "{}" { // empty struct + obj.XRayServicesIncludeAll = nil + } else { + match++ + } + } else { + obj.XRayServicesIncludeAll = nil + } + } else { + obj.XRayServicesIncludeAll = nil + } + + // try to unmarshal data into XRayServicesIncludeOnly + err = datadog.Unmarshal(data, &obj.XRayServicesIncludeOnly) + if err == nil { + if obj.XRayServicesIncludeOnly != nil && obj.XRayServicesIncludeOnly.UnparsedObject == nil { + jsonXRayServicesIncludeOnly, _ := datadog.Marshal(obj.XRayServicesIncludeOnly) + if string(jsonXRayServicesIncludeOnly) == "{}" { // empty struct + obj.XRayServicesIncludeOnly = nil + } else { + match++ + } + } else { + obj.XRayServicesIncludeOnly = nil + } + } else { + obj.XRayServicesIncludeOnly = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.XRayServicesIncludeAll = nil + obj.XRayServicesIncludeOnly = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj XRayServicesList) MarshalJSON() ([]byte, error) { + if obj.XRayServicesIncludeAll != nil { + return datadog.Marshal(&obj.XRayServicesIncludeAll) + } + + if obj.XRayServicesIncludeOnly != nil { + return datadog.Marshal(&obj.XRayServicesIncludeOnly) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *XRayServicesList) GetActualInstance() interface{} { + if obj.XRayServicesIncludeAll != nil { + return obj.XRayServicesIncludeAll + } + + if obj.XRayServicesIncludeOnly != nil { + return obj.XRayServicesIncludeOnly + } + + // all schemas are nil + return nil +} diff --git a/examples/v2/aws-integration/CreateAWSAccount.go b/examples/v2/aws-integration/CreateAWSAccount.go new file mode 100644 index 00000000000..63d5ab4ec2c --- /dev/null +++ b/examples/v2/aws-integration/CreateAWSAccount.go @@ -0,0 +1,76 @@ +// Create an AWS integration returns "AWS Account object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AWSAccountCreateRequest{ + Data: datadogV2.AWSAccountCreateRequestData{ + Attributes: datadogV2.AWSAccountCreateRequestAttributes{ + AccountTags: *datadog.NewNullableList(&[]string{ + "key:value", + }), + AuthConfig: datadogV2.AWSAuthConfig{ + AWSAuthConfigKeys: &datadogV2.AWSAuthConfigKeys{ + AccessKeyId: "AKIAIOSFODNN7EXAMPLE", + SecretAccessKey: datadog.PtrString("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), + }}, + AwsAccountId: "123456789012", + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS, + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{ + "arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder", + }, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + AutomuteEnabled: datadog.PtrBool(true), + CollectCloudwatchAlarms: datadog.PtrBool(true), + CollectCustomMetrics: datadog.PtrBool(true), + Enabled: datadog.PtrBool(true), + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{ + "key:value", + }), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{ + CloudSecurityPostureManagementCollection: datadog.PtrBool(false), + ExtendedCollection: datadog.PtrBool(false), + }, + TracesConfig: &datadogV2.AWSTracesConfig{}, + }, + Type: datadogV2.AWSACCOUNTTYPE_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/CreateAWSAccount_1716720881.go b/examples/v2/aws-integration/CreateAWSAccount_1716720881.go new file mode 100644 index 00000000000..ee6e0d3773c --- /dev/null +++ b/examples/v2/aws-integration/CreateAWSAccount_1716720881.go @@ -0,0 +1,75 @@ +// Create an AWS account returns "AWS Account object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AWSAccountCreateRequest{ + Data: datadogV2.AWSAccountCreateRequestData{ + Attributes: datadogV2.AWSAccountCreateRequestAttributes{ + AccountTags: *datadog.NewNullableList(&[]string{ + "key:value", + }), + AuthConfig: datadogV2.AWSAuthConfig{ + AWSAuthConfigRole: &datadogV2.AWSAuthConfigRole{ + RoleName: "DatadogIntegrationRole", + }}, + AwsAccountId: "123456789012", + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS, + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{ + "arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder", + }, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + AutomuteEnabled: datadog.PtrBool(true), + CollectCloudwatchAlarms: datadog.PtrBool(true), + CollectCustomMetrics: datadog.PtrBool(true), + Enabled: datadog.PtrBool(true), + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{ + "key:value", + }), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{ + CloudSecurityPostureManagementCollection: datadog.PtrBool(false), + ExtendedCollection: datadog.PtrBool(false), + }, + TracesConfig: &datadogV2.AWSTracesConfig{}, + }, + Type: datadogV2.AWSACCOUNTTYPE_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/CreateNewAWSExternalID.go b/examples/v2/aws-integration/CreateNewAWSExternalID.go new file mode 100644 index 00000000000..c31b9a487bd --- /dev/null +++ b/examples/v2/aws-integration/CreateNewAWSExternalID.go @@ -0,0 +1,30 @@ +// Generate a new external ID returns "AWS External ID 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.CreateNewAWSExternalID", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.CreateNewAWSExternalID(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.CreateNewAWSExternalID`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.CreateNewAWSExternalID`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/CreateNewAWSExternalID_364713854.go b/examples/v2/aws-integration/CreateNewAWSExternalID_364713854.go new file mode 100644 index 00000000000..5dfc5a4f4bf --- /dev/null +++ b/examples/v2/aws-integration/CreateNewAWSExternalID_364713854.go @@ -0,0 +1,30 @@ +// Generate new external ID returns "AWS External ID 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.CreateNewAWSExternalID", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.CreateNewAWSExternalID(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.CreateNewAWSExternalID`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.CreateNewAWSExternalID`:\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..3984162b793 --- /dev/null +++ b/examples/v2/aws-integration/DeleteAWSAccount.go @@ -0,0 +1,29 @@ +// Delete an AWS integration 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 + AwsAccountV2DataID := os.Getenv("AWS_ACCOUNT_V2_DATA_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, AwsAccountV2DataID) + + 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..d1ca464d45f --- /dev/null +++ b/examples/v2/aws-integration/GetAWSAccount.go @@ -0,0 +1,33 @@ +// Get an AWS integration by config ID 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 + AwsAccountV2DataID := os.Getenv("AWS_ACCOUNT_V2_DATA_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, AwsAccountV2DataID) + + 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..c9385e681ac --- /dev/null +++ b/examples/v2/aws-integration/ListAWSAccounts.go @@ -0,0 +1,30 @@ +// List all AWS integrations returns "AWS Accounts List object" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListAWSAccounts", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.ListAWSAccounts(ctx, *datadogV2.NewListAWSAccountsOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.ListAWSAccounts`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.ListAWSAccounts`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/ListAWSNamespaces.go b/examples/v2/aws-integration/ListAWSNamespaces.go new file mode 100644 index 00000000000..e0cc097a93d --- /dev/null +++ b/examples/v2/aws-integration/ListAWSNamespaces.go @@ -0,0 +1,30 @@ +// List available namespaces returns "AWS Namespaces 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.ListAWSNamespaces", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.ListAWSNamespaces(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.ListAWSNamespaces`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.ListAWSNamespaces`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/ListAWSNamespaces_3031307873.go b/examples/v2/aws-integration/ListAWSNamespaces_3031307873.go new file mode 100644 index 00000000000..46cb98880cc --- /dev/null +++ b/examples/v2/aws-integration/ListAWSNamespaces_3031307873.go @@ -0,0 +1,30 @@ +// List namespaces returns "AWS Namespaces 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.ListAWSNamespaces", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.ListAWSNamespaces(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.ListAWSNamespaces`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.ListAWSNamespaces`:\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..9862d5ef7f3 --- /dev/null +++ b/examples/v2/aws-integration/UpdateAWSAccount.go @@ -0,0 +1,78 @@ +// Update an AWS integration 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 + AwsAccountV2DataID := os.Getenv("AWS_ACCOUNT_V2_DATA_ID") + + body := datadogV2.AWSAccountUpdateRequest{ + Data: datadogV2.AWSAccountUpdateRequestData{ + Attributes: datadogV2.AWSAccountUpdateRequestAttributes{ + AccountTags: *datadog.NewNullableList(&[]string{ + "key:value", + }), + AuthConfig: &datadogV2.AWSAuthConfig{ + AWSAuthConfigRole: &datadogV2.AWSAuthConfigRole{ + RoleName: "DatadogIntegrationRole", + }}, + AwsAccountId: "123456789012", + AwsPartition: datadogV2.AWSACCOUNTPARTITION_AWS.Ptr(), + LogsConfig: &datadogV2.AWSLogsConfig{ + LambdaForwarder: &datadogV2.AWSLambdaForwarderConfig{ + Lambdas: []string{ + "arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder", + }, + Sources: []string{ + "s3", + }, + }, + }, + MetricsConfig: &datadogV2.AWSMetricsConfig{ + AutomuteEnabled: datadog.PtrBool(true), + CollectCloudwatchAlarms: datadog.PtrBool(true), + CollectCustomMetrics: datadog.PtrBool(true), + Enabled: datadog.PtrBool(true), + TagFilters: []datadogV2.AWSNamespaceTagFilter{ + { + Namespace: datadog.PtrString("AWS/EC2"), + Tags: *datadog.NewNullableList(&[]string{ + "key:value", + }), + }, + }, + }, + ResourcesConfig: &datadogV2.AWSResourcesConfig{ + CloudSecurityPostureManagementCollection: datadog.PtrBool(false), + ExtendedCollection: datadog.PtrBool(false), + }, + TracesConfig: &datadogV2.AWSTracesConfig{}, + }, + Type: datadogV2.AWSACCOUNTTYPE_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, AwsAccountV2DataID, 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/examples/v2/aws-logs-integration/ListAWSLogsServices.go b/examples/v2/aws-logs-integration/ListAWSLogsServices.go new file mode 100644 index 00000000000..72d60c1d7d7 --- /dev/null +++ b/examples/v2/aws-logs-integration/ListAWSLogsServices.go @@ -0,0 +1,30 @@ +// Get list of AWS log ready services returns "AWS Logs Services 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.ListAWSLogsServices", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSLogsIntegrationApi(apiClient) + resp, r, err := api.ListAWSLogsServices(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSLogsIntegrationApi.ListAWSLogsServices`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSLogsIntegrationApi.ListAWSLogsServices`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 5710bfc56fe..a0379fa7046 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -64,6 +64,8 @@ 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), + "AWSLogsIntegrationApi": reflect.ValueOf(datadogV2.NewAWSLogsIntegrationApi), "GCPIntegrationApi": reflect.ValueOf(datadogV2.NewGCPIntegrationApi), "MicrosoftTeamsIntegrationApi": reflect.ValueOf(datadogV2.NewMicrosoftTeamsIntegrationApi), "OpsgenieIntegrationApi": reflect.ValueOf(datadogV2.NewOpsgenieIntegrationApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..466a5f73537 --- /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-10-28T14:43:00.419Z \ 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..85adc277b3a --- /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,37 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + 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":"83eacdb0-09e6-4e72-bf2e-b2fbcdf438b7","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"2803c423184c499dbd123d346e5bd16f"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-10-28T14:43:01.065460229Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"exclude_only":["AWS/SQS","AWS/ElasticMapReduce"]}},"modified_at":"2024-10-28T14:43:01.065463823Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}}}' + 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/83eacdb0-09e6-4e72-bf2e-b2fbcdf438b7 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + 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..225e608e0dd --- /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-10-28T14:43:01.350Z \ 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..41488b97468 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws-invalid","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + 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-invalid"}]}' + 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_config_returns_Conflict_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Conflict_response.freeze new file mode 100644 index 00000000000..0dbdfb53601 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Conflict_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:01.458Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Conflict_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Conflict_response.yaml new file mode 100644 index 00000000000..154d3e5878c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Create_account_config_returns_Conflict_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"00000000-abcd-0001-0000-000000000000","type":"account"}} + 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":"fa9e70b4-5fbb-499d-ba36-b802512cbc83","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"7fca00b8e534405e990889d4960d23f6"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:02.014523417Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:02.014527511Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"errors":[{"status":"409","title":"Account already exists","detail":"AWS + account with provided id already exists"}]}' + code: 409 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 409 Conflict +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/fa9e70b4-5fbb-499d-ba36-b802512cbc83 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +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_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..279b77d56f6 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:02.940Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..8f3e200c961 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/not-a-uuid + response: + body: '{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid + parameter \"aws_account_config_id\" in \"path\"; expected type \"uuid\""}]}' + 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_-_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..f5fe1a6f0b9 --- /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-10-28T14:43:03.036Z \ 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..385c3d69476 --- /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,55 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"00000000-abcd-0001-0000-000000000000","type":"account"}} + 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":"ea195e91-95f9-4811-9161-cbcce608b8ed","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"cd09f429becf46babb7f30a4da51b5fb"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:03.638813736Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:03.638829687Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/ea195e91-95f9-4811-9161-cbcce608b8ed + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/ea195e91-95f9-4811-9161-cbcce608b8ed + 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_-_Delete_account_config_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..b8c3c7fbd4d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:04.053Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..2fbfe87896f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Delete_account_config_returns_Not_Found_response.yaml @@ -0,0 +1,55 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"00000000-abcd-0001-0000-000000000000","type":"account"}} + 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":"615cc571-774b-4e40-bc94-ad3f178cbfc8","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"b4966eed30af4b1ba9f62a4a3e841cb8"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:04.618588959Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:04.618593611Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/448169a8-251c-4344-abee-1c4edef39f7a + 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 +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/615cc571-774b-4e40-bc94-ad3f178cbfc8 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Generate_new_external_ID_returns_AWS_External_ID_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Generate_new_external_ID_returns_AWS_External_ID_object_response.freeze new file mode 100644 index 00000000000..b9c80bdbbbf --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Generate_new_external_ID_returns_AWS_External_ID_object_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:05.063Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Generate_new_external_ID_returns_AWS_External_ID_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Generate_new_external_ID_returns_AWS_External_ID_object_response.yaml new file mode 100644 index 00000000000..9accac766c3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Generate_new_external_ID_returns_AWS_External_ID_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/generate_new_external_id + response: + body: '{"data":{"id":"external_id","type":"external_id","attributes":{"external_id":"46c7ca9418564d478f52b94479b3aae2"}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +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..ae44c8d586d --- /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-10-28T14:43:05.156Z \ 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..d0bcd791168 --- /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,54 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"00000000-abcd-0001-0000-000000000000","type":"account"}} + 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":"35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"34c9dbc0f2934cebb5d7a0690f3f333f"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:05.736496681Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:05.736509432Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0 + response: + body: '{"data":{"id":"35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"34c9dbc0f2934cebb5d7a0690f3f333f"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:05.736497Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:05.736509Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/35ed0f5a-6a49-4fd7-bdf6-cc8edc410ea0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..3602f01ba0a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:06.192Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..e895e0c8e38 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/not-a-uuid + response: + body: '{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid + parameter \"aws_account_config_id\" in \"path\"; expected type \"uuid\""}]}' + 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_-_Get_account_config_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..b4eaf08518d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:06.335Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..f575e265cb4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Get_account_config_returns_Not_Found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a + 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_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..684ec896f95 --- /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-10-28T14:43:06.477Z \ 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..12f7b0af454 --- /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,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":[{"id":"e6daa8c4-58b6-42e1-970e-44e6fa812ce0","type":"account","attributes":{"account_tags":[],"auth_config":{"access_key_id":"AKIA514950102505"},"aws_account_id":"514950102505","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-09-06T00:18:12.382448Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder"],"sources":[]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-06T00:18:17.536561Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"a0c7f96e-a471-488e-84be-c3336e7ab693","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"859ffc73702c40f589cc3b74c5967e27"},"aws_account_id":"172830950700","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-10-07T13:58:28.577522Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-10-07T13:58:28.577526Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"3a3d5b83-2ad8-41d8-b82e-a3ba972a9783","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"be10a93f33a64b0ea872da2f48348979"},"aws_account_id":"172704974400","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-23T00:02:26.306293Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-23T00:02:26.306297Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"89a9dae5-cbe3-4fba-b1b2-aae8775ed319","type":"account","attributes":{"account_tags":["filter:one","filtertwo"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e31ada331546486f9099cd5c01eef257"},"aws_account_id":"001725901256","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-2","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-09T17:00:58.823444Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["testTag","test:Tag2"]}],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-10-16T14:55:17.947931Z","resources_config":{"cloud_security_posture_management_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"7e1d660d-1142-45b1-a795-dc3900b6bd17","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"f61b52d768394db6851aed2f887ac6f6"},"aws_account_id":"172830950701","aws_partition":"aws","aws_regions":{"include_only":["me-south-1"]},"created_at":"2024-10-17T15:08:40.917209Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-10-18T20:19:53.960435Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"d52e151c-c608-4e14-9f29-dfeff876bb39","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"c2909403ca9949db82c36adf6e8cdcfa"},"aws_account_id":"172772261200","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-30T18:56:55.042771Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-30T18:56:55.042775Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"d7d74617-832d-4c4d-a8c3-1e69d509ea52","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"2b1dd9fd35b0440ca4bf98ff70ac2e63"},"aws_account_id":"172772275700","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-30T18:59:18.175722Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-30T18:59:18.175727Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"7e5acac6-3ac8-4762-8100-479f03ccffc8","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"04548a334583412aa4e6f5548f4e9989"},"aws_account_id":"172532181900","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-03T00:03:40.248176Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-03T00:03:40.24818Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_available_namespaces_returns_AWS_Namespaces_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_available_namespaces_returns_AWS_Namespaces_List_object_response.freeze new file mode 100644 index 00000000000..cce7072482b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_available_namespaces_returns_AWS_Namespaces_List_object_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:06.671Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_available_namespaces_returns_AWS_Namespaces_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_available_namespaces_returns_AWS_Namespaces_List_object_response.yaml new file mode 100644 index 00000000000..56b7d6f8f58 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_available_namespaces_returns_AWS_Namespaces_List_object_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/available_namespaces + response: + body: '{"data":{"id":"namespaces","type":"namespaces","attributes":{"namespaces":["AWS/ApiGateway","AWS/AppRunner","AWS/AppStream","AWS/AppSync","AWS/ApplicationELB","AWS/Athena","AWS/AutoScaling","AWS/Backup","AWS/Bedrock","AWS/Billing","AWS/CertificateManager","AWS/ELB","AWS/CloudFront","AWS/CloudHSM","AWS/CloudSearch","AWS/CodeBuild","AWS/CodeWhisperer","AWS/Cognito","AWS/Config","AWS/Connect","AWS/DMS","AWS/DX","AWS/DocDB","AWS/DynamoDB","AWS/DAX","AWS/EC2","AWS/EC2/API","AWS/EC2/InfrastructurePerformance","AWS/EC2Spot","AWS/ElasticMapReduce","AWS/ElastiCache","AWS/ElasticBeanstalk","AWS/EBS","AWS/ECR","AWS/ECS","AWS/EFS","AWS/ElasticTranscoder","AWS/MediaConnect","AWS/MediaConvert","AWS/MediaLive","AWS/MediaPackage","AWS/MediaStore","AWS/MediaTailor","AWS/Events","AWS/FSx","AWS/GameLift","AWS/GlobalAccelerator","Glue","AWS/Inspector","AWS/IoT","AWS/KMS","AWS/Cassandra","AWS/Kinesis","AWS/KinesisAnalytics","AWS/Firehose","AWS/Lambda","AWS/Lex","AWS/AmazonMQ","AWS/ML","AWS/Kafka","AmazonMWAA","AWS/MemoryDB","AWS/NATGateway","AWS/Neptune","AWS/NetworkFirewall","AWS/NetworkELB","AWS/Network + Manager","AWS/NetworkMonitor","AWS/ES","AWS/AOSS","AWS/OpsWorks","AWS/Polly","AWS/PrivateLinkEndpoints","AWS/PrivateLinkServices","AWS/RDS","AWS/RDS/Proxy","AWS/Redshift","AWS/Rekognition","AWS/Route53","AWS/Route53Resolver","AWS/S3","AWS/S3/Storage-Lens","AWS/SageMaker","/aws/sagemaker/Endpoints","AWS/Sagemaker/LabelingJobs","AWS/Sagemaker/ModelBuildingPipeline","/aws/sagemaker/ProcessingJobs","/aws/sagemaker/TrainingJobs","/aws/sagemaker/TransformJobs","AWS/SageMaker/Workteam","AWS/ServiceQuotas","AWS/DDoSProtection","AWS/SES","AWS/SNS","AWS/SQS","AWS/SWF","AWS/States","AWS/StorageGateway","AWS/Textract","AWS/TransitGateway","AWS/Translate","AWS/TrustedAdvisor","AWS/VPN","WAF","AWS/WAFV2","AWS/WorkSpaces","AWS/X-Ray"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_log_services_returns_AWS_Logs_Services_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_log_services_returns_AWS_Logs_Services_List_object_response.freeze new file mode 100644 index 00000000000..c1c6a30de5a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_log_services_returns_AWS_Logs_Services_List_object_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:06.777Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_log_services_returns_AWS_Logs_Services_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_log_services_returns_AWS_Logs_Services_List_object_response.yaml new file mode 100644 index 00000000000..b36c105777e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_log_services_returns_AWS_Logs_Services_List_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/logs/services + response: + body: '{"data":{"id":"logs_services","type":"logs_services","attributes":{"logs_services":["apigw-access-logs","apigw-execution-logs","cloudfront","elb","elbv2","lambda","redshift","s3","states","waf"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_namespaces_returns_AWS_Namespaces_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_namespaces_returns_AWS_Namespaces_List_object_response.freeze new file mode 100644 index 00000000000..9053e750470 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_namespaces_returns_AWS_Namespaces_List_object_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:06.862Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_namespaces_returns_AWS_Namespaces_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_namespaces_returns_AWS_Namespaces_List_object_response.yaml new file mode 100644 index 00000000000..56b7d6f8f58 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_List_namespaces_returns_AWS_Namespaces_List_object_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/available_namespaces + response: + body: '{"data":{"id":"namespaces","type":"namespaces","attributes":{"namespaces":["AWS/ApiGateway","AWS/AppRunner","AWS/AppStream","AWS/AppSync","AWS/ApplicationELB","AWS/Athena","AWS/AutoScaling","AWS/Backup","AWS/Bedrock","AWS/Billing","AWS/CertificateManager","AWS/ELB","AWS/CloudFront","AWS/CloudHSM","AWS/CloudSearch","AWS/CodeBuild","AWS/CodeWhisperer","AWS/Cognito","AWS/Config","AWS/Connect","AWS/DMS","AWS/DX","AWS/DocDB","AWS/DynamoDB","AWS/DAX","AWS/EC2","AWS/EC2/API","AWS/EC2/InfrastructurePerformance","AWS/EC2Spot","AWS/ElasticMapReduce","AWS/ElastiCache","AWS/ElasticBeanstalk","AWS/EBS","AWS/ECR","AWS/ECS","AWS/EFS","AWS/ElasticTranscoder","AWS/MediaConnect","AWS/MediaConvert","AWS/MediaLive","AWS/MediaPackage","AWS/MediaStore","AWS/MediaTailor","AWS/Events","AWS/FSx","AWS/GameLift","AWS/GlobalAccelerator","Glue","AWS/Inspector","AWS/IoT","AWS/KMS","AWS/Cassandra","AWS/Kinesis","AWS/KinesisAnalytics","AWS/Firehose","AWS/Lambda","AWS/Lex","AWS/AmazonMQ","AWS/ML","AWS/Kafka","AmazonMWAA","AWS/MemoryDB","AWS/NATGateway","AWS/Neptune","AWS/NetworkFirewall","AWS/NetworkELB","AWS/Network + Manager","AWS/NetworkMonitor","AWS/ES","AWS/AOSS","AWS/OpsWorks","AWS/Polly","AWS/PrivateLinkEndpoints","AWS/PrivateLinkServices","AWS/RDS","AWS/RDS/Proxy","AWS/Redshift","AWS/Rekognition","AWS/Route53","AWS/Route53Resolver","AWS/S3","AWS/S3/Storage-Lens","AWS/SageMaker","/aws/sagemaker/Endpoints","AWS/Sagemaker/LabelingJobs","AWS/Sagemaker/ModelBuildingPipeline","/aws/sagemaker/ProcessingJobs","/aws/sagemaker/TrainingJobs","/aws/sagemaker/TransformJobs","AWS/SageMaker/Workteam","AWS/ServiceQuotas","AWS/DDoSProtection","AWS/SES","AWS/SNS","AWS/SQS","AWS/SWF","AWS/States","AWS/StorageGateway","AWS/Textract","AWS/TransitGateway","AWS/Translate","AWS/TrustedAdvisor","AWS/VPN","WAF","AWS/WAFV2","AWS/WorkSpaces","AWS/X-Ray"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze new file mode 100644 index 00000000000..042faedbb73 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.freeze @@ -0,0 +1 @@ +2024-08-21T20:16:52.731Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml new file mode 100644 index 00000000000..3571d1e61d0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_API_error_response._response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"logs_config":{},"metrics_config":{"automute_enabled":true,"enabled":false,"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}]},"resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"123456789012","type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":{"id":"b5333e91-03e0-4a3f-9bd6-07e2d83cb85f","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"aa55eef398064c1ab1937f6f008b7184"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1"]},"created_at":"2024-08-21T20:16:53.079170523Z","logs_config":{"lambda_forwarder":{}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-08-21T20:16:53.079176907Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":[],"auth_config":{"role_name":"test"},"aws_account_id":"123456789012","aws_partition":"aws-test","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":[],"sources":["s3"]}},"metrics_config":{"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":[]}]},"resources_config":{},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"123456789012","type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '{"errors":[{"title":"Generic Error","detail":"invalid partition: aws-test"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/123456789012 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..3736f4c8c57 --- /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-10-28T14:43:06.952Z \ 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..0d2ba469c7f --- /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,57 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"00000000-abcd-0001-0000-000000000000","type":"account"}} + 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":"28a2004c-84b4-4f07-a2a4-01c9ab6a021e","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"a55061deb44b4bd28f751f150cabf912"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:07.521247459Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:07.521251841Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/28a2004c-84b4-4f07-a2a4-01c9ab6a021e + response: + body: '{"data":{"id":"28a2004c-84b4-4f07-a2a4-01c9ab6a021e","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"a55061deb44b4bd28f751f150cabf912"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:07.521247Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:07.787129993Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/28a2004c-84b4-4f07-a2a4-01c9ab6a021e + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..e56f6833678 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:08.012Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..4052c6771e9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Bad_Request_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"id":"00000000-abcd-0001-0000-000000000000","type":"account"}} + 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":"84a5a2e9-80f6-4740-a478-c885ae8d4117","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"8e44f2912a454f59824ddcb767a6f6da"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-10-28T14:43:08.585257799Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-10-28T14:43:08.585261311Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"access_key_id":"AKIAIOSFODNN7EXAMPLE","secret_access_key":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/84a5a2e9-80f6-4740-a478-c885ae8d4117 + response: + body: '{"errors":[{"title":"Generic Error","detail":"cannot switch between role + and key based auth"}]}' + 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/84a5a2e9-80f6-4740-a478-c885ae8d4117 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..861698b9718 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-10-28T14:43:08.932Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..e53e3dd9b87 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_AWS_Integration_-_Patch_account_config_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a + 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_Create_an_AWS_account_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_account_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..8da9363a4aa --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_account_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:46.341Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_account_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_account_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..bbee1a4d71f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_account_returns_AWS_Account_object_response.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + 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":"0696eb1f-06fa-40a6-a623-084a83f61623","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"32cd9dafa1d24205ba26a02d157cd16f"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-11-06T18:44:47.20569681Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"exclude_only":["AWS/SQS","AWS/ElasticMapReduce"]}},"modified_at":"2024-11-06T18:44:47.20570138Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}}}' + 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/0696eb1f-06fa-40a6-a623-084a83f61623 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..4adb1638a7a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:47.513Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..c7962eb18ac --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_AWS_Account_object_response.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"access_key_id":"AKIAIOSFODNN7EXAMPLE","secret_access_key":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + 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":"5b07e0e7-013c-427e-977a-7adb94ff4b40","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"access_key_id":"AKIAIOSFODNN7EXAMPLE"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-11-06T18:44:47.622908005Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"exclude_only":["AWS/SQS","AWS/ElasticMapReduce"]}},"modified_at":"2024-11-06T18:44:47.62291187Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}}}' + 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/5b07e0e7-013c-427e-977a-7adb94ff4b40 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..26a03306f6a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:47.919Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..41488b97468 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws-invalid","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + 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-invalid"}]}' + 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_Create_an_AWS_integration_returns_Conflict_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Conflict_response.freeze new file mode 100644 index 00000000000..89901ede4c0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Conflict_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:48.024Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Conflict_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Conflict_response.yaml new file mode 100644 index 00000000000..8cd2250ee10 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Create_an_AWS_integration_returns_Conflict_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"type":"account"}} + 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":"7f221537-cb4f-47dc-8666-f77e5ca60750","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"8fce2f5d4975420794b61a5455bf78f2"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:48.579473724Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:48.579477654Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"errors":[{"status":"409","title":"Account already exists","detail":"AWS + account with provided id already exists"}]}' + code: 409 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 409 Conflict +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/7f221537-cb4f-47dc-8666-f77e5ca60750 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..27a329cddf3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:49.460Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..8f3e200c961 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/not-a-uuid + response: + body: '{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid + parameter \"aws_account_config_id\" in \"path\"; expected type \"uuid\""}]}' + 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_Delete_an_AWS_integration_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_No_Content_response.freeze new file mode 100644 index 00000000000..19dc73505b0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:49.526Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_No_Content_response.yaml new file mode 100644 index 00000000000..fd01f82214c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_No_Content_response.yaml @@ -0,0 +1,55 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"type":"account"}} + 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":"e733f58b-b8d1-4d0c-b2f5-6438d314ca51","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"33e38eb9a16041fc8688ca9afcf82224"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:50.086633712Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:50.086637995Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/e733f58b-b8d1-4d0c-b2f5-6438d314ca51 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/e733f58b-b8d1-4d0c-b2f5-6438d314ca51 + 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_Delete_an_AWS_integration_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..abe0e4a74aa --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:50.507Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..b2eb4fdba73 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Delete_an_AWS_integration_returns_Not_Found_response.yaml @@ -0,0 +1,55 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"type":"account"}} + 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":"22e02b17-0d91-46d7-a228-69f7250a9c67","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"7d448990acf04682b29cb61691bf86bc"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:51.024047931Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:51.024054618Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/448169a8-251c-4344-abee-1c4edef39f7a + 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 +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/22e02b17-0d91-46d7-a228-69f7250a9c67 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_a_new_external_ID_returns_AWS_External_ID_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_a_new_external_ID_returns_AWS_External_ID_object_response.freeze new file mode 100644 index 00000000000..6095c780297 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_a_new_external_ID_returns_AWS_External_ID_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:51.500Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_a_new_external_ID_returns_AWS_External_ID_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_a_new_external_ID_returns_AWS_External_ID_object_response.yaml new file mode 100644 index 00000000000..ae12e2e4833 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_a_new_external_ID_returns_AWS_External_ID_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/generate_new_external_id + response: + body: '{"data":{"id":"external_id","type":"external_id","attributes":{"external_id":"96fc79a77c474e4f863a3c227fb91fef"}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_new_external_ID_returns_AWS_External_ID_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_new_external_ID_returns_AWS_External_ID_object_response.freeze new file mode 100644 index 00000000000..37cfccb87df --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_new_external_ID_returns_AWS_External_ID_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:51.871Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_new_external_ID_returns_AWS_External_ID_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_new_external_ID_returns_AWS_External_ID_object_response.yaml new file mode 100644 index 00000000000..6ce802c21aa --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Generate_new_external_ID_returns_AWS_External_ID_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/integration/aws/generate_new_external_id + response: + body: '{"data":{"id":"78feee6b9c374776888068593fa8c0b9","type":"external_id","attributes":{"external_id":"78feee6b9c374776888068593fa8c0b9"}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..3121171861c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:52.052Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..c44f51a9ebf --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_AWS_Account_object_response.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"type":"account"}} + 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":"db6c660f-0ee0-4479-b1e6-936e5faa7266","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"f4c8000f33f94d25bcec9afd6609bb11"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:52.646520994Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:52.646525244Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/db6c660f-0ee0-4479-b1e6-936e5faa7266 + response: + body: '{"data":{"id":"db6c660f-0ee0-4479-b1e6-936e5faa7266","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"f4c8000f33f94d25bcec9afd6609bb11"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:52.646521Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:52.646525Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/db6c660f-0ee0-4479-b1e6-936e5faa7266 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..8de2f0fbb4c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:53.120Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..e895e0c8e38 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/not-a-uuid + response: + body: '{"errors":[{"status":"400","title":"Invalid Parameter","detail":"invalid + parameter \"aws_account_config_id\" in \"path\"; expected type \"uuid\""}]}' + 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_Get_an_AWS_integration_by_config_ID_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..2abc18523ca --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:53.215Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..f575e265cb4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Get_an_AWS_integration_by_config_ID_returns_Not_Found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a + 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_List_all_AWS_integrations_returns_AWS_Accounts_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_all_AWS_integrations_returns_AWS_Accounts_List_object_response.freeze new file mode 100644 index 00000000000..2932343225b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_all_AWS_integrations_returns_AWS_Accounts_List_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:53.338Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_all_AWS_integrations_returns_AWS_Accounts_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_all_AWS_integrations_returns_AWS_Accounts_List_object_response.yaml new file mode 100644 index 00000000000..12f7b0af454 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_all_AWS_integrations_returns_AWS_Accounts_List_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/accounts + response: + body: '{"data":[{"id":"e6daa8c4-58b6-42e1-970e-44e6fa812ce0","type":"account","attributes":{"account_tags":[],"auth_config":{"access_key_id":"AKIA514950102505"},"aws_account_id":"514950102505","aws_partition":"aws","aws_regions":{"include_all":true},"created_at":"2024-09-06T00:18:12.382448Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:1234567890:function:datadog-forwarder-Forwarder"],"sources":[]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-06T00:18:17.536561Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"a0c7f96e-a471-488e-84be-c3336e7ab693","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"859ffc73702c40f589cc3b74c5967e27"},"aws_account_id":"172830950700","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-10-07T13:58:28.577522Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-10-07T13:58:28.577526Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"3a3d5b83-2ad8-41d8-b82e-a3ba972a9783","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"be10a93f33a64b0ea872da2f48348979"},"aws_account_id":"172704974400","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-23T00:02:26.306293Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-23T00:02:26.306297Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"89a9dae5-cbe3-4fba-b1b2-aae8775ed319","type":"account","attributes":{"account_tags":["filter:one","filtertwo"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"e31ada331546486f9099cd5c01eef257"},"aws_account_id":"001725901256","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-2","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-09T17:00:58.823444Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["testTag","test:Tag2"]}],"namespace_filters":{"exclude_only":["AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-10-16T14:55:17.947931Z","resources_config":{"cloud_security_posture_management_collection":false},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"7e1d660d-1142-45b1-a795-dc3900b6bd17","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"f61b52d768394db6851aed2f887ac6f6"},"aws_account_id":"172830950701","aws_partition":"aws","aws_regions":{"include_only":["me-south-1"]},"created_at":"2024-10-17T15:08:40.917209Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-10-18T20:19:53.960435Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"d52e151c-c608-4e14-9f29-dfeff876bb39","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"c2909403ca9949db82c36adf6e8cdcfa"},"aws_account_id":"172772261200","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-30T18:56:55.042771Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-30T18:56:55.042775Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"d7d74617-832d-4c4d-a8c3-1e69d509ea52","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"2b1dd9fd35b0440ca4bf98ff70ac2e63"},"aws_account_id":"172772275700","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-30T18:59:18.175722Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-30T18:59:18.175727Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}},{"id":"7e5acac6-3ac8-4762-8100-479f03ccffc8","type":"account","attributes":{"account_tags":["$KEY:$VALUE"],"auth_config":{"role_name":"DatadogAWSIntegrationRole","external_id":"04548a334583412aa4e6f5548f4e9989"},"aws_account_id":"172532181900","aws_partition":"aws","aws_regions":{"include_only":["us-east-2","us-west-1","eu-west-1","eu-central-1","ap-southeast-1","ap-southeast-2","ap-northeast-1","ap-northeast-2","ap-northeast-3","sa-east-1","ap-south-1","ca-central-1","eu-west-2","eu-west-3","eu-north-1","af-south-1","ap-east-1","ap-south-2","ap-southeast-3","ap-southeast-4","ca-west-1","eu-central-2","eu-south-1","eu-south-2","il-central-1","me-central-1","me-south-1"]},"created_at":"2024-09-03T00:03:40.248176Z","logs_config":{"lambda_forwarder":{"lambdas":[],"sources":[]}},"metrics_config":{"enabled":false,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["$KEY:$VALUE"]}],"namespace_filters":{"exclude_only":["AWS/AutoScaling","AWS/ElasticMapReduce","AWS/SQS"]}},"modified_at":"2024-09-03T00:03:40.24818Z","resources_config":{"cloud_security_posture_management_collection":true,"extended_collection":true},"traces_config":{"xray_services":{"include_only":[]}}}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_available_namespaces_returns_AWS_Namespaces_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_available_namespaces_returns_AWS_Namespaces_List_object_response.freeze new file mode 100644 index 00000000000..e1b33d2dbbc --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_available_namespaces_returns_AWS_Namespaces_List_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:53.502Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_available_namespaces_returns_AWS_Namespaces_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_available_namespaces_returns_AWS_Namespaces_List_object_response.yaml new file mode 100644 index 00000000000..0b6290049b1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_available_namespaces_returns_AWS_Namespaces_List_object_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/available_namespaces + response: + body: '{"data":{"id":"namespaces","type":"namespaces","attributes":{"namespaces":["AWS/ApiGateway","AWS/AppRunner","AWS/AppStream","AWS/AppSync","AWS/ApplicationELB","AWS/Athena","AWS/AutoScaling","AWS/Backup","AWS/Bedrock","AWS/Billing","AWS/Budgeting","AWS/CertificateManager","AWS/ELB","AWS/CloudFront","AWS/CloudHSM","AWS/CloudSearch","AWS/Logs","AWS/CodeBuild","AWS/CodeWhisperer","AWS/Cognito","AWS/Config","AWS/Connect","AWS/DMS","AWS/DX","AWS/DocDB","AWS/DynamoDB","AWS/DAX","AWS/EC2","AWS/EC2/API","AWS/EC2/InfrastructurePerformance","AWS/EC2Spot","AWS/ElasticMapReduce","AWS/ElastiCache","AWS/ElasticBeanstalk","AWS/EBS","AWS/ECR","AWS/ECS","AWS/EFS","AWS/ElasticInference","AWS/ElasticTranscoder","AWS/MediaConnect","AWS/MediaConvert","AWS/MediaLive","AWS/MediaPackage","AWS/MediaStore","AWS/MediaTailor","AWS/Events","AWS/FSx","AWS/GameLift","AWS/GlobalAccelerator","Glue","AWS/Inspector","AWS/IoT","AWS/KMS","AWS/Cassandra","AWS/Kinesis","AWS/KinesisAnalytics","AWS/Firehose","AWS/Lambda","AWS/Lex","AWS/AmazonMQ","AWS/ML","AWS/Kafka","AmazonMWAA","AWS/MemoryDB","AWS/NATGateway","AWS/Neptune","AWS/NetworkFirewall","AWS/NetworkELB","AWS/Network + Manager","AWS/NetworkMonitor","AWS/ES","AWS/AOSS","AWS/OpsWorks","AWS/Polly","AWS/PrivateLinkEndpoints","AWS/PrivateLinkServices","AWS/RDS","AWS/RDS/Proxy","AWS/Redshift","AWS/Rekognition","AWS/Route53","AWS/Route53Resolver","AWS/S3","AWS/S3/Storage-Lens","AWS/SageMaker","/aws/sagemaker/Endpoints","AWS/Sagemaker/LabelingJobs","AWS/Sagemaker/ModelBuildingPipeline","/aws/sagemaker/ProcessingJobs","/aws/sagemaker/TrainingJobs","/aws/sagemaker/TransformJobs","AWS/SageMaker/Workteam","AWS/ServiceQuotas","AWS/DDoSProtection","AWS/SES","AWS/SNS","AWS/SQS","AWS/SWF","AWS/States","AWS/StorageGateway","AWS/Textract","AWS/TransitGateway","AWS/Translate","AWS/TrustedAdvisor","AWS/Usage","AWS/VPN","WAF","AWS/WAFV2","AWS/WorkSpaces","AWS/X-Ray"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_log_services_returns_AWS_Logs_Services_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_log_services_returns_AWS_Logs_Services_List_object_response.freeze new file mode 100644 index 00000000000..ec96db9bef6 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_log_services_returns_AWS_Logs_Services_List_object_response.freeze @@ -0,0 +1 @@ +2024-11-04T20:55:55.328Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_log_services_returns_AWS_Logs_Services_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_log_services_returns_AWS_Logs_Services_List_object_response.yaml new file mode 100644 index 00000000000..b36c105777e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_log_services_returns_AWS_Logs_Services_List_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/logs/services + response: + body: '{"data":{"id":"logs_services","type":"logs_services","attributes":{"logs_services":["apigw-access-logs","apigw-execution-logs","cloudfront","elb","elbv2","lambda","redshift","s3","states","waf"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_namespaces_returns_AWS_Namespaces_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_namespaces_returns_AWS_Namespaces_List_object_response.freeze new file mode 100644 index 00000000000..f663dde1fad --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_namespaces_returns_AWS_Namespaces_List_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:53.574Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_namespaces_returns_AWS_Namespaces_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_namespaces_returns_AWS_Namespaces_List_object_response.yaml new file mode 100644 index 00000000000..0b6290049b1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_List_namespaces_returns_AWS_Namespaces_List_object_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/available_namespaces + response: + body: '{"data":{"id":"namespaces","type":"namespaces","attributes":{"namespaces":["AWS/ApiGateway","AWS/AppRunner","AWS/AppStream","AWS/AppSync","AWS/ApplicationELB","AWS/Athena","AWS/AutoScaling","AWS/Backup","AWS/Bedrock","AWS/Billing","AWS/Budgeting","AWS/CertificateManager","AWS/ELB","AWS/CloudFront","AWS/CloudHSM","AWS/CloudSearch","AWS/Logs","AWS/CodeBuild","AWS/CodeWhisperer","AWS/Cognito","AWS/Config","AWS/Connect","AWS/DMS","AWS/DX","AWS/DocDB","AWS/DynamoDB","AWS/DAX","AWS/EC2","AWS/EC2/API","AWS/EC2/InfrastructurePerformance","AWS/EC2Spot","AWS/ElasticMapReduce","AWS/ElastiCache","AWS/ElasticBeanstalk","AWS/EBS","AWS/ECR","AWS/ECS","AWS/EFS","AWS/ElasticInference","AWS/ElasticTranscoder","AWS/MediaConnect","AWS/MediaConvert","AWS/MediaLive","AWS/MediaPackage","AWS/MediaStore","AWS/MediaTailor","AWS/Events","AWS/FSx","AWS/GameLift","AWS/GlobalAccelerator","Glue","AWS/Inspector","AWS/IoT","AWS/KMS","AWS/Cassandra","AWS/Kinesis","AWS/KinesisAnalytics","AWS/Firehose","AWS/Lambda","AWS/Lex","AWS/AmazonMQ","AWS/ML","AWS/Kafka","AmazonMWAA","AWS/MemoryDB","AWS/NATGateway","AWS/Neptune","AWS/NetworkFirewall","AWS/NetworkELB","AWS/Network + Manager","AWS/NetworkMonitor","AWS/ES","AWS/AOSS","AWS/OpsWorks","AWS/Polly","AWS/PrivateLinkEndpoints","AWS/PrivateLinkServices","AWS/RDS","AWS/RDS/Proxy","AWS/Redshift","AWS/Rekognition","AWS/Route53","AWS/Route53Resolver","AWS/S3","AWS/S3/Storage-Lens","AWS/SageMaker","/aws/sagemaker/Endpoints","AWS/Sagemaker/LabelingJobs","AWS/Sagemaker/ModelBuildingPipeline","/aws/sagemaker/ProcessingJobs","/aws/sagemaker/TrainingJobs","/aws/sagemaker/TransformJobs","AWS/SageMaker/Workteam","AWS/ServiceQuotas","AWS/DDoSProtection","AWS/SES","AWS/SNS","AWS/SQS","AWS/SWF","AWS/States","AWS/StorageGateway","AWS/Textract","AWS/TransitGateway","AWS/Translate","AWS/TrustedAdvisor","AWS/Usage","AWS/VPN","WAF","AWS/WAFV2","AWS/WorkSpaces","AWS/X-Ray"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_AWS_Account_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_AWS_Account_object_response.freeze new file mode 100644 index 00000000000..7d9884c7935 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_AWS_Account_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:53.669Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_AWS_Account_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_AWS_Account_object_response.yaml new file mode 100644 index 00000000000..b202f8627df --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_AWS_Account_object_response.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"type":"account"}} + 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":"06b62294-36d7-4bbe-a8b8-7c93736dc0ee","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"c16e1ceb4ac64293ba91f020191fa781"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:54.297075743Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:54.297079976Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/06b62294-36d7-4bbe-a8b8-7c93736dc0ee + response: + body: '{"data":{"id":"06b62294-36d7-4bbe-a8b8-7c93736dc0ee","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"c16e1ceb4ac64293ba91f020191fa781"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:54.297076Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":true,"collect_cloudwatch_alarms":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:54.489623544Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + 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/06b62294-36d7-4bbe-a8b8-7c93736dc0ee + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..a20f0bad445 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:54.767Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..3dfcce94dc0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Bad_Request_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":false,"collect_custom_metrics":false,"enabled":true,"namespace_filters":{"include_only":["AWS/EC2"]},"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}},"type":"account"}} + 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":"6e045c0b-458a-4ec1-8654-6ac491320939","type":"account","attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole","external_id":"00d5e0f623574d388e9717154bcbf7f2"},"aws_account_id":"123456789012","aws_partition":"aws","aws_regions":{"include_only":["us-east-1"]},"created_at":"2024-11-06T18:44:55.461251746Z","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"enabled":true,"automute_enabled":true,"collect_custom_metrics":false,"collect_cloudwatch_alarms":false,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}],"namespace_filters":{"include_only":["AWS/EC2"]}},"modified_at":"2024-11-06T18:44:55.461256677Z","resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{"xray_services":{"include_only":["AWS/AppSync"]}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"access_key_id":"AKIAIOSFODNN7EXAMPLE","secret_access_key":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/6e045c0b-458a-4ec1-8654-6ac491320939 + response: + body: '{"errors":[{"title":"Generic Error","detail":"cannot switch between role + and key based auth"}]}' + 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/6e045c0b-458a-4ec1-8654-6ac491320939 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..7d82ab53f41 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-11-06T18:44:55.829Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..e53e3dd9b87 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Integration/Scenario_Update_an_AWS_integration_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"account_tags":["key:value"],"auth_config":{"role_name":"DatadogIntegrationRole"},"aws_account_id":"123456789012","aws_partition":"aws","logs_config":{"lambda_forwarder":{"lambdas":["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"],"sources":["s3"]}},"metrics_config":{"automute_enabled":true,"collect_cloudwatch_alarms":true,"collect_custom_metrics":true,"enabled":true,"tag_filters":[{"namespace":"AWS/EC2","tags":["key:value"]}]},"resources_config":{"cloud_security_posture_management_collection":false,"extended_collection":false},"traces_config":{}},"type":"account"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/integration/aws/accounts/448169a8-251c-4344-abee-1c4edef39f7a + 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_Logs_Integration/Scenario_Get_list_of_AWS_log_ready_services_returns_AWS_Logs_Services_List_object_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Logs_Integration/Scenario_Get_list_of_AWS_log_ready_services_returns_AWS_Logs_Services_List_object_response.freeze new file mode 100644 index 00000000000..59066f4dee5 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Logs_Integration/Scenario_Get_list_of_AWS_log_ready_services_returns_AWS_Logs_Services_List_object_response.freeze @@ -0,0 +1 @@ +2024-11-06T15:58:53.184Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Logs_Integration/Scenario_Get_list_of_AWS_log_ready_services_returns_AWS_Logs_Services_List_object_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Logs_Integration/Scenario_Get_list_of_AWS_log_ready_services_returns_AWS_Logs_Services_List_object_response.yaml new file mode 100644 index 00000000000..b36c105777e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_AWS_Logs_Integration/Scenario_Get_list_of_AWS_log_ready_services_returns_AWS_Logs_Services_List_object_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/integration/aws/logs/services + response: + body: '{"data":{"id":"logs_services","type":"logs_services","attributes":{"logs_services":["apigw-access-logs","apigw-execution-logs","cloudfront","elb","elbv2","lambda","redshift","s3","states","waf"]}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +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..3f47d837a7b --- /dev/null +++ b/tests/scenarios/features/v2/aws_integration.feature @@ -0,0 +1,158 @@ +@endpoint(aws-integration) @endpoint(aws-integration-v2) +Feature: AWS Integration + Configure your Datadog-AWS integration directly through the Datadog API. + For more information, see the [AWS integration + page](https://docs.datadoghq.com/integrations/amazon_web_services). + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AWSIntegration" API + + @team:DataDog/aws-integrations + Scenario: Create an AWS account returns "AWS Account object" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Create an AWS integration returns "AWS Account object" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Create an AWS integration returns "Bad Request" response + Given operation "CreateAWSAccount" enabled + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws-invalid", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Create an AWS integration returns "Conflict" response + Given operation "CreateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "CreateAWSAccount" request + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/aws-integrations + Scenario: Delete an AWS integration returns "Bad Request" response + Given operation "DeleteAWSAccount" enabled + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter with value "not-a-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Delete an AWS integration returns "No Content" response + Given operation "DeleteAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/aws-integrations + Scenario: Delete an AWS integration returns "Not Found" response + Given operation "DeleteAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "DeleteAWSAccount" request + And request contains "aws_account_config_id" parameter with value "448169a8-251c-4344-abee-1c4edef39f7a" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/aws-integrations + Scenario: Generate a new external ID returns "AWS External ID object" response + Given operation "CreateNewAWSExternalID" enabled + And new "CreateNewAWSExternalID" request + When the request is sent + Then the response status is 200 AWS External ID object + + @team:DataDog/aws-integrations + Scenario: Generate new external ID returns "AWS External ID object" response + Given operation "CreateNewAWSExternalID" enabled + And new "CreateNewAWSExternalID" request + When the request is sent + Then the response status is 200 AWS External ID object + + @team:DataDog/aws-integrations + Scenario: Get an AWS integration by config ID returns "AWS Account object" response + Given operation "GetAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Get an AWS integration by config ID returns "Bad Request" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter with value "not-a-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Get an AWS integration by config ID returns "Not Found" response + Given operation "GetAWSAccount" enabled + And new "GetAWSAccount" request + And request contains "aws_account_config_id" parameter with value "448169a8-251c-4344-abee-1c4edef39f7a" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/aws-integrations + Scenario: List all AWS integrations returns "AWS Accounts List object" response + Given operation "ListAWSAccounts" enabled + And new "ListAWSAccounts" request + When the request is sent + Then the response status is 200 AWS Accounts List object + + @team:DataDog/aws-integrations + Scenario: List available namespaces returns "AWS Namespaces List object" response + Given operation "ListAWSNamespaces" enabled + And new "ListAWSNamespaces" request + When the request is sent + Then the response status is 200 AWS Namespaces List object + + @team:DataDog/aws-integrations + Scenario: List namespaces returns "AWS Namespaces List object" response + Given operation "ListAWSNamespaces" enabled + And new "ListAWSNamespaces" request + When the request is sent + Then the response status is 200 AWS Namespaces List object + + @team:DataDog/aws-integrations + Scenario: Update an AWS integration returns "AWS Account object" response + Given operation "UpdateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 200 AWS Account object + + @team:DataDog/aws-integrations + Scenario: Update an AWS integration returns "Bad Request" response + Given operation "UpdateAWSAccount" enabled + And there is a valid "aws_account_v2" in the system + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter from "aws_account_v2.data.id" + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"access_key_id": "AKIAIOSFODNN7EXAMPLE", "secret_access_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/aws-integrations + Scenario: Update an AWS integration returns "Not Found" response + Given operation "UpdateAWSAccount" enabled + And new "UpdateAWSAccount" request + And request contains "aws_account_config_id" parameter with value "448169a8-251c-4344-abee-1c4edef39f7a" + And body with value {"data": {"attributes": {"account_tags": ["key:value"], "auth_config": {"role_name": "DatadogIntegrationRole"}, "aws_account_id": "123456789012", "aws_partition": "aws", "logs_config": {"lambda_forwarder": {"lambdas": ["arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder"], "sources": ["s3"]}}, "metrics_config": {"automute_enabled": true, "collect_cloudwatch_alarms": true, "collect_custom_metrics": true, "enabled": true, "tag_filters": [{"namespace": "AWS/EC2", "tags": ["key:value"]}]}, "resources_config": {"cloud_security_posture_management_collection": false, "extended_collection": false}, "traces_config": {}}, "type": "account"}} + When the request is sent + Then the response status is 404 Not Found diff --git a/tests/scenarios/features/v2/aws_logs_integration.feature b/tests/scenarios/features/v2/aws_logs_integration.feature new file mode 100644 index 00000000000..7dcfb894ae9 --- /dev/null +++ b/tests/scenarios/features/v2/aws_logs_integration.feature @@ -0,0 +1,16 @@ +@endpoint(aws-logs-integration) @endpoint(aws-logs-integration-v2) +Feature: AWS Logs Integration + Configure your Datadog-AWS-Logs integration directly through Datadog API. + For more information, see the [AWS integration + page](https://docs.datadoghq.com/integrations/amazon_web_services/#log- + collection). + + @team:DataDog/aws-integrations + Scenario: Get list of AWS log ready services returns "AWS Logs Services List object" response + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "AWSLogsIntegration" API + And operation "ListAWSLogsServices" enabled + And new "ListAWSLogsServices" request + When the request is sent + Then the response status is 200 AWS Logs Services List object diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index d5a158b247b..7a20547087d 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -212,6 +212,18 @@ "tag": "Incidents", "operationId": "CreateIncidentTodo" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"account\",\n \"attributes\": {\n \"account_tags\": [\n \"key:value\"\n ],\n \"auth_config\": {\n \"role_name\": \"DatadogIntegrationRole\"\n },\n \"aws_account_id\": \"123456789012\",\n \"aws_partition\": \"aws\",\n \"aws_regions\": {\n \"include_only\": [\n \"us-east-1\"\n ]\n },\n \"logs_config\": {\n \"lambda_forwarder\": {\n \"lambdas\": [\n \"arn:aws:lambda:us-east-1:123456789012:function:DatadogLambdaLogForwarder\"\n ],\n \"sources\": [\n \"s3\"\n ]\n }\n },\n \"metrics_config\": {\n \"enabled\": true,\n \"automute_enabled\": true,\n \"collect_custom_metrics\": false,\n \"collect_cloudwatch_alarms\": false,\n \"tag_filters\": [\n {\n \"namespace\": \"AWS/EC2\",\n \"tags\": [\n \"key:value\"\n ]\n }\n ],\n \"namespace_filters\": {\n \"include_only\": [\n \"AWS/EC2\"\n ]\n }\n },\n \"resources_config\": {\n \"cloud_security_posture_management_collection\": false,\n \"extended_collection\": false\n },\n \"traces_config\": {\n \"xray_services\": {\n \"include_only\": [\n \"AWS/AppSync\"\n ]\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"aws_account_v2\" in the system", + "key": "aws_account_v2", + "tag": "AWS Integration", + "operationId": "CreateAWSAccount" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 81c6a29e22c..364cb9a8cfd 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -788,6 +788,61 @@ "type": "idempotent" } }, + "ListAWSAccounts": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "CreateAWSAccount": { + "tag": "AWS Integration", + "undo": { + "operationId": "DeleteAWSAccount", + "parameters": [ + { + "name": "aws_account_config_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteAWSAccount": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "GetAWSAccount": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "UpdateAWSAccount": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "ListAWSNamespaces": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "CreateNewAWSExternalID": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "ListAWSLogsServices": { + "tag": "AWS Logs Integration", + "undo": { + "type": "safe" + } + }, "ListGCPSTSAccounts": { "tag": "GCP Integration", "undo": {