From 65449f460747c904b888cd459805618a217f8f68 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 15:30:18 +0000 Subject: [PATCH 1/2] Add specs for v2 eventbridge API (#3414) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v1/openapi.yaml | 3 + .generator/schemas/v2/openapi.yaml | 430 ++++++++++++++++-- api/datadogV1/api_aws_integration.go | 6 + api/datadogV2/api_aws_integration.go | 237 ++++++++++ api/datadogV2/doc.go | 3 + ...l_aws_account_create_request_attributes.go | 3 +- api/datadogV2/model_aws_account_partition.go | 3 +- .../model_aws_account_response_attributes.go | 3 +- .../model_aws_account_response_data.go | 3 +- ...l_aws_account_update_request_attributes.go | 3 +- .../model_aws_account_update_request_data.go | 3 +- ..._aws_event_bridge_account_configuration.go | 173 +++++++ .../model_aws_event_bridge_create_request.go | 110 +++++ ..._event_bridge_create_request_attributes.go | 203 +++++++++ ...el_aws_event_bridge_create_request_data.go | 148 ++++++ .../model_aws_event_bridge_create_response.go | 110 +++++ ...event_bridge_create_response_attributes.go | 218 +++++++++ ...l_aws_event_bridge_create_response_data.go | 187 ++++++++ .../model_aws_event_bridge_create_status.go | 64 +++ .../model_aws_event_bridge_delete_request.go | 110 +++++ ..._event_bridge_delete_request_attributes.go | 166 +++++++ ...el_aws_event_bridge_delete_request_data.go | 148 ++++++ .../model_aws_event_bridge_delete_response.go | 110 +++++ ...event_bridge_delete_response_attributes.go | 112 +++++ ...l_aws_event_bridge_delete_response_data.go | 187 ++++++++ .../model_aws_event_bridge_delete_status.go | 64 +++ .../model_aws_event_bridge_list_response.go | 110 +++++ ...s_event_bridge_list_response_attributes.go | 137 ++++++ ...del_aws_event_bridge_list_response_data.go | 182 ++++++++ .../model_aws_event_bridge_source.go | 138 ++++++ api/datadogV2/model_aws_event_bridge_type.go | 64 +++ .../model_aws_lambda_forwarder_config.go | 11 +- .../model_aws_log_source_tag_filter.go | 10 +- api/datadogV2/model_aws_logs_config.go | 5 +- ...odel_aws_namespace_filters_exclude_only.go | 12 +- .../model_aws_namespace_tag_filter.go | 10 +- api/datadogV2/model_aws_resources_config.go | 7 +- .../CreateAWSEventBridgeSource.go | 40 ++ .../DeleteAWSEventBridgeSource.go | 39 ++ .../ListAWSEventBridgeSources.go | 29 ++ .../features/v2/aws_integration.feature | 47 ++ tests/scenarios/features/v2/undo.json | 20 + 42 files changed, 3617 insertions(+), 51 deletions(-) create mode 100644 api/datadogV2/model_aws_event_bridge_account_configuration.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_request.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_request_attributes.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_request_data.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_response.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_response_attributes.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_response_data.go create mode 100644 api/datadogV2/model_aws_event_bridge_create_status.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_request.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_request_attributes.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_request_data.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_response.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_response_attributes.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_response_data.go create mode 100644 api/datadogV2/model_aws_event_bridge_delete_status.go create mode 100644 api/datadogV2/model_aws_event_bridge_list_response.go create mode 100644 api/datadogV2/model_aws_event_bridge_list_response_attributes.go create mode 100644 api/datadogV2/model_aws_event_bridge_list_response_data.go create mode 100644 api/datadogV2/model_aws_event_bridge_source.go create mode 100644 api/datadogV2/model_aws_event_bridge_type.go create mode 100644 examples/v2/aws-integration/CreateAWSEventBridgeSource.go create mode 100644 examples/v2/aws-integration/DeleteAWSEventBridgeSource.go create mode 100644 examples/v2/aws-integration/ListAWSEventBridgeSources.go 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": { From 151a146e7ae57e5e8ed620a9ae6f958ed7db1ca7 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 16:04:06 +0000 Subject: [PATCH 2/2] Add Static Analysis Rules Endpoints (#3395) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 362 +++++++ api/datadog/configuration.go | 2 + api/datadogV2/api_security_monitoring.go | 175 ++++ api/datadogV2/doc.go | 2 + .../model_get_multiple_rulesets_request.go | 111 ++ ...odel_get_multiple_rulesets_request_data.go | 186 ++++ ...ltiple_rulesets_request_data_attributes.go | 172 ++++ ...get_multiple_rulesets_request_data_type.go | 64 ++ .../model_get_multiple_rulesets_response.go | 111 ++ ...del_get_multiple_rulesets_response_data.go | 186 ++++ ...tiple_rulesets_response_data_attributes.go | 102 ++ ...response_data_attributes_rulesets_items.go | 250 +++++ ...nse_data_attributes_rulesets_items_data.go | 148 +++ ...ata_attributes_rulesets_items_data_type.go | 64 ++ ...a_attributes_rulesets_items_rules_items.go | 959 ++++++++++++++++++ ...esets_items_rules_items_arguments_items.go | 137 +++ ...ributes_rulesets_items_rules_items_data.go | 148 +++ ...es_rulesets_items_rules_items_data_type.go | 64 ++ ..._rulesets_items_rules_items_tests_items.go | 172 ++++ ...et_multiple_rulesets_response_data_type.go | 64 ++ api/datadogV2/model_secret_rule_array.go | 101 ++ api/datadogV2/model_secret_rule_data.go | 186 ++++ .../model_secret_rule_data_attributes.go | 391 +++++++ ...t_rule_data_attributes_match_validation.go | 347 +++++++ ...lidation_invalid_http_status_code_items.go | 137 +++ ...validation_valid_http_status_code_items.go | 137 +++ api/datadogV2/model_secret_rule_data_type.go | 64 ++ .../v2/security-monitoring/GetSecretsRules.go | 30 + .../ListMultipleRulesets.go | 38 + .../features/v2/security_monitoring.feature | 19 +- tests/scenarios/features/v2/undo.json | 14 + 31 files changed, 4941 insertions(+), 2 deletions(-) create mode 100644 api/datadogV2/model_get_multiple_rulesets_request.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_request_data.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_request_data_attributes.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_request_data_type.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_data.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_data_type.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items.go create mode 100644 api/datadogV2/model_get_multiple_rulesets_response_data_type.go create mode 100644 api/datadogV2/model_secret_rule_array.go create mode 100644 api/datadogV2/model_secret_rule_data.go create mode 100644 api/datadogV2/model_secret_rule_data_attributes.go create mode 100644 api/datadogV2/model_secret_rule_data_attributes_match_validation.go create mode 100644 api/datadogV2/model_secret_rule_data_attributes_match_validation_invalid_http_status_code_items.go create mode 100644 api/datadogV2/model_secret_rule_data_attributes_match_validation_valid_http_status_code_items.go create mode 100644 api/datadogV2/model_secret_rule_data_type.go create mode 100644 examples/v2/security-monitoring/GetSecretsRules.go create mode 100644 examples/v2/security-monitoring/ListMultipleRulesets.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e44adfced6e..93efc78e5a9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21899,6 +21899,207 @@ components: - ASSIGNEE - CASE - TEAM_OWNERS + GetMultipleRulesetsRequest: + properties: + data: + $ref: '#/components/schemas/GetMultipleRulesetsRequestData' + type: object + GetMultipleRulesetsRequestData: + properties: + attributes: + $ref: '#/components/schemas/GetMultipleRulesetsRequestDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/GetMultipleRulesetsRequestDataType' + required: + - type + type: object + GetMultipleRulesetsRequestDataAttributes: + properties: + include_testing_rules: + type: boolean + include_tests: + type: boolean + rulesets: + items: + type: string + type: array + type: object + GetMultipleRulesetsRequestDataType: + default: get_multiple_rulesets_request + description: Get multiple rulesets request resource type. + enum: + - get_multiple_rulesets_request + example: get_multiple_rulesets_request + type: string + x-enum-varnames: + - GET_MULTIPLE_RULESETS_REQUEST + GetMultipleRulesetsResponse: + properties: + data: + $ref: '#/components/schemas/GetMultipleRulesetsResponseData' + type: object + GetMultipleRulesetsResponseData: + properties: + attributes: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataType' + required: + - type + type: object + GetMultipleRulesetsResponseDataAttributes: + properties: + rulesets: + items: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItems' + type: array + type: object + GetMultipleRulesetsResponseDataAttributesRulesetsItems: + properties: + data: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsData' + description: + type: string + name: + type: string + rules: + items: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems' + type: array + short_description: + type: string + required: + - data + type: object + GetMultipleRulesetsResponseDataAttributesRulesetsItemsData: + properties: + id: + type: string + type: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType' + required: + - type + type: object + GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType: + default: rulesets + description: Rulesets resource type. + enum: + - rulesets + example: rulesets + type: string + x-enum-varnames: + - RULESETS + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems: + properties: + arguments: + items: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems' + type: array + category: + type: string + checksum: + type: string + code: + type: string + created_at: + format: date-time + type: string + created_by: + type: string + cve: + type: string + cwe: + type: string + data: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData' + description: + type: string + documentation_url: + type: string + entity_checked: + type: string + is_published: + type: boolean + is_testing: + type: boolean + language: + type: string + last_updated_at: + format: date-time + type: string + last_updated_by: + type: string + name: + type: string + regex: + type: string + severity: + type: string + short_description: + type: string + should_use_ai_fix: + type: boolean + tests: + items: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems' + type: array + tree_sitter_query: + type: string + type: + type: string + required: + - data + type: object + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems: + properties: + description: + type: string + name: + type: string + type: object + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData: + properties: + id: + type: string + type: + $ref: '#/components/schemas/GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType' + required: + - type + type: object + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType: + default: rules + description: Rules resource type. + enum: + - rules + example: rules + type: string + x-enum-varnames: + - RULES + GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems: + properties: + annotation_count: + format: int64 + maximum: 65535 + minimum: 0 + type: integer + code: + type: string + filename: + type: string + type: object + GetMultipleRulesetsResponseDataType: + default: get_multiple_rulesets_response + description: Get multiple rulesets response resource type. + enum: + - get_multiple_rulesets_response + example: get_multiple_rulesets_response + type: string + x-enum-varnames: + - GET_MULTIPLE_RULESETS_RESPONSE GetResourceEvaluationFiltersResponse: description: The definition of `GetResourceEvaluationFiltersResponse` object. properties: @@ -43131,6 +43332,116 @@ components: - ISSUE_ASSIGNEE - ISSUE_CASE - ISSUE_TEAM_OWNERS + SecretRuleArray: + properties: + data: + items: + $ref: '#/components/schemas/SecretRuleData' + type: array + required: + - data + type: object + SecretRuleData: + properties: + attributes: + $ref: '#/components/schemas/SecretRuleDataAttributes' + id: + type: string + type: + $ref: '#/components/schemas/SecretRuleDataType' + required: + - type + type: object + SecretRuleDataAttributes: + properties: + default_included_keywords: + items: + type: string + type: array + description: + type: string + license: + type: string + match_validation: + $ref: '#/components/schemas/SecretRuleDataAttributesMatchValidation' + name: + type: string + pattern: + type: string + priority: + type: string + sds_id: + type: string + validators: + items: + type: string + type: array + type: object + SecretRuleDataAttributesMatchValidation: + properties: + endpoint: + type: string + hosts: + items: + type: string + type: array + http_method: + type: string + invalid_http_status_code: + items: + $ref: '#/components/schemas/SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems' + type: array + request_headers: + additionalProperties: + type: string + type: object + timeout_seconds: + format: int64 + maximum: 1.8446744073709552e+19 + minimum: 0 + type: integer + type: + type: string + valid_http_status_code: + items: + $ref: '#/components/schemas/SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems' + type: array + type: object + SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems: + properties: + end: + format: int64 + maximum: 1.8446744073709552e+19 + minimum: 0 + type: integer + start: + format: int64 + maximum: 1.8446744073709552e+19 + minimum: 0 + type: integer + type: object + SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems: + properties: + end: + format: int64 + maximum: 1.8446744073709552e+19 + minimum: 0 + type: integer + start: + format: int64 + maximum: 1.8446744073709552e+19 + minimum: 0 + type: integer + type: object + SecretRuleDataType: + default: secret_rule + description: Secret rule resource type. + enum: + - secret_rule + example: secret_rule + type: string + x-enum-varnames: + - SECRET_RULE SecurityFilter: description: The security filter's properties. properties: @@ -77714,6 +78025,57 @@ paths: tags: - Static Analysis x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/static-analysis/rulesets: + post: + description: Get rules for multiple rulesets in batch. + operationId: ListMultipleRulesets + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetMultipleRulesetsRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/GetMultipleRulesetsResponse' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Ruleset get multiple + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint may be subject to changes.' + /api/v2/static-analysis/secrets/rules: + get: + description: Returns list of Secrets rules with ID, Pattern, Description, Priority, + and SDS ID + operationId: GetSecretsRules + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SecretRuleArray' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - code_analysis_read + summary: Returns list of Secrets rules + tags: + - Security Monitoring + x-unstable: '**Note**: This endpoint may be subject to changes.' /api/v2/synthetics/settings/on_demand_concurrency_cap: get: description: Get the on-demand concurrency cap. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 5d232f74f65..0fb98e36578 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -615,11 +615,13 @@ func NewConfiguration() *Configuration { "v2.GetFinding": false, "v2.GetRuleVersionHistory": false, "v2.GetSBOM": false, + "v2.GetSecretsRules": false, "v2.GetSecurityMonitoringHistsignal": false, "v2.GetSecurityMonitoringHistsignalsByJobId": false, "v2.GetThreatHuntingJob": false, "v2.ListAssetsSBOMs": false, "v2.ListFindings": false, + "v2.ListMultipleRulesets": false, "v2.ListScannedAssetsMetadata": false, "v2.ListSecurityMonitoringHistsignals": false, "v2.ListThreatHuntingJobs": false, diff --git a/api/datadogV2/api_security_monitoring.go b/api/datadogV2/api_security_monitoring.go index 4d81bade60d..7f459b02aef 100644 --- a/api/datadogV2/api_security_monitoring.go +++ b/api/datadogV2/api_security_monitoring.go @@ -2136,6 +2136,92 @@ func (a *SecurityMonitoringApi) GetSBOM(ctx _context.Context, assetType AssetTyp return localVarReturnValue, localVarHTTPResponse, nil } +// GetSecretsRules Returns list of Secrets rules. +// Returns list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID +func (a *SecurityMonitoringApi) GetSecretsRules(ctx _context.Context) (SecretRuleArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SecretRuleArray + ) + + operationId := "v2.GetSecretsRules" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.GetSecretsRules") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/static-analysis/secrets/rules" + + 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 == 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 +} + // GetSecurityFilter Get a security filter. // Get the details of a specific security filter. // @@ -3826,6 +3912,95 @@ func (a *SecurityMonitoringApi) ListFindingsWithPagination(ctx _context.Context, return items, cancel } +// ListMultipleRulesets Ruleset get multiple. +// Get rules for multiple rulesets in batch. +func (a *SecurityMonitoringApi) ListMultipleRulesets(ctx _context.Context, body GetMultipleRulesetsRequest) (GetMultipleRulesetsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue GetMultipleRulesetsResponse + ) + + operationId := "v2.ListMultipleRulesets" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.ListMultipleRulesets") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/static-analysis/rulesets" + + 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 == 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 +} + // ListScannedAssetsMetadataOptionalParameters holds optional parameters for ListScannedAssetsMetadata. type ListScannedAssetsMetadataOptionalParameters struct { PageToken *string diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index e4f80078fee..4d31a1c74c4 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -507,6 +507,7 @@ // - [SecurityMonitoringApi.GetResourceEvaluationFilters] // - [SecurityMonitoringApi.GetRuleVersionHistory] // - [SecurityMonitoringApi.GetSBOM] +// - [SecurityMonitoringApi.GetSecretsRules] // - [SecurityMonitoringApi.GetSecurityFilter] // - [SecurityMonitoringApi.GetSecurityMonitoringHistsignal] // - [SecurityMonitoringApi.GetSecurityMonitoringHistsignalsByJobId] @@ -522,6 +523,7 @@ // - [SecurityMonitoringApi.GetVulnerabilityNotificationRules] // - [SecurityMonitoringApi.ListAssetsSBOMs] // - [SecurityMonitoringApi.ListFindings] +// - [SecurityMonitoringApi.ListMultipleRulesets] // - [SecurityMonitoringApi.ListScannedAssetsMetadata] // - [SecurityMonitoringApi.ListSecurityFilters] // - [SecurityMonitoringApi.ListSecurityMonitoringHistsignals] diff --git a/api/datadogV2/model_get_multiple_rulesets_request.go b/api/datadogV2/model_get_multiple_rulesets_request.go new file mode 100644 index 00000000000..22356adacad --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsRequest +type GetMultipleRulesetsRequest struct { + // + Data *GetMultipleRulesetsRequestData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGetMultipleRulesetsRequest instantiates a new GetMultipleRulesetsRequest 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 NewGetMultipleRulesetsRequest() *GetMultipleRulesetsRequest { + this := GetMultipleRulesetsRequest{} + return &this +} + +// NewGetMultipleRulesetsRequestWithDefaults instantiates a new GetMultipleRulesetsRequest 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 NewGetMultipleRulesetsRequestWithDefaults() *GetMultipleRulesetsRequest { + this := GetMultipleRulesetsRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetMultipleRulesetsRequest) GetData() GetMultipleRulesetsRequestData { + if o == nil || o.Data == nil { + var ret GetMultipleRulesetsRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsRequest) GetDataOk() (*GetMultipleRulesetsRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *GetMultipleRulesetsRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given GetMultipleRulesetsRequestData and assigns it to the Data field. +func (o *GetMultipleRulesetsRequest) SetData(v GetMultipleRulesetsRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetMultipleRulesetsRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_request_data.go b/api/datadogV2/model_get_multiple_rulesets_request_data.go new file mode 100644 index 00000000000..d7e23a7f6e6 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_request_data.go @@ -0,0 +1,186 @@ +// 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" +) + +// GetMultipleRulesetsRequestData +type GetMultipleRulesetsRequestData struct { + // + Attributes *GetMultipleRulesetsRequestDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // Get multiple rulesets request resource type. + Type GetMultipleRulesetsRequestDataType `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:"-"` +} + +// NewGetMultipleRulesetsRequestData instantiates a new GetMultipleRulesetsRequestData 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 NewGetMultipleRulesetsRequestData(typeVar GetMultipleRulesetsRequestDataType) *GetMultipleRulesetsRequestData { + this := GetMultipleRulesetsRequestData{} + this.Type = typeVar + return &this +} + +// NewGetMultipleRulesetsRequestDataWithDefaults instantiates a new GetMultipleRulesetsRequestData 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 NewGetMultipleRulesetsRequestDataWithDefaults() *GetMultipleRulesetsRequestData { + this := GetMultipleRulesetsRequestData{} + var typeVar GetMultipleRulesetsRequestDataType = GETMULTIPLERULESETSREQUESTDATATYPE_GET_MULTIPLE_RULESETS_REQUEST + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *GetMultipleRulesetsRequestData) GetAttributes() GetMultipleRulesetsRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret GetMultipleRulesetsRequestDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsRequestData) GetAttributesOk() (*GetMultipleRulesetsRequestDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *GetMultipleRulesetsRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given GetMultipleRulesetsRequestDataAttributes and assigns it to the Attributes field. +func (o *GetMultipleRulesetsRequestData) SetAttributes(v GetMultipleRulesetsRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetMultipleRulesetsRequestData) 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 *GetMultipleRulesetsRequestData) 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 *GetMultipleRulesetsRequestData) 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 *GetMultipleRulesetsRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetMultipleRulesetsRequestData) GetType() GetMultipleRulesetsRequestDataType { + if o == nil { + var ret GetMultipleRulesetsRequestDataType + 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 *GetMultipleRulesetsRequestData) GetTypeOk() (*GetMultipleRulesetsRequestDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetMultipleRulesetsRequestData) SetType(v GetMultipleRulesetsRequestDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + 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 *GetMultipleRulesetsRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GetMultipleRulesetsRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *GetMultipleRulesetsRequestDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_request_data_attributes.go b/api/datadogV2/model_get_multiple_rulesets_request_data_attributes.go new file mode 100644 index 00000000000..351dda74140 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_request_data_attributes.go @@ -0,0 +1,172 @@ +// 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" +) + +// GetMultipleRulesetsRequestDataAttributes +type GetMultipleRulesetsRequestDataAttributes struct { + // + IncludeTestingRules *bool `json:"include_testing_rules,omitempty"` + // + IncludeTests *bool `json:"include_tests,omitempty"` + // + Rulesets []string `json:"rulesets,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:"-"` +} + +// NewGetMultipleRulesetsRequestDataAttributes instantiates a new GetMultipleRulesetsRequestDataAttributes 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 NewGetMultipleRulesetsRequestDataAttributes() *GetMultipleRulesetsRequestDataAttributes { + this := GetMultipleRulesetsRequestDataAttributes{} + return &this +} + +// NewGetMultipleRulesetsRequestDataAttributesWithDefaults instantiates a new GetMultipleRulesetsRequestDataAttributes 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 NewGetMultipleRulesetsRequestDataAttributesWithDefaults() *GetMultipleRulesetsRequestDataAttributes { + this := GetMultipleRulesetsRequestDataAttributes{} + return &this +} + +// GetIncludeTestingRules returns the IncludeTestingRules field value if set, zero value otherwise. +func (o *GetMultipleRulesetsRequestDataAttributes) GetIncludeTestingRules() bool { + if o == nil || o.IncludeTestingRules == nil { + var ret bool + return ret + } + return *o.IncludeTestingRules +} + +// GetIncludeTestingRulesOk returns a tuple with the IncludeTestingRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsRequestDataAttributes) GetIncludeTestingRulesOk() (*bool, bool) { + if o == nil || o.IncludeTestingRules == nil { + return nil, false + } + return o.IncludeTestingRules, true +} + +// HasIncludeTestingRules returns a boolean if a field has been set. +func (o *GetMultipleRulesetsRequestDataAttributes) HasIncludeTestingRules() bool { + return o != nil && o.IncludeTestingRules != nil +} + +// SetIncludeTestingRules gets a reference to the given bool and assigns it to the IncludeTestingRules field. +func (o *GetMultipleRulesetsRequestDataAttributes) SetIncludeTestingRules(v bool) { + o.IncludeTestingRules = &v +} + +// GetIncludeTests returns the IncludeTests field value if set, zero value otherwise. +func (o *GetMultipleRulesetsRequestDataAttributes) GetIncludeTests() bool { + if o == nil || o.IncludeTests == nil { + var ret bool + return ret + } + return *o.IncludeTests +} + +// GetIncludeTestsOk returns a tuple with the IncludeTests field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsRequestDataAttributes) GetIncludeTestsOk() (*bool, bool) { + if o == nil || o.IncludeTests == nil { + return nil, false + } + return o.IncludeTests, true +} + +// HasIncludeTests returns a boolean if a field has been set. +func (o *GetMultipleRulesetsRequestDataAttributes) HasIncludeTests() bool { + return o != nil && o.IncludeTests != nil +} + +// SetIncludeTests gets a reference to the given bool and assigns it to the IncludeTests field. +func (o *GetMultipleRulesetsRequestDataAttributes) SetIncludeTests(v bool) { + o.IncludeTests = &v +} + +// GetRulesets returns the Rulesets field value if set, zero value otherwise. +func (o *GetMultipleRulesetsRequestDataAttributes) GetRulesets() []string { + if o == nil || o.Rulesets == nil { + var ret []string + return ret + } + return o.Rulesets +} + +// GetRulesetsOk returns a tuple with the Rulesets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsRequestDataAttributes) GetRulesetsOk() (*[]string, bool) { + if o == nil || o.Rulesets == nil { + return nil, false + } + return &o.Rulesets, true +} + +// HasRulesets returns a boolean if a field has been set. +func (o *GetMultipleRulesetsRequestDataAttributes) HasRulesets() bool { + return o != nil && o.Rulesets != nil +} + +// SetRulesets gets a reference to the given []string and assigns it to the Rulesets field. +func (o *GetMultipleRulesetsRequestDataAttributes) SetRulesets(v []string) { + o.Rulesets = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IncludeTestingRules != nil { + toSerialize["include_testing_rules"] = o.IncludeTestingRules + } + if o.IncludeTests != nil { + toSerialize["include_tests"] = o.IncludeTests + } + if o.Rulesets != nil { + toSerialize["rulesets"] = o.Rulesets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeTestingRules *bool `json:"include_testing_rules,omitempty"` + IncludeTests *bool `json:"include_tests,omitempty"` + Rulesets []string `json:"rulesets,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{"include_testing_rules", "include_tests", "rulesets"}) + } else { + return err + } + o.IncludeTestingRules = all.IncludeTestingRules + o.IncludeTests = all.IncludeTests + o.Rulesets = all.Rulesets + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_request_data_type.go b/api/datadogV2/model_get_multiple_rulesets_request_data_type.go new file mode 100644 index 00000000000..87614bb049f --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_request_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsRequestDataType Get multiple rulesets request resource type. +type GetMultipleRulesetsRequestDataType string + +// List of GetMultipleRulesetsRequestDataType. +const ( + GETMULTIPLERULESETSREQUESTDATATYPE_GET_MULTIPLE_RULESETS_REQUEST GetMultipleRulesetsRequestDataType = "get_multiple_rulesets_request" +) + +var allowedGetMultipleRulesetsRequestDataTypeEnumValues = []GetMultipleRulesetsRequestDataType{ + GETMULTIPLERULESETSREQUESTDATATYPE_GET_MULTIPLE_RULESETS_REQUEST, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetMultipleRulesetsRequestDataType) GetAllowedValues() []GetMultipleRulesetsRequestDataType { + return allowedGetMultipleRulesetsRequestDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetMultipleRulesetsRequestDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetMultipleRulesetsRequestDataType(value) + return nil +} + +// NewGetMultipleRulesetsRequestDataTypeFromValue returns a pointer to a valid GetMultipleRulesetsRequestDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetMultipleRulesetsRequestDataTypeFromValue(v string) (*GetMultipleRulesetsRequestDataType, error) { + ev := GetMultipleRulesetsRequestDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetMultipleRulesetsRequestDataType: valid values are %v", v, allowedGetMultipleRulesetsRequestDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetMultipleRulesetsRequestDataType) IsValid() bool { + for _, existing := range allowedGetMultipleRulesetsRequestDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetMultipleRulesetsRequestDataType value. +func (v GetMultipleRulesetsRequestDataType) Ptr() *GetMultipleRulesetsRequestDataType { + return &v +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response.go b/api/datadogV2/model_get_multiple_rulesets_response.go new file mode 100644 index 00000000000..9bf06b26ff8 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsResponse +type GetMultipleRulesetsResponse struct { + // + Data *GetMultipleRulesetsResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGetMultipleRulesetsResponse instantiates a new GetMultipleRulesetsResponse 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 NewGetMultipleRulesetsResponse() *GetMultipleRulesetsResponse { + this := GetMultipleRulesetsResponse{} + return &this +} + +// NewGetMultipleRulesetsResponseWithDefaults instantiates a new GetMultipleRulesetsResponse 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 NewGetMultipleRulesetsResponseWithDefaults() *GetMultipleRulesetsResponse { + this := GetMultipleRulesetsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponse) GetData() GetMultipleRulesetsResponseData { + if o == nil || o.Data == nil { + var ret GetMultipleRulesetsResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponse) GetDataOk() (*GetMultipleRulesetsResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given GetMultipleRulesetsResponseData and assigns it to the Data field. +func (o *GetMultipleRulesetsResponse) SetData(v GetMultipleRulesetsResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetMultipleRulesetsResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data.go b/api/datadogV2/model_get_multiple_rulesets_response_data.go new file mode 100644 index 00000000000..8b7288b67e5 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data.go @@ -0,0 +1,186 @@ +// 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" +) + +// GetMultipleRulesetsResponseData +type GetMultipleRulesetsResponseData struct { + // + Attributes *GetMultipleRulesetsResponseDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // Get multiple rulesets response resource type. + Type GetMultipleRulesetsResponseDataType `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:"-"` +} + +// NewGetMultipleRulesetsResponseData instantiates a new GetMultipleRulesetsResponseData 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 NewGetMultipleRulesetsResponseData(typeVar GetMultipleRulesetsResponseDataType) *GetMultipleRulesetsResponseData { + this := GetMultipleRulesetsResponseData{} + this.Type = typeVar + return &this +} + +// NewGetMultipleRulesetsResponseDataWithDefaults instantiates a new GetMultipleRulesetsResponseData 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 NewGetMultipleRulesetsResponseDataWithDefaults() *GetMultipleRulesetsResponseData { + this := GetMultipleRulesetsResponseData{} + var typeVar GetMultipleRulesetsResponseDataType = GETMULTIPLERULESETSRESPONSEDATATYPE_GET_MULTIPLE_RULESETS_RESPONSE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseData) GetAttributes() GetMultipleRulesetsResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret GetMultipleRulesetsResponseDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseData) GetAttributesOk() (*GetMultipleRulesetsResponseDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given GetMultipleRulesetsResponseDataAttributes and assigns it to the Attributes field. +func (o *GetMultipleRulesetsResponseData) SetAttributes(v GetMultipleRulesetsResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseData) 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 *GetMultipleRulesetsResponseData) 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 *GetMultipleRulesetsResponseData) 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 *GetMultipleRulesetsResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetMultipleRulesetsResponseData) GetType() GetMultipleRulesetsResponseDataType { + if o == nil { + var ret GetMultipleRulesetsResponseDataType + 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 *GetMultipleRulesetsResponseData) GetTypeOk() (*GetMultipleRulesetsResponseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetMultipleRulesetsResponseData) SetType(v GetMultipleRulesetsResponseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + 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 *GetMultipleRulesetsResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *GetMultipleRulesetsResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *GetMultipleRulesetsResponseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_attributes.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes.go new file mode 100644 index 00000000000..5103da8013d --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsResponseDataAttributes +type GetMultipleRulesetsResponseDataAttributes struct { + // + Rulesets []GetMultipleRulesetsResponseDataAttributesRulesetsItems `json:"rulesets,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:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributes instantiates a new GetMultipleRulesetsResponseDataAttributes 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 NewGetMultipleRulesetsResponseDataAttributes() *GetMultipleRulesetsResponseDataAttributes { + this := GetMultipleRulesetsResponseDataAttributes{} + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributes 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 NewGetMultipleRulesetsResponseDataAttributesWithDefaults() *GetMultipleRulesetsResponseDataAttributes { + this := GetMultipleRulesetsResponseDataAttributes{} + return &this +} + +// GetRulesets returns the Rulesets field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributes) GetRulesets() []GetMultipleRulesetsResponseDataAttributesRulesetsItems { + if o == nil || o.Rulesets == nil { + var ret []GetMultipleRulesetsResponseDataAttributesRulesetsItems + return ret + } + return o.Rulesets +} + +// GetRulesetsOk returns a tuple with the Rulesets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributes) GetRulesetsOk() (*[]GetMultipleRulesetsResponseDataAttributesRulesetsItems, bool) { + if o == nil || o.Rulesets == nil { + return nil, false + } + return &o.Rulesets, true +} + +// HasRulesets returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributes) HasRulesets() bool { + return o != nil && o.Rulesets != nil +} + +// SetRulesets gets a reference to the given []GetMultipleRulesetsResponseDataAttributesRulesetsItems and assigns it to the Rulesets field. +func (o *GetMultipleRulesetsResponseDataAttributes) SetRulesets(v []GetMultipleRulesetsResponseDataAttributesRulesetsItems) { + o.Rulesets = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Rulesets != nil { + toSerialize["rulesets"] = o.Rulesets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Rulesets []GetMultipleRulesetsResponseDataAttributesRulesetsItems `json:"rulesets,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{"rulesets"}) + } else { + return err + } + o.Rulesets = all.Rulesets + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items.go new file mode 100644 index 00000000000..303b1f9b7a8 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items.go @@ -0,0 +1,250 @@ +// 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" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItems +type GetMultipleRulesetsResponseDataAttributesRulesetsItems struct { + // + Data GetMultipleRulesetsResponseDataAttributesRulesetsItemsData `json:"data"` + // + Description *string `json:"description,omitempty"` + // + Name *string `json:"name,omitempty"` + // + Rules []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems `json:"rules,omitempty"` + // + ShortDescription *string `json:"short_description,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:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItems instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItems(data GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) *GetMultipleRulesetsResponseDataAttributesRulesetsItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItems{} + this.Data = data + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsWithDefaults() *GetMultipleRulesetsResponseDataAttributesRulesetsItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItems{} + return &this +} + +// GetData returns the Data field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetData() GetMultipleRulesetsResponseDataAttributesRulesetsItemsData { + if o == nil { + var ret GetMultipleRulesetsResponseDataAttributesRulesetsItemsData + 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetDataOk() (*GetMultipleRulesetsResponseDataAttributesRulesetsItemsData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) SetData(v GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) { + o.Data = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItems) SetName(v string) { + o.Name = &v +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetRules() []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { + if o == nil || o.Rules == nil { + var ret []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems + return ret + } + return o.Rules +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetRulesOk() (*[]GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems, bool) { + if o == nil || o.Rules == nil { + return nil, false + } + return &o.Rules, true +} + +// HasRules returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) HasRules() bool { + return o != nil && o.Rules != nil +} + +// SetRules gets a reference to the given []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems and assigns it to the Rules field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) SetRules(v []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) { + o.Rules = v +} + +// GetShortDescription returns the ShortDescription field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetShortDescription() string { + if o == nil || o.ShortDescription == nil { + var ret string + return ret + } + return *o.ShortDescription +} + +// GetShortDescriptionOk returns a tuple with the ShortDescription field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) GetShortDescriptionOk() (*string, bool) { + if o == nil || o.ShortDescription == nil { + return nil, false + } + return o.ShortDescription, true +} + +// HasShortDescription returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) HasShortDescription() bool { + return o != nil && o.ShortDescription != nil +} + +// SetShortDescription gets a reference to the given string and assigns it to the ShortDescription field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) SetShortDescription(v string) { + o.ShortDescription = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributesRulesetsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Rules != nil { + toSerialize["rules"] = o.Rules + } + if o.ShortDescription != nil { + toSerialize["short_description"] = o.ShortDescription + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData `json:"data"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Rules []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems `json:"rules,omitempty"` + ShortDescription *string `json:"short_description,omitempty"` + }{} + 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", "description", "name", "rules", "short_description"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Description = all.Description + o.Name = all.Name + o.Rules = all.Rules + o.ShortDescription = all.ShortDescription + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_data.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_data.go new file mode 100644 index 00000000000..3c7af344b99 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_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" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsData +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsData struct { + // + Id *string `json:"id,omitempty"` + // Rulesets resource type. + Type GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType `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:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsData instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsData 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsData(typeVar GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType) *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsData{} + this.Type = typeVar + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsData 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataWithDefaults() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsData{} + var typeVar GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType = GETMULTIPLERULESETSRESPONSEDATAATTRIBUTESRULESETSITEMSDATATYPE_RULESETS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) GetType() GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType { + if o == nil { + var ret GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType + 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) GetTypeOk() (*GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) SetType(v GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Type *GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + 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{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + 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_get_multiple_rulesets_response_data_attributes_rulesets_items_data_type.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_data_type.go new file mode 100644 index 00000000000..30a954b1af4 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType Rulesets resource type. +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType string + +// List of GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType. +const ( + GETMULTIPLERULESETSRESPONSEDATAATTRIBUTESRULESETSITEMSDATATYPE_RULESETS GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType = "rulesets" +) + +var allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTypeEnumValues = []GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType{ + GETMULTIPLERULESETSRESPONSEDATAATTRIBUTESRULESETSITEMSDATATYPE_RULESETS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType) GetAllowedValues() []GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType { + return allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType(value) + return nil +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTypeFromValue returns a pointer to a valid GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTypeFromValue(v string) (*GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType, error) { + ev := GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType: valid values are %v", v, allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType) IsValid() bool { + for _, existing := range allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType value. +func (v GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType) Ptr() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsDataType { + return &v +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.go new file mode 100644 index 00000000000..7dbd8c54505 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items.go @@ -0,0 +1,959 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems struct { + // + Arguments []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems `json:"arguments,omitempty"` + // + Category *string `json:"category,omitempty"` + // + Checksum *string `json:"checksum,omitempty"` + // + Code *string `json:"code,omitempty"` + // + CreatedAt *time.Time `json:"created_at,omitempty"` + // + CreatedBy *string `json:"created_by,omitempty"` + // + Cve *string `json:"cve,omitempty"` + // + Cwe *string `json:"cwe,omitempty"` + // + Data GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData `json:"data"` + // + Description *string `json:"description,omitempty"` + // + DocumentationUrl *string `json:"documentation_url,omitempty"` + // + EntityChecked *string `json:"entity_checked,omitempty"` + // + IsPublished *bool `json:"is_published,omitempty"` + // + IsTesting *bool `json:"is_testing,omitempty"` + // + Language *string `json:"language,omitempty"` + // + LastUpdatedAt *time.Time `json:"last_updated_at,omitempty"` + // + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + // + Name *string `json:"name,omitempty"` + // + Regex *string `json:"regex,omitempty"` + // + Severity *string `json:"severity,omitempty"` + // + ShortDescription *string `json:"short_description,omitempty"` + // + ShouldUseAiFix *bool `json:"should_use_ai_fix,omitempty"` + // + Tests []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems `json:"tests,omitempty"` + // + TreeSitterQuery *string `json:"tree_sitter_query,omitempty"` + // + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems(data GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems{} + this.Data = data + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsWithDefaults() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems{} + return &this +} + +// GetArguments returns the Arguments field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetArguments() []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems { + if o == nil || o.Arguments == nil { + var ret []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems + return ret + } + return o.Arguments +} + +// GetArgumentsOk returns a tuple with the Arguments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetArgumentsOk() (*[]GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems, bool) { + if o == nil || o.Arguments == nil { + return nil, false + } + return &o.Arguments, true +} + +// HasArguments returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasArguments() bool { + return o != nil && o.Arguments != nil +} + +// SetArguments gets a reference to the given []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems and assigns it to the Arguments field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetArguments(v []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) { + o.Arguments = v +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCategory() string { + if o == nil || o.Category == nil { + var ret string + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCategoryOk() (*string, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasCategory() bool { + return o != nil && o.Category != nil +} + +// SetCategory gets a reference to the given string and assigns it to the Category field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetCategory(v string) { + o.Category = &v +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetChecksum() string { + if o == nil || o.Checksum == nil { + var ret string + return ret + } + return *o.Checksum +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetChecksumOk() (*string, bool) { + if o == nil || o.Checksum == nil { + return nil, false + } + return o.Checksum, true +} + +// HasChecksum returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasChecksum() bool { + return o != nil && o.Checksum != nil +} + +// SetChecksum gets a reference to the given string and assigns it to the Checksum field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetChecksum(v string) { + o.Checksum = &v +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasCode() bool { + return o != nil && o.Code != nil +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetCode(v string) { + o.Code = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCreatedBy() string { + if o == nil || o.CreatedBy == nil { + var ret string + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCreatedByOk() (*string, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasCreatedBy() bool { + return o != nil && o.CreatedBy != nil +} + +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetCreatedBy(v string) { + o.CreatedBy = &v +} + +// GetCve returns the Cve field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCve() string { + if o == nil || o.Cve == nil { + var ret string + return ret + } + return *o.Cve +} + +// GetCveOk returns a tuple with the Cve field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCveOk() (*string, bool) { + if o == nil || o.Cve == nil { + return nil, false + } + return o.Cve, true +} + +// HasCve returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasCve() bool { + return o != nil && o.Cve != nil +} + +// SetCve gets a reference to the given string and assigns it to the Cve field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetCve(v string) { + o.Cve = &v +} + +// GetCwe returns the Cwe field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCwe() string { + if o == nil || o.Cwe == nil { + var ret string + return ret + } + return *o.Cwe +} + +// GetCweOk returns a tuple with the Cwe field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetCweOk() (*string, bool) { + if o == nil || o.Cwe == nil { + return nil, false + } + return o.Cwe, true +} + +// HasCwe returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasCwe() bool { + return o != nil && o.Cwe != nil +} + +// SetCwe gets a reference to the given string and assigns it to the Cwe field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetCwe(v string) { + o.Cwe = &v +} + +// GetData returns the Data field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetData() GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData { + if o == nil { + var ret GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData + 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetDataOk() (*GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetData(v GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) { + o.Data = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetDescription(v string) { + o.Description = &v +} + +// GetDocumentationUrl returns the DocumentationUrl field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetDocumentationUrl() string { + if o == nil || o.DocumentationUrl == nil { + var ret string + return ret + } + return *o.DocumentationUrl +} + +// GetDocumentationUrlOk returns a tuple with the DocumentationUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetDocumentationUrlOk() (*string, bool) { + if o == nil || o.DocumentationUrl == nil { + return nil, false + } + return o.DocumentationUrl, true +} + +// HasDocumentationUrl returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasDocumentationUrl() bool { + return o != nil && o.DocumentationUrl != nil +} + +// SetDocumentationUrl gets a reference to the given string and assigns it to the DocumentationUrl field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetDocumentationUrl(v string) { + o.DocumentationUrl = &v +} + +// GetEntityChecked returns the EntityChecked field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetEntityChecked() string { + if o == nil || o.EntityChecked == nil { + var ret string + return ret + } + return *o.EntityChecked +} + +// GetEntityCheckedOk returns a tuple with the EntityChecked field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetEntityCheckedOk() (*string, bool) { + if o == nil || o.EntityChecked == nil { + return nil, false + } + return o.EntityChecked, true +} + +// HasEntityChecked returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasEntityChecked() bool { + return o != nil && o.EntityChecked != nil +} + +// SetEntityChecked gets a reference to the given string and assigns it to the EntityChecked field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetEntityChecked(v string) { + o.EntityChecked = &v +} + +// GetIsPublished returns the IsPublished field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetIsPublished() bool { + if o == nil || o.IsPublished == nil { + var ret bool + return ret + } + return *o.IsPublished +} + +// GetIsPublishedOk returns a tuple with the IsPublished field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetIsPublishedOk() (*bool, bool) { + if o == nil || o.IsPublished == nil { + return nil, false + } + return o.IsPublished, true +} + +// HasIsPublished returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasIsPublished() bool { + return o != nil && o.IsPublished != nil +} + +// SetIsPublished gets a reference to the given bool and assigns it to the IsPublished field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetIsPublished(v bool) { + o.IsPublished = &v +} + +// GetIsTesting returns the IsTesting field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetIsTesting() bool { + if o == nil || o.IsTesting == nil { + var ret bool + return ret + } + return *o.IsTesting +} + +// GetIsTestingOk returns a tuple with the IsTesting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetIsTestingOk() (*bool, bool) { + if o == nil || o.IsTesting == nil { + return nil, false + } + return o.IsTesting, true +} + +// HasIsTesting returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasIsTesting() bool { + return o != nil && o.IsTesting != nil +} + +// SetIsTesting gets a reference to the given bool and assigns it to the IsTesting field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetIsTesting(v bool) { + o.IsTesting = &v +} + +// GetLanguage returns the Language field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetLanguage() string { + if o == nil || o.Language == nil { + var ret string + return ret + } + return *o.Language +} + +// GetLanguageOk returns a tuple with the Language field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetLanguageOk() (*string, bool) { + if o == nil || o.Language == nil { + return nil, false + } + return o.Language, true +} + +// HasLanguage returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasLanguage() bool { + return o != nil && o.Language != nil +} + +// SetLanguage gets a reference to the given string and assigns it to the Language field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetLanguage(v string) { + o.Language = &v +} + +// GetLastUpdatedAt returns the LastUpdatedAt field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetLastUpdatedAt() time.Time { + if o == nil || o.LastUpdatedAt == nil { + var ret time.Time + return ret + } + return *o.LastUpdatedAt +} + +// GetLastUpdatedAtOk returns a tuple with the LastUpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetLastUpdatedAtOk() (*time.Time, bool) { + if o == nil || o.LastUpdatedAt == nil { + return nil, false + } + return o.LastUpdatedAt, true +} + +// HasLastUpdatedAt returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasLastUpdatedAt() bool { + return o != nil && o.LastUpdatedAt != nil +} + +// SetLastUpdatedAt gets a reference to the given time.Time and assigns it to the LastUpdatedAt field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetLastUpdatedAt(v time.Time) { + o.LastUpdatedAt = &v +} + +// GetLastUpdatedBy returns the LastUpdatedBy field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetLastUpdatedBy() string { + if o == nil || o.LastUpdatedBy == nil { + var ret string + return ret + } + return *o.LastUpdatedBy +} + +// GetLastUpdatedByOk returns a tuple with the LastUpdatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetLastUpdatedByOk() (*string, bool) { + if o == nil || o.LastUpdatedBy == nil { + return nil, false + } + return o.LastUpdatedBy, true +} + +// HasLastUpdatedBy returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasLastUpdatedBy() bool { + return o != nil && o.LastUpdatedBy != nil +} + +// SetLastUpdatedBy gets a reference to the given string and assigns it to the LastUpdatedBy field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetLastUpdatedBy(v string) { + o.LastUpdatedBy = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetName(v string) { + o.Name = &v +} + +// GetRegex returns the Regex field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetRegex() string { + if o == nil || o.Regex == nil { + var ret string + return ret + } + return *o.Regex +} + +// GetRegexOk returns a tuple with the Regex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetRegexOk() (*string, bool) { + if o == nil || o.Regex == nil { + return nil, false + } + return o.Regex, true +} + +// HasRegex returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasRegex() bool { + return o != nil && o.Regex != nil +} + +// SetRegex gets a reference to the given string and assigns it to the Regex field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetRegex(v string) { + o.Regex = &v +} + +// GetSeverity returns the Severity field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetSeverity() string { + if o == nil || o.Severity == nil { + var ret string + return ret + } + return *o.Severity +} + +// GetSeverityOk returns a tuple with the Severity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetSeverityOk() (*string, bool) { + if o == nil || o.Severity == nil { + return nil, false + } + return o.Severity, true +} + +// HasSeverity returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasSeverity() bool { + return o != nil && o.Severity != nil +} + +// SetSeverity gets a reference to the given string and assigns it to the Severity field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetSeverity(v string) { + o.Severity = &v +} + +// GetShortDescription returns the ShortDescription field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetShortDescription() string { + if o == nil || o.ShortDescription == nil { + var ret string + return ret + } + return *o.ShortDescription +} + +// GetShortDescriptionOk returns a tuple with the ShortDescription field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetShortDescriptionOk() (*string, bool) { + if o == nil || o.ShortDescription == nil { + return nil, false + } + return o.ShortDescription, true +} + +// HasShortDescription returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasShortDescription() bool { + return o != nil && o.ShortDescription != nil +} + +// SetShortDescription gets a reference to the given string and assigns it to the ShortDescription field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetShortDescription(v string) { + o.ShortDescription = &v +} + +// GetShouldUseAiFix returns the ShouldUseAiFix field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetShouldUseAiFix() bool { + if o == nil || o.ShouldUseAiFix == nil { + var ret bool + return ret + } + return *o.ShouldUseAiFix +} + +// GetShouldUseAiFixOk returns a tuple with the ShouldUseAiFix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetShouldUseAiFixOk() (*bool, bool) { + if o == nil || o.ShouldUseAiFix == nil { + return nil, false + } + return o.ShouldUseAiFix, true +} + +// HasShouldUseAiFix returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasShouldUseAiFix() bool { + return o != nil && o.ShouldUseAiFix != nil +} + +// SetShouldUseAiFix gets a reference to the given bool and assigns it to the ShouldUseAiFix field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetShouldUseAiFix(v bool) { + o.ShouldUseAiFix = &v +} + +// GetTests returns the Tests field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetTests() []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems { + if o == nil || o.Tests == nil { + var ret []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems + return ret + } + return o.Tests +} + +// GetTestsOk returns a tuple with the Tests field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetTestsOk() (*[]GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems, bool) { + if o == nil || o.Tests == nil { + return nil, false + } + return &o.Tests, true +} + +// HasTests returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasTests() bool { + return o != nil && o.Tests != nil +} + +// SetTests gets a reference to the given []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems and assigns it to the Tests field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetTests(v []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) { + o.Tests = v +} + +// GetTreeSitterQuery returns the TreeSitterQuery field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetTreeSitterQuery() string { + if o == nil || o.TreeSitterQuery == nil { + var ret string + return ret + } + return *o.TreeSitterQuery +} + +// GetTreeSitterQueryOk returns a tuple with the TreeSitterQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetTreeSitterQueryOk() (*string, bool) { + if o == nil || o.TreeSitterQuery == nil { + return nil, false + } + return o.TreeSitterQuery, true +} + +// HasTreeSitterQuery returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasTreeSitterQuery() bool { + return o != nil && o.TreeSitterQuery != nil +} + +// SetTreeSitterQuery gets a reference to the given string and assigns it to the TreeSitterQuery field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetTreeSitterQuery(v string) { + o.TreeSitterQuery = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Arguments != nil { + toSerialize["arguments"] = o.Arguments + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.Checksum != nil { + toSerialize["checksum"] = o.Checksum + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.Cve != nil { + toSerialize["cve"] = o.Cve + } + if o.Cwe != nil { + toSerialize["cwe"] = o.Cwe + } + toSerialize["data"] = o.Data + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.DocumentationUrl != nil { + toSerialize["documentation_url"] = o.DocumentationUrl + } + if o.EntityChecked != nil { + toSerialize["entity_checked"] = o.EntityChecked + } + if o.IsPublished != nil { + toSerialize["is_published"] = o.IsPublished + } + if o.IsTesting != nil { + toSerialize["is_testing"] = o.IsTesting + } + if o.Language != nil { + toSerialize["language"] = o.Language + } + if o.LastUpdatedAt != nil { + if o.LastUpdatedAt.Nanosecond() == 0 { + toSerialize["last_updated_at"] = o.LastUpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["last_updated_at"] = o.LastUpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LastUpdatedBy != nil { + toSerialize["last_updated_by"] = o.LastUpdatedBy + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Regex != nil { + toSerialize["regex"] = o.Regex + } + if o.Severity != nil { + toSerialize["severity"] = o.Severity + } + if o.ShortDescription != nil { + toSerialize["short_description"] = o.ShortDescription + } + if o.ShouldUseAiFix != nil { + toSerialize["should_use_ai_fix"] = o.ShouldUseAiFix + } + if o.Tests != nil { + toSerialize["tests"] = o.Tests + } + if o.TreeSitterQuery != nil { + toSerialize["tree_sitter_query"] = o.TreeSitterQuery + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Arguments []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems `json:"arguments,omitempty"` + Category *string `json:"category,omitempty"` + Checksum *string `json:"checksum,omitempty"` + Code *string `json:"code,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreatedBy *string `json:"created_by,omitempty"` + Cve *string `json:"cve,omitempty"` + Cwe *string `json:"cwe,omitempty"` + Data *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData `json:"data"` + Description *string `json:"description,omitempty"` + DocumentationUrl *string `json:"documentation_url,omitempty"` + EntityChecked *string `json:"entity_checked,omitempty"` + IsPublished *bool `json:"is_published,omitempty"` + IsTesting *bool `json:"is_testing,omitempty"` + Language *string `json:"language,omitempty"` + LastUpdatedAt *time.Time `json:"last_updated_at,omitempty"` + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + Name *string `json:"name,omitempty"` + Regex *string `json:"regex,omitempty"` + Severity *string `json:"severity,omitempty"` + ShortDescription *string `json:"short_description,omitempty"` + ShouldUseAiFix *bool `json:"should_use_ai_fix,omitempty"` + Tests []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems `json:"tests,omitempty"` + TreeSitterQuery *string `json:"tree_sitter_query,omitempty"` + Type *string `json:"type,omitempty"` + }{} + 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{"arguments", "category", "checksum", "code", "created_at", "created_by", "cve", "cwe", "data", "description", "documentation_url", "entity_checked", "is_published", "is_testing", "language", "last_updated_at", "last_updated_by", "name", "regex", "severity", "short_description", "should_use_ai_fix", "tests", "tree_sitter_query", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Arguments = all.Arguments + o.Category = all.Category + o.Checksum = all.Checksum + o.Code = all.Code + o.CreatedAt = all.CreatedAt + o.CreatedBy = all.CreatedBy + o.Cve = all.Cve + o.Cwe = all.Cwe + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Description = all.Description + o.DocumentationUrl = all.DocumentationUrl + o.EntityChecked = all.EntityChecked + o.IsPublished = all.IsPublished + o.IsTesting = all.IsTesting + o.Language = all.Language + o.LastUpdatedAt = all.LastUpdatedAt + o.LastUpdatedBy = all.LastUpdatedBy + o.Name = all.Name + o.Regex = all.Regex + o.Severity = all.Severity + o.ShortDescription = all.ShortDescription + o.ShouldUseAiFix = all.ShouldUseAiFix + o.Tests = all.Tests + o.TreeSitterQuery = all.TreeSitterQuery + 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_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items.go new file mode 100644 index 00000000000..a68a75de9e6 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_arguments_items.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" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems struct { + // + Description *string `json:"description,omitempty"` + // + Name *string `json:"name,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:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems{} + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItemsWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItemsWithDefaults() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) SetDescription(v string) { + o.Description = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsArgumentsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,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{"description", "name"}) + } else { + return err + } + o.Description = all.Description + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data.go new file mode 100644 index 00000000000..cf472a7212f --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_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" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData struct { + // + Id *string `json:"id,omitempty"` + // Rules resource type. + Type GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType `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:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData(typeVar GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType) *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData{} + this.Type = typeVar + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataWithDefaults() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData{} + var typeVar GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType = GETMULTIPLERULESETSRESPONSEDATAATTRIBUTESRULESETSITEMSRULESITEMSDATATYPE_RULES + this.Type = typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) GetType() GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType { + if o == nil { + var ret GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType + 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) GetTypeOk() (*GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) SetType(v GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Type *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + 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{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + 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_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.go new file mode 100644 index 00000000000..35d33d717fb --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType Rules resource type. +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType string + +// List of GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType. +const ( + GETMULTIPLERULESETSRESPONSEDATAATTRIBUTESRULESETSITEMSRULESITEMSDATATYPE_RULES GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType = "rules" +) + +var allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeEnumValues = []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType{ + GETMULTIPLERULESETSRESPONSEDATAATTRIBUTESRULESETSITEMSRULESITEMSDATATYPE_RULES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType) GetAllowedValues() []GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType { + return allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType(value) + return nil +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeFromValue returns a pointer to a valid GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeFromValue(v string) (*GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType, error) { + ev := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType: valid values are %v", v, allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType) IsValid() bool { + for _, existing := range allowedGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType value. +func (v GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType) Ptr() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsDataType { + return &v +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items.go b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items.go new file mode 100644 index 00000000000..7e2560986bd --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_attributes_rulesets_items_rules_items_tests_items.go @@ -0,0 +1,172 @@ +// 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" +) + +// GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems +type GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems struct { + // + AnnotationCount *int64 `json:"annotation_count,omitempty"` + // + Code *string `json:"code,omitempty"` + // + Filename *string `json:"filename,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:"-"` +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems{} + return &this +} + +// NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItemsWithDefaults instantiates a new GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems 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 NewGetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItemsWithDefaults() *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems { + this := GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems{} + return &this +} + +// GetAnnotationCount returns the AnnotationCount field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) GetAnnotationCount() int64 { + if o == nil || o.AnnotationCount == nil { + var ret int64 + return ret + } + return *o.AnnotationCount +} + +// GetAnnotationCountOk returns a tuple with the AnnotationCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) GetAnnotationCountOk() (*int64, bool) { + if o == nil || o.AnnotationCount == nil { + return nil, false + } + return o.AnnotationCount, true +} + +// HasAnnotationCount returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) HasAnnotationCount() bool { + return o != nil && o.AnnotationCount != nil +} + +// SetAnnotationCount gets a reference to the given int64 and assigns it to the AnnotationCount field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) SetAnnotationCount(v int64) { + o.AnnotationCount = &v +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) GetCode() string { + if o == nil || o.Code == nil { + var ret string + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) GetCodeOk() (*string, bool) { + if o == nil || o.Code == nil { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) HasCode() bool { + return o != nil && o.Code != nil +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) SetCode(v string) { + o.Code = &v +} + +// GetFilename returns the Filename field value if set, zero value otherwise. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) GetFilename() string { + if o == nil || o.Filename == nil { + var ret string + return ret + } + return *o.Filename +} + +// GetFilenameOk returns a tuple with the Filename field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) GetFilenameOk() (*string, bool) { + if o == nil || o.Filename == nil { + return nil, false + } + return o.Filename, true +} + +// HasFilename returns a boolean if a field has been set. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) HasFilename() bool { + return o != nil && o.Filename != nil +} + +// SetFilename gets a reference to the given string and assigns it to the Filename field. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) SetFilename(v string) { + o.Filename = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AnnotationCount != nil { + toSerialize["annotation_count"] = o.AnnotationCount + } + if o.Code != nil { + toSerialize["code"] = o.Code + } + if o.Filename != nil { + toSerialize["filename"] = o.Filename + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *GetMultipleRulesetsResponseDataAttributesRulesetsItemsRulesItemsTestsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AnnotationCount *int64 `json:"annotation_count,omitempty"` + Code *string `json:"code,omitempty"` + Filename *string `json:"filename,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{"annotation_count", "code", "filename"}) + } else { + return err + } + o.AnnotationCount = all.AnnotationCount + o.Code = all.Code + o.Filename = all.Filename + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_get_multiple_rulesets_response_data_type.go b/api/datadogV2/model_get_multiple_rulesets_response_data_type.go new file mode 100644 index 00000000000..1b40368def8 --- /dev/null +++ b/api/datadogV2/model_get_multiple_rulesets_response_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// GetMultipleRulesetsResponseDataType Get multiple rulesets response resource type. +type GetMultipleRulesetsResponseDataType string + +// List of GetMultipleRulesetsResponseDataType. +const ( + GETMULTIPLERULESETSRESPONSEDATATYPE_GET_MULTIPLE_RULESETS_RESPONSE GetMultipleRulesetsResponseDataType = "get_multiple_rulesets_response" +) + +var allowedGetMultipleRulesetsResponseDataTypeEnumValues = []GetMultipleRulesetsResponseDataType{ + GETMULTIPLERULESETSRESPONSEDATATYPE_GET_MULTIPLE_RULESETS_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *GetMultipleRulesetsResponseDataType) GetAllowedValues() []GetMultipleRulesetsResponseDataType { + return allowedGetMultipleRulesetsResponseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *GetMultipleRulesetsResponseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = GetMultipleRulesetsResponseDataType(value) + return nil +} + +// NewGetMultipleRulesetsResponseDataTypeFromValue returns a pointer to a valid GetMultipleRulesetsResponseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewGetMultipleRulesetsResponseDataTypeFromValue(v string) (*GetMultipleRulesetsResponseDataType, error) { + ev := GetMultipleRulesetsResponseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for GetMultipleRulesetsResponseDataType: valid values are %v", v, allowedGetMultipleRulesetsResponseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v GetMultipleRulesetsResponseDataType) IsValid() bool { + for _, existing := range allowedGetMultipleRulesetsResponseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GetMultipleRulesetsResponseDataType value. +func (v GetMultipleRulesetsResponseDataType) Ptr() *GetMultipleRulesetsResponseDataType { + return &v +} diff --git a/api/datadogV2/model_secret_rule_array.go b/api/datadogV2/model_secret_rule_array.go new file mode 100644 index 00000000000..9f21d0ec1ae --- /dev/null +++ b/api/datadogV2/model_secret_rule_array.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecretRuleArray +type SecretRuleArray struct { + // + Data []SecretRuleData `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:"-"` +} + +// NewSecretRuleArray instantiates a new SecretRuleArray 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 NewSecretRuleArray(data []SecretRuleData) *SecretRuleArray { + this := SecretRuleArray{} + this.Data = data + return &this +} + +// NewSecretRuleArrayWithDefaults instantiates a new SecretRuleArray 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 NewSecretRuleArrayWithDefaults() *SecretRuleArray { + this := SecretRuleArray{} + return &this +} + +// GetData returns the Data field value. +func (o *SecretRuleArray) GetData() []SecretRuleData { + if o == nil { + var ret []SecretRuleData + 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 *SecretRuleArray) GetDataOk() (*[]SecretRuleData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecretRuleArray) SetData(v []SecretRuleData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecretRuleArray) 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 *SecretRuleArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]SecretRuleData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_secret_rule_data.go b/api/datadogV2/model_secret_rule_data.go new file mode 100644 index 00000000000..b57fc257de5 --- /dev/null +++ b/api/datadogV2/model_secret_rule_data.go @@ -0,0 +1,186 @@ +// 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" +) + +// SecretRuleData +type SecretRuleData struct { + // + Attributes *SecretRuleDataAttributes `json:"attributes,omitempty"` + // + Id *string `json:"id,omitempty"` + // Secret rule resource type. + Type SecretRuleDataType `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:"-"` +} + +// NewSecretRuleData instantiates a new SecretRuleData 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 NewSecretRuleData(typeVar SecretRuleDataType) *SecretRuleData { + this := SecretRuleData{} + this.Type = typeVar + return &this +} + +// NewSecretRuleDataWithDefaults instantiates a new SecretRuleData 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 NewSecretRuleDataWithDefaults() *SecretRuleData { + this := SecretRuleData{} + var typeVar SecretRuleDataType = SECRETRULEDATATYPE_SECRET_RULE + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SecretRuleData) GetAttributes() SecretRuleDataAttributes { + if o == nil || o.Attributes == nil { + var ret SecretRuleDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleData) GetAttributesOk() (*SecretRuleDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *SecretRuleData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SecretRuleDataAttributes and assigns it to the Attributes field. +func (o *SecretRuleData) SetAttributes(v SecretRuleDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecretRuleData) 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 *SecretRuleData) 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 *SecretRuleData) 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 *SecretRuleData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *SecretRuleData) GetType() SecretRuleDataType { + if o == nil { + var ret SecretRuleDataType + 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 *SecretRuleData) GetTypeOk() (*SecretRuleDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SecretRuleData) SetType(v SecretRuleDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecretRuleData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + 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 *SecretRuleData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SecretRuleDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SecretRuleDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_secret_rule_data_attributes.go b/api/datadogV2/model_secret_rule_data_attributes.go new file mode 100644 index 00000000000..5c0934afbaf --- /dev/null +++ b/api/datadogV2/model_secret_rule_data_attributes.go @@ -0,0 +1,391 @@ +// 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" +) + +// SecretRuleDataAttributes +type SecretRuleDataAttributes struct { + // + DefaultIncludedKeywords []string `json:"default_included_keywords,omitempty"` + // + Description *string `json:"description,omitempty"` + // + License *string `json:"license,omitempty"` + // + MatchValidation *SecretRuleDataAttributesMatchValidation `json:"match_validation,omitempty"` + // + Name *string `json:"name,omitempty"` + // + Pattern *string `json:"pattern,omitempty"` + // + Priority *string `json:"priority,omitempty"` + // + SdsId *string `json:"sds_id,omitempty"` + // + Validators []string `json:"validators,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:"-"` +} + +// NewSecretRuleDataAttributes instantiates a new SecretRuleDataAttributes 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 NewSecretRuleDataAttributes() *SecretRuleDataAttributes { + this := SecretRuleDataAttributes{} + return &this +} + +// NewSecretRuleDataAttributesWithDefaults instantiates a new SecretRuleDataAttributes 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 NewSecretRuleDataAttributesWithDefaults() *SecretRuleDataAttributes { + this := SecretRuleDataAttributes{} + return &this +} + +// GetDefaultIncludedKeywords returns the DefaultIncludedKeywords field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetDefaultIncludedKeywords() []string { + if o == nil || o.DefaultIncludedKeywords == nil { + var ret []string + return ret + } + return o.DefaultIncludedKeywords +} + +// GetDefaultIncludedKeywordsOk returns a tuple with the DefaultIncludedKeywords field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetDefaultIncludedKeywordsOk() (*[]string, bool) { + if o == nil || o.DefaultIncludedKeywords == nil { + return nil, false + } + return &o.DefaultIncludedKeywords, true +} + +// HasDefaultIncludedKeywords returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasDefaultIncludedKeywords() bool { + return o != nil && o.DefaultIncludedKeywords != nil +} + +// SetDefaultIncludedKeywords gets a reference to the given []string and assigns it to the DefaultIncludedKeywords field. +func (o *SecretRuleDataAttributes) SetDefaultIncludedKeywords(v []string) { + o.DefaultIncludedKeywords = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SecretRuleDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetLicense returns the License field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetLicense() string { + if o == nil || o.License == nil { + var ret string + return ret + } + return *o.License +} + +// GetLicenseOk returns a tuple with the License field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetLicenseOk() (*string, bool) { + if o == nil || o.License == nil { + return nil, false + } + return o.License, true +} + +// HasLicense returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasLicense() bool { + return o != nil && o.License != nil +} + +// SetLicense gets a reference to the given string and assigns it to the License field. +func (o *SecretRuleDataAttributes) SetLicense(v string) { + o.License = &v +} + +// GetMatchValidation returns the MatchValidation field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetMatchValidation() SecretRuleDataAttributesMatchValidation { + if o == nil || o.MatchValidation == nil { + var ret SecretRuleDataAttributesMatchValidation + return ret + } + return *o.MatchValidation +} + +// GetMatchValidationOk returns a tuple with the MatchValidation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetMatchValidationOk() (*SecretRuleDataAttributesMatchValidation, bool) { + if o == nil || o.MatchValidation == nil { + return nil, false + } + return o.MatchValidation, true +} + +// HasMatchValidation returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasMatchValidation() bool { + return o != nil && o.MatchValidation != nil +} + +// SetMatchValidation gets a reference to the given SecretRuleDataAttributesMatchValidation and assigns it to the MatchValidation field. +func (o *SecretRuleDataAttributes) SetMatchValidation(v SecretRuleDataAttributesMatchValidation) { + o.MatchValidation = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) 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 *SecretRuleDataAttributes) 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 *SecretRuleDataAttributes) 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 *SecretRuleDataAttributes) SetName(v string) { + o.Name = &v +} + +// GetPattern returns the Pattern field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetPattern() string { + if o == nil || o.Pattern == nil { + var ret string + return ret + } + return *o.Pattern +} + +// GetPatternOk returns a tuple with the Pattern field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetPatternOk() (*string, bool) { + if o == nil || o.Pattern == nil { + return nil, false + } + return o.Pattern, true +} + +// HasPattern returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasPattern() bool { + return o != nil && o.Pattern != nil +} + +// SetPattern gets a reference to the given string and assigns it to the Pattern field. +func (o *SecretRuleDataAttributes) SetPattern(v string) { + o.Pattern = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetPriority() string { + if o == nil || o.Priority == nil { + var ret string + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetPriorityOk() (*string, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given string and assigns it to the Priority field. +func (o *SecretRuleDataAttributes) SetPriority(v string) { + o.Priority = &v +} + +// GetSdsId returns the SdsId field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetSdsId() string { + if o == nil || o.SdsId == nil { + var ret string + return ret + } + return *o.SdsId +} + +// GetSdsIdOk returns a tuple with the SdsId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetSdsIdOk() (*string, bool) { + if o == nil || o.SdsId == nil { + return nil, false + } + return o.SdsId, true +} + +// HasSdsId returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasSdsId() bool { + return o != nil && o.SdsId != nil +} + +// SetSdsId gets a reference to the given string and assigns it to the SdsId field. +func (o *SecretRuleDataAttributes) SetSdsId(v string) { + o.SdsId = &v +} + +// GetValidators returns the Validators field value if set, zero value otherwise. +func (o *SecretRuleDataAttributes) GetValidators() []string { + if o == nil || o.Validators == nil { + var ret []string + return ret + } + return o.Validators +} + +// GetValidatorsOk returns a tuple with the Validators field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributes) GetValidatorsOk() (*[]string, bool) { + if o == nil || o.Validators == nil { + return nil, false + } + return &o.Validators, true +} + +// HasValidators returns a boolean if a field has been set. +func (o *SecretRuleDataAttributes) HasValidators() bool { + return o != nil && o.Validators != nil +} + +// SetValidators gets a reference to the given []string and assigns it to the Validators field. +func (o *SecretRuleDataAttributes) SetValidators(v []string) { + o.Validators = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecretRuleDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DefaultIncludedKeywords != nil { + toSerialize["default_included_keywords"] = o.DefaultIncludedKeywords + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.License != nil { + toSerialize["license"] = o.License + } + if o.MatchValidation != nil { + toSerialize["match_validation"] = o.MatchValidation + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Pattern != nil { + toSerialize["pattern"] = o.Pattern + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.SdsId != nil { + toSerialize["sds_id"] = o.SdsId + } + if o.Validators != nil { + toSerialize["validators"] = o.Validators + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecretRuleDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DefaultIncludedKeywords []string `json:"default_included_keywords,omitempty"` + Description *string `json:"description,omitempty"` + License *string `json:"license,omitempty"` + MatchValidation *SecretRuleDataAttributesMatchValidation `json:"match_validation,omitempty"` + Name *string `json:"name,omitempty"` + Pattern *string `json:"pattern,omitempty"` + Priority *string `json:"priority,omitempty"` + SdsId *string `json:"sds_id,omitempty"` + Validators []string `json:"validators,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{"default_included_keywords", "description", "license", "match_validation", "name", "pattern", "priority", "sds_id", "validators"}) + } else { + return err + } + + hasInvalidField := false + o.DefaultIncludedKeywords = all.DefaultIncludedKeywords + o.Description = all.Description + o.License = all.License + if all.MatchValidation != nil && all.MatchValidation.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.MatchValidation = all.MatchValidation + o.Name = all.Name + o.Pattern = all.Pattern + o.Priority = all.Priority + o.SdsId = all.SdsId + o.Validators = all.Validators + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_secret_rule_data_attributes_match_validation.go b/api/datadogV2/model_secret_rule_data_attributes_match_validation.go new file mode 100644 index 00000000000..fbbe036a4ab --- /dev/null +++ b/api/datadogV2/model_secret_rule_data_attributes_match_validation.go @@ -0,0 +1,347 @@ +// 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" +) + +// SecretRuleDataAttributesMatchValidation +type SecretRuleDataAttributesMatchValidation struct { + // + Endpoint *string `json:"endpoint,omitempty"` + // + Hosts []string `json:"hosts,omitempty"` + // + HttpMethod *string `json:"http_method,omitempty"` + // + InvalidHttpStatusCode []SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems `json:"invalid_http_status_code,omitempty"` + // + RequestHeaders map[string]string `json:"request_headers,omitempty"` + // + TimeoutSeconds *int64 `json:"timeout_seconds,omitempty"` + // + Type *string `json:"type,omitempty"` + // + ValidHttpStatusCode []SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems `json:"valid_http_status_code,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:"-"` +} + +// NewSecretRuleDataAttributesMatchValidation instantiates a new SecretRuleDataAttributesMatchValidation 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 NewSecretRuleDataAttributesMatchValidation() *SecretRuleDataAttributesMatchValidation { + this := SecretRuleDataAttributesMatchValidation{} + return &this +} + +// NewSecretRuleDataAttributesMatchValidationWithDefaults instantiates a new SecretRuleDataAttributesMatchValidation 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 NewSecretRuleDataAttributesMatchValidationWithDefaults() *SecretRuleDataAttributesMatchValidation { + this := SecretRuleDataAttributesMatchValidation{} + return &this +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetEndpoint() string { + if o == nil || o.Endpoint == nil { + var ret string + return ret + } + return *o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetEndpointOk() (*string, bool) { + if o == nil || o.Endpoint == nil { + return nil, false + } + return o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasEndpoint() bool { + return o != nil && o.Endpoint != nil +} + +// SetEndpoint gets a reference to the given string and assigns it to the Endpoint field. +func (o *SecretRuleDataAttributesMatchValidation) SetEndpoint(v string) { + o.Endpoint = &v +} + +// GetHosts returns the Hosts field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetHosts() []string { + if o == nil || o.Hosts == nil { + var ret []string + return ret + } + return o.Hosts +} + +// GetHostsOk returns a tuple with the Hosts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetHostsOk() (*[]string, bool) { + if o == nil || o.Hosts == nil { + return nil, false + } + return &o.Hosts, true +} + +// HasHosts returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasHosts() bool { + return o != nil && o.Hosts != nil +} + +// SetHosts gets a reference to the given []string and assigns it to the Hosts field. +func (o *SecretRuleDataAttributesMatchValidation) SetHosts(v []string) { + o.Hosts = v +} + +// GetHttpMethod returns the HttpMethod field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetHttpMethod() string { + if o == nil || o.HttpMethod == nil { + var ret string + return ret + } + return *o.HttpMethod +} + +// GetHttpMethodOk returns a tuple with the HttpMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetHttpMethodOk() (*string, bool) { + if o == nil || o.HttpMethod == nil { + return nil, false + } + return o.HttpMethod, true +} + +// HasHttpMethod returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasHttpMethod() bool { + return o != nil && o.HttpMethod != nil +} + +// SetHttpMethod gets a reference to the given string and assigns it to the HttpMethod field. +func (o *SecretRuleDataAttributesMatchValidation) SetHttpMethod(v string) { + o.HttpMethod = &v +} + +// GetInvalidHttpStatusCode returns the InvalidHttpStatusCode field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetInvalidHttpStatusCode() []SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems { + if o == nil || o.InvalidHttpStatusCode == nil { + var ret []SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems + return ret + } + return o.InvalidHttpStatusCode +} + +// GetInvalidHttpStatusCodeOk returns a tuple with the InvalidHttpStatusCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetInvalidHttpStatusCodeOk() (*[]SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems, bool) { + if o == nil || o.InvalidHttpStatusCode == nil { + return nil, false + } + return &o.InvalidHttpStatusCode, true +} + +// HasInvalidHttpStatusCode returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasInvalidHttpStatusCode() bool { + return o != nil && o.InvalidHttpStatusCode != nil +} + +// SetInvalidHttpStatusCode gets a reference to the given []SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems and assigns it to the InvalidHttpStatusCode field. +func (o *SecretRuleDataAttributesMatchValidation) SetInvalidHttpStatusCode(v []SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) { + o.InvalidHttpStatusCode = v +} + +// GetRequestHeaders returns the RequestHeaders field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetRequestHeaders() map[string]string { + if o == nil || o.RequestHeaders == nil { + var ret map[string]string + return ret + } + return o.RequestHeaders +} + +// GetRequestHeadersOk returns a tuple with the RequestHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetRequestHeadersOk() (*map[string]string, bool) { + if o == nil || o.RequestHeaders == nil { + return nil, false + } + return &o.RequestHeaders, true +} + +// HasRequestHeaders returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasRequestHeaders() bool { + return o != nil && o.RequestHeaders != nil +} + +// SetRequestHeaders gets a reference to the given map[string]string and assigns it to the RequestHeaders field. +func (o *SecretRuleDataAttributesMatchValidation) SetRequestHeaders(v map[string]string) { + o.RequestHeaders = v +} + +// GetTimeoutSeconds returns the TimeoutSeconds field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetTimeoutSeconds() int64 { + if o == nil || o.TimeoutSeconds == nil { + var ret int64 + return ret + } + return *o.TimeoutSeconds +} + +// GetTimeoutSecondsOk returns a tuple with the TimeoutSeconds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetTimeoutSecondsOk() (*int64, bool) { + if o == nil || o.TimeoutSeconds == nil { + return nil, false + } + return o.TimeoutSeconds, true +} + +// HasTimeoutSeconds returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasTimeoutSeconds() bool { + return o != nil && o.TimeoutSeconds != nil +} + +// SetTimeoutSeconds gets a reference to the given int64 and assigns it to the TimeoutSeconds field. +func (o *SecretRuleDataAttributesMatchValidation) SetTimeoutSeconds(v int64) { + o.TimeoutSeconds = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *SecretRuleDataAttributesMatchValidation) SetType(v string) { + o.Type = &v +} + +// GetValidHttpStatusCode returns the ValidHttpStatusCode field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidation) GetValidHttpStatusCode() []SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems { + if o == nil || o.ValidHttpStatusCode == nil { + var ret []SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems + return ret + } + return o.ValidHttpStatusCode +} + +// GetValidHttpStatusCodeOk returns a tuple with the ValidHttpStatusCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidation) GetValidHttpStatusCodeOk() (*[]SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems, bool) { + if o == nil || o.ValidHttpStatusCode == nil { + return nil, false + } + return &o.ValidHttpStatusCode, true +} + +// HasValidHttpStatusCode returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidation) HasValidHttpStatusCode() bool { + return o != nil && o.ValidHttpStatusCode != nil +} + +// SetValidHttpStatusCode gets a reference to the given []SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems and assigns it to the ValidHttpStatusCode field. +func (o *SecretRuleDataAttributesMatchValidation) SetValidHttpStatusCode(v []SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) { + o.ValidHttpStatusCode = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecretRuleDataAttributesMatchValidation) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + if o.Hosts != nil { + toSerialize["hosts"] = o.Hosts + } + if o.HttpMethod != nil { + toSerialize["http_method"] = o.HttpMethod + } + if o.InvalidHttpStatusCode != nil { + toSerialize["invalid_http_status_code"] = o.InvalidHttpStatusCode + } + if o.RequestHeaders != nil { + toSerialize["request_headers"] = o.RequestHeaders + } + if o.TimeoutSeconds != nil { + toSerialize["timeout_seconds"] = o.TimeoutSeconds + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.ValidHttpStatusCode != nil { + toSerialize["valid_http_status_code"] = o.ValidHttpStatusCode + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecretRuleDataAttributesMatchValidation) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Endpoint *string `json:"endpoint,omitempty"` + Hosts []string `json:"hosts,omitempty"` + HttpMethod *string `json:"http_method,omitempty"` + InvalidHttpStatusCode []SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems `json:"invalid_http_status_code,omitempty"` + RequestHeaders map[string]string `json:"request_headers,omitempty"` + TimeoutSeconds *int64 `json:"timeout_seconds,omitempty"` + Type *string `json:"type,omitempty"` + ValidHttpStatusCode []SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems `json:"valid_http_status_code,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{"endpoint", "hosts", "http_method", "invalid_http_status_code", "request_headers", "timeout_seconds", "type", "valid_http_status_code"}) + } else { + return err + } + o.Endpoint = all.Endpoint + o.Hosts = all.Hosts + o.HttpMethod = all.HttpMethod + o.InvalidHttpStatusCode = all.InvalidHttpStatusCode + o.RequestHeaders = all.RequestHeaders + o.TimeoutSeconds = all.TimeoutSeconds + o.Type = all.Type + o.ValidHttpStatusCode = all.ValidHttpStatusCode + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_secret_rule_data_attributes_match_validation_invalid_http_status_code_items.go b/api/datadogV2/model_secret_rule_data_attributes_match_validation_invalid_http_status_code_items.go new file mode 100644 index 00000000000..d2a4cc4b191 --- /dev/null +++ b/api/datadogV2/model_secret_rule_data_attributes_match_validation_invalid_http_status_code_items.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" +) + +// SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems +type SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems struct { + // + End *int64 `json:"end,omitempty"` + // + Start *int64 `json:"start,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:"-"` +} + +// NewSecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems instantiates a new SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems 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 NewSecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems() *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems { + this := SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems{} + return &this +} + +// NewSecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItemsWithDefaults instantiates a new SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems 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 NewSecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItemsWithDefaults() *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems { + this := SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) HasEnd() bool { + return o != nil && o.End != nil +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) SetEnd(v int64) { + o.End = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) HasStart() bool { + return o != nil && o.Start != nil +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) SetStart(v int64) { + o.Start = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End *int64 `json:"end,omitempty"` + Start *int64 `json:"start,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{"end", "start"}) + } else { + return err + } + o.End = all.End + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_secret_rule_data_attributes_match_validation_valid_http_status_code_items.go b/api/datadogV2/model_secret_rule_data_attributes_match_validation_valid_http_status_code_items.go new file mode 100644 index 00000000000..dcce65fd7e0 --- /dev/null +++ b/api/datadogV2/model_secret_rule_data_attributes_match_validation_valid_http_status_code_items.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" +) + +// SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems +type SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems struct { + // + End *int64 `json:"end,omitempty"` + // + Start *int64 `json:"start,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:"-"` +} + +// NewSecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems instantiates a new SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems 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 NewSecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems() *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems { + this := SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems{} + return &this +} + +// NewSecretRuleDataAttributesMatchValidationValidHttpStatusCodeItemsWithDefaults instantiates a new SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems 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 NewSecretRuleDataAttributesMatchValidationValidHttpStatusCodeItemsWithDefaults() *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems { + this := SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems{} + return &this +} + +// GetEnd returns the End field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) GetEnd() int64 { + if o == nil || o.End == nil { + var ret int64 + return ret + } + return *o.End +} + +// GetEndOk returns a tuple with the End field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) GetEndOk() (*int64, bool) { + if o == nil || o.End == nil { + return nil, false + } + return o.End, true +} + +// HasEnd returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) HasEnd() bool { + return o != nil && o.End != nil +} + +// SetEnd gets a reference to the given int64 and assigns it to the End field. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) SetEnd(v int64) { + o.End = &v +} + +// GetStart returns the Start field value if set, zero value otherwise. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) GetStart() int64 { + if o == nil || o.Start == nil { + var ret int64 + return ret + } + return *o.Start +} + +// GetStartOk returns a tuple with the Start field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) GetStartOk() (*int64, bool) { + if o == nil || o.Start == nil { + return nil, false + } + return o.Start, true +} + +// HasStart returns a boolean if a field has been set. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) HasStart() bool { + return o != nil && o.Start != nil +} + +// SetStart gets a reference to the given int64 and assigns it to the Start field. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) SetStart(v int64) { + o.Start = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.End != nil { + toSerialize["end"] = o.End + } + if o.Start != nil { + toSerialize["start"] = o.Start + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + End *int64 `json:"end,omitempty"` + Start *int64 `json:"start,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{"end", "start"}) + } else { + return err + } + o.End = all.End + o.Start = all.Start + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_secret_rule_data_type.go b/api/datadogV2/model_secret_rule_data_type.go new file mode 100644 index 00000000000..9b470e5e555 --- /dev/null +++ b/api/datadogV2/model_secret_rule_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecretRuleDataType Secret rule resource type. +type SecretRuleDataType string + +// List of SecretRuleDataType. +const ( + SECRETRULEDATATYPE_SECRET_RULE SecretRuleDataType = "secret_rule" +) + +var allowedSecretRuleDataTypeEnumValues = []SecretRuleDataType{ + SECRETRULEDATATYPE_SECRET_RULE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecretRuleDataType) GetAllowedValues() []SecretRuleDataType { + return allowedSecretRuleDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecretRuleDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecretRuleDataType(value) + return nil +} + +// NewSecretRuleDataTypeFromValue returns a pointer to a valid SecretRuleDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecretRuleDataTypeFromValue(v string) (*SecretRuleDataType, error) { + ev := SecretRuleDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecretRuleDataType: valid values are %v", v, allowedSecretRuleDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecretRuleDataType) IsValid() bool { + for _, existing := range allowedSecretRuleDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecretRuleDataType value. +func (v SecretRuleDataType) Ptr() *SecretRuleDataType { + return &v +} diff --git a/examples/v2/security-monitoring/GetSecretsRules.go b/examples/v2/security-monitoring/GetSecretsRules.go new file mode 100644 index 00000000000..8f47e8475cd --- /dev/null +++ b/examples/v2/security-monitoring/GetSecretsRules.go @@ -0,0 +1,30 @@ +// Returns list of Secrets rules returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetSecretsRules", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.GetSecretsRules(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.GetSecretsRules`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.GetSecretsRules`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/ListMultipleRulesets.go b/examples/v2/security-monitoring/ListMultipleRulesets.go new file mode 100644 index 00000000000..915444918af --- /dev/null +++ b/examples/v2/security-monitoring/ListMultipleRulesets.go @@ -0,0 +1,38 @@ +// Ruleset get multiple returns "OK" 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.GetMultipleRulesetsRequest{ + Data: &datadogV2.GetMultipleRulesetsRequestData{ + Attributes: &datadogV2.GetMultipleRulesetsRequestDataAttributes{ + Rulesets: []string{}, + }, + Type: datadogV2.GETMULTIPLERULESETSREQUESTDATATYPE_GET_MULTIPLE_RULESETS_REQUEST, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListMultipleRulesets", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.ListMultipleRulesets(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.ListMultipleRulesets`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.ListMultipleRulesets`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index 703fc3e460f..2937151efb2 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -5,9 +5,9 @@ Feature: Security Monitoring information. Background: - Given a valid "apiKeyAuth" key in the system + Given an instance of "SecurityMonitoring" API + And a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system - And an instance of "SecurityMonitoring" API @team:DataDog/k9-cloud-security-platform Scenario: Cancel a historical job returns "Bad Request" response @@ -1295,6 +1295,21 @@ Feature: Security Monitoring When the request is sent Then the response status is 422 The server cannot process the request because it contains invalid data. + @generated @skip @team:DataDog/asm-vm + Scenario: Returns list of Secrets rules returns "OK" response + Given operation "GetSecretsRules" enabled + And new "GetSecretsRules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/asm-vm + Scenario: Ruleset get multiple returns "OK" response + Given operation "ListMultipleRulesets" enabled + And new "ListMultipleRulesets" request + And body with value {"data": {"attributes": {"rulesets": []}, "type": "get_multiple_rulesets_request"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/k9-cloud-security-platform Scenario: Run a threat hunting job returns "Bad Request" response Given operation "RunThreatHuntingJob" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index ec7eca2cfdf..f4a7f9e7f8d 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4025,6 +4025,20 @@ "type": "safe" } }, + "ListMultipleRulesets": { + "tag": "Security Monitoring", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "GetSecretsRules": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "GetOnDemandConcurrencyCap": { "tag": "Synthetics", "undo": {