diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 42ec940d042..9a4d9f05ee8 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -27888,6 +27888,7 @@ paths: - aws_configuration_read /api/v1/integration/aws/event_bridge: delete: + deprecated: true description: Delete an Amazon EventBridge source. operationId: DeleteAWSEventBridgeSource requestBody: @@ -27928,6 +27929,7 @@ paths: permissions: - manage_integrations get: + deprecated: true description: Get all Amazon EventBridge sources. operationId: ListAWSEventBridgeSources parameters: [] @@ -27959,6 +27961,7 @@ paths: operator: OPEN permissions: [] post: + deprecated: true description: Create an Amazon EventBridge source. operationId: CreateAWSEventBridgeSource requestBody: diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c31c76079af..e44adfced6e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1428,7 +1428,9 @@ components: AWSAccountConfigID: description: 'Unique Datadog ID of the AWS Account Integration Config. - To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) + To get the config ID for an account, use the + + [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) endpoint and query by AWS Account ID.' example: 00000000-abcd-0001-0000-000000000000 @@ -1486,6 +1488,7 @@ components: description: 'AWS partition your AWS account is scoped to. Defaults to `aws`. See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) + in the AWS documentation for more information.' enum: - aws @@ -1730,6 +1733,269 @@ components: description: The definition of `AWSCredentialsUpdate` object. oneOf: - $ref: '#/components/schemas/AWSAssumeRoleUpdate' + AWSEventBridgeAccountConfiguration: + description: The EventBridge configuration for one AWS account. + properties: + account_id: + description: Your AWS Account ID without dashes. + example: '123456789012' + type: string + event_hubs: + description: Array of AWS event sources associated with this account. + items: + $ref: '#/components/schemas/AWSEventBridgeSource' + type: array + tags: + description: 'Array of tags (in the form `key:value`) which are added to + all hosts + + and metrics reporting through the main AWS integration.' + example: + - $KEY:$VALUE + items: + description: The list of the host_tags. + type: string + type: array + type: object + AWSEventBridgeCreateRequest: + description: Amazon EventBridge create request body. + properties: + data: + $ref: '#/components/schemas/AWSEventBridgeCreateRequestData' + required: + - data + type: object + AWSEventBridgeCreateRequestAttributes: + description: The EventBridge source to be created. + properties: + account_id: + $ref: '#/components/schemas/AWSAccountID' + create_event_bus: + description: 'Set to true if Datadog should create the event bus in addition + to the event + + source. Requires the `events:CreateEventBus` permission.' + example: true + type: boolean + event_generator_name: + description: 'The given part of the event source name, which is then combined + with an + + assigned suffix to form the full name.' + example: app-alerts + type: string + region: + description: 'The event source''s + + [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints).' + example: us-east-1 + type: string + required: + - account_id + - event_generator_name + - region + type: object + AWSEventBridgeCreateRequestData: + description: Amazon EventBridge create request data. + properties: + attributes: + $ref: '#/components/schemas/AWSEventBridgeCreateRequestAttributes' + type: + $ref: '#/components/schemas/AWSEventBridgeType' + required: + - attributes + - type + type: object + AWSEventBridgeCreateResponse: + description: Amazon EventBridge create response body. + properties: + data: + $ref: '#/components/schemas/AWSEventBridgeCreateResponseData' + required: + - data + type: object + AWSEventBridgeCreateResponseAttributes: + description: A created EventBridge source. + properties: + event_source_name: + description: The event source name. + example: app-alerts-zyxw3210 + type: string + has_bus: + description: True if the event bus was created in addition to the source. + example: true + type: boolean + region: + description: 'The event source''s + + [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints).' + example: us-east-1 + type: string + status: + $ref: '#/components/schemas/AWSEventBridgeCreateStatus' + type: object + AWSEventBridgeCreateResponseData: + description: Amazon EventBridge create response data. + properties: + attributes: + $ref: '#/components/schemas/AWSEventBridgeCreateResponseAttributes' + id: + default: create_event_bridge + description: The ID of the Amazon EventBridge create response data. + example: create_event_bridge + type: string + type: + $ref: '#/components/schemas/AWSEventBridgeType' + required: + - attributes + - type + type: object + AWSEventBridgeCreateStatus: + description: The event source status "created". + enum: + - created + example: created + type: string + x-enum-varnames: + - CREATED + AWSEventBridgeDeleteRequest: + description: Amazon EventBridge delete request body. + properties: + data: + $ref: '#/components/schemas/AWSEventBridgeDeleteRequestData' + required: + - data + type: object + AWSEventBridgeDeleteRequestAttributes: + description: The EventBridge source to be deleted. + properties: + account_id: + $ref: '#/components/schemas/AWSAccountID' + event_generator_name: + description: The event source name. + example: app-alerts-zyxw3210 + type: string + region: + description: 'The event source''s + + [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints).' + example: us-east-1 + type: string + required: + - account_id + - event_generator_name + - region + type: object + AWSEventBridgeDeleteRequestData: + description: Amazon EventBridge delete request data. + properties: + attributes: + $ref: '#/components/schemas/AWSEventBridgeDeleteRequestAttributes' + type: + $ref: '#/components/schemas/AWSEventBridgeType' + required: + - attributes + - type + type: object + AWSEventBridgeDeleteResponse: + description: Amazon EventBridge delete response body. + properties: + data: + $ref: '#/components/schemas/AWSEventBridgeDeleteResponseData' + required: + - data + type: object + AWSEventBridgeDeleteResponseAttributes: + description: The EventBridge source delete response attributes. + properties: + status: + $ref: '#/components/schemas/AWSEventBridgeDeleteStatus' + type: object + AWSEventBridgeDeleteResponseData: + description: Amazon EventBridge delete response data. + properties: + attributes: + $ref: '#/components/schemas/AWSEventBridgeDeleteResponseAttributes' + id: + default: delete_event_bridge + description: The ID of the Amazon EventBridge list response data. + example: delete_event_bridge + type: string + type: + $ref: '#/components/schemas/AWSEventBridgeType' + required: + - attributes + - type + type: object + AWSEventBridgeDeleteStatus: + description: The event source status "empty". + enum: + - empty + example: empty + type: string + x-enum-varnames: + - EMPTY + AWSEventBridgeListResponse: + description: Amazon EventBridge list response body. + properties: + data: + $ref: '#/components/schemas/AWSEventBridgeListResponseData' + required: + - data + type: object + AWSEventBridgeListResponseAttributes: + description: An object describing the EventBridge configuration for multiple + accounts. + properties: + accounts: + description: List of accounts with their event sources. + items: + $ref: '#/components/schemas/AWSEventBridgeAccountConfiguration' + type: array + is_installed: + description: True if the EventBridge integration is enabled for your organization. + type: boolean + type: object + AWSEventBridgeListResponseData: + description: Amazon EventBridge list response data. + properties: + attributes: + $ref: '#/components/schemas/AWSEventBridgeListResponseAttributes' + id: + default: get_event_bridge + description: The ID of the Amazon EventBridge list response data. + example: get_event_bridge + type: string + type: + $ref: '#/components/schemas/AWSEventBridgeType' + required: + - attributes + - id + - type + type: object + AWSEventBridgeSource: + description: An EventBridge source. + properties: + name: + description: The event source name. + example: app-alerts-zyxw3210 + type: string + region: + description: 'The event source''s + + [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints).' + example: us-east-1 + type: string + type: object + AWSEventBridgeType: + default: event_bridge + description: Amazon EventBridge resource type. + enum: + - event_bridge + example: event_bridge + type: string + x-enum-varnames: + - EVENT_BRIDGE AWSIntegration: description: The definition of `AWSIntegration` object. properties: @@ -1809,10 +2075,12 @@ components: type: object AWSLambdaForwarderConfig: description: 'Log Autosubscription configuration for Datadog Forwarder Lambda - functions. Automatically set up triggers for existing + functions. - and new logs for some services, ensuring no logs from new resources are missed - and saving time spent on manual configuration.' + Automatically set up triggers for existing and new logs for some services, + + ensuring no logs from new resources are missed and saving time spent on manual + configuration.' properties: lambdas: description: List of Datadog Lambda Log Forwarder ARNs in your AWS account. @@ -1825,9 +2093,11 @@ components: $ref: '#/components/schemas/AWSLambdaForwarderConfigLogSourceConfig' sources: description: 'List of service IDs set to enable automatic log collection. + Discover the list of available services with the [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) + endpoint.' items: example: s3 @@ -1847,14 +2117,20 @@ components: description: 'AWS log source tag filter list. Defaults to `[]`. Array of log source to AWS resource tag mappings. Each mapping contains a - log source and its associated AWS resource tags (in `key:value` format) used - to filter logs submitted to Datadog. + log source and its + + associated AWS resource tags (in `key:value` format) used to filter logs submitted + to Datadog. Tag filters are applied for tags on the AWS resource emitting logs; tags associated - with the log storage entity (such as a CloudWatch Log Group or S3 Bucket) - are not considered. + with the + + log storage entity (such as a CloudWatch Log Group or S3 Bucket) are not considered. + + For more information on resource tag filter syntax, + + [see AWS resource exclusion](https://docs.datadoghq.com/account_management/billing/aws/#aws-resource-exclusion) - For more information on resource tag filter syntax, [see AWS resource exclusion](https://docs.datadoghq.com/account_management/billing/aws/#aws-resource-exclusion) in the AWS integration billing page.' properties: source: @@ -1958,17 +2234,21 @@ components: - $ref: '#/components/schemas/AWSNamespaceFiltersExcludeOnly' - $ref: '#/components/schemas/AWSNamespaceFiltersIncludeOnly' AWSNamespaceFiltersExcludeOnly: - description: 'Exclude only these namespaces from metrics collection. Defaults - to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. + description: 'Exclude only these namespaces from metrics collection. + + Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default + to reduce your AWS CloudWatch costs from `GetMetricData` API calls.' properties: exclude_only: - description: 'Exclude only these namespaces from metrics collection. Defaults - to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. + description: 'Exclude only these namespaces from metrics collection. + + Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default + to reduce your AWS CloudWatch costs from `GetMetricData` API calls.' example: - AWS/SQS @@ -1999,15 +2279,18 @@ components: description: 'AWS Metrics Collection tag filters list. Defaults to `[]`. The array of custom AWS resource tags (in the form `key:value`) defines a - filter that Datadog uses when collecting metrics from a specified service. + filter that Datadog uses + + when collecting metrics from a specified service. Wildcards, such as `?` (match a single character) and `*` (match multiple - characters), and exclusion using `!` before the tag are supported. + characters), + + and exclusion using `!` before the tag are supported. - For EC2, only hosts that match one of the defined tags will be imported into - Datadog. The rest will be ignored. + For EC2, only hosts that match one of the defined tags are imported into Datadog. - For example, `env:production,instance-type:c?.*,!region:us-east-1`.' + The rest are ignored. For example, `env:production,instance-type:c?.*,!region:us-east-1`.' properties: namespace: description: The AWS service for which the tag filters defined in `tags` @@ -2147,15 +2430,19 @@ components: description: AWS Resources Collection config. properties: cloud_security_posture_management_collection: - description: Enable Cloud Security Management to scan AWS resources for - vulnerabilities, misconfigurations, identity risks, and compliance violations. - Defaults to `false`. Requires `extended_collection` to be set to `true`. + description: 'Enable Cloud Security Management to scan AWS resources for + vulnerabilities, misconfigurations, + + identity risks, and compliance violations. Defaults to `false`. + + Requires `extended_collection` to be set to `true`.' example: false type: boolean extended_collection: - description: Whether Datadog collects additional attributes and configuration - information about the resources in your AWS account. Defaults to `true`. - Required for `cloud_security_posture_management_collection`. + description: 'Whether Datadog collects additional attributes and configuration + information about the resources + + in your AWS account. Defaults to `true`. Required for `cloud_security_posture_management_collection`.' example: true type: boolean type: object @@ -63553,8 +63840,9 @@ paths: description: Get a list of AWS Account Integration Configs. operationId: ListAWSAccounts parameters: - - description: Optional query parameter to filter accounts by AWS Account ID. - If not provided, all accounts are returned. + - description: 'Optional query parameter to filter accounts by AWS Account ID. + + If not provided, all accounts are returned.' example: '123456789012' in: query name: aws_account_id @@ -63719,6 +64007,96 @@ paths: operator: OR permissions: - aws_configuration_read + /api/v2/integration/aws/event_bridge: + delete: + description: Delete an Amazon EventBridge source. + operationId: DeleteAWSEventBridgeSource + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSEventBridgeDeleteRequest' + description: Delete the Amazon EventBridge source with the given name, region, + and associated AWS account. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSEventBridgeDeleteResponse' + description: Amazon EventBridge source deleted. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete an Amazon EventBridge source + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - manage_integrations + get: + description: Get all Amazon EventBridge sources. + operationId: ListAWSEventBridgeSources + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSEventBridgeListResponse' + description: Amazon EventBridge sources list. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all Amazon EventBridge sources + tags: + - AWS Integration + x-permission: + operator: OR + permissions: + - integrations_read + post: + description: Create an Amazon EventBridge source. + operationId: CreateAWSEventBridgeSource + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AWSEventBridgeCreateRequest' + description: Create an Amazon EventBridge source for an AWS account with a + given name and region. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AWSEventBridgeCreateResponse' + description: Amazon EventBridge source created. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + $ref: '#/components/responses/ConflictResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create an Amazon EventBridge source + tags: + - AWS Integration + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - manage_integrations /api/v2/integration/aws/generate_new_external_id: post: description: Generate a new external ID for AWS role-based authentication. diff --git a/api/datadogV1/api_aws_integration.go b/api/datadogV1/api_aws_integration.go index 3c972fc5a87..b40c4dc0054 100644 --- a/api/datadogV1/api_aws_integration.go +++ b/api/datadogV1/api_aws_integration.go @@ -102,6 +102,8 @@ func (a *AWSIntegrationApi) CreateAWSAccount(ctx _context.Context, body AWSAccou // CreateAWSEventBridgeSource Create an Amazon EventBridge source. // Create an Amazon EventBridge source. +// +// Deprecated: This API is deprecated. func (a *AWSIntegrationApi) CreateAWSEventBridgeSource(ctx _context.Context, body AWSEventBridgeCreateRequest) (AWSEventBridgeCreateResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -428,6 +430,8 @@ func (a *AWSIntegrationApi) DeleteAWSAccount(ctx _context.Context, body AWSAccou // DeleteAWSEventBridgeSource Delete an Amazon EventBridge source. // Delete an Amazon EventBridge source. +// +// Deprecated: This API is deprecated. func (a *AWSIntegrationApi) DeleteAWSEventBridgeSource(ctx _context.Context, body AWSEventBridgeDeleteRequest) (AWSEventBridgeDeleteResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -717,6 +721,8 @@ func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context, o ...ListAWSAc // ListAWSEventBridgeSources Get all Amazon EventBridge sources. // Get all Amazon EventBridge sources. +// +// Deprecated: This API is deprecated. func (a *AWSIntegrationApi) ListAWSEventBridgeSources(ctx _context.Context) (AWSEventBridgeListResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet diff --git a/api/datadogV2/api_aws_integration.go b/api/datadogV2/api_aws_integration.go index 9282dccbde8..57682b96bd6 100644 --- a/api/datadogV2/api_aws_integration.go +++ b/api/datadogV2/api_aws_integration.go @@ -95,6 +95,86 @@ func (a *AWSIntegrationApi) CreateAWSAccount(ctx _context.Context, body AWSAccou return localVarReturnValue, localVarHTTPResponse, nil } +// CreateAWSEventBridgeSource Create an Amazon EventBridge source. +// Create an Amazon EventBridge source. +func (a *AWSIntegrationApi) CreateAWSEventBridgeSource(ctx _context.Context, body AWSEventBridgeCreateRequest) (AWSEventBridgeCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AWSEventBridgeCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.CreateAWSEventBridgeSource") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/event_bridge" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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) { @@ -240,6 +320,86 @@ func (a *AWSIntegrationApi) DeleteAWSAccount(ctx _context.Context, awsAccountCon return localVarHTTPResponse, nil } +// DeleteAWSEventBridgeSource Delete an Amazon EventBridge source. +// Delete an Amazon EventBridge source. +func (a *AWSIntegrationApi) DeleteAWSEventBridgeSource(ctx _context.Context, body AWSEventBridgeDeleteRequest) (AWSEventBridgeDeleteResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue AWSEventBridgeDeleteResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.DeleteAWSEventBridgeSource") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/event_bridge" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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 +} + // GetAWSAccount Get an AWS integration by config ID. // Get an AWS Account Integration Config by config ID. func (a *AWSIntegrationApi) GetAWSAccount(ctx _context.Context, awsAccountConfigId string) (AWSAccountResponse, *_nethttp.Response, error) { @@ -654,6 +814,83 @@ func (a *AWSIntegrationApi) ListAWSAccounts(ctx _context.Context, o ...ListAWSAc return localVarReturnValue, localVarHTTPResponse, nil } +// ListAWSEventBridgeSources Get all Amazon EventBridge sources. +// Get all Amazon EventBridge sources. +func (a *AWSIntegrationApi) ListAWSEventBridgeSources(ctx _context.Context) (AWSEventBridgeListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AWSEventBridgeListResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.AWSIntegrationApi.ListAWSEventBridgeSources") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/integration/aws/event_bridge" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + 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 == 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) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index e708bb3f9fc..e4f80078fee 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -15,13 +15,16 @@ // - [APMRetentionFiltersApi.ReorderApmRetentionFilters] // - [APMRetentionFiltersApi.UpdateApmRetentionFilter] // - [AWSIntegrationApi.CreateAWSAccount] +// - [AWSIntegrationApi.CreateAWSEventBridgeSource] // - [AWSIntegrationApi.CreateNewAWSExternalID] // - [AWSIntegrationApi.DeleteAWSAccount] +// - [AWSIntegrationApi.DeleteAWSEventBridgeSource] // - [AWSIntegrationApi.GetAWSAccount] // - [AWSIntegrationApi.GetAWSIntegrationIAMPermissions] // - [AWSIntegrationApi.GetAWSIntegrationIAMPermissionsResourceCollection] // - [AWSIntegrationApi.GetAWSIntegrationIAMPermissionsStandard] // - [AWSIntegrationApi.ListAWSAccounts] +// - [AWSIntegrationApi.ListAWSEventBridgeSources] // - [AWSIntegrationApi.ListAWSNamespaces] // - [AWSIntegrationApi.UpdateAWSAccount] // - [AWSLogsIntegrationApi.ListAWSLogsServices] diff --git a/api/datadogV2/model_aws_account_create_request_attributes.go b/api/datadogV2/model_aws_account_create_request_attributes.go index dec6b2a8fe8..1decb7a92df 100644 --- a/api/datadogV2/model_aws_account_create_request_attributes.go +++ b/api/datadogV2/model_aws_account_create_request_attributes.go @@ -19,7 +19,8 @@ type AWSAccountCreateRequestAttributes struct { // AWS Account ID. AwsAccountId string `json:"aws_account_id"` // AWS partition your AWS account is scoped to. Defaults to `aws`. - // See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) in the AWS documentation for more information. + // See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) + // in the AWS documentation for more information. AwsPartition AWSAccountPartition `json:"aws_partition"` // AWS Regions to collect data from. Defaults to `include_all`. AwsRegions *AWSRegions `json:"aws_regions,omitempty"` diff --git a/api/datadogV2/model_aws_account_partition.go b/api/datadogV2/model_aws_account_partition.go index c21d1287b34..d6fd534fe70 100644 --- a/api/datadogV2/model_aws_account_partition.go +++ b/api/datadogV2/model_aws_account_partition.go @@ -11,7 +11,8 @@ import ( ) // AWSAccountPartition AWS partition your AWS account is scoped to. Defaults to `aws`. -// See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) in the AWS documentation for more information. +// See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) +// in the AWS documentation for more information. type AWSAccountPartition string // List of AWSAccountPartition. diff --git a/api/datadogV2/model_aws_account_response_attributes.go b/api/datadogV2/model_aws_account_response_attributes.go index 14df1938a44..f6b0d0c9b67 100644 --- a/api/datadogV2/model_aws_account_response_attributes.go +++ b/api/datadogV2/model_aws_account_response_attributes.go @@ -20,7 +20,8 @@ type AWSAccountResponseAttributes struct { // AWS Account ID. AwsAccountId string `json:"aws_account_id"` // AWS partition your AWS account is scoped to. Defaults to `aws`. - // See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) in the AWS documentation for more information. + // See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) + // in the AWS documentation for more information. AwsPartition *AWSAccountPartition `json:"aws_partition,omitempty"` // AWS Regions to collect data from. Defaults to `include_all`. AwsRegions *AWSRegions `json:"aws_regions,omitempty"` diff --git a/api/datadogV2/model_aws_account_response_data.go b/api/datadogV2/model_aws_account_response_data.go index 0b998fba517..2fda6047b89 100644 --- a/api/datadogV2/model_aws_account_response_data.go +++ b/api/datadogV2/model_aws_account_response_data.go @@ -15,7 +15,8 @@ type AWSAccountResponseData struct { // AWS Account response attributes. Attributes *AWSAccountResponseAttributes `json:"attributes,omitempty"` // Unique Datadog ID of the AWS Account Integration Config. - // To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) + // To get the config ID for an account, use the + // [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) // endpoint and query by AWS Account ID. Id string `json:"id"` // AWS Account resource type. diff --git a/api/datadogV2/model_aws_account_update_request_attributes.go b/api/datadogV2/model_aws_account_update_request_attributes.go index b66deae2db7..de1d861746c 100644 --- a/api/datadogV2/model_aws_account_update_request_attributes.go +++ b/api/datadogV2/model_aws_account_update_request_attributes.go @@ -19,7 +19,8 @@ type AWSAccountUpdateRequestAttributes struct { // AWS Account ID. AwsAccountId string `json:"aws_account_id"` // AWS partition your AWS account is scoped to. Defaults to `aws`. - // See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) in the AWS documentation for more information. + // See [Partitions](https://docs.aws.amazon.com/whitepapers/latest/aws-fault-isolation-boundaries/partitions.html) + // in the AWS documentation for more information. AwsPartition *AWSAccountPartition `json:"aws_partition,omitempty"` // AWS Regions to collect data from. Defaults to `include_all`. AwsRegions *AWSRegions `json:"aws_regions,omitempty"` diff --git a/api/datadogV2/model_aws_account_update_request_data.go b/api/datadogV2/model_aws_account_update_request_data.go index 05a37880307..c467ca4f3cf 100644 --- a/api/datadogV2/model_aws_account_update_request_data.go +++ b/api/datadogV2/model_aws_account_update_request_data.go @@ -15,7 +15,8 @@ type AWSAccountUpdateRequestData struct { // The AWS Account Integration Config to be updated. Attributes AWSAccountUpdateRequestAttributes `json:"attributes"` // Unique Datadog ID of the AWS Account Integration Config. - // To get the config ID for an account, use the [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) + // To get the config ID for an account, use the + // [List all AWS integrations](https://docs.datadoghq.com/api/latest/aws-integration/#list-all-aws-integrations) // endpoint and query by AWS Account ID. Id *string `json:"id,omitempty"` // AWS Account resource type. diff --git a/api/datadogV2/model_aws_event_bridge_account_configuration.go b/api/datadogV2/model_aws_event_bridge_account_configuration.go new file mode 100644 index 00000000000..83e1c3ebca1 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_account_configuration.go @@ -0,0 +1,173 @@ +// 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" +) + +// AWSEventBridgeAccountConfiguration The EventBridge configuration for one AWS account. +type AWSEventBridgeAccountConfiguration struct { + // Your AWS Account ID without dashes. + AccountId *string `json:"account_id,omitempty"` + // Array of AWS event sources associated with this account. + EventHubs []AWSEventBridgeSource `json:"event_hubs,omitempty"` + // Array of tags (in the form `key:value`) which are added to all hosts + // and metrics reporting through the main AWS integration. + Tags []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:"-"` +} + +// NewAWSEventBridgeAccountConfiguration instantiates a new AWSEventBridgeAccountConfiguration 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 NewAWSEventBridgeAccountConfiguration() *AWSEventBridgeAccountConfiguration { + this := AWSEventBridgeAccountConfiguration{} + return &this +} + +// NewAWSEventBridgeAccountConfigurationWithDefaults instantiates a new AWSEventBridgeAccountConfiguration 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 NewAWSEventBridgeAccountConfigurationWithDefaults() *AWSEventBridgeAccountConfiguration { + this := AWSEventBridgeAccountConfiguration{} + return &this +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *AWSEventBridgeAccountConfiguration) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeAccountConfiguration) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *AWSEventBridgeAccountConfiguration) HasAccountId() bool { + return o != nil && o.AccountId != nil +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *AWSEventBridgeAccountConfiguration) SetAccountId(v string) { + o.AccountId = &v +} + +// GetEventHubs returns the EventHubs field value if set, zero value otherwise. +func (o *AWSEventBridgeAccountConfiguration) GetEventHubs() []AWSEventBridgeSource { + if o == nil || o.EventHubs == nil { + var ret []AWSEventBridgeSource + return ret + } + return o.EventHubs +} + +// GetEventHubsOk returns a tuple with the EventHubs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeAccountConfiguration) GetEventHubsOk() (*[]AWSEventBridgeSource, bool) { + if o == nil || o.EventHubs == nil { + return nil, false + } + return &o.EventHubs, true +} + +// HasEventHubs returns a boolean if a field has been set. +func (o *AWSEventBridgeAccountConfiguration) HasEventHubs() bool { + return o != nil && o.EventHubs != nil +} + +// SetEventHubs gets a reference to the given []AWSEventBridgeSource and assigns it to the EventHubs field. +func (o *AWSEventBridgeAccountConfiguration) SetEventHubs(v []AWSEventBridgeSource) { + o.EventHubs = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *AWSEventBridgeAccountConfiguration) GetTags() []string { + if o == nil || o.Tags == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeAccountConfiguration) GetTagsOk() (*[]string, bool) { + if o == nil || o.Tags == nil { + return nil, false + } + return &o.Tags, true +} + +// HasTags returns a boolean if a field has been set. +func (o *AWSEventBridgeAccountConfiguration) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *AWSEventBridgeAccountConfiguration) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeAccountConfiguration) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.EventHubs != nil { + toSerialize["event_hubs"] = o.EventHubs + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeAccountConfiguration) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountId *string `json:"account_id,omitempty"` + EventHubs []AWSEventBridgeSource `json:"event_hubs,omitempty"` + Tags []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{"account_id", "event_hubs", "tags"}) + } else { + return err + } + o.AccountId = all.AccountId + o.EventHubs = all.EventHubs + o.Tags = all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_create_request.go b/api/datadogV2/model_aws_event_bridge_create_request.go new file mode 100644 index 00000000000..d6082b86e0c --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_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" +) + +// AWSEventBridgeCreateRequest Amazon EventBridge create request body. +type AWSEventBridgeCreateRequest struct { + // Amazon EventBridge create request data. + Data AWSEventBridgeCreateRequestData `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:"-"` +} + +// NewAWSEventBridgeCreateRequest instantiates a new AWSEventBridgeCreateRequest 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 NewAWSEventBridgeCreateRequest(data AWSEventBridgeCreateRequestData) *AWSEventBridgeCreateRequest { + this := AWSEventBridgeCreateRequest{} + this.Data = data + return &this +} + +// NewAWSEventBridgeCreateRequestWithDefaults instantiates a new AWSEventBridgeCreateRequest 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 NewAWSEventBridgeCreateRequestWithDefaults() *AWSEventBridgeCreateRequest { + this := AWSEventBridgeCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSEventBridgeCreateRequest) GetData() AWSEventBridgeCreateRequestData { + if o == nil { + var ret AWSEventBridgeCreateRequestData + 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 *AWSEventBridgeCreateRequest) GetDataOk() (*AWSEventBridgeCreateRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSEventBridgeCreateRequest) SetData(v AWSEventBridgeCreateRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeCreateRequest) 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 *AWSEventBridgeCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSEventBridgeCreateRequestData `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_event_bridge_create_request_attributes.go b/api/datadogV2/model_aws_event_bridge_create_request_attributes.go new file mode 100644 index 00000000000..b766a39dfbe --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_create_request_attributes.go @@ -0,0 +1,203 @@ +// 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" +) + +// AWSEventBridgeCreateRequestAttributes The EventBridge source to be created. +type AWSEventBridgeCreateRequestAttributes struct { + // AWS Account ID. + AccountId string `json:"account_id"` + // Set to true if Datadog should create the event bus in addition to the event + // source. Requires the `events:CreateEventBus` permission. + CreateEventBus *bool `json:"create_event_bus,omitempty"` + // The given part of the event source name, which is then combined with an + // assigned suffix to form the full name. + EventGeneratorName string `json:"event_generator_name"` + // The event source's + // [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). + Region string `json:"region"` + // 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:"-"` +} + +// NewAWSEventBridgeCreateRequestAttributes instantiates a new AWSEventBridgeCreateRequestAttributes 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 NewAWSEventBridgeCreateRequestAttributes(accountId string, eventGeneratorName string, region string) *AWSEventBridgeCreateRequestAttributes { + this := AWSEventBridgeCreateRequestAttributes{} + this.AccountId = accountId + this.EventGeneratorName = eventGeneratorName + this.Region = region + return &this +} + +// NewAWSEventBridgeCreateRequestAttributesWithDefaults instantiates a new AWSEventBridgeCreateRequestAttributes 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 NewAWSEventBridgeCreateRequestAttributesWithDefaults() *AWSEventBridgeCreateRequestAttributes { + this := AWSEventBridgeCreateRequestAttributes{} + return &this +} + +// GetAccountId returns the AccountId field value. +func (o *AWSEventBridgeCreateRequestAttributes) GetAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateRequestAttributes) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccountId, true +} + +// SetAccountId sets field value. +func (o *AWSEventBridgeCreateRequestAttributes) SetAccountId(v string) { + o.AccountId = v +} + +// GetCreateEventBus returns the CreateEventBus field value if set, zero value otherwise. +func (o *AWSEventBridgeCreateRequestAttributes) GetCreateEventBus() bool { + if o == nil || o.CreateEventBus == nil { + var ret bool + return ret + } + return *o.CreateEventBus +} + +// GetCreateEventBusOk returns a tuple with the CreateEventBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateRequestAttributes) GetCreateEventBusOk() (*bool, bool) { + if o == nil || o.CreateEventBus == nil { + return nil, false + } + return o.CreateEventBus, true +} + +// HasCreateEventBus returns a boolean if a field has been set. +func (o *AWSEventBridgeCreateRequestAttributes) HasCreateEventBus() bool { + return o != nil && o.CreateEventBus != nil +} + +// SetCreateEventBus gets a reference to the given bool and assigns it to the CreateEventBus field. +func (o *AWSEventBridgeCreateRequestAttributes) SetCreateEventBus(v bool) { + o.CreateEventBus = &v +} + +// GetEventGeneratorName returns the EventGeneratorName field value. +func (o *AWSEventBridgeCreateRequestAttributes) GetEventGeneratorName() string { + if o == nil { + var ret string + return ret + } + return o.EventGeneratorName +} + +// GetEventGeneratorNameOk returns a tuple with the EventGeneratorName field value +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateRequestAttributes) GetEventGeneratorNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EventGeneratorName, true +} + +// SetEventGeneratorName sets field value. +func (o *AWSEventBridgeCreateRequestAttributes) SetEventGeneratorName(v string) { + o.EventGeneratorName = v +} + +// GetRegion returns the Region field value. +func (o *AWSEventBridgeCreateRequestAttributes) GetRegion() string { + if o == nil { + var ret string + return ret + } + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateRequestAttributes) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value. +func (o *AWSEventBridgeCreateRequestAttributes) SetRegion(v string) { + o.Region = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeCreateRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["account_id"] = o.AccountId + if o.CreateEventBus != nil { + toSerialize["create_event_bus"] = o.CreateEventBus + } + toSerialize["event_generator_name"] = o.EventGeneratorName + toSerialize["region"] = o.Region + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeCreateRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountId *string `json:"account_id"` + CreateEventBus *bool `json:"create_event_bus,omitempty"` + EventGeneratorName *string `json:"event_generator_name"` + Region *string `json:"region"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AccountId == nil { + return fmt.Errorf("required field account_id missing") + } + if all.EventGeneratorName == nil { + return fmt.Errorf("required field event_generator_name missing") + } + if all.Region == nil { + return fmt.Errorf("required field region missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "create_event_bus", "event_generator_name", "region"}) + } else { + return err + } + o.AccountId = *all.AccountId + o.CreateEventBus = all.CreateEventBus + o.EventGeneratorName = *all.EventGeneratorName + o.Region = *all.Region + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_create_request_data.go b/api/datadogV2/model_aws_event_bridge_create_request_data.go new file mode 100644 index 00000000000..4cdffb884b6 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_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" +) + +// AWSEventBridgeCreateRequestData Amazon EventBridge create request data. +type AWSEventBridgeCreateRequestData struct { + // The EventBridge source to be created. + Attributes AWSEventBridgeCreateRequestAttributes `json:"attributes"` + // Amazon EventBridge resource type. + Type AWSEventBridgeType `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:"-"` +} + +// NewAWSEventBridgeCreateRequestData instantiates a new AWSEventBridgeCreateRequestData 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 NewAWSEventBridgeCreateRequestData(attributes AWSEventBridgeCreateRequestAttributes, typeVar AWSEventBridgeType) *AWSEventBridgeCreateRequestData { + this := AWSEventBridgeCreateRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAWSEventBridgeCreateRequestDataWithDefaults instantiates a new AWSEventBridgeCreateRequestData 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 NewAWSEventBridgeCreateRequestDataWithDefaults() *AWSEventBridgeCreateRequestData { + this := AWSEventBridgeCreateRequestData{} + var typeVar AWSEventBridgeType = AWSEVENTBRIDGETYPE_EVENT_BRIDGE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSEventBridgeCreateRequestData) GetAttributes() AWSEventBridgeCreateRequestAttributes { + if o == nil { + var ret AWSEventBridgeCreateRequestAttributes + 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 *AWSEventBridgeCreateRequestData) GetAttributesOk() (*AWSEventBridgeCreateRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSEventBridgeCreateRequestData) SetAttributes(v AWSEventBridgeCreateRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AWSEventBridgeCreateRequestData) GetType() AWSEventBridgeType { + if o == nil { + var ret AWSEventBridgeType + 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 *AWSEventBridgeCreateRequestData) GetTypeOk() (*AWSEventBridgeType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSEventBridgeCreateRequestData) SetType(v AWSEventBridgeType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeCreateRequestData) 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 *AWSEventBridgeCreateRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSEventBridgeCreateRequestAttributes `json:"attributes"` + Type *AWSEventBridgeType `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_event_bridge_create_response.go b/api/datadogV2/model_aws_event_bridge_create_response.go new file mode 100644 index 00000000000..6caf4ee7178 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_create_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" +) + +// AWSEventBridgeCreateResponse Amazon EventBridge create response body. +type AWSEventBridgeCreateResponse struct { + // Amazon EventBridge create response data. + Data AWSEventBridgeCreateResponseData `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:"-"` +} + +// NewAWSEventBridgeCreateResponse instantiates a new AWSEventBridgeCreateResponse 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 NewAWSEventBridgeCreateResponse(data AWSEventBridgeCreateResponseData) *AWSEventBridgeCreateResponse { + this := AWSEventBridgeCreateResponse{} + this.Data = data + return &this +} + +// NewAWSEventBridgeCreateResponseWithDefaults instantiates a new AWSEventBridgeCreateResponse 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 NewAWSEventBridgeCreateResponseWithDefaults() *AWSEventBridgeCreateResponse { + this := AWSEventBridgeCreateResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSEventBridgeCreateResponse) GetData() AWSEventBridgeCreateResponseData { + if o == nil { + var ret AWSEventBridgeCreateResponseData + 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 *AWSEventBridgeCreateResponse) GetDataOk() (*AWSEventBridgeCreateResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSEventBridgeCreateResponse) SetData(v AWSEventBridgeCreateResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeCreateResponse) 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 *AWSEventBridgeCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSEventBridgeCreateResponseData `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_event_bridge_create_response_attributes.go b/api/datadogV2/model_aws_event_bridge_create_response_attributes.go new file mode 100644 index 00000000000..64cb252c845 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_create_response_attributes.go @@ -0,0 +1,218 @@ +// 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" +) + +// AWSEventBridgeCreateResponseAttributes A created EventBridge source. +type AWSEventBridgeCreateResponseAttributes struct { + // The event source name. + EventSourceName *string `json:"event_source_name,omitempty"` + // True if the event bus was created in addition to the source. + HasBus *bool `json:"has_bus,omitempty"` + // The event source's + // [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). + Region *string `json:"region,omitempty"` + // The event source status "created". + Status *AWSEventBridgeCreateStatus `json:"status,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:"-"` +} + +// NewAWSEventBridgeCreateResponseAttributes instantiates a new AWSEventBridgeCreateResponseAttributes 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 NewAWSEventBridgeCreateResponseAttributes() *AWSEventBridgeCreateResponseAttributes { + this := AWSEventBridgeCreateResponseAttributes{} + return &this +} + +// NewAWSEventBridgeCreateResponseAttributesWithDefaults instantiates a new AWSEventBridgeCreateResponseAttributes 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 NewAWSEventBridgeCreateResponseAttributesWithDefaults() *AWSEventBridgeCreateResponseAttributes { + this := AWSEventBridgeCreateResponseAttributes{} + return &this +} + +// GetEventSourceName returns the EventSourceName field value if set, zero value otherwise. +func (o *AWSEventBridgeCreateResponseAttributes) GetEventSourceName() string { + if o == nil || o.EventSourceName == nil { + var ret string + return ret + } + return *o.EventSourceName +} + +// GetEventSourceNameOk returns a tuple with the EventSourceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateResponseAttributes) GetEventSourceNameOk() (*string, bool) { + if o == nil || o.EventSourceName == nil { + return nil, false + } + return o.EventSourceName, true +} + +// HasEventSourceName returns a boolean if a field has been set. +func (o *AWSEventBridgeCreateResponseAttributes) HasEventSourceName() bool { + return o != nil && o.EventSourceName != nil +} + +// SetEventSourceName gets a reference to the given string and assigns it to the EventSourceName field. +func (o *AWSEventBridgeCreateResponseAttributes) SetEventSourceName(v string) { + o.EventSourceName = &v +} + +// GetHasBus returns the HasBus field value if set, zero value otherwise. +func (o *AWSEventBridgeCreateResponseAttributes) GetHasBus() bool { + if o == nil || o.HasBus == nil { + var ret bool + return ret + } + return *o.HasBus +} + +// GetHasBusOk returns a tuple with the HasBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateResponseAttributes) GetHasBusOk() (*bool, bool) { + if o == nil || o.HasBus == nil { + return nil, false + } + return o.HasBus, true +} + +// HasHasBus returns a boolean if a field has been set. +func (o *AWSEventBridgeCreateResponseAttributes) HasHasBus() bool { + return o != nil && o.HasBus != nil +} + +// SetHasBus gets a reference to the given bool and assigns it to the HasBus field. +func (o *AWSEventBridgeCreateResponseAttributes) SetHasBus(v bool) { + o.HasBus = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *AWSEventBridgeCreateResponseAttributes) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateResponseAttributes) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *AWSEventBridgeCreateResponseAttributes) HasRegion() bool { + return o != nil && o.Region != nil +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *AWSEventBridgeCreateResponseAttributes) SetRegion(v string) { + o.Region = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *AWSEventBridgeCreateResponseAttributes) GetStatus() AWSEventBridgeCreateStatus { + if o == nil || o.Status == nil { + var ret AWSEventBridgeCreateStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeCreateResponseAttributes) GetStatusOk() (*AWSEventBridgeCreateStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *AWSEventBridgeCreateResponseAttributes) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given AWSEventBridgeCreateStatus and assigns it to the Status field. +func (o *AWSEventBridgeCreateResponseAttributes) SetStatus(v AWSEventBridgeCreateStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeCreateResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.EventSourceName != nil { + toSerialize["event_source_name"] = o.EventSourceName + } + if o.HasBus != nil { + toSerialize["has_bus"] = o.HasBus + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeCreateResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + EventSourceName *string `json:"event_source_name,omitempty"` + HasBus *bool `json:"has_bus,omitempty"` + Region *string `json:"region,omitempty"` + Status *AWSEventBridgeCreateStatus `json:"status,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{"event_source_name", "has_bus", "region", "status"}) + } else { + return err + } + + hasInvalidField := false + o.EventSourceName = all.EventSourceName + o.HasBus = all.HasBus + o.Region = all.Region + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_create_response_data.go b/api/datadogV2/model_aws_event_bridge_create_response_data.go new file mode 100644 index 00000000000..0751c164be2 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_create_response_data.go @@ -0,0 +1,187 @@ +// 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" +) + +// AWSEventBridgeCreateResponseData Amazon EventBridge create response data. +type AWSEventBridgeCreateResponseData struct { + // A created EventBridge source. + Attributes AWSEventBridgeCreateResponseAttributes `json:"attributes"` + // The ID of the Amazon EventBridge create response data. + Id *string `json:"id,omitempty"` + // Amazon EventBridge resource type. + Type AWSEventBridgeType `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:"-"` +} + +// NewAWSEventBridgeCreateResponseData instantiates a new AWSEventBridgeCreateResponseData 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 NewAWSEventBridgeCreateResponseData(attributes AWSEventBridgeCreateResponseAttributes, typeVar AWSEventBridgeType) *AWSEventBridgeCreateResponseData { + this := AWSEventBridgeCreateResponseData{} + this.Attributes = attributes + var id string = "create_event_bridge" + this.Id = &id + this.Type = typeVar + return &this +} + +// NewAWSEventBridgeCreateResponseDataWithDefaults instantiates a new AWSEventBridgeCreateResponseData 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 NewAWSEventBridgeCreateResponseDataWithDefaults() *AWSEventBridgeCreateResponseData { + this := AWSEventBridgeCreateResponseData{} + var id string = "create_event_bridge" + this.Id = &id + var typeVar AWSEventBridgeType = AWSEVENTBRIDGETYPE_EVENT_BRIDGE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSEventBridgeCreateResponseData) GetAttributes() AWSEventBridgeCreateResponseAttributes { + if o == nil { + var ret AWSEventBridgeCreateResponseAttributes + 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 *AWSEventBridgeCreateResponseData) GetAttributesOk() (*AWSEventBridgeCreateResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSEventBridgeCreateResponseData) SetAttributes(v AWSEventBridgeCreateResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSEventBridgeCreateResponseData) 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 *AWSEventBridgeCreateResponseData) 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 *AWSEventBridgeCreateResponseData) 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 *AWSEventBridgeCreateResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *AWSEventBridgeCreateResponseData) GetType() AWSEventBridgeType { + if o == nil { + var ret AWSEventBridgeType + 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 *AWSEventBridgeCreateResponseData) GetTypeOk() (*AWSEventBridgeType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSEventBridgeCreateResponseData) SetType(v AWSEventBridgeType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeCreateResponseData) 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 *AWSEventBridgeCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSEventBridgeCreateResponseAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *AWSEventBridgeType `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_event_bridge_create_status.go b/api/datadogV2/model_aws_event_bridge_create_status.go new file mode 100644 index 00000000000..0dfd068db18 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_create_status.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" +) + +// AWSEventBridgeCreateStatus The event source status "created". +type AWSEventBridgeCreateStatus string + +// List of AWSEventBridgeCreateStatus. +const ( + AWSEVENTBRIDGECREATESTATUS_CREATED AWSEventBridgeCreateStatus = "created" +) + +var allowedAWSEventBridgeCreateStatusEnumValues = []AWSEventBridgeCreateStatus{ + AWSEVENTBRIDGECREATESTATUS_CREATED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSEventBridgeCreateStatus) GetAllowedValues() []AWSEventBridgeCreateStatus { + return allowedAWSEventBridgeCreateStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSEventBridgeCreateStatus) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSEventBridgeCreateStatus(value) + return nil +} + +// NewAWSEventBridgeCreateStatusFromValue returns a pointer to a valid AWSEventBridgeCreateStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSEventBridgeCreateStatusFromValue(v string) (*AWSEventBridgeCreateStatus, error) { + ev := AWSEventBridgeCreateStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSEventBridgeCreateStatus: valid values are %v", v, allowedAWSEventBridgeCreateStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSEventBridgeCreateStatus) IsValid() bool { + for _, existing := range allowedAWSEventBridgeCreateStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSEventBridgeCreateStatus value. +func (v AWSEventBridgeCreateStatus) Ptr() *AWSEventBridgeCreateStatus { + return &v +} diff --git a/api/datadogV2/model_aws_event_bridge_delete_request.go b/api/datadogV2/model_aws_event_bridge_delete_request.go new file mode 100644 index 00000000000..4abd7eff571 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_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" +) + +// AWSEventBridgeDeleteRequest Amazon EventBridge delete request body. +type AWSEventBridgeDeleteRequest struct { + // Amazon EventBridge delete request data. + Data AWSEventBridgeDeleteRequestData `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:"-"` +} + +// NewAWSEventBridgeDeleteRequest instantiates a new AWSEventBridgeDeleteRequest 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 NewAWSEventBridgeDeleteRequest(data AWSEventBridgeDeleteRequestData) *AWSEventBridgeDeleteRequest { + this := AWSEventBridgeDeleteRequest{} + this.Data = data + return &this +} + +// NewAWSEventBridgeDeleteRequestWithDefaults instantiates a new AWSEventBridgeDeleteRequest 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 NewAWSEventBridgeDeleteRequestWithDefaults() *AWSEventBridgeDeleteRequest { + this := AWSEventBridgeDeleteRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSEventBridgeDeleteRequest) GetData() AWSEventBridgeDeleteRequestData { + if o == nil { + var ret AWSEventBridgeDeleteRequestData + 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 *AWSEventBridgeDeleteRequest) GetDataOk() (*AWSEventBridgeDeleteRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSEventBridgeDeleteRequest) SetData(v AWSEventBridgeDeleteRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeDeleteRequest) 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 *AWSEventBridgeDeleteRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSEventBridgeDeleteRequestData `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_event_bridge_delete_request_attributes.go b/api/datadogV2/model_aws_event_bridge_delete_request_attributes.go new file mode 100644 index 00000000000..1bcd5debd03 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_request_attributes.go @@ -0,0 +1,166 @@ +// 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" +) + +// AWSEventBridgeDeleteRequestAttributes The EventBridge source to be deleted. +type AWSEventBridgeDeleteRequestAttributes struct { + // AWS Account ID. + AccountId string `json:"account_id"` + // The event source name. + EventGeneratorName string `json:"event_generator_name"` + // The event source's + // [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). + Region string `json:"region"` + // 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:"-"` +} + +// NewAWSEventBridgeDeleteRequestAttributes instantiates a new AWSEventBridgeDeleteRequestAttributes 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 NewAWSEventBridgeDeleteRequestAttributes(accountId string, eventGeneratorName string, region string) *AWSEventBridgeDeleteRequestAttributes { + this := AWSEventBridgeDeleteRequestAttributes{} + this.AccountId = accountId + this.EventGeneratorName = eventGeneratorName + this.Region = region + return &this +} + +// NewAWSEventBridgeDeleteRequestAttributesWithDefaults instantiates a new AWSEventBridgeDeleteRequestAttributes 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 NewAWSEventBridgeDeleteRequestAttributesWithDefaults() *AWSEventBridgeDeleteRequestAttributes { + this := AWSEventBridgeDeleteRequestAttributes{} + return &this +} + +// GetAccountId returns the AccountId field value. +func (o *AWSEventBridgeDeleteRequestAttributes) GetAccountId() string { + if o == nil { + var ret string + return ret + } + return o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeDeleteRequestAttributes) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccountId, true +} + +// SetAccountId sets field value. +func (o *AWSEventBridgeDeleteRequestAttributes) SetAccountId(v string) { + o.AccountId = v +} + +// GetEventGeneratorName returns the EventGeneratorName field value. +func (o *AWSEventBridgeDeleteRequestAttributes) GetEventGeneratorName() string { + if o == nil { + var ret string + return ret + } + return o.EventGeneratorName +} + +// GetEventGeneratorNameOk returns a tuple with the EventGeneratorName field value +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeDeleteRequestAttributes) GetEventGeneratorNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EventGeneratorName, true +} + +// SetEventGeneratorName sets field value. +func (o *AWSEventBridgeDeleteRequestAttributes) SetEventGeneratorName(v string) { + o.EventGeneratorName = v +} + +// GetRegion returns the Region field value. +func (o *AWSEventBridgeDeleteRequestAttributes) GetRegion() string { + if o == nil { + var ret string + return ret + } + return o.Region +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeDeleteRequestAttributes) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Region, true +} + +// SetRegion sets field value. +func (o *AWSEventBridgeDeleteRequestAttributes) SetRegion(v string) { + o.Region = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeDeleteRequestAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["account_id"] = o.AccountId + toSerialize["event_generator_name"] = o.EventGeneratorName + toSerialize["region"] = o.Region + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeDeleteRequestAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountId *string `json:"account_id"` + EventGeneratorName *string `json:"event_generator_name"` + Region *string `json:"region"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AccountId == nil { + return fmt.Errorf("required field account_id missing") + } + if all.EventGeneratorName == nil { + return fmt.Errorf("required field event_generator_name missing") + } + if all.Region == nil { + return fmt.Errorf("required field region missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "event_generator_name", "region"}) + } else { + return err + } + o.AccountId = *all.AccountId + o.EventGeneratorName = *all.EventGeneratorName + o.Region = *all.Region + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_delete_request_data.go b/api/datadogV2/model_aws_event_bridge_delete_request_data.go new file mode 100644 index 00000000000..2ec14ac1d0f --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_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" +) + +// AWSEventBridgeDeleteRequestData Amazon EventBridge delete request data. +type AWSEventBridgeDeleteRequestData struct { + // The EventBridge source to be deleted. + Attributes AWSEventBridgeDeleteRequestAttributes `json:"attributes"` + // Amazon EventBridge resource type. + Type AWSEventBridgeType `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:"-"` +} + +// NewAWSEventBridgeDeleteRequestData instantiates a new AWSEventBridgeDeleteRequestData 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 NewAWSEventBridgeDeleteRequestData(attributes AWSEventBridgeDeleteRequestAttributes, typeVar AWSEventBridgeType) *AWSEventBridgeDeleteRequestData { + this := AWSEventBridgeDeleteRequestData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewAWSEventBridgeDeleteRequestDataWithDefaults instantiates a new AWSEventBridgeDeleteRequestData 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 NewAWSEventBridgeDeleteRequestDataWithDefaults() *AWSEventBridgeDeleteRequestData { + this := AWSEventBridgeDeleteRequestData{} + var typeVar AWSEventBridgeType = AWSEVENTBRIDGETYPE_EVENT_BRIDGE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSEventBridgeDeleteRequestData) GetAttributes() AWSEventBridgeDeleteRequestAttributes { + if o == nil { + var ret AWSEventBridgeDeleteRequestAttributes + 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 *AWSEventBridgeDeleteRequestData) GetAttributesOk() (*AWSEventBridgeDeleteRequestAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSEventBridgeDeleteRequestData) SetAttributes(v AWSEventBridgeDeleteRequestAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *AWSEventBridgeDeleteRequestData) GetType() AWSEventBridgeType { + if o == nil { + var ret AWSEventBridgeType + 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 *AWSEventBridgeDeleteRequestData) GetTypeOk() (*AWSEventBridgeType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSEventBridgeDeleteRequestData) SetType(v AWSEventBridgeType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeDeleteRequestData) 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 *AWSEventBridgeDeleteRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSEventBridgeDeleteRequestAttributes `json:"attributes"` + Type *AWSEventBridgeType `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_event_bridge_delete_response.go b/api/datadogV2/model_aws_event_bridge_delete_response.go new file mode 100644 index 00000000000..e5eda20920e --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_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" +) + +// AWSEventBridgeDeleteResponse Amazon EventBridge delete response body. +type AWSEventBridgeDeleteResponse struct { + // Amazon EventBridge delete response data. + Data AWSEventBridgeDeleteResponseData `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:"-"` +} + +// NewAWSEventBridgeDeleteResponse instantiates a new AWSEventBridgeDeleteResponse 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 NewAWSEventBridgeDeleteResponse(data AWSEventBridgeDeleteResponseData) *AWSEventBridgeDeleteResponse { + this := AWSEventBridgeDeleteResponse{} + this.Data = data + return &this +} + +// NewAWSEventBridgeDeleteResponseWithDefaults instantiates a new AWSEventBridgeDeleteResponse 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 NewAWSEventBridgeDeleteResponseWithDefaults() *AWSEventBridgeDeleteResponse { + this := AWSEventBridgeDeleteResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSEventBridgeDeleteResponse) GetData() AWSEventBridgeDeleteResponseData { + if o == nil { + var ret AWSEventBridgeDeleteResponseData + 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 *AWSEventBridgeDeleteResponse) GetDataOk() (*AWSEventBridgeDeleteResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSEventBridgeDeleteResponse) SetData(v AWSEventBridgeDeleteResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeDeleteResponse) 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 *AWSEventBridgeDeleteResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSEventBridgeDeleteResponseData `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_event_bridge_delete_response_attributes.go b/api/datadogV2/model_aws_event_bridge_delete_response_attributes.go new file mode 100644 index 00000000000..17cde0c6cd4 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_response_attributes.go @@ -0,0 +1,112 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AWSEventBridgeDeleteResponseAttributes The EventBridge source delete response attributes. +type AWSEventBridgeDeleteResponseAttributes struct { + // The event source status "empty". + Status *AWSEventBridgeDeleteStatus `json:"status,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:"-"` +} + +// NewAWSEventBridgeDeleteResponseAttributes instantiates a new AWSEventBridgeDeleteResponseAttributes 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 NewAWSEventBridgeDeleteResponseAttributes() *AWSEventBridgeDeleteResponseAttributes { + this := AWSEventBridgeDeleteResponseAttributes{} + return &this +} + +// NewAWSEventBridgeDeleteResponseAttributesWithDefaults instantiates a new AWSEventBridgeDeleteResponseAttributes 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 NewAWSEventBridgeDeleteResponseAttributesWithDefaults() *AWSEventBridgeDeleteResponseAttributes { + this := AWSEventBridgeDeleteResponseAttributes{} + return &this +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *AWSEventBridgeDeleteResponseAttributes) GetStatus() AWSEventBridgeDeleteStatus { + if o == nil || o.Status == nil { + var ret AWSEventBridgeDeleteStatus + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeDeleteResponseAttributes) GetStatusOk() (*AWSEventBridgeDeleteStatus, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *AWSEventBridgeDeleteResponseAttributes) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given AWSEventBridgeDeleteStatus and assigns it to the Status field. +func (o *AWSEventBridgeDeleteResponseAttributes) SetStatus(v AWSEventBridgeDeleteStatus) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeDeleteResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeDeleteResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Status *AWSEventBridgeDeleteStatus `json:"status,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{"status"}) + } else { + return err + } + + hasInvalidField := false + if all.Status != nil && !all.Status.IsValid() { + hasInvalidField = true + } else { + o.Status = all.Status + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_delete_response_data.go b/api/datadogV2/model_aws_event_bridge_delete_response_data.go new file mode 100644 index 00000000000..75b500838a2 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_response_data.go @@ -0,0 +1,187 @@ +// 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" +) + +// AWSEventBridgeDeleteResponseData Amazon EventBridge delete response data. +type AWSEventBridgeDeleteResponseData struct { + // The EventBridge source delete response attributes. + Attributes AWSEventBridgeDeleteResponseAttributes `json:"attributes"` + // The ID of the Amazon EventBridge list response data. + Id *string `json:"id,omitempty"` + // Amazon EventBridge resource type. + Type AWSEventBridgeType `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:"-"` +} + +// NewAWSEventBridgeDeleteResponseData instantiates a new AWSEventBridgeDeleteResponseData 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 NewAWSEventBridgeDeleteResponseData(attributes AWSEventBridgeDeleteResponseAttributes, typeVar AWSEventBridgeType) *AWSEventBridgeDeleteResponseData { + this := AWSEventBridgeDeleteResponseData{} + this.Attributes = attributes + var id string = "delete_event_bridge" + this.Id = &id + this.Type = typeVar + return &this +} + +// NewAWSEventBridgeDeleteResponseDataWithDefaults instantiates a new AWSEventBridgeDeleteResponseData 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 NewAWSEventBridgeDeleteResponseDataWithDefaults() *AWSEventBridgeDeleteResponseData { + this := AWSEventBridgeDeleteResponseData{} + var id string = "delete_event_bridge" + this.Id = &id + var typeVar AWSEventBridgeType = AWSEVENTBRIDGETYPE_EVENT_BRIDGE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSEventBridgeDeleteResponseData) GetAttributes() AWSEventBridgeDeleteResponseAttributes { + if o == nil { + var ret AWSEventBridgeDeleteResponseAttributes + 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 *AWSEventBridgeDeleteResponseData) GetAttributesOk() (*AWSEventBridgeDeleteResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSEventBridgeDeleteResponseData) SetAttributes(v AWSEventBridgeDeleteResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AWSEventBridgeDeleteResponseData) 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 *AWSEventBridgeDeleteResponseData) 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 *AWSEventBridgeDeleteResponseData) 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 *AWSEventBridgeDeleteResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *AWSEventBridgeDeleteResponseData) GetType() AWSEventBridgeType { + if o == nil { + var ret AWSEventBridgeType + 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 *AWSEventBridgeDeleteResponseData) GetTypeOk() (*AWSEventBridgeType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSEventBridgeDeleteResponseData) SetType(v AWSEventBridgeType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeDeleteResponseData) 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 *AWSEventBridgeDeleteResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSEventBridgeDeleteResponseAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *AWSEventBridgeType `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_event_bridge_delete_status.go b/api/datadogV2/model_aws_event_bridge_delete_status.go new file mode 100644 index 00000000000..469be570932 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_delete_status.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" +) + +// AWSEventBridgeDeleteStatus The event source status "empty". +type AWSEventBridgeDeleteStatus string + +// List of AWSEventBridgeDeleteStatus. +const ( + AWSEVENTBRIDGEDELETESTATUS_EMPTY AWSEventBridgeDeleteStatus = "empty" +) + +var allowedAWSEventBridgeDeleteStatusEnumValues = []AWSEventBridgeDeleteStatus{ + AWSEVENTBRIDGEDELETESTATUS_EMPTY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSEventBridgeDeleteStatus) GetAllowedValues() []AWSEventBridgeDeleteStatus { + return allowedAWSEventBridgeDeleteStatusEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSEventBridgeDeleteStatus) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSEventBridgeDeleteStatus(value) + return nil +} + +// NewAWSEventBridgeDeleteStatusFromValue returns a pointer to a valid AWSEventBridgeDeleteStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSEventBridgeDeleteStatusFromValue(v string) (*AWSEventBridgeDeleteStatus, error) { + ev := AWSEventBridgeDeleteStatus(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSEventBridgeDeleteStatus: valid values are %v", v, allowedAWSEventBridgeDeleteStatusEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSEventBridgeDeleteStatus) IsValid() bool { + for _, existing := range allowedAWSEventBridgeDeleteStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSEventBridgeDeleteStatus value. +func (v AWSEventBridgeDeleteStatus) Ptr() *AWSEventBridgeDeleteStatus { + return &v +} diff --git a/api/datadogV2/model_aws_event_bridge_list_response.go b/api/datadogV2/model_aws_event_bridge_list_response.go new file mode 100644 index 00000000000..c0511e15042 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_list_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" +) + +// AWSEventBridgeListResponse Amazon EventBridge list response body. +type AWSEventBridgeListResponse struct { + // Amazon EventBridge list response data. + Data AWSEventBridgeListResponseData `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:"-"` +} + +// NewAWSEventBridgeListResponse instantiates a new AWSEventBridgeListResponse 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 NewAWSEventBridgeListResponse(data AWSEventBridgeListResponseData) *AWSEventBridgeListResponse { + this := AWSEventBridgeListResponse{} + this.Data = data + return &this +} + +// NewAWSEventBridgeListResponseWithDefaults instantiates a new AWSEventBridgeListResponse 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 NewAWSEventBridgeListResponseWithDefaults() *AWSEventBridgeListResponse { + this := AWSEventBridgeListResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *AWSEventBridgeListResponse) GetData() AWSEventBridgeListResponseData { + if o == nil { + var ret AWSEventBridgeListResponseData + 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 *AWSEventBridgeListResponse) GetDataOk() (*AWSEventBridgeListResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *AWSEventBridgeListResponse) SetData(v AWSEventBridgeListResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeListResponse) 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 *AWSEventBridgeListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AWSEventBridgeListResponseData `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_event_bridge_list_response_attributes.go b/api/datadogV2/model_aws_event_bridge_list_response_attributes.go new file mode 100644 index 00000000000..a63e202df8e --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_list_response_attributes.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" +) + +// AWSEventBridgeListResponseAttributes An object describing the EventBridge configuration for multiple accounts. +type AWSEventBridgeListResponseAttributes struct { + // List of accounts with their event sources. + Accounts []AWSEventBridgeAccountConfiguration `json:"accounts,omitempty"` + // True if the EventBridge integration is enabled for your organization. + IsInstalled *bool `json:"is_installed,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:"-"` +} + +// NewAWSEventBridgeListResponseAttributes instantiates a new AWSEventBridgeListResponseAttributes 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 NewAWSEventBridgeListResponseAttributes() *AWSEventBridgeListResponseAttributes { + this := AWSEventBridgeListResponseAttributes{} + return &this +} + +// NewAWSEventBridgeListResponseAttributesWithDefaults instantiates a new AWSEventBridgeListResponseAttributes 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 NewAWSEventBridgeListResponseAttributesWithDefaults() *AWSEventBridgeListResponseAttributes { + this := AWSEventBridgeListResponseAttributes{} + return &this +} + +// GetAccounts returns the Accounts field value if set, zero value otherwise. +func (o *AWSEventBridgeListResponseAttributes) GetAccounts() []AWSEventBridgeAccountConfiguration { + if o == nil || o.Accounts == nil { + var ret []AWSEventBridgeAccountConfiguration + return ret + } + return o.Accounts +} + +// GetAccountsOk returns a tuple with the Accounts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeListResponseAttributes) GetAccountsOk() (*[]AWSEventBridgeAccountConfiguration, bool) { + if o == nil || o.Accounts == nil { + return nil, false + } + return &o.Accounts, true +} + +// HasAccounts returns a boolean if a field has been set. +func (o *AWSEventBridgeListResponseAttributes) HasAccounts() bool { + return o != nil && o.Accounts != nil +} + +// SetAccounts gets a reference to the given []AWSEventBridgeAccountConfiguration and assigns it to the Accounts field. +func (o *AWSEventBridgeListResponseAttributes) SetAccounts(v []AWSEventBridgeAccountConfiguration) { + o.Accounts = v +} + +// GetIsInstalled returns the IsInstalled field value if set, zero value otherwise. +func (o *AWSEventBridgeListResponseAttributes) GetIsInstalled() bool { + if o == nil || o.IsInstalled == nil { + var ret bool + return ret + } + return *o.IsInstalled +} + +// GetIsInstalledOk returns a tuple with the IsInstalled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeListResponseAttributes) GetIsInstalledOk() (*bool, bool) { + if o == nil || o.IsInstalled == nil { + return nil, false + } + return o.IsInstalled, true +} + +// HasIsInstalled returns a boolean if a field has been set. +func (o *AWSEventBridgeListResponseAttributes) HasIsInstalled() bool { + return o != nil && o.IsInstalled != nil +} + +// SetIsInstalled gets a reference to the given bool and assigns it to the IsInstalled field. +func (o *AWSEventBridgeListResponseAttributes) SetIsInstalled(v bool) { + o.IsInstalled = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeListResponseAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Accounts != nil { + toSerialize["accounts"] = o.Accounts + } + if o.IsInstalled != nil { + toSerialize["is_installed"] = o.IsInstalled + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeListResponseAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Accounts []AWSEventBridgeAccountConfiguration `json:"accounts,omitempty"` + IsInstalled *bool `json:"is_installed,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{"accounts", "is_installed"}) + } else { + return err + } + o.Accounts = all.Accounts + o.IsInstalled = all.IsInstalled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_list_response_data.go b/api/datadogV2/model_aws_event_bridge_list_response_data.go new file mode 100644 index 00000000000..fdd5e65cbac --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_list_response_data.go @@ -0,0 +1,182 @@ +// 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" +) + +// AWSEventBridgeListResponseData Amazon EventBridge list response data. +type AWSEventBridgeListResponseData struct { + // An object describing the EventBridge configuration for multiple accounts. + Attributes AWSEventBridgeListResponseAttributes `json:"attributes"` + // The ID of the Amazon EventBridge list response data. + Id string `json:"id"` + // Amazon EventBridge resource type. + Type AWSEventBridgeType `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:"-"` +} + +// NewAWSEventBridgeListResponseData instantiates a new AWSEventBridgeListResponseData 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 NewAWSEventBridgeListResponseData(attributes AWSEventBridgeListResponseAttributes, id string, typeVar AWSEventBridgeType) *AWSEventBridgeListResponseData { + this := AWSEventBridgeListResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewAWSEventBridgeListResponseDataWithDefaults instantiates a new AWSEventBridgeListResponseData 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 NewAWSEventBridgeListResponseDataWithDefaults() *AWSEventBridgeListResponseData { + this := AWSEventBridgeListResponseData{} + var id string = "get_event_bridge" + this.Id = id + var typeVar AWSEventBridgeType = AWSEVENTBRIDGETYPE_EVENT_BRIDGE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *AWSEventBridgeListResponseData) GetAttributes() AWSEventBridgeListResponseAttributes { + if o == nil { + var ret AWSEventBridgeListResponseAttributes + 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 *AWSEventBridgeListResponseData) GetAttributesOk() (*AWSEventBridgeListResponseAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *AWSEventBridgeListResponseData) SetAttributes(v AWSEventBridgeListResponseAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *AWSEventBridgeListResponseData) 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 *AWSEventBridgeListResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AWSEventBridgeListResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *AWSEventBridgeListResponseData) GetType() AWSEventBridgeType { + if o == nil { + var ret AWSEventBridgeType + 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 *AWSEventBridgeListResponseData) GetTypeOk() (*AWSEventBridgeType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AWSEventBridgeListResponseData) SetType(v AWSEventBridgeType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeListResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *AWSEventBridgeListResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AWSEventBridgeListResponseAttributes `json:"attributes"` + Id *string `json:"id"` + Type *AWSEventBridgeType `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.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.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_event_bridge_source.go b/api/datadogV2/model_aws_event_bridge_source.go new file mode 100644 index 00000000000..f3af3c9a367 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_source.go @@ -0,0 +1,138 @@ +// 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" +) + +// AWSEventBridgeSource An EventBridge source. +type AWSEventBridgeSource struct { + // The event source name. + Name *string `json:"name,omitempty"` + // The event source's + // [AWS region](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). + Region *string `json:"region,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:"-"` +} + +// NewAWSEventBridgeSource instantiates a new AWSEventBridgeSource 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 NewAWSEventBridgeSource() *AWSEventBridgeSource { + this := AWSEventBridgeSource{} + return &this +} + +// NewAWSEventBridgeSourceWithDefaults instantiates a new AWSEventBridgeSource 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 NewAWSEventBridgeSourceWithDefaults() *AWSEventBridgeSource { + this := AWSEventBridgeSource{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *AWSEventBridgeSource) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeSource) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *AWSEventBridgeSource) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *AWSEventBridgeSource) SetName(v string) { + o.Name = &v +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *AWSEventBridgeSource) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AWSEventBridgeSource) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *AWSEventBridgeSource) HasRegion() bool { + return o != nil && o.Region != nil +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *AWSEventBridgeSource) SetRegion(v string) { + o.Region = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AWSEventBridgeSource) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AWSEventBridgeSource) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,omitempty"` + Region *string `json:"region,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{"name", "region"}) + } else { + return err + } + o.Name = all.Name + o.Region = all.Region + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_aws_event_bridge_type.go b/api/datadogV2/model_aws_event_bridge_type.go new file mode 100644 index 00000000000..504ea4d3bc0 --- /dev/null +++ b/api/datadogV2/model_aws_event_bridge_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" +) + +// AWSEventBridgeType Amazon EventBridge resource type. +type AWSEventBridgeType string + +// List of AWSEventBridgeType. +const ( + AWSEVENTBRIDGETYPE_EVENT_BRIDGE AWSEventBridgeType = "event_bridge" +) + +var allowedAWSEventBridgeTypeEnumValues = []AWSEventBridgeType{ + AWSEVENTBRIDGETYPE_EVENT_BRIDGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *AWSEventBridgeType) GetAllowedValues() []AWSEventBridgeType { + return allowedAWSEventBridgeTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *AWSEventBridgeType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = AWSEventBridgeType(value) + return nil +} + +// NewAWSEventBridgeTypeFromValue returns a pointer to a valid AWSEventBridgeType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewAWSEventBridgeTypeFromValue(v string) (*AWSEventBridgeType, error) { + ev := AWSEventBridgeType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for AWSEventBridgeType: valid values are %v", v, allowedAWSEventBridgeTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v AWSEventBridgeType) IsValid() bool { + for _, existing := range allowedAWSEventBridgeTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AWSEventBridgeType value. +func (v AWSEventBridgeType) Ptr() *AWSEventBridgeType { + return &v +} diff --git a/api/datadogV2/model_aws_lambda_forwarder_config.go b/api/datadogV2/model_aws_lambda_forwarder_config.go index 15621c0db12..616867151b5 100644 --- a/api/datadogV2/model_aws_lambda_forwarder_config.go +++ b/api/datadogV2/model_aws_lambda_forwarder_config.go @@ -8,15 +8,18 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// AWSLambdaForwarderConfig Log Autosubscription configuration for Datadog Forwarder Lambda functions. Automatically set up triggers for existing -// and new logs for some services, ensuring no logs from new resources are missed and saving time spent on manual configuration. +// AWSLambdaForwarderConfig Log Autosubscription configuration for Datadog Forwarder Lambda functions. +// Automatically set up triggers for existing and new logs for some services, +// ensuring no logs from new resources are missed and saving time spent on manual configuration. type AWSLambdaForwarderConfig struct { // List of Datadog Lambda Log Forwarder ARNs in your AWS account. Defaults to `[]`. Lambdas []string `json:"lambdas,omitempty"` // Log source configuration. LogSourceConfig *AWSLambdaForwarderConfigLogSourceConfig `json:"log_source_config,omitempty"` - // List of service IDs set to enable automatic log collection. Discover the list of available services with the - // [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) endpoint. + // List of service IDs set to enable automatic log collection. + // Discover the list of available services with the + // [Get list of AWS log ready services](https://docs.datadoghq.com/api/latest/aws-logs-integration/#get-list-of-aws-log-ready-services) + // endpoint. 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:"-"` diff --git a/api/datadogV2/model_aws_log_source_tag_filter.go b/api/datadogV2/model_aws_log_source_tag_filter.go index 9092d98ddb6..1b0b05f97bd 100644 --- a/api/datadogV2/model_aws_log_source_tag_filter.go +++ b/api/datadogV2/model_aws_log_source_tag_filter.go @@ -9,9 +9,13 @@ import ( ) // AWSLogSourceTagFilter AWS log source tag filter list. Defaults to `[]`. -// Array of log source to AWS resource tag mappings. Each mapping contains a log source and its associated AWS resource tags (in `key:value` format) used to filter logs submitted to Datadog. -// Tag filters are applied for tags on the AWS resource emitting logs; tags associated with the log storage entity (such as a CloudWatch Log Group or S3 Bucket) are not considered. -// For more information on resource tag filter syntax, [see AWS resource exclusion](https://docs.datadoghq.com/account_management/billing/aws/#aws-resource-exclusion) in the AWS integration billing page. +// Array of log source to AWS resource tag mappings. Each mapping contains a log source and its +// associated AWS resource tags (in `key:value` format) used to filter logs submitted to Datadog. +// Tag filters are applied for tags on the AWS resource emitting logs; tags associated with the +// log storage entity (such as a CloudWatch Log Group or S3 Bucket) are not considered. +// For more information on resource tag filter syntax, +// [see AWS resource exclusion](https://docs.datadoghq.com/account_management/billing/aws/#aws-resource-exclusion) +// in the AWS integration billing page. type AWSLogSourceTagFilter struct { // The AWS log source to which the tag filters defined in `tags` are applied. Source *string `json:"source,omitempty"` diff --git a/api/datadogV2/model_aws_logs_config.go b/api/datadogV2/model_aws_logs_config.go index 6cbb92d907a..c49f94b85f7 100644 --- a/api/datadogV2/model_aws_logs_config.go +++ b/api/datadogV2/model_aws_logs_config.go @@ -10,8 +10,9 @@ import ( // AWSLogsConfig AWS Logs Collection config. type AWSLogsConfig struct { - // Log Autosubscription configuration for Datadog Forwarder Lambda functions. Automatically set up triggers for existing - // and new logs for some services, ensuring no logs from new resources are missed and saving time spent on manual configuration. + // Log Autosubscription configuration for Datadog Forwarder Lambda functions. + // Automatically set up triggers for existing and new logs for some services, + // ensuring no logs from new resources are missed and saving time spent on manual configuration. 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:"-"` diff --git a/api/datadogV2/model_aws_namespace_filters_exclude_only.go b/api/datadogV2/model_aws_namespace_filters_exclude_only.go index 6bc2ec00286..c68161b8768 100644 --- a/api/datadogV2/model_aws_namespace_filters_exclude_only.go +++ b/api/datadogV2/model_aws_namespace_filters_exclude_only.go @@ -10,11 +10,15 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// AWSNamespaceFiltersExcludeOnly Exclude only these namespaces from metrics collection. Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. -// `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default to reduce your AWS CloudWatch costs from `GetMetricData` API calls. +// AWSNamespaceFiltersExcludeOnly Exclude only these namespaces from metrics collection. +// Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. +// `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default +// to reduce your AWS CloudWatch costs from `GetMetricData` API calls. type AWSNamespaceFiltersExcludeOnly struct { - // Exclude only these namespaces from metrics collection. Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. - // `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default to reduce your AWS CloudWatch costs from `GetMetricData` API calls. + // Exclude only these namespaces from metrics collection. + // Defaults to `["AWS/SQS", "AWS/ElasticMapReduce", "AWS/Usage"]`. + // `AWS/SQS`, `AWS/ElasticMapReduce`, and `AWS/Usage` are excluded by default + // to reduce your AWS CloudWatch costs from `GetMetricData` API calls. 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:"-"` diff --git a/api/datadogV2/model_aws_namespace_tag_filter.go b/api/datadogV2/model_aws_namespace_tag_filter.go index 5faf5261faf..8140647793f 100644 --- a/api/datadogV2/model_aws_namespace_tag_filter.go +++ b/api/datadogV2/model_aws_namespace_tag_filter.go @@ -9,10 +9,12 @@ import ( ) // AWSNamespaceTagFilter AWS Metrics Collection tag filters list. Defaults to `[]`. -// The array of custom AWS resource tags (in the form `key:value`) defines a filter that Datadog uses when collecting metrics from a specified service. -// Wildcards, such as `?` (match a single character) and `*` (match multiple characters), and exclusion using `!` before the tag are supported. -// For EC2, only hosts that match one of the defined tags will be imported into Datadog. The rest will be ignored. -// For example, `env:production,instance-type:c?.*,!region:us-east-1`. +// The array of custom AWS resource tags (in the form `key:value`) defines a filter that Datadog uses +// when collecting metrics from a specified service. +// Wildcards, such as `?` (match a single character) and `*` (match multiple characters), +// and exclusion using `!` before the tag are supported. +// For EC2, only hosts that match one of the defined tags are imported into Datadog. +// The rest are ignored. For example, `env:production,instance-type:c?.*,!region:us-east-1`. type AWSNamespaceTagFilter struct { // The AWS service for which the tag filters defined in `tags` will be applied. Namespace *string `json:"namespace,omitempty"` diff --git a/api/datadogV2/model_aws_resources_config.go b/api/datadogV2/model_aws_resources_config.go index 3a4d322e2f7..60ad41ec911 100644 --- a/api/datadogV2/model_aws_resources_config.go +++ b/api/datadogV2/model_aws_resources_config.go @@ -10,9 +10,12 @@ import ( // AWSResourcesConfig AWS Resources Collection config. type AWSResourcesConfig struct { - // Enable Cloud Security Management to scan AWS resources for vulnerabilities, misconfigurations, identity risks, and compliance violations. Defaults to `false`. Requires `extended_collection` to be set to `true`. + // Enable Cloud Security Management to scan AWS resources for vulnerabilities, misconfigurations, + // identity risks, and compliance violations. Defaults to `false`. + // Requires `extended_collection` to be set to `true`. CloudSecurityPostureManagementCollection *bool `json:"cloud_security_posture_management_collection,omitempty"` - // Whether Datadog collects additional attributes and configuration information about the resources in your AWS account. Defaults to `true`. Required for `cloud_security_posture_management_collection`. + // Whether Datadog collects additional attributes and configuration information about the resources + // in your AWS account. Defaults to `true`. Required for `cloud_security_posture_management_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:"-"` diff --git a/examples/v2/aws-integration/CreateAWSEventBridgeSource.go b/examples/v2/aws-integration/CreateAWSEventBridgeSource.go new file mode 100644 index 00000000000..ec50fa493ba --- /dev/null +++ b/examples/v2/aws-integration/CreateAWSEventBridgeSource.go @@ -0,0 +1,40 @@ +// Create an Amazon EventBridge source returns "Amazon EventBridge source created." 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.AWSEventBridgeCreateRequest{ + Data: datadogV2.AWSEventBridgeCreateRequestData{ + Attributes: datadogV2.AWSEventBridgeCreateRequestAttributes{ + AccountId: "123456789012", + CreateEventBus: datadog.PtrBool(true), + EventGeneratorName: "app-alerts", + Region: "us-east-1", + }, + Type: datadogV2.AWSEVENTBRIDGETYPE_EVENT_BRIDGE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.CreateAWSEventBridgeSource(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.CreateAWSEventBridgeSource`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.CreateAWSEventBridgeSource`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/DeleteAWSEventBridgeSource.go b/examples/v2/aws-integration/DeleteAWSEventBridgeSource.go new file mode 100644 index 00000000000..e8e8bb9a34a --- /dev/null +++ b/examples/v2/aws-integration/DeleteAWSEventBridgeSource.go @@ -0,0 +1,39 @@ +// Delete an Amazon EventBridge source returns "Amazon EventBridge source deleted." 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.AWSEventBridgeDeleteRequest{ + Data: datadogV2.AWSEventBridgeDeleteRequestData{ + Attributes: datadogV2.AWSEventBridgeDeleteRequestAttributes{ + AccountId: "123456789012", + EventGeneratorName: "app-alerts-zyxw3210", + Region: "us-east-1", + }, + Type: datadogV2.AWSEVENTBRIDGETYPE_EVENT_BRIDGE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.DeleteAWSEventBridgeSource(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.DeleteAWSEventBridgeSource`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.DeleteAWSEventBridgeSource`:\n%s\n", responseContent) +} diff --git a/examples/v2/aws-integration/ListAWSEventBridgeSources.go b/examples/v2/aws-integration/ListAWSEventBridgeSources.go new file mode 100644 index 00000000000..b95ea6165a8 --- /dev/null +++ b/examples/v2/aws-integration/ListAWSEventBridgeSources.go @@ -0,0 +1,29 @@ +// Get all Amazon EventBridge sources returns "Amazon EventBridge sources list." 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() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewAWSIntegrationApi(apiClient) + resp, r, err := api.ListAWSEventBridgeSources(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AWSIntegrationApi.ListAWSEventBridgeSources`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `AWSIntegrationApi.ListAWSEventBridgeSources`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/aws_integration.feature b/tests/scenarios/features/v2/aws_integration.feature index 16522a97cf5..30ded64d73f 100644 --- a/tests/scenarios/features/v2/aws_integration.feature +++ b/tests/scenarios/features/v2/aws_integration.feature @@ -38,6 +38,27 @@ Feature: AWS Integration When the request is sent Then the response status is 409 Conflict + @generated @skip @team:DataDog/aws-integrations + Scenario: Create an Amazon EventBridge source returns "Amazon EventBridge source created." response + Given new "CreateAWSEventBridgeSource" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "create_event_bus": true, "event_generator_name": "app-alerts", "region": "us-east-1"}, "type": "event_bridge"}} + When the request is sent + Then the response status is 200 Amazon EventBridge source created. + + @generated @skip @team:DataDog/aws-integrations + Scenario: Create an Amazon EventBridge source returns "Bad Request" response + Given new "CreateAWSEventBridgeSource" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "create_event_bus": true, "event_generator_name": "app-alerts", "region": "us-east-1"}, "type": "event_bridge"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aws-integrations + Scenario: Create an Amazon EventBridge source returns "Conflict" response + Given new "CreateAWSEventBridgeSource" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "create_event_bus": true, "event_generator_name": "app-alerts", "region": "us-east-1"}, "type": "event_bridge"}} + 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 new "DeleteAWSAccount" request @@ -61,6 +82,20 @@ Feature: AWS Integration When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/aws-integrations + Scenario: Delete an Amazon EventBridge source returns "Amazon EventBridge source deleted." response + Given new "DeleteAWSEventBridgeSource" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "event_generator_name": "app-alerts-zyxw3210", "region": "us-east-1"}, "type": "event_bridge"}} + When the request is sent + Then the response status is 200 Amazon EventBridge source deleted. + + @generated @skip @team:DataDog/aws-integrations + Scenario: Delete an Amazon EventBridge source returns "Bad Request" response + Given new "DeleteAWSEventBridgeSource" request + And body with value {"data": {"attributes": {"account_id": "123456789012", "event_generator_name": "app-alerts-zyxw3210", "region": "us-east-1"}, "type": "event_bridge"}} + When the request is sent + Then the response status is 400 Bad Request + @team:DataDog/aws-integrations Scenario: Generate a new external ID returns "AWS External ID object" response Given new "CreateNewAWSExternalID" request @@ -91,6 +126,18 @@ Feature: AWS Integration When the request is sent Then the response status is 200 AWS integration standard IAM permissions. + @generated @skip @team:DataDog/aws-integrations + Scenario: Get all Amazon EventBridge sources returns "Amazon EventBridge sources list." response + Given new "ListAWSEventBridgeSources" request + When the request is sent + Then the response status is 200 Amazon EventBridge sources list. + + @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 + @team:DataDog/aws-integrations Scenario: Get an AWS integration by config ID returns "AWS Account object" response Given there is a valid "aws_account_v2" in the system diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index eb1380ab6b8..ec7eca2cfdf 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1712,6 +1712,26 @@ "type": "safe" } }, + "DeleteAWSEventBridgeSource": { + "tag": "AWS Integration", + "undo": { + "type": "idempotent" + } + }, + "ListAWSEventBridgeSources": { + "tag": "AWS Integration", + "undo": { + "type": "safe" + } + }, + "CreateAWSEventBridgeSource": { + "tag": "AWS Integration", + "undo": { + "operationId": "DeleteAWSEventBridgeSource", + "parameters": [], + "type": "unsafe" + } + }, "CreateNewAWSExternalID": { "tag": "AWS Integration", "undo": {