diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 93efc78e5a9..9632e2d7de2 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1157,6 +1157,24 @@ components: schema: $ref: '#/components/schemas/APIErrorResponse' description: Forbidden + HTTPCDGatesBadRequestResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCDGatesBadRequestResponse' + description: Bad request. + HTTPCDGatesNotFoundResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCDGatesNotFoundResponse' + description: Deployment gate not found. + HTTPCDRulesNotFoundResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCDRulesNotFoundResponse' + description: Deployment rule not found. NotAuthorizedResponse: content: application/json: @@ -12576,6 +12594,91 @@ components: meta: $ref: '#/components/schemas/DataDeletionResponseMeta' type: object + CreateDeploymentGateParams: + description: Parameters for creating a deployment gate. + properties: + data: + $ref: '#/components/schemas/CreateDeploymentGateParamsData' + required: + - data + type: object + CreateDeploymentGateParamsData: + description: Parameters for creating a deployment gate. + properties: + attributes: + $ref: '#/components/schemas/CreateDeploymentGateParamsDataAttributes' + type: + $ref: '#/components/schemas/DeploymentGateDataType' + required: + - type + - attributes + type: object + CreateDeploymentGateParamsDataAttributes: + description: Parameters for creating a deployment gate. + properties: + dry_run: + default: false + description: Whether this gate is run in dry-run mode. + example: false + type: boolean + env: + description: The environment of the deployment gate. + example: production + type: string + identifier: + default: default + description: The identifier of the deployment gate. + example: pre + type: string + service: + description: The service of the deployment gate. + example: my-service + type: string + required: + - env + - service + type: object + CreateDeploymentRuleParams: + description: Parameters for creating a deployment rule. + properties: + data: + $ref: '#/components/schemas/CreateDeploymentRuleParamsData' + type: object + CreateDeploymentRuleParamsData: + description: Parameters for creating a deployment rule. + properties: + attributes: + $ref: '#/components/schemas/CreateDeploymentRuleParamsDataAttributes' + type: + $ref: '#/components/schemas/DeploymentRuleDataType' + required: + - type + - attributes + type: object + CreateDeploymentRuleParamsDataAttributes: + description: Parameters for creating a deployment rule. + properties: + dry_run: + default: false + description: Whether this rule is run in dry-run mode. + example: false + type: boolean + name: + description: The name of the deployment rule. + example: My deployment rule + type: string + options: + $ref: '#/components/schemas/DeploymentRulesOptions' + type: + description: The type of the deployment rule (faulty_deployment_detection + or monitor). + example: faulty_deployment_detection + type: string + required: + - name + - options + - type + type: object CreateIncidentNotificationRuleRequest: description: Create request for a notification rule. properties: @@ -16284,6 +16387,113 @@ components: format: uuid type: string type: object + DeploymentGateDataType: + description: Deployment gate resource type. + enum: + - deployment_gate + example: deployment_gate + type: string + x-enum-varnames: + - DEPLOYMENT_GATE + DeploymentGateResponse: + description: Response for a deployment gate. + properties: + data: + $ref: '#/components/schemas/DeploymentGateResponseData' + type: object + DeploymentGateResponseData: + description: Data for a deployment gate. + properties: + attributes: + $ref: '#/components/schemas/DeploymentGateResponseDataAttributes' + id: + description: Unique identifier of the deployment gate. + example: 1111-2222-3333-4444-555566667777 + type: string + type: + $ref: '#/components/schemas/DeploymentGateDataType' + required: + - type + - attributes + - id + type: object + DeploymentGateResponseDataAttributes: + description: Basic information about a deployment gate. + properties: + created_at: + description: The timestamp when the deployment gate was created. + example: '2021-01-01T00:00:00Z' + format: date-time + type: string + created_by: + $ref: '#/components/schemas/DeploymentGateResponseDataAttributesCreatedBy' + dry_run: + description: Whether this gate is run in dry-run mode. + example: false + type: boolean + env: + description: The environment of the deployment gate. + example: production + type: string + identifier: + description: The identifier of the deployment gate. + example: pre + type: string + service: + description: The service of the deployment gate. + example: my-service + type: string + updated_at: + description: The timestamp when the deployment gate was last updated. + example: '2021-01-01T00:00:00Z' + format: date-time + type: string + updated_by: + $ref: '#/components/schemas/DeploymentGateResponseDataAttributesUpdatedBy' + required: + - created_at + - created_by + - dry_run + - env + - identifier + - service + type: object + DeploymentGateResponseDataAttributesCreatedBy: + description: Information about the user who created the deployment gate. + properties: + handle: + description: The handle of the user who created the deployment rule. + example: test-user + type: string + id: + description: The ID of the user who created the deployment rule. + example: 1111-2222-3333-4444-555566667777 + type: string + name: + description: The name of the user who created the deployment rule. + example: Test User + type: string + required: + - id + type: object + DeploymentGateResponseDataAttributesUpdatedBy: + description: Information about the user who updated the deployment gate. + properties: + handle: + description: The handle of the user who updated the deployment rule. + example: test-user + type: string + id: + description: The ID of the user who updated the deployment rule. + example: 1111-2222-3333-4444-555566667777 + type: string + name: + description: The name of the user who updated the deployment rule. + example: Test User + type: string + required: + - id + type: object DeploymentMetadata: description: Metadata object containing the publication creation information. properties: @@ -16323,6 +16533,164 @@ components: type: $ref: '#/components/schemas/AppDeploymentType' type: object + DeploymentRuleDataType: + description: Deployment rule resource type. + enum: + - deployment_rule + example: deployment_rule + type: string + x-enum-varnames: + - DEPLOYMENT_RULE + DeploymentRuleOptionsFaultyDeploymentDetection: + additionalProperties: false + description: Faulty deployment detection options for deployment rules. + properties: + duration: + description: The duration for faulty deployment detection. + example: 3600 + format: int64 + type: integer + excluded_resources: + description: Resources to exclude from faulty deployment detection. + example: + - resource1 + - resource2 + items: + type: string + type: array + type: object + DeploymentRuleOptionsMonitor: + additionalProperties: false + description: Monitor options for deployment rules. + properties: + duration: + description: Seconds the monitor needs to stay in OK status for the rule + to pass. + example: 3600 + format: int64 + type: integer + query: + description: Monitors that match this query are evaluated. + example: service:my-service env:prod + type: string + required: + - query + type: object + DeploymentRuleResponse: + description: Response for a deployment rule. + properties: + data: + $ref: '#/components/schemas/DeploymentRuleResponseData' + type: object + DeploymentRuleResponseData: + description: Data for a deployment rule. + properties: + attributes: + $ref: '#/components/schemas/DeploymentRuleResponseDataAttributes' + id: + description: Unique identifier of the deployment rule. + example: 1111-2222-3333-4444-555566667777 + type: string + type: + $ref: '#/components/schemas/DeploymentRuleDataType' + required: + - type + - attributes + - id + type: object + DeploymentRuleResponseDataAttributes: + description: Basic information about a deployment rule. + properties: + created_at: + description: The timestamp when the deployment rule was created. + example: '2021-01-01T00:00:00Z' + format: date-time + type: string + created_by: + $ref: '#/components/schemas/DeploymentRuleResponseDataAttributesCreatedBy' + dry_run: + description: Whether this rule is run in dry-run mode. + example: false + type: boolean + gate_id: + description: The ID of the deployment gate. + example: 1111-2222-3333-4444-555566667777 + type: string + name: + description: The name of the deployment rule. + example: My deployment rule + type: string + options: + $ref: '#/components/schemas/DeploymentRulesOptions' + type: + $ref: '#/components/schemas/DeploymentRuleResponseDataAttributesType' + updated_at: + description: The timestamp when the deployment rule was last updated. + format: date-time + type: string + updated_by: + $ref: '#/components/schemas/DeploymentRuleResponseDataAttributesUpdatedBy' + required: + - created_at + - created_by + - dry_run + - gate_id + - name + - options + - type + type: object + DeploymentRuleResponseDataAttributesCreatedBy: + description: Information about the user who created the deployment rule. + properties: + handle: + description: The handle of the user who created the deployment rule. + example: test-user + type: string + id: + description: The ID of the user who created the deployment rule. + example: 1111-2222-3333-4444-555566667777 + type: string + name: + description: The name of the user who created the deployment rule. + example: Test User + type: string + required: + - id + type: object + DeploymentRuleResponseDataAttributesType: + description: The type of the deployment rule. + enum: + - faulty_deployment_detection + - monitor + example: faulty_deployment_detection + type: string + x-enum-varnames: + - FAULTY_DEPLOYMENT_DETECTION + - MONITOR + DeploymentRuleResponseDataAttributesUpdatedBy: + description: Information about the user who updated the deployment rule. + properties: + handle: + description: The handle of the user who updated the deployment rule. + example: test-user + type: string + id: + description: The ID of the user who updated the deployment rule. + example: 1111-2222-3333-4444-555566667777 + type: string + name: + description: The name of the user who updated the deployment rule. + example: Test User + type: string + required: + - id + type: object + DeploymentRulesOptions: + description: Options for deployment rule response representing either faulty + deployment detection or monitor options. + oneOf: + - $ref: '#/components/schemas/DeploymentRuleOptionsFaultyDeploymentDetection' + - $ref: '#/components/schemas/DeploymentRuleOptionsMonitor' DetailedFinding: description: A single finding with with message and resource configuration. properties: @@ -22414,6 +22782,33 @@ components: example: application/json type: string type: object + HTTPCDGatesBadRequestResponse: + description: Bad request. + properties: + errors: + description: Structured errors. + items: + $ref: '#/components/schemas/HTTPCIAppError' + type: array + type: object + HTTPCDGatesNotFoundResponse: + description: Deployment gate not found. + properties: + errors: + description: Structured errors. + items: + $ref: '#/components/schemas/HTTPCIAppError' + type: array + type: object + HTTPCDRulesNotFoundResponse: + description: Deployment rule not found. + properties: + errors: + description: Structured errors. + items: + $ref: '#/components/schemas/HTTPCIAppError' + type: array + type: object HTTPCIAppError: description: List of errors. properties: @@ -51896,6 +52291,77 @@ components: required: - data type: object + UpdateDeploymentGateParams: + description: Parameters for updating a deployment gate. + properties: + data: + $ref: '#/components/schemas/UpdateDeploymentGateParamsData' + required: + - data + type: object + UpdateDeploymentGateParamsData: + description: Parameters for updating a deployment gate. + properties: + attributes: + $ref: '#/components/schemas/UpdateDeploymentGateParamsDataAttributes' + id: + description: Unique identifier of the deployment gate. + example: 12345678-1234-1234-1234-123456789012 + type: string + type: + $ref: '#/components/schemas/DeploymentGateDataType' + required: + - type + - id + - attributes + type: object + UpdateDeploymentGateParamsDataAttributes: + description: Attributes for updating a deployment gate. + properties: + dry_run: + description: Whether to run in dry-run mode. + example: false + type: boolean + required: + - dry_run + type: object + UpdateDeploymentRuleParams: + description: Parameters for updating a deployment rule. + properties: + data: + $ref: '#/components/schemas/UpdateDeploymentRuleParamsData' + required: + - data + type: object + UpdateDeploymentRuleParamsData: + description: Parameters for updating a deployment rule. + properties: + attributes: + $ref: '#/components/schemas/UpdateDeploymentRuleParamsDataAttributes' + type: + $ref: '#/components/schemas/DeploymentRuleDataType' + required: + - type + - attributes + type: object + UpdateDeploymentRuleParamsDataAttributes: + description: Parameters for updating a deployment rule. + properties: + dry_run: + description: Whether to run this rule in dry-run mode. + example: false + type: boolean + name: + description: The name of the deployment rule. + example: Updated deployment rule + type: string + options: + $ref: '#/components/schemas/DeploymentRulesOptions' + required: + - dry_run + - name + - options + type: object UpdateOpenAPIResponse: description: Response for `UpdateOpenAPI`. properties: @@ -61541,6 +62007,403 @@ paths: x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/deployment_gates: + post: + description: Endpoint to create a deployment gate. + operationId: CreateDeploymentGate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDeploymentGateParams' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentGateResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create deployment gate + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/deployment_gates/{gate_id}/rules: + post: + description: Endpoint to create a deployment rule. A gate for the rule must + already exist. + operationId: CreateDeploymentRule + parameters: + - description: The ID of the deployment gate. + in: path + name: gate_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDeploymentRuleParams' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentRuleResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create deployment rule + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/deployment_gates/{gate_id}/rules/{id}: + delete: + description: Endpoint to delete a deployment rule. + operationId: DeleteDeploymentRule + parameters: + - description: The ID of the deployment gate. + in: path + name: gate_id + required: true + schema: + type: string + - description: The ID of the deployment rule. + in: path + name: id + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/HTTPCDGatesNotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete deployment rule + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Endpoint to get a deployment rule. + operationId: GetDeploymentRule + parameters: + - description: The ID of the deployment gate. + in: path + name: gate_id + required: true + schema: + type: string + - description: The ID of the deployment rule. + in: path + name: id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentRuleResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/HTTPCDRulesNotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get deployment rule + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Endpoint to update a deployment rule. + operationId: UpdateDeploymentRule + parameters: + - description: The ID of the deployment gate. + in: path + name: gate_id + required: true + schema: + type: string + - description: The ID of the deployment rule. + in: path + name: id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateDeploymentRuleParams' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentRuleResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/HTTPCDRulesNotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update deployment rule + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/deployment_gates/{id}: + delete: + description: Endpoint to delete a deployment gate. Rules associated with the + gate are also deleted. + operationId: DeleteDeploymentGate + parameters: + - description: The ID of the deployment gate. + in: path + name: id + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/HTTPCDGatesNotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete deployment gate + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Endpoint to get a deployment gate. + operationId: GetDeploymentGate + parameters: + - description: The ID of the deployment gate. + in: path + name: id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentGateResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/HTTPCDGatesNotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get deployment gate + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_read + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Endpoint to update a deployment gate. + operationId: UpdateDeploymentGate + parameters: + - description: The ID of the deployment gate. + in: path + name: id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateDeploymentGateParams' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DeploymentGateResponse' + description: OK + '400': + $ref: '#/components/responses/HTTPCDGatesBadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/HTTPCDGatesNotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPCIAppErrors' + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update deployment gate + tags: + - Deployment Gates + x-permission: + operator: OR + permissions: + - deployment_gates_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/domain_allowlist: get: description: Get the domain allowlist for an organization. @@ -79554,8 +80417,7 @@ paths: operator: OR permissions: - test_optimization_read - x-unstable: '**Note**: This endpoint is in public beta and may be subject to - change. + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/usage/application_security: @@ -81289,6 +82151,10 @@ tags: view certain types of telemetry (for example, logs, traces, metrics, and RUM data).' name: Datasets +- description: Manage Deployment Gates using this API to reduce the likelihood and + impact of incidents caused by deployments. See the [Deployment Gates documentation](https://docs.datadoghq.com/deployment_gates/) + for more information. + name: Deployment Gates - description: 'Configure your Datadog Email Domain Allowlist directly through the Datadog API. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 0fb98e36578..e7c7fdc822f 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -638,6 +638,14 @@ func NewConfiguration() *Configuration { "v2.CancelDataDeletionRequest": false, "v2.CreateDataDeletionRequest": false, "v2.GetDataDeletionRequests": false, + "v2.CreateDeploymentGate": false, + "v2.CreateDeploymentRule": false, + "v2.DeleteDeploymentGate": false, + "v2.DeleteDeploymentRule": false, + "v2.GetDeploymentGate": false, + "v2.GetDeploymentRule": false, + "v2.UpdateDeploymentGate": false, + "v2.UpdateDeploymentRule": false, "v2.CreateIncident": false, "v2.CreateIncidentImpact": false, "v2.CreateIncidentIntegration": false, diff --git a/api/datadogV2/api_deployment_gates.go b/api/datadogV2/api_deployment_gates.go new file mode 100644 index 00000000000..6aef6506ae5 --- /dev/null +++ b/api/datadogV2/api_deployment_gates.go @@ -0,0 +1,913 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DeploymentGatesApi service type +type DeploymentGatesApi datadog.Service + +// CreateDeploymentGate Create deployment gate. +// Endpoint to create a deployment gate. +func (a *DeploymentGatesApi) CreateDeploymentGate(ctx _context.Context, body CreateDeploymentGateParams) (DeploymentGateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue DeploymentGateResponse + ) + + operationId := "v2.CreateDeploymentGate" + 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.DeploymentGatesApi.CreateDeploymentGate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates" + + 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 { + var v HTTPCDGatesBadRequestResponse + 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 + } + if localVarHTTPResponse.StatusCode == 401 || 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + 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 +} + +// CreateDeploymentRule Create deployment rule. +// Endpoint to create a deployment rule. A gate for the rule must already exist. +func (a *DeploymentGatesApi) CreateDeploymentRule(ctx _context.Context, gateId string, body CreateDeploymentRuleParams) (DeploymentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue DeploymentRuleResponse + ) + + operationId := "v2.CreateDeploymentRule" + 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.DeploymentGatesApi.CreateDeploymentRule") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{gate_id}/rules" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{gate_id}", _neturl.PathEscape(datadog.ParameterToString(gateId, ""))) + + 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 { + var v HTTPCDGatesBadRequestResponse + 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 + } + if localVarHTTPResponse.StatusCode == 401 || 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + 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 +} + +// DeleteDeploymentGate Delete deployment gate. +// Endpoint to delete a deployment gate. Rules associated with the gate are also deleted. +func (a *DeploymentGatesApi) DeleteDeploymentGate(ctx _context.Context, id string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteDeploymentGate" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return 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.DeploymentGatesApi.DeleteDeploymentGate") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return 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 nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HTTPCDGatesBadRequestResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HTTPCDGatesNotFoundResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteDeploymentRule Delete deployment rule. +// Endpoint to delete a deployment rule. +func (a *DeploymentGatesApi) DeleteDeploymentRule(ctx _context.Context, gateId string, id string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteDeploymentRule" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return 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.DeploymentGatesApi.DeleteDeploymentRule") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{gate_id}/rules/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{gate_id}", _neturl.PathEscape(datadog.ParameterToString(gateId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return 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 nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HTTPCDGatesBadRequestResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HTTPCDGatesNotFoundResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetDeploymentGate Get deployment gate. +// Endpoint to get a deployment gate. +func (a *DeploymentGatesApi) GetDeploymentGate(ctx _context.Context, id string) (DeploymentGateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DeploymentGateResponse + ) + + operationId := "v2.GetDeploymentGate" + 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.DeploymentGatesApi.GetDeploymentGate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + 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 { + var v HTTPCDGatesBadRequestResponse + 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 + } + if localVarHTTPResponse.StatusCode == 401 || 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v HTTPCDGatesNotFoundResponse + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + 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 +} + +// GetDeploymentRule Get deployment rule. +// Endpoint to get a deployment rule. +func (a *DeploymentGatesApi) GetDeploymentRule(ctx _context.Context, gateId string, id string) (DeploymentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue DeploymentRuleResponse + ) + + operationId := "v2.GetDeploymentRule" + 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.DeploymentGatesApi.GetDeploymentRule") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{gate_id}/rules/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{gate_id}", _neturl.PathEscape(datadog.ParameterToString(gateId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + 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 { + var v HTTPCDGatesBadRequestResponse + 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 + } + if localVarHTTPResponse.StatusCode == 401 || 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v HTTPCDRulesNotFoundResponse + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + 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 +} + +// UpdateDeploymentGate Update deployment gate. +// Endpoint to update a deployment gate. +func (a *DeploymentGatesApi) UpdateDeploymentGate(ctx _context.Context, id string, body UpdateDeploymentGateParams) (DeploymentGateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue DeploymentGateResponse + ) + + operationId := "v2.UpdateDeploymentGate" + 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.DeploymentGatesApi.UpdateDeploymentGate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + 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 { + var v HTTPCDGatesBadRequestResponse + 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 + } + if localVarHTTPResponse.StatusCode == 401 || 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v HTTPCDGatesNotFoundResponse + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + 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 +} + +// UpdateDeploymentRule Update deployment rule. +// Endpoint to update a deployment rule. +func (a *DeploymentGatesApi) UpdateDeploymentRule(ctx _context.Context, gateId string, id string, body UpdateDeploymentRuleParams) (DeploymentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue DeploymentRuleResponse + ) + + operationId := "v2.UpdateDeploymentRule" + 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.DeploymentGatesApi.UpdateDeploymentRule") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/deployment_gates/{gate_id}/rules/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{gate_id}", _neturl.PathEscape(datadog.ParameterToString(gateId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + 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 { + var v HTTPCDGatesBadRequestResponse + 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 + } + if localVarHTTPResponse.StatusCode == 401 || 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 + } + if localVarHTTPResponse.StatusCode == 404 { + var v HTTPCDRulesNotFoundResponse + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + var v HTTPCIAppErrors + 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 +} + +// NewDeploymentGatesApi Returns NewDeploymentGatesApi. +func NewDeploymentGatesApi(client *datadog.APIClient) *DeploymentGatesApi { + return &DeploymentGatesApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 4d31a1c74c4..3110f1cabc7 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -221,6 +221,14 @@ // - [DatasetsApi.GetAllDatasets] // - [DatasetsApi.GetDataset] // - [DatasetsApi.UpdateDataset] +// - [DeploymentGatesApi.CreateDeploymentGate] +// - [DeploymentGatesApi.CreateDeploymentRule] +// - [DeploymentGatesApi.DeleteDeploymentGate] +// - [DeploymentGatesApi.DeleteDeploymentRule] +// - [DeploymentGatesApi.GetDeploymentGate] +// - [DeploymentGatesApi.GetDeploymentRule] +// - [DeploymentGatesApi.UpdateDeploymentGate] +// - [DeploymentGatesApi.UpdateDeploymentRule] // - [DomainAllowlistApi.GetDomainAllowlist] // - [DomainAllowlistApi.PatchDomainAllowlist] // - [DowntimesApi.CancelDowntime] diff --git a/api/datadogV2/model_create_deployment_gate_params.go b/api/datadogV2/model_create_deployment_gate_params.go new file mode 100644 index 00000000000..eff6d4c1121 --- /dev/null +++ b/api/datadogV2/model_create_deployment_gate_params.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" +) + +// CreateDeploymentGateParams Parameters for creating a deployment gate. +type CreateDeploymentGateParams struct { + // Parameters for creating a deployment gate. + Data CreateDeploymentGateParamsData `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:"-"` +} + +// NewCreateDeploymentGateParams instantiates a new CreateDeploymentGateParams 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 NewCreateDeploymentGateParams(data CreateDeploymentGateParamsData) *CreateDeploymentGateParams { + this := CreateDeploymentGateParams{} + this.Data = data + return &this +} + +// NewCreateDeploymentGateParamsWithDefaults instantiates a new CreateDeploymentGateParams 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 NewCreateDeploymentGateParamsWithDefaults() *CreateDeploymentGateParams { + this := CreateDeploymentGateParams{} + return &this +} + +// GetData returns the Data field value. +func (o *CreateDeploymentGateParams) GetData() CreateDeploymentGateParamsData { + if o == nil { + var ret CreateDeploymentGateParamsData + 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 *CreateDeploymentGateParams) GetDataOk() (*CreateDeploymentGateParamsData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CreateDeploymentGateParams) SetData(v CreateDeploymentGateParamsData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDeploymentGateParams) 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 *CreateDeploymentGateParams) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateDeploymentGateParamsData `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_create_deployment_gate_params_data.go b/api/datadogV2/model_create_deployment_gate_params_data.go new file mode 100644 index 00000000000..5206d4631fb --- /dev/null +++ b/api/datadogV2/model_create_deployment_gate_params_data.go @@ -0,0 +1,146 @@ +// 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" +) + +// CreateDeploymentGateParamsData Parameters for creating a deployment gate. +type CreateDeploymentGateParamsData struct { + // Parameters for creating a deployment gate. + Attributes CreateDeploymentGateParamsDataAttributes `json:"attributes"` + // Deployment gate resource type. + Type DeploymentGateDataType `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:"-"` +} + +// NewCreateDeploymentGateParamsData instantiates a new CreateDeploymentGateParamsData 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 NewCreateDeploymentGateParamsData(attributes CreateDeploymentGateParamsDataAttributes, typeVar DeploymentGateDataType) *CreateDeploymentGateParamsData { + this := CreateDeploymentGateParamsData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewCreateDeploymentGateParamsDataWithDefaults instantiates a new CreateDeploymentGateParamsData 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 NewCreateDeploymentGateParamsDataWithDefaults() *CreateDeploymentGateParamsData { + this := CreateDeploymentGateParamsData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CreateDeploymentGateParamsData) GetAttributes() CreateDeploymentGateParamsDataAttributes { + if o == nil { + var ret CreateDeploymentGateParamsDataAttributes + 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 *CreateDeploymentGateParamsData) GetAttributesOk() (*CreateDeploymentGateParamsDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CreateDeploymentGateParamsData) SetAttributes(v CreateDeploymentGateParamsDataAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *CreateDeploymentGateParamsData) GetType() DeploymentGateDataType { + if o == nil { + var ret DeploymentGateDataType + 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 *CreateDeploymentGateParamsData) GetTypeOk() (*DeploymentGateDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateDeploymentGateParamsData) SetType(v DeploymentGateDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDeploymentGateParamsData) 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 *CreateDeploymentGateParamsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateDeploymentGateParamsDataAttributes `json:"attributes"` + Type *DeploymentGateDataType `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_create_deployment_gate_params_data_attributes.go b/api/datadogV2/model_create_deployment_gate_params_data_attributes.go new file mode 100644 index 00000000000..60b81233af5 --- /dev/null +++ b/api/datadogV2/model_create_deployment_gate_params_data_attributes.go @@ -0,0 +1,211 @@ +// 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" +) + +// CreateDeploymentGateParamsDataAttributes Parameters for creating a deployment gate. +type CreateDeploymentGateParamsDataAttributes struct { + // Whether this gate is run in dry-run mode. + DryRun *bool `json:"dry_run,omitempty"` + // The environment of the deployment gate. + Env string `json:"env"` + // The identifier of the deployment gate. + Identifier *string `json:"identifier,omitempty"` + // The service of the deployment gate. + Service string `json:"service"` + // 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:"-"` +} + +// NewCreateDeploymentGateParamsDataAttributes instantiates a new CreateDeploymentGateParamsDataAttributes 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 NewCreateDeploymentGateParamsDataAttributes(env string, service string) *CreateDeploymentGateParamsDataAttributes { + this := CreateDeploymentGateParamsDataAttributes{} + var dryRun bool = false + this.DryRun = &dryRun + this.Env = env + var identifier string = "default" + this.Identifier = &identifier + this.Service = service + return &this +} + +// NewCreateDeploymentGateParamsDataAttributesWithDefaults instantiates a new CreateDeploymentGateParamsDataAttributes 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 NewCreateDeploymentGateParamsDataAttributesWithDefaults() *CreateDeploymentGateParamsDataAttributes { + this := CreateDeploymentGateParamsDataAttributes{} + var dryRun bool = false + this.DryRun = &dryRun + var identifier string = "default" + this.Identifier = &identifier + return &this +} + +// GetDryRun returns the DryRun field value if set, zero value otherwise. +func (o *CreateDeploymentGateParamsDataAttributes) GetDryRun() bool { + if o == nil || o.DryRun == nil { + var ret bool + return ret + } + return *o.DryRun +} + +// GetDryRunOk returns a tuple with the DryRun field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDeploymentGateParamsDataAttributes) GetDryRunOk() (*bool, bool) { + if o == nil || o.DryRun == nil { + return nil, false + } + return o.DryRun, true +} + +// HasDryRun returns a boolean if a field has been set. +func (o *CreateDeploymentGateParamsDataAttributes) HasDryRun() bool { + return o != nil && o.DryRun != nil +} + +// SetDryRun gets a reference to the given bool and assigns it to the DryRun field. +func (o *CreateDeploymentGateParamsDataAttributes) SetDryRun(v bool) { + o.DryRun = &v +} + +// GetEnv returns the Env field value. +func (o *CreateDeploymentGateParamsDataAttributes) GetEnv() string { + if o == nil { + var ret string + return ret + } + return o.Env +} + +// GetEnvOk returns a tuple with the Env field value +// and a boolean to check if the value has been set. +func (o *CreateDeploymentGateParamsDataAttributes) GetEnvOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Env, true +} + +// SetEnv sets field value. +func (o *CreateDeploymentGateParamsDataAttributes) SetEnv(v string) { + o.Env = v +} + +// GetIdentifier returns the Identifier field value if set, zero value otherwise. +func (o *CreateDeploymentGateParamsDataAttributes) GetIdentifier() string { + if o == nil || o.Identifier == nil { + var ret string + return ret + } + return *o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDeploymentGateParamsDataAttributes) GetIdentifierOk() (*string, bool) { + if o == nil || o.Identifier == nil { + return nil, false + } + return o.Identifier, true +} + +// HasIdentifier returns a boolean if a field has been set. +func (o *CreateDeploymentGateParamsDataAttributes) HasIdentifier() bool { + return o != nil && o.Identifier != nil +} + +// SetIdentifier gets a reference to the given string and assigns it to the Identifier field. +func (o *CreateDeploymentGateParamsDataAttributes) SetIdentifier(v string) { + o.Identifier = &v +} + +// GetService returns the Service field value. +func (o *CreateDeploymentGateParamsDataAttributes) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *CreateDeploymentGateParamsDataAttributes) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *CreateDeploymentGateParamsDataAttributes) SetService(v string) { + o.Service = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDeploymentGateParamsDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DryRun != nil { + toSerialize["dry_run"] = o.DryRun + } + toSerialize["env"] = o.Env + if o.Identifier != nil { + toSerialize["identifier"] = o.Identifier + } + toSerialize["service"] = o.Service + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateDeploymentGateParamsDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DryRun *bool `json:"dry_run,omitempty"` + Env *string `json:"env"` + Identifier *string `json:"identifier,omitempty"` + Service *string `json:"service"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Env == nil { + return fmt.Errorf("required field env missing") + } + if all.Service == nil { + return fmt.Errorf("required field service missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"dry_run", "env", "identifier", "service"}) + } else { + return err + } + o.DryRun = all.DryRun + o.Env = *all.Env + o.Identifier = all.Identifier + o.Service = *all.Service + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_deployment_rule_params.go b/api/datadogV2/model_create_deployment_rule_params.go new file mode 100644 index 00000000000..0ff4c22e329 --- /dev/null +++ b/api/datadogV2/model_create_deployment_rule_params.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" +) + +// CreateDeploymentRuleParams Parameters for creating a deployment rule. +type CreateDeploymentRuleParams struct { + // Parameters for creating a deployment rule. + Data *CreateDeploymentRuleParamsData `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:"-"` +} + +// NewCreateDeploymentRuleParams instantiates a new CreateDeploymentRuleParams 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 NewCreateDeploymentRuleParams() *CreateDeploymentRuleParams { + this := CreateDeploymentRuleParams{} + return &this +} + +// NewCreateDeploymentRuleParamsWithDefaults instantiates a new CreateDeploymentRuleParams 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 NewCreateDeploymentRuleParamsWithDefaults() *CreateDeploymentRuleParams { + this := CreateDeploymentRuleParams{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *CreateDeploymentRuleParams) GetData() CreateDeploymentRuleParamsData { + if o == nil || o.Data == nil { + var ret CreateDeploymentRuleParamsData + 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 *CreateDeploymentRuleParams) GetDataOk() (*CreateDeploymentRuleParamsData, 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 *CreateDeploymentRuleParams) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given CreateDeploymentRuleParamsData and assigns it to the Data field. +func (o *CreateDeploymentRuleParams) SetData(v CreateDeploymentRuleParamsData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDeploymentRuleParams) 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 *CreateDeploymentRuleParams) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateDeploymentRuleParamsData `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_create_deployment_rule_params_data.go b/api/datadogV2/model_create_deployment_rule_params_data.go new file mode 100644 index 00000000000..99e194bb8a1 --- /dev/null +++ b/api/datadogV2/model_create_deployment_rule_params_data.go @@ -0,0 +1,146 @@ +// 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" +) + +// CreateDeploymentRuleParamsData Parameters for creating a deployment rule. +type CreateDeploymentRuleParamsData struct { + // Parameters for creating a deployment rule. + Attributes CreateDeploymentRuleParamsDataAttributes `json:"attributes"` + // Deployment rule resource type. + Type DeploymentRuleDataType `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:"-"` +} + +// NewCreateDeploymentRuleParamsData instantiates a new CreateDeploymentRuleParamsData 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 NewCreateDeploymentRuleParamsData(attributes CreateDeploymentRuleParamsDataAttributes, typeVar DeploymentRuleDataType) *CreateDeploymentRuleParamsData { + this := CreateDeploymentRuleParamsData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewCreateDeploymentRuleParamsDataWithDefaults instantiates a new CreateDeploymentRuleParamsData 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 NewCreateDeploymentRuleParamsDataWithDefaults() *CreateDeploymentRuleParamsData { + this := CreateDeploymentRuleParamsData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *CreateDeploymentRuleParamsData) GetAttributes() CreateDeploymentRuleParamsDataAttributes { + if o == nil { + var ret CreateDeploymentRuleParamsDataAttributes + 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 *CreateDeploymentRuleParamsData) GetAttributesOk() (*CreateDeploymentRuleParamsDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *CreateDeploymentRuleParamsData) SetAttributes(v CreateDeploymentRuleParamsDataAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *CreateDeploymentRuleParamsData) GetType() DeploymentRuleDataType { + if o == nil { + var ret DeploymentRuleDataType + 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 *CreateDeploymentRuleParamsData) GetTypeOk() (*DeploymentRuleDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateDeploymentRuleParamsData) SetType(v DeploymentRuleDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDeploymentRuleParamsData) 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 *CreateDeploymentRuleParamsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateDeploymentRuleParamsDataAttributes `json:"attributes"` + Type *DeploymentRuleDataType `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_create_deployment_rule_params_data_attributes.go b/api/datadogV2/model_create_deployment_rule_params_data_attributes.go new file mode 100644 index 00000000000..279e3dcbe34 --- /dev/null +++ b/api/datadogV2/model_create_deployment_rule_params_data_attributes.go @@ -0,0 +1,204 @@ +// 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" +) + +// CreateDeploymentRuleParamsDataAttributes Parameters for creating a deployment rule. +type CreateDeploymentRuleParamsDataAttributes struct { + // Whether this rule is run in dry-run mode. + DryRun *bool `json:"dry_run,omitempty"` + // The name of the deployment rule. + Name string `json:"name"` + // Options for deployment rule response representing either faulty deployment detection or monitor options. + Options DeploymentRulesOptions `json:"options"` + // The type of the deployment rule (faulty_deployment_detection or monitor). + Type string `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:"-"` +} + +// NewCreateDeploymentRuleParamsDataAttributes instantiates a new CreateDeploymentRuleParamsDataAttributes 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 NewCreateDeploymentRuleParamsDataAttributes(name string, options DeploymentRulesOptions, typeVar string) *CreateDeploymentRuleParamsDataAttributes { + this := CreateDeploymentRuleParamsDataAttributes{} + var dryRun bool = false + this.DryRun = &dryRun + this.Name = name + this.Options = options + this.Type = typeVar + return &this +} + +// NewCreateDeploymentRuleParamsDataAttributesWithDefaults instantiates a new CreateDeploymentRuleParamsDataAttributes 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 NewCreateDeploymentRuleParamsDataAttributesWithDefaults() *CreateDeploymentRuleParamsDataAttributes { + this := CreateDeploymentRuleParamsDataAttributes{} + var dryRun bool = false + this.DryRun = &dryRun + return &this +} + +// GetDryRun returns the DryRun field value if set, zero value otherwise. +func (o *CreateDeploymentRuleParamsDataAttributes) GetDryRun() bool { + if o == nil || o.DryRun == nil { + var ret bool + return ret + } + return *o.DryRun +} + +// GetDryRunOk returns a tuple with the DryRun field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDeploymentRuleParamsDataAttributes) GetDryRunOk() (*bool, bool) { + if o == nil || o.DryRun == nil { + return nil, false + } + return o.DryRun, true +} + +// HasDryRun returns a boolean if a field has been set. +func (o *CreateDeploymentRuleParamsDataAttributes) HasDryRun() bool { + return o != nil && o.DryRun != nil +} + +// SetDryRun gets a reference to the given bool and assigns it to the DryRun field. +func (o *CreateDeploymentRuleParamsDataAttributes) SetDryRun(v bool) { + o.DryRun = &v +} + +// GetName returns the Name field value. +func (o *CreateDeploymentRuleParamsDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateDeploymentRuleParamsDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *CreateDeploymentRuleParamsDataAttributes) SetName(v string) { + o.Name = v +} + +// GetOptions returns the Options field value. +func (o *CreateDeploymentRuleParamsDataAttributes) GetOptions() DeploymentRulesOptions { + if o == nil { + var ret DeploymentRulesOptions + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *CreateDeploymentRuleParamsDataAttributes) GetOptionsOk() (*DeploymentRulesOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value. +func (o *CreateDeploymentRuleParamsDataAttributes) SetOptions(v DeploymentRulesOptions) { + o.Options = v +} + +// GetType returns the Type field value. +func (o *CreateDeploymentRuleParamsDataAttributes) GetType() string { + if o == nil { + var ret string + 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 *CreateDeploymentRuleParamsDataAttributes) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateDeploymentRuleParamsDataAttributes) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateDeploymentRuleParamsDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DryRun != nil { + toSerialize["dry_run"] = o.DryRun + } + toSerialize["name"] = o.Name + toSerialize["options"] = o.Options + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateDeploymentRuleParamsDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DryRun *bool `json:"dry_run,omitempty"` + Name *string `json:"name"` + Options *DeploymentRulesOptions `json:"options"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Options == nil { + return fmt.Errorf("required field options 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{"dry_run", "name", "options", "type"}) + } else { + return err + } + o.DryRun = all.DryRun + o.Name = *all.Name + o.Options = *all.Options + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_deployment_gate_data_type.go b/api/datadogV2/model_deployment_gate_data_type.go new file mode 100644 index 00000000000..12c3cca4ca6 --- /dev/null +++ b/api/datadogV2/model_deployment_gate_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" +) + +// DeploymentGateDataType Deployment gate resource type. +type DeploymentGateDataType string + +// List of DeploymentGateDataType. +const ( + DEPLOYMENTGATEDATATYPE_DEPLOYMENT_GATE DeploymentGateDataType = "deployment_gate" +) + +var allowedDeploymentGateDataTypeEnumValues = []DeploymentGateDataType{ + DEPLOYMENTGATEDATATYPE_DEPLOYMENT_GATE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DeploymentGateDataType) GetAllowedValues() []DeploymentGateDataType { + return allowedDeploymentGateDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DeploymentGateDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DeploymentGateDataType(value) + return nil +} + +// NewDeploymentGateDataTypeFromValue returns a pointer to a valid DeploymentGateDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDeploymentGateDataTypeFromValue(v string) (*DeploymentGateDataType, error) { + ev := DeploymentGateDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DeploymentGateDataType: valid values are %v", v, allowedDeploymentGateDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DeploymentGateDataType) IsValid() bool { + for _, existing := range allowedDeploymentGateDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DeploymentGateDataType value. +func (v DeploymentGateDataType) Ptr() *DeploymentGateDataType { + return &v +} diff --git a/api/datadogV2/model_deployment_gate_response.go b/api/datadogV2/model_deployment_gate_response.go new file mode 100644 index 00000000000..a1348f87ba5 --- /dev/null +++ b/api/datadogV2/model_deployment_gate_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" +) + +// DeploymentGateResponse Response for a deployment gate. +type DeploymentGateResponse struct { + // Data for a deployment gate. + Data *DeploymentGateResponseData `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:"-"` +} + +// NewDeploymentGateResponse instantiates a new DeploymentGateResponse 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 NewDeploymentGateResponse() *DeploymentGateResponse { + this := DeploymentGateResponse{} + return &this +} + +// NewDeploymentGateResponseWithDefaults instantiates a new DeploymentGateResponse 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 NewDeploymentGateResponseWithDefaults() *DeploymentGateResponse { + this := DeploymentGateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DeploymentGateResponse) GetData() DeploymentGateResponseData { + if o == nil || o.Data == nil { + var ret DeploymentGateResponseData + 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 *DeploymentGateResponse) GetDataOk() (*DeploymentGateResponseData, 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 *DeploymentGateResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DeploymentGateResponseData and assigns it to the Data field. +func (o *DeploymentGateResponse) SetData(v DeploymentGateResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentGateResponse) 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 *DeploymentGateResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DeploymentGateResponseData `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_deployment_gate_response_data.go b/api/datadogV2/model_deployment_gate_response_data.go new file mode 100644 index 00000000000..27475957c95 --- /dev/null +++ b/api/datadogV2/model_deployment_gate_response_data.go @@ -0,0 +1,178 @@ +// 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" +) + +// DeploymentGateResponseData Data for a deployment gate. +type DeploymentGateResponseData struct { + // Basic information about a deployment gate. + Attributes DeploymentGateResponseDataAttributes `json:"attributes"` + // Unique identifier of the deployment gate. + Id string `json:"id"` + // Deployment gate resource type. + Type DeploymentGateDataType `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:"-"` +} + +// NewDeploymentGateResponseData instantiates a new DeploymentGateResponseData 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 NewDeploymentGateResponseData(attributes DeploymentGateResponseDataAttributes, id string, typeVar DeploymentGateDataType) *DeploymentGateResponseData { + this := DeploymentGateResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewDeploymentGateResponseDataWithDefaults instantiates a new DeploymentGateResponseData 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 NewDeploymentGateResponseDataWithDefaults() *DeploymentGateResponseData { + this := DeploymentGateResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *DeploymentGateResponseData) GetAttributes() DeploymentGateResponseDataAttributes { + if o == nil { + var ret DeploymentGateResponseDataAttributes + 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 *DeploymentGateResponseData) GetAttributesOk() (*DeploymentGateResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *DeploymentGateResponseData) SetAttributes(v DeploymentGateResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *DeploymentGateResponseData) 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 *DeploymentGateResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DeploymentGateResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *DeploymentGateResponseData) GetType() DeploymentGateDataType { + if o == nil { + var ret DeploymentGateDataType + 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 *DeploymentGateResponseData) GetTypeOk() (*DeploymentGateDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DeploymentGateResponseData) SetType(v DeploymentGateDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentGateResponseData) 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 *DeploymentGateResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DeploymentGateResponseDataAttributes `json:"attributes"` + Id *string `json:"id"` + Type *DeploymentGateDataType `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_deployment_gate_response_data_attributes.go b/api/datadogV2/model_deployment_gate_response_data_attributes.go new file mode 100644 index 00000000000..7b1959b3da9 --- /dev/null +++ b/api/datadogV2/model_deployment_gate_response_data_attributes.go @@ -0,0 +1,352 @@ +// 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" +) + +// DeploymentGateResponseDataAttributes Basic information about a deployment gate. +type DeploymentGateResponseDataAttributes struct { + // The timestamp when the deployment gate was created. + CreatedAt time.Time `json:"created_at"` + // Information about the user who created the deployment gate. + CreatedBy DeploymentGateResponseDataAttributesCreatedBy `json:"created_by"` + // Whether this gate is run in dry-run mode. + DryRun bool `json:"dry_run"` + // The environment of the deployment gate. + Env string `json:"env"` + // The identifier of the deployment gate. + Identifier string `json:"identifier"` + // The service of the deployment gate. + Service string `json:"service"` + // The timestamp when the deployment gate was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Information about the user who updated the deployment gate. + UpdatedBy *DeploymentGateResponseDataAttributesUpdatedBy `json:"updated_by,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:"-"` +} + +// NewDeploymentGateResponseDataAttributes instantiates a new DeploymentGateResponseDataAttributes 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 NewDeploymentGateResponseDataAttributes(createdAt time.Time, createdBy DeploymentGateResponseDataAttributesCreatedBy, dryRun bool, env string, identifier string, service string) *DeploymentGateResponseDataAttributes { + this := DeploymentGateResponseDataAttributes{} + this.CreatedAt = createdAt + this.CreatedBy = createdBy + this.DryRun = dryRun + this.Env = env + this.Identifier = identifier + this.Service = service + return &this +} + +// NewDeploymentGateResponseDataAttributesWithDefaults instantiates a new DeploymentGateResponseDataAttributes 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 NewDeploymentGateResponseDataAttributesWithDefaults() *DeploymentGateResponseDataAttributes { + this := DeploymentGateResponseDataAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *DeploymentGateResponseDataAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *DeploymentGateResponseDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value. +func (o *DeploymentGateResponseDataAttributes) GetCreatedBy() DeploymentGateResponseDataAttributesCreatedBy { + if o == nil { + var ret DeploymentGateResponseDataAttributesCreatedBy + return ret + } + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetCreatedByOk() (*DeploymentGateResponseDataAttributesCreatedBy, bool) { + if o == nil { + return nil, false + } + return &o.CreatedBy, true +} + +// SetCreatedBy sets field value. +func (o *DeploymentGateResponseDataAttributes) SetCreatedBy(v DeploymentGateResponseDataAttributesCreatedBy) { + o.CreatedBy = v +} + +// GetDryRun returns the DryRun field value. +func (o *DeploymentGateResponseDataAttributes) GetDryRun() bool { + if o == nil { + var ret bool + return ret + } + return o.DryRun +} + +// GetDryRunOk returns a tuple with the DryRun field value +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetDryRunOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.DryRun, true +} + +// SetDryRun sets field value. +func (o *DeploymentGateResponseDataAttributes) SetDryRun(v bool) { + o.DryRun = v +} + +// GetEnv returns the Env field value. +func (o *DeploymentGateResponseDataAttributes) GetEnv() string { + if o == nil { + var ret string + return ret + } + return o.Env +} + +// GetEnvOk returns a tuple with the Env field value +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetEnvOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Env, true +} + +// SetEnv sets field value. +func (o *DeploymentGateResponseDataAttributes) SetEnv(v string) { + o.Env = v +} + +// GetIdentifier returns the Identifier field value. +func (o *DeploymentGateResponseDataAttributes) GetIdentifier() string { + if o == nil { + var ret string + return ret + } + return o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetIdentifierOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Identifier, true +} + +// SetIdentifier sets field value. +func (o *DeploymentGateResponseDataAttributes) SetIdentifier(v string) { + o.Identifier = v +} + +// GetService returns the Service field value. +func (o *DeploymentGateResponseDataAttributes) GetService() string { + if o == nil { + var ret string + return ret + } + return o.Service +} + +// GetServiceOk returns a tuple with the Service field value +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetServiceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Service, true +} + +// SetService sets field value. +func (o *DeploymentGateResponseDataAttributes) SetService(v string) { + o.Service = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *DeploymentGateResponseDataAttributes) GetUpdatedAt() time.Time { + if o == nil || o.UpdatedAt == nil { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *DeploymentGateResponseDataAttributes) HasUpdatedAt() bool { + return o != nil && o.UpdatedAt != nil +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *DeploymentGateResponseDataAttributes) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUpdatedBy returns the UpdatedBy field value if set, zero value otherwise. +func (o *DeploymentGateResponseDataAttributes) GetUpdatedBy() DeploymentGateResponseDataAttributesUpdatedBy { + if o == nil || o.UpdatedBy == nil { + var ret DeploymentGateResponseDataAttributesUpdatedBy + return ret + } + return *o.UpdatedBy +} + +// GetUpdatedByOk returns a tuple with the UpdatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributes) GetUpdatedByOk() (*DeploymentGateResponseDataAttributesUpdatedBy, bool) { + if o == nil || o.UpdatedBy == nil { + return nil, false + } + return o.UpdatedBy, true +} + +// HasUpdatedBy returns a boolean if a field has been set. +func (o *DeploymentGateResponseDataAttributes) HasUpdatedBy() bool { + return o != nil && o.UpdatedBy != nil +} + +// SetUpdatedBy gets a reference to the given DeploymentGateResponseDataAttributesUpdatedBy and assigns it to the UpdatedBy field. +func (o *DeploymentGateResponseDataAttributes) SetUpdatedBy(v DeploymentGateResponseDataAttributesUpdatedBy) { + o.UpdatedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentGateResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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") + } + toSerialize["created_by"] = o.CreatedBy + toSerialize["dry_run"] = o.DryRun + toSerialize["env"] = o.Env + toSerialize["identifier"] = o.Identifier + toSerialize["service"] = o.Service + if o.UpdatedAt != nil { + if o.UpdatedAt.Nanosecond() == 0 { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.UpdatedBy != nil { + toSerialize["updated_by"] = o.UpdatedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeploymentGateResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + CreatedBy *DeploymentGateResponseDataAttributesCreatedBy `json:"created_by"` + DryRun *bool `json:"dry_run"` + Env *string `json:"env"` + Identifier *string `json:"identifier"` + Service *string `json:"service"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + UpdatedBy *DeploymentGateResponseDataAttributesUpdatedBy `json:"updated_by,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.CreatedBy == nil { + return fmt.Errorf("required field created_by missing") + } + if all.DryRun == nil { + return fmt.Errorf("required field dry_run missing") + } + if all.Env == nil { + return fmt.Errorf("required field env missing") + } + if all.Identifier == nil { + return fmt.Errorf("required field identifier missing") + } + if all.Service == nil { + return fmt.Errorf("required field service missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "created_by", "dry_run", "env", "identifier", "service", "updated_at", "updated_by"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = *all.CreatedAt + if all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = *all.CreatedBy + o.DryRun = *all.DryRun + o.Env = *all.Env + o.Identifier = *all.Identifier + o.Service = *all.Service + o.UpdatedAt = all.UpdatedAt + if all.UpdatedBy != nil && all.UpdatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.UpdatedBy = all.UpdatedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_deployment_gate_response_data_attributes_created_by.go b/api/datadogV2/model_deployment_gate_response_data_attributes_created_by.go new file mode 100644 index 00000000000..1201a59a8b3 --- /dev/null +++ b/api/datadogV2/model_deployment_gate_response_data_attributes_created_by.go @@ -0,0 +1,171 @@ +// 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" +) + +// DeploymentGateResponseDataAttributesCreatedBy Information about the user who created the deployment gate. +type DeploymentGateResponseDataAttributesCreatedBy struct { + // The handle of the user who created the deployment rule. + Handle *string `json:"handle,omitempty"` + // The ID of the user who created the deployment rule. + Id string `json:"id"` + // The name of the user who created the deployment rule. + 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:"-"` +} + +// NewDeploymentGateResponseDataAttributesCreatedBy instantiates a new DeploymentGateResponseDataAttributesCreatedBy 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 NewDeploymentGateResponseDataAttributesCreatedBy(id string) *DeploymentGateResponseDataAttributesCreatedBy { + this := DeploymentGateResponseDataAttributesCreatedBy{} + this.Id = id + return &this +} + +// NewDeploymentGateResponseDataAttributesCreatedByWithDefaults instantiates a new DeploymentGateResponseDataAttributesCreatedBy 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 NewDeploymentGateResponseDataAttributesCreatedByWithDefaults() *DeploymentGateResponseDataAttributesCreatedBy { + this := DeploymentGateResponseDataAttributesCreatedBy{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *DeploymentGateResponseDataAttributesCreatedBy) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributesCreatedBy) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *DeploymentGateResponseDataAttributesCreatedBy) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *DeploymentGateResponseDataAttributesCreatedBy) SetHandle(v string) { + o.Handle = &v +} + +// GetId returns the Id field value. +func (o *DeploymentGateResponseDataAttributesCreatedBy) 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 *DeploymentGateResponseDataAttributesCreatedBy) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DeploymentGateResponseDataAttributesCreatedBy) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DeploymentGateResponseDataAttributesCreatedBy) 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 *DeploymentGateResponseDataAttributesCreatedBy) 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 *DeploymentGateResponseDataAttributesCreatedBy) 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 *DeploymentGateResponseDataAttributesCreatedBy) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentGateResponseDataAttributesCreatedBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + toSerialize["id"] = o.Id + 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 *DeploymentGateResponseDataAttributesCreatedBy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle,omitempty"` + Id *string `json:"id"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "id", "name"}) + } else { + return err + } + o.Handle = all.Handle + o.Id = *all.Id + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_deployment_gate_response_data_attributes_updated_by.go b/api/datadogV2/model_deployment_gate_response_data_attributes_updated_by.go new file mode 100644 index 00000000000..80efddc18ea --- /dev/null +++ b/api/datadogV2/model_deployment_gate_response_data_attributes_updated_by.go @@ -0,0 +1,171 @@ +// 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" +) + +// DeploymentGateResponseDataAttributesUpdatedBy Information about the user who updated the deployment gate. +type DeploymentGateResponseDataAttributesUpdatedBy struct { + // The handle of the user who updated the deployment rule. + Handle *string `json:"handle,omitempty"` + // The ID of the user who updated the deployment rule. + Id string `json:"id"` + // The name of the user who updated the deployment rule. + 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:"-"` +} + +// NewDeploymentGateResponseDataAttributesUpdatedBy instantiates a new DeploymentGateResponseDataAttributesUpdatedBy 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 NewDeploymentGateResponseDataAttributesUpdatedBy(id string) *DeploymentGateResponseDataAttributesUpdatedBy { + this := DeploymentGateResponseDataAttributesUpdatedBy{} + this.Id = id + return &this +} + +// NewDeploymentGateResponseDataAttributesUpdatedByWithDefaults instantiates a new DeploymentGateResponseDataAttributesUpdatedBy 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 NewDeploymentGateResponseDataAttributesUpdatedByWithDefaults() *DeploymentGateResponseDataAttributesUpdatedBy { + this := DeploymentGateResponseDataAttributesUpdatedBy{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) SetHandle(v string) { + o.Handle = &v +} + +// GetId returns the Id field value. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) 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 *DeploymentGateResponseDataAttributesUpdatedBy) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DeploymentGateResponseDataAttributesUpdatedBy) 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 *DeploymentGateResponseDataAttributesUpdatedBy) 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 *DeploymentGateResponseDataAttributesUpdatedBy) 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 *DeploymentGateResponseDataAttributesUpdatedBy) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentGateResponseDataAttributesUpdatedBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + toSerialize["id"] = o.Id + 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 *DeploymentGateResponseDataAttributesUpdatedBy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle,omitempty"` + Id *string `json:"id"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "id", "name"}) + } else { + return err + } + o.Handle = all.Handle + o.Id = *all.Id + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_deployment_rule_data_type.go b/api/datadogV2/model_deployment_rule_data_type.go new file mode 100644 index 00000000000..a0c4cbe51ef --- /dev/null +++ b/api/datadogV2/model_deployment_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" +) + +// DeploymentRuleDataType Deployment rule resource type. +type DeploymentRuleDataType string + +// List of DeploymentRuleDataType. +const ( + DEPLOYMENTRULEDATATYPE_DEPLOYMENT_RULE DeploymentRuleDataType = "deployment_rule" +) + +var allowedDeploymentRuleDataTypeEnumValues = []DeploymentRuleDataType{ + DEPLOYMENTRULEDATATYPE_DEPLOYMENT_RULE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DeploymentRuleDataType) GetAllowedValues() []DeploymentRuleDataType { + return allowedDeploymentRuleDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DeploymentRuleDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DeploymentRuleDataType(value) + return nil +} + +// NewDeploymentRuleDataTypeFromValue returns a pointer to a valid DeploymentRuleDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDeploymentRuleDataTypeFromValue(v string) (*DeploymentRuleDataType, error) { + ev := DeploymentRuleDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DeploymentRuleDataType: valid values are %v", v, allowedDeploymentRuleDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DeploymentRuleDataType) IsValid() bool { + for _, existing := range allowedDeploymentRuleDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DeploymentRuleDataType value. +func (v DeploymentRuleDataType) Ptr() *DeploymentRuleDataType { + return &v +} diff --git a/api/datadogV2/model_deployment_rule_options_faulty_deployment_detection.go b/api/datadogV2/model_deployment_rule_options_faulty_deployment_detection.go new file mode 100644 index 00000000000..5a083c172f1 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_options_faulty_deployment_detection.go @@ -0,0 +1,122 @@ +// 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" +) + +// DeploymentRuleOptionsFaultyDeploymentDetection Faulty deployment detection options for deployment rules. +type DeploymentRuleOptionsFaultyDeploymentDetection struct { + // The duration for faulty deployment detection. + Duration *int64 `json:"duration,omitempty"` + // Resources to exclude from faulty deployment detection. + ExcludedResources []string `json:"excluded_resources,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` +} + +// NewDeploymentRuleOptionsFaultyDeploymentDetection instantiates a new DeploymentRuleOptionsFaultyDeploymentDetection 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 NewDeploymentRuleOptionsFaultyDeploymentDetection() *DeploymentRuleOptionsFaultyDeploymentDetection { + this := DeploymentRuleOptionsFaultyDeploymentDetection{} + return &this +} + +// NewDeploymentRuleOptionsFaultyDeploymentDetectionWithDefaults instantiates a new DeploymentRuleOptionsFaultyDeploymentDetection 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 NewDeploymentRuleOptionsFaultyDeploymentDetectionWithDefaults() *DeploymentRuleOptionsFaultyDeploymentDetection { + this := DeploymentRuleOptionsFaultyDeploymentDetection{} + return &this +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) GetDuration() int64 { + if o == nil || o.Duration == nil { + var ret int64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) GetDurationOk() (*int64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) HasDuration() bool { + return o != nil && o.Duration != nil +} + +// SetDuration gets a reference to the given int64 and assigns it to the Duration field. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) SetDuration(v int64) { + o.Duration = &v +} + +// GetExcludedResources returns the ExcludedResources field value if set, zero value otherwise. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) GetExcludedResources() []string { + if o == nil || o.ExcludedResources == nil { + var ret []string + return ret + } + return o.ExcludedResources +} + +// GetExcludedResourcesOk returns a tuple with the ExcludedResources field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) GetExcludedResourcesOk() (*[]string, bool) { + if o == nil || o.ExcludedResources == nil { + return nil, false + } + return &o.ExcludedResources, true +} + +// HasExcludedResources returns a boolean if a field has been set. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) HasExcludedResources() bool { + return o != nil && o.ExcludedResources != nil +} + +// SetExcludedResources gets a reference to the given []string and assigns it to the ExcludedResources field. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) SetExcludedResources(v []string) { + o.ExcludedResources = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleOptionsFaultyDeploymentDetection) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + if o.ExcludedResources != nil { + toSerialize["excluded_resources"] = o.ExcludedResources + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeploymentRuleOptionsFaultyDeploymentDetection) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Duration *int64 `json:"duration,omitempty"` + ExcludedResources []string `json:"excluded_resources,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + o.Duration = all.Duration + o.ExcludedResources = all.ExcludedResources + + return nil +} diff --git a/api/datadogV2/model_deployment_rule_options_monitor.go b/api/datadogV2/model_deployment_rule_options_monitor.go new file mode 100644 index 00000000000..df2bd7ff218 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_options_monitor.go @@ -0,0 +1,121 @@ +// 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" +) + +// DeploymentRuleOptionsMonitor Monitor options for deployment rules. +type DeploymentRuleOptionsMonitor struct { + // Seconds the monitor needs to stay in OK status for the rule to pass. + Duration *int64 `json:"duration,omitempty"` + // Monitors that match this query are evaluated. + Query string `json:"query"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` +} + +// NewDeploymentRuleOptionsMonitor instantiates a new DeploymentRuleOptionsMonitor 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 NewDeploymentRuleOptionsMonitor(query string) *DeploymentRuleOptionsMonitor { + this := DeploymentRuleOptionsMonitor{} + this.Query = query + return &this +} + +// NewDeploymentRuleOptionsMonitorWithDefaults instantiates a new DeploymentRuleOptionsMonitor 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 NewDeploymentRuleOptionsMonitorWithDefaults() *DeploymentRuleOptionsMonitor { + this := DeploymentRuleOptionsMonitor{} + return &this +} + +// GetDuration returns the Duration field value if set, zero value otherwise. +func (o *DeploymentRuleOptionsMonitor) GetDuration() int64 { + if o == nil || o.Duration == nil { + var ret int64 + return ret + } + return *o.Duration +} + +// GetDurationOk returns a tuple with the Duration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleOptionsMonitor) GetDurationOk() (*int64, bool) { + if o == nil || o.Duration == nil { + return nil, false + } + return o.Duration, true +} + +// HasDuration returns a boolean if a field has been set. +func (o *DeploymentRuleOptionsMonitor) HasDuration() bool { + return o != nil && o.Duration != nil +} + +// SetDuration gets a reference to the given int64 and assigns it to the Duration field. +func (o *DeploymentRuleOptionsMonitor) SetDuration(v int64) { + o.Duration = &v +} + +// GetQuery returns the Query field value. +func (o *DeploymentRuleOptionsMonitor) GetQuery() string { + if o == nil { + var ret string + return ret + } + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleOptionsMonitor) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value. +func (o *DeploymentRuleOptionsMonitor) SetQuery(v string) { + o.Query = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleOptionsMonitor) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Duration != nil { + toSerialize["duration"] = o.Duration + } + toSerialize["query"] = o.Query + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeploymentRuleOptionsMonitor) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Duration *int64 `json:"duration,omitempty"` + Query *string `json:"query"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Query == nil { + return fmt.Errorf("required field query missing") + } + o.Duration = all.Duration + o.Query = *all.Query + + return nil +} diff --git a/api/datadogV2/model_deployment_rule_response.go b/api/datadogV2/model_deployment_rule_response.go new file mode 100644 index 00000000000..df622e65160 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_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" +) + +// DeploymentRuleResponse Response for a deployment rule. +type DeploymentRuleResponse struct { + // Data for a deployment rule. + Data *DeploymentRuleResponseData `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:"-"` +} + +// NewDeploymentRuleResponse instantiates a new DeploymentRuleResponse 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 NewDeploymentRuleResponse() *DeploymentRuleResponse { + this := DeploymentRuleResponse{} + return &this +} + +// NewDeploymentRuleResponseWithDefaults instantiates a new DeploymentRuleResponse 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 NewDeploymentRuleResponseWithDefaults() *DeploymentRuleResponse { + this := DeploymentRuleResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DeploymentRuleResponse) GetData() DeploymentRuleResponseData { + if o == nil || o.Data == nil { + var ret DeploymentRuleResponseData + 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 *DeploymentRuleResponse) GetDataOk() (*DeploymentRuleResponseData, 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 *DeploymentRuleResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DeploymentRuleResponseData and assigns it to the Data field. +func (o *DeploymentRuleResponse) SetData(v DeploymentRuleResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleResponse) 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 *DeploymentRuleResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DeploymentRuleResponseData `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_deployment_rule_response_data.go b/api/datadogV2/model_deployment_rule_response_data.go new file mode 100644 index 00000000000..261ae738278 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_response_data.go @@ -0,0 +1,178 @@ +// 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" +) + +// DeploymentRuleResponseData Data for a deployment rule. +type DeploymentRuleResponseData struct { + // Basic information about a deployment rule. + Attributes DeploymentRuleResponseDataAttributes `json:"attributes"` + // Unique identifier of the deployment rule. + Id string `json:"id"` + // Deployment rule resource type. + Type DeploymentRuleDataType `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:"-"` +} + +// NewDeploymentRuleResponseData instantiates a new DeploymentRuleResponseData 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 NewDeploymentRuleResponseData(attributes DeploymentRuleResponseDataAttributes, id string, typeVar DeploymentRuleDataType) *DeploymentRuleResponseData { + this := DeploymentRuleResponseData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewDeploymentRuleResponseDataWithDefaults instantiates a new DeploymentRuleResponseData 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 NewDeploymentRuleResponseDataWithDefaults() *DeploymentRuleResponseData { + this := DeploymentRuleResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *DeploymentRuleResponseData) GetAttributes() DeploymentRuleResponseDataAttributes { + if o == nil { + var ret DeploymentRuleResponseDataAttributes + 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 *DeploymentRuleResponseData) GetAttributesOk() (*DeploymentRuleResponseDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *DeploymentRuleResponseData) SetAttributes(v DeploymentRuleResponseDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *DeploymentRuleResponseData) 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 *DeploymentRuleResponseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DeploymentRuleResponseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *DeploymentRuleResponseData) GetType() DeploymentRuleDataType { + if o == nil { + var ret DeploymentRuleDataType + 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 *DeploymentRuleResponseData) GetTypeOk() (*DeploymentRuleDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DeploymentRuleResponseData) SetType(v DeploymentRuleDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleResponseData) 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 *DeploymentRuleResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *DeploymentRuleResponseDataAttributes `json:"attributes"` + Id *string `json:"id"` + Type *DeploymentRuleDataType `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_deployment_rule_response_data_attributes.go b/api/datadogV2/model_deployment_rule_response_data_attributes.go new file mode 100644 index 00000000000..9343aa9c467 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_response_data_attributes.go @@ -0,0 +1,388 @@ +// 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" +) + +// DeploymentRuleResponseDataAttributes Basic information about a deployment rule. +type DeploymentRuleResponseDataAttributes struct { + // The timestamp when the deployment rule was created. + CreatedAt time.Time `json:"created_at"` + // Information about the user who created the deployment rule. + CreatedBy DeploymentRuleResponseDataAttributesCreatedBy `json:"created_by"` + // Whether this rule is run in dry-run mode. + DryRun bool `json:"dry_run"` + // The ID of the deployment gate. + GateId string `json:"gate_id"` + // The name of the deployment rule. + Name string `json:"name"` + // Options for deployment rule response representing either faulty deployment detection or monitor options. + Options DeploymentRulesOptions `json:"options"` + // The type of the deployment rule. + Type DeploymentRuleResponseDataAttributesType `json:"type"` + // The timestamp when the deployment rule was last updated. + UpdatedAt *time.Time `json:"updated_at,omitempty"` + // Information about the user who updated the deployment rule. + UpdatedBy *DeploymentRuleResponseDataAttributesUpdatedBy `json:"updated_by,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:"-"` +} + +// NewDeploymentRuleResponseDataAttributes instantiates a new DeploymentRuleResponseDataAttributes 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 NewDeploymentRuleResponseDataAttributes(createdAt time.Time, createdBy DeploymentRuleResponseDataAttributesCreatedBy, dryRun bool, gateId string, name string, options DeploymentRulesOptions, typeVar DeploymentRuleResponseDataAttributesType) *DeploymentRuleResponseDataAttributes { + this := DeploymentRuleResponseDataAttributes{} + this.CreatedAt = createdAt + this.CreatedBy = createdBy + this.DryRun = dryRun + this.GateId = gateId + this.Name = name + this.Options = options + this.Type = typeVar + return &this +} + +// NewDeploymentRuleResponseDataAttributesWithDefaults instantiates a new DeploymentRuleResponseDataAttributes 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 NewDeploymentRuleResponseDataAttributesWithDefaults() *DeploymentRuleResponseDataAttributes { + this := DeploymentRuleResponseDataAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *DeploymentRuleResponseDataAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value. +func (o *DeploymentRuleResponseDataAttributes) GetCreatedBy() DeploymentRuleResponseDataAttributesCreatedBy { + if o == nil { + var ret DeploymentRuleResponseDataAttributesCreatedBy + return ret + } + return o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetCreatedByOk() (*DeploymentRuleResponseDataAttributesCreatedBy, bool) { + if o == nil { + return nil, false + } + return &o.CreatedBy, true +} + +// SetCreatedBy sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetCreatedBy(v DeploymentRuleResponseDataAttributesCreatedBy) { + o.CreatedBy = v +} + +// GetDryRun returns the DryRun field value. +func (o *DeploymentRuleResponseDataAttributes) GetDryRun() bool { + if o == nil { + var ret bool + return ret + } + return o.DryRun +} + +// GetDryRunOk returns a tuple with the DryRun field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetDryRunOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.DryRun, true +} + +// SetDryRun sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetDryRun(v bool) { + o.DryRun = v +} + +// GetGateId returns the GateId field value. +func (o *DeploymentRuleResponseDataAttributes) GetGateId() string { + if o == nil { + var ret string + return ret + } + return o.GateId +} + +// GetGateIdOk returns a tuple with the GateId field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetGateIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GateId, true +} + +// SetGateId sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetGateId(v string) { + o.GateId = v +} + +// GetName returns the Name field value. +func (o *DeploymentRuleResponseDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetName(v string) { + o.Name = v +} + +// GetOptions returns the Options field value. +func (o *DeploymentRuleResponseDataAttributes) GetOptions() DeploymentRulesOptions { + if o == nil { + var ret DeploymentRulesOptions + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetOptionsOk() (*DeploymentRulesOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetOptions(v DeploymentRulesOptions) { + o.Options = v +} + +// GetType returns the Type field value. +func (o *DeploymentRuleResponseDataAttributes) GetType() DeploymentRuleResponseDataAttributesType { + if o == nil { + var ret DeploymentRuleResponseDataAttributesType + 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 *DeploymentRuleResponseDataAttributes) GetTypeOk() (*DeploymentRuleResponseDataAttributesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DeploymentRuleResponseDataAttributes) SetType(v DeploymentRuleResponseDataAttributesType) { + o.Type = v +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *DeploymentRuleResponseDataAttributes) GetUpdatedAt() time.Time { + if o == nil || o.UpdatedAt == nil { + var ret time.Time + return ret + } + return *o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil || o.UpdatedAt == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *DeploymentRuleResponseDataAttributes) HasUpdatedAt() bool { + return o != nil && o.UpdatedAt != nil +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *DeploymentRuleResponseDataAttributes) SetUpdatedAt(v time.Time) { + o.UpdatedAt = &v +} + +// GetUpdatedBy returns the UpdatedBy field value if set, zero value otherwise. +func (o *DeploymentRuleResponseDataAttributes) GetUpdatedBy() DeploymentRuleResponseDataAttributesUpdatedBy { + if o == nil || o.UpdatedBy == nil { + var ret DeploymentRuleResponseDataAttributesUpdatedBy + return ret + } + return *o.UpdatedBy +} + +// GetUpdatedByOk returns a tuple with the UpdatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributes) GetUpdatedByOk() (*DeploymentRuleResponseDataAttributesUpdatedBy, bool) { + if o == nil || o.UpdatedBy == nil { + return nil, false + } + return o.UpdatedBy, true +} + +// HasUpdatedBy returns a boolean if a field has been set. +func (o *DeploymentRuleResponseDataAttributes) HasUpdatedBy() bool { + return o != nil && o.UpdatedBy != nil +} + +// SetUpdatedBy gets a reference to the given DeploymentRuleResponseDataAttributesUpdatedBy and assigns it to the UpdatedBy field. +func (o *DeploymentRuleResponseDataAttributes) SetUpdatedBy(v DeploymentRuleResponseDataAttributesUpdatedBy) { + o.UpdatedBy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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") + } + toSerialize["created_by"] = o.CreatedBy + toSerialize["dry_run"] = o.DryRun + toSerialize["gate_id"] = o.GateId + toSerialize["name"] = o.Name + toSerialize["options"] = o.Options + toSerialize["type"] = o.Type + if o.UpdatedAt != nil { + if o.UpdatedAt.Nanosecond() == 0 { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.UpdatedBy != nil { + toSerialize["updated_by"] = o.UpdatedBy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DeploymentRuleResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + CreatedBy *DeploymentRuleResponseDataAttributesCreatedBy `json:"created_by"` + DryRun *bool `json:"dry_run"` + GateId *string `json:"gate_id"` + Name *string `json:"name"` + Options *DeploymentRulesOptions `json:"options"` + Type *DeploymentRuleResponseDataAttributesType `json:"type"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + UpdatedBy *DeploymentRuleResponseDataAttributesUpdatedBy `json:"updated_by,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.CreatedBy == nil { + return fmt.Errorf("required field created_by missing") + } + if all.DryRun == nil { + return fmt.Errorf("required field dry_run missing") + } + if all.GateId == nil { + return fmt.Errorf("required field gate_id missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Options == nil { + return fmt.Errorf("required field options 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{"created_at", "created_by", "dry_run", "gate_id", "name", "options", "type", "updated_at", "updated_by"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = *all.CreatedAt + if all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = *all.CreatedBy + o.DryRun = *all.DryRun + o.GateId = *all.GateId + o.Name = *all.Name + o.Options = *all.Options + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + o.UpdatedAt = all.UpdatedAt + if all.UpdatedBy != nil && all.UpdatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.UpdatedBy = all.UpdatedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_deployment_rule_response_data_attributes_created_by.go b/api/datadogV2/model_deployment_rule_response_data_attributes_created_by.go new file mode 100644 index 00000000000..61e744b222b --- /dev/null +++ b/api/datadogV2/model_deployment_rule_response_data_attributes_created_by.go @@ -0,0 +1,171 @@ +// 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" +) + +// DeploymentRuleResponseDataAttributesCreatedBy Information about the user who created the deployment rule. +type DeploymentRuleResponseDataAttributesCreatedBy struct { + // The handle of the user who created the deployment rule. + Handle *string `json:"handle,omitempty"` + // The ID of the user who created the deployment rule. + Id string `json:"id"` + // The name of the user who created the deployment rule. + 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:"-"` +} + +// NewDeploymentRuleResponseDataAttributesCreatedBy instantiates a new DeploymentRuleResponseDataAttributesCreatedBy 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 NewDeploymentRuleResponseDataAttributesCreatedBy(id string) *DeploymentRuleResponseDataAttributesCreatedBy { + this := DeploymentRuleResponseDataAttributesCreatedBy{} + this.Id = id + return &this +} + +// NewDeploymentRuleResponseDataAttributesCreatedByWithDefaults instantiates a new DeploymentRuleResponseDataAttributesCreatedBy 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 NewDeploymentRuleResponseDataAttributesCreatedByWithDefaults() *DeploymentRuleResponseDataAttributesCreatedBy { + this := DeploymentRuleResponseDataAttributesCreatedBy{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) SetHandle(v string) { + o.Handle = &v +} + +// GetId returns the Id field value. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) 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 *DeploymentRuleResponseDataAttributesCreatedBy) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DeploymentRuleResponseDataAttributesCreatedBy) 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 *DeploymentRuleResponseDataAttributesCreatedBy) 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 *DeploymentRuleResponseDataAttributesCreatedBy) 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 *DeploymentRuleResponseDataAttributesCreatedBy) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleResponseDataAttributesCreatedBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + toSerialize["id"] = o.Id + 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 *DeploymentRuleResponseDataAttributesCreatedBy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle,omitempty"` + Id *string `json:"id"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "id", "name"}) + } else { + return err + } + o.Handle = all.Handle + o.Id = *all.Id + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_deployment_rule_response_data_attributes_type.go b/api/datadogV2/model_deployment_rule_response_data_attributes_type.go new file mode 100644 index 00000000000..f5ca5686917 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_response_data_attributes_type.go @@ -0,0 +1,66 @@ +// 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" +) + +// DeploymentRuleResponseDataAttributesType The type of the deployment rule. +type DeploymentRuleResponseDataAttributesType string + +// List of DeploymentRuleResponseDataAttributesType. +const ( + DEPLOYMENTRULERESPONSEDATAATTRIBUTESTYPE_FAULTY_DEPLOYMENT_DETECTION DeploymentRuleResponseDataAttributesType = "faulty_deployment_detection" + DEPLOYMENTRULERESPONSEDATAATTRIBUTESTYPE_MONITOR DeploymentRuleResponseDataAttributesType = "monitor" +) + +var allowedDeploymentRuleResponseDataAttributesTypeEnumValues = []DeploymentRuleResponseDataAttributesType{ + DEPLOYMENTRULERESPONSEDATAATTRIBUTESTYPE_FAULTY_DEPLOYMENT_DETECTION, + DEPLOYMENTRULERESPONSEDATAATTRIBUTESTYPE_MONITOR, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *DeploymentRuleResponseDataAttributesType) GetAllowedValues() []DeploymentRuleResponseDataAttributesType { + return allowedDeploymentRuleResponseDataAttributesTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *DeploymentRuleResponseDataAttributesType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = DeploymentRuleResponseDataAttributesType(value) + return nil +} + +// NewDeploymentRuleResponseDataAttributesTypeFromValue returns a pointer to a valid DeploymentRuleResponseDataAttributesType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewDeploymentRuleResponseDataAttributesTypeFromValue(v string) (*DeploymentRuleResponseDataAttributesType, error) { + ev := DeploymentRuleResponseDataAttributesType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for DeploymentRuleResponseDataAttributesType: valid values are %v", v, allowedDeploymentRuleResponseDataAttributesTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v DeploymentRuleResponseDataAttributesType) IsValid() bool { + for _, existing := range allowedDeploymentRuleResponseDataAttributesTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DeploymentRuleResponseDataAttributesType value. +func (v DeploymentRuleResponseDataAttributesType) Ptr() *DeploymentRuleResponseDataAttributesType { + return &v +} diff --git a/api/datadogV2/model_deployment_rule_response_data_attributes_updated_by.go b/api/datadogV2/model_deployment_rule_response_data_attributes_updated_by.go new file mode 100644 index 00000000000..2f885faac56 --- /dev/null +++ b/api/datadogV2/model_deployment_rule_response_data_attributes_updated_by.go @@ -0,0 +1,171 @@ +// 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" +) + +// DeploymentRuleResponseDataAttributesUpdatedBy Information about the user who updated the deployment rule. +type DeploymentRuleResponseDataAttributesUpdatedBy struct { + // The handle of the user who updated the deployment rule. + Handle *string `json:"handle,omitempty"` + // The ID of the user who updated the deployment rule. + Id string `json:"id"` + // The name of the user who updated the deployment rule. + 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:"-"` +} + +// NewDeploymentRuleResponseDataAttributesUpdatedBy instantiates a new DeploymentRuleResponseDataAttributesUpdatedBy 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 NewDeploymentRuleResponseDataAttributesUpdatedBy(id string) *DeploymentRuleResponseDataAttributesUpdatedBy { + this := DeploymentRuleResponseDataAttributesUpdatedBy{} + this.Id = id + return &this +} + +// NewDeploymentRuleResponseDataAttributesUpdatedByWithDefaults instantiates a new DeploymentRuleResponseDataAttributesUpdatedBy 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 NewDeploymentRuleResponseDataAttributesUpdatedByWithDefaults() *DeploymentRuleResponseDataAttributesUpdatedBy { + this := DeploymentRuleResponseDataAttributesUpdatedBy{} + return &this +} + +// GetHandle returns the Handle field value if set, zero value otherwise. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) GetHandle() string { + if o == nil || o.Handle == nil { + var ret string + return ret + } + return *o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) GetHandleOk() (*string, bool) { + if o == nil || o.Handle == nil { + return nil, false + } + return o.Handle, true +} + +// HasHandle returns a boolean if a field has been set. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) HasHandle() bool { + return o != nil && o.Handle != nil +} + +// SetHandle gets a reference to the given string and assigns it to the Handle field. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) SetHandle(v string) { + o.Handle = &v +} + +// GetId returns the Id field value. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) 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 *DeploymentRuleResponseDataAttributesUpdatedBy) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DeploymentRuleResponseDataAttributesUpdatedBy) 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 *DeploymentRuleResponseDataAttributesUpdatedBy) 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 *DeploymentRuleResponseDataAttributesUpdatedBy) 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 *DeploymentRuleResponseDataAttributesUpdatedBy) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DeploymentRuleResponseDataAttributesUpdatedBy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Handle != nil { + toSerialize["handle"] = o.Handle + } + toSerialize["id"] = o.Id + 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 *DeploymentRuleResponseDataAttributesUpdatedBy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Handle *string `json:"handle,omitempty"` + Id *string `json:"id"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"handle", "id", "name"}) + } else { + return err + } + o.Handle = all.Handle + o.Id = *all.Id + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_deployment_rules_options.go b/api/datadogV2/model_deployment_rules_options.go new file mode 100644 index 00000000000..4e68cb24cbc --- /dev/null +++ b/api/datadogV2/model_deployment_rules_options.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DeploymentRulesOptions - Options for deployment rule response representing either faulty deployment detection or monitor options. +type DeploymentRulesOptions struct { + DeploymentRuleOptionsFaultyDeploymentDetection *DeploymentRuleOptionsFaultyDeploymentDetection + DeploymentRuleOptionsMonitor *DeploymentRuleOptionsMonitor + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// DeploymentRuleOptionsFaultyDeploymentDetectionAsDeploymentRulesOptions is a convenience function that returns DeploymentRuleOptionsFaultyDeploymentDetection wrapped in DeploymentRulesOptions. +func DeploymentRuleOptionsFaultyDeploymentDetectionAsDeploymentRulesOptions(v *DeploymentRuleOptionsFaultyDeploymentDetection) DeploymentRulesOptions { + return DeploymentRulesOptions{DeploymentRuleOptionsFaultyDeploymentDetection: v} +} + +// DeploymentRuleOptionsMonitorAsDeploymentRulesOptions is a convenience function that returns DeploymentRuleOptionsMonitor wrapped in DeploymentRulesOptions. +func DeploymentRuleOptionsMonitorAsDeploymentRulesOptions(v *DeploymentRuleOptionsMonitor) DeploymentRulesOptions { + return DeploymentRulesOptions{DeploymentRuleOptionsMonitor: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *DeploymentRulesOptions) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into DeploymentRuleOptionsFaultyDeploymentDetection + err = datadog.Unmarshal(data, &obj.DeploymentRuleOptionsFaultyDeploymentDetection) + if err == nil { + if obj.DeploymentRuleOptionsFaultyDeploymentDetection != nil && obj.DeploymentRuleOptionsFaultyDeploymentDetection.UnparsedObject == nil { + jsonDeploymentRuleOptionsFaultyDeploymentDetection, _ := datadog.Marshal(obj.DeploymentRuleOptionsFaultyDeploymentDetection) + if string(jsonDeploymentRuleOptionsFaultyDeploymentDetection) == "{}" && string(data) != "{}" { // empty struct + obj.DeploymentRuleOptionsFaultyDeploymentDetection = nil + } else { + match++ + } + } else { + obj.DeploymentRuleOptionsFaultyDeploymentDetection = nil + } + } else { + obj.DeploymentRuleOptionsFaultyDeploymentDetection = nil + } + + // try to unmarshal data into DeploymentRuleOptionsMonitor + err = datadog.Unmarshal(data, &obj.DeploymentRuleOptionsMonitor) + if err == nil { + if obj.DeploymentRuleOptionsMonitor != nil && obj.DeploymentRuleOptionsMonitor.UnparsedObject == nil { + jsonDeploymentRuleOptionsMonitor, _ := datadog.Marshal(obj.DeploymentRuleOptionsMonitor) + if string(jsonDeploymentRuleOptionsMonitor) == "{}" { // empty struct + obj.DeploymentRuleOptionsMonitor = nil + } else { + match++ + } + } else { + obj.DeploymentRuleOptionsMonitor = nil + } + } else { + obj.DeploymentRuleOptionsMonitor = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.DeploymentRuleOptionsFaultyDeploymentDetection = nil + obj.DeploymentRuleOptionsMonitor = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj DeploymentRulesOptions) MarshalJSON() ([]byte, error) { + if obj.DeploymentRuleOptionsFaultyDeploymentDetection != nil { + return datadog.Marshal(&obj.DeploymentRuleOptionsFaultyDeploymentDetection) + } + + if obj.DeploymentRuleOptionsMonitor != nil { + return datadog.Marshal(&obj.DeploymentRuleOptionsMonitor) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *DeploymentRulesOptions) GetActualInstance() interface{} { + if obj.DeploymentRuleOptionsFaultyDeploymentDetection != nil { + return obj.DeploymentRuleOptionsFaultyDeploymentDetection + } + + if obj.DeploymentRuleOptionsMonitor != nil { + return obj.DeploymentRuleOptionsMonitor + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_httpcd_gates_bad_request_response.go b/api/datadogV2/model_httpcd_gates_bad_request_response.go new file mode 100644 index 00000000000..1d43fd6fab7 --- /dev/null +++ b/api/datadogV2/model_httpcd_gates_bad_request_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// HTTPCDGatesBadRequestResponse Bad request. +type HTTPCDGatesBadRequestResponse struct { + // Structured errors. + Errors []HTTPCIAppError `json:"errors,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:"-"` +} + +// NewHTTPCDGatesBadRequestResponse instantiates a new HTTPCDGatesBadRequestResponse 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 NewHTTPCDGatesBadRequestResponse() *HTTPCDGatesBadRequestResponse { + this := HTTPCDGatesBadRequestResponse{} + return &this +} + +// NewHTTPCDGatesBadRequestResponseWithDefaults instantiates a new HTTPCDGatesBadRequestResponse 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 NewHTTPCDGatesBadRequestResponseWithDefaults() *HTTPCDGatesBadRequestResponse { + this := HTTPCDGatesBadRequestResponse{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *HTTPCDGatesBadRequestResponse) GetErrors() []HTTPCIAppError { + if o == nil || o.Errors == nil { + var ret []HTTPCIAppError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPCDGatesBadRequestResponse) GetErrorsOk() (*[]HTTPCIAppError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *HTTPCDGatesBadRequestResponse) HasErrors() bool { + return o != nil && o.Errors != nil +} + +// SetErrors gets a reference to the given []HTTPCIAppError and assigns it to the Errors field. +func (o *HTTPCDGatesBadRequestResponse) SetErrors(v []HTTPCIAppError) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPCDGatesBadRequestResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPCDGatesBadRequestResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Errors []HTTPCIAppError `json:"errors,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{"errors"}) + } else { + return err + } + o.Errors = all.Errors + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_httpcd_gates_not_found_response.go b/api/datadogV2/model_httpcd_gates_not_found_response.go new file mode 100644 index 00000000000..e5acde9afe9 --- /dev/null +++ b/api/datadogV2/model_httpcd_gates_not_found_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// HTTPCDGatesNotFoundResponse Deployment gate not found. +type HTTPCDGatesNotFoundResponse struct { + // Structured errors. + Errors []HTTPCIAppError `json:"errors,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:"-"` +} + +// NewHTTPCDGatesNotFoundResponse instantiates a new HTTPCDGatesNotFoundResponse 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 NewHTTPCDGatesNotFoundResponse() *HTTPCDGatesNotFoundResponse { + this := HTTPCDGatesNotFoundResponse{} + return &this +} + +// NewHTTPCDGatesNotFoundResponseWithDefaults instantiates a new HTTPCDGatesNotFoundResponse 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 NewHTTPCDGatesNotFoundResponseWithDefaults() *HTTPCDGatesNotFoundResponse { + this := HTTPCDGatesNotFoundResponse{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *HTTPCDGatesNotFoundResponse) GetErrors() []HTTPCIAppError { + if o == nil || o.Errors == nil { + var ret []HTTPCIAppError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPCDGatesNotFoundResponse) GetErrorsOk() (*[]HTTPCIAppError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *HTTPCDGatesNotFoundResponse) HasErrors() bool { + return o != nil && o.Errors != nil +} + +// SetErrors gets a reference to the given []HTTPCIAppError and assigns it to the Errors field. +func (o *HTTPCDGatesNotFoundResponse) SetErrors(v []HTTPCIAppError) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPCDGatesNotFoundResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPCDGatesNotFoundResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Errors []HTTPCIAppError `json:"errors,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{"errors"}) + } else { + return err + } + o.Errors = all.Errors + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_httpcd_rules_not_found_response.go b/api/datadogV2/model_httpcd_rules_not_found_response.go new file mode 100644 index 00000000000..fde0b61775e --- /dev/null +++ b/api/datadogV2/model_httpcd_rules_not_found_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// HTTPCDRulesNotFoundResponse Deployment rule not found. +type HTTPCDRulesNotFoundResponse struct { + // Structured errors. + Errors []HTTPCIAppError `json:"errors,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:"-"` +} + +// NewHTTPCDRulesNotFoundResponse instantiates a new HTTPCDRulesNotFoundResponse 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 NewHTTPCDRulesNotFoundResponse() *HTTPCDRulesNotFoundResponse { + this := HTTPCDRulesNotFoundResponse{} + return &this +} + +// NewHTTPCDRulesNotFoundResponseWithDefaults instantiates a new HTTPCDRulesNotFoundResponse 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 NewHTTPCDRulesNotFoundResponseWithDefaults() *HTTPCDRulesNotFoundResponse { + this := HTTPCDRulesNotFoundResponse{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *HTTPCDRulesNotFoundResponse) GetErrors() []HTTPCIAppError { + if o == nil || o.Errors == nil { + var ret []HTTPCIAppError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPCDRulesNotFoundResponse) GetErrorsOk() (*[]HTTPCIAppError, bool) { + if o == nil || o.Errors == nil { + return nil, false + } + return &o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *HTTPCDRulesNotFoundResponse) HasErrors() bool { + return o != nil && o.Errors != nil +} + +// SetErrors gets a reference to the given []HTTPCIAppError and assigns it to the Errors field. +func (o *HTTPCDRulesNotFoundResponse) SetErrors(v []HTTPCIAppError) { + o.Errors = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HTTPCDRulesNotFoundResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Errors != nil { + toSerialize["errors"] = o.Errors + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HTTPCDRulesNotFoundResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Errors []HTTPCIAppError `json:"errors,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{"errors"}) + } else { + return err + } + o.Errors = all.Errors + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_deployment_gate_params.go b/api/datadogV2/model_update_deployment_gate_params.go new file mode 100644 index 00000000000..c44750014a5 --- /dev/null +++ b/api/datadogV2/model_update_deployment_gate_params.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" +) + +// UpdateDeploymentGateParams Parameters for updating a deployment gate. +type UpdateDeploymentGateParams struct { + // Parameters for updating a deployment gate. + Data UpdateDeploymentGateParamsData `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:"-"` +} + +// NewUpdateDeploymentGateParams instantiates a new UpdateDeploymentGateParams 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 NewUpdateDeploymentGateParams(data UpdateDeploymentGateParamsData) *UpdateDeploymentGateParams { + this := UpdateDeploymentGateParams{} + this.Data = data + return &this +} + +// NewUpdateDeploymentGateParamsWithDefaults instantiates a new UpdateDeploymentGateParams 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 NewUpdateDeploymentGateParamsWithDefaults() *UpdateDeploymentGateParams { + this := UpdateDeploymentGateParams{} + return &this +} + +// GetData returns the Data field value. +func (o *UpdateDeploymentGateParams) GetData() UpdateDeploymentGateParamsData { + if o == nil { + var ret UpdateDeploymentGateParamsData + 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 *UpdateDeploymentGateParams) GetDataOk() (*UpdateDeploymentGateParamsData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *UpdateDeploymentGateParams) SetData(v UpdateDeploymentGateParamsData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateDeploymentGateParams) 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 *UpdateDeploymentGateParams) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *UpdateDeploymentGateParamsData `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_update_deployment_gate_params_data.go b/api/datadogV2/model_update_deployment_gate_params_data.go new file mode 100644 index 00000000000..c5a41bcbc0b --- /dev/null +++ b/api/datadogV2/model_update_deployment_gate_params_data.go @@ -0,0 +1,178 @@ +// 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" +) + +// UpdateDeploymentGateParamsData Parameters for updating a deployment gate. +type UpdateDeploymentGateParamsData struct { + // Attributes for updating a deployment gate. + Attributes UpdateDeploymentGateParamsDataAttributes `json:"attributes"` + // Unique identifier of the deployment gate. + Id string `json:"id"` + // Deployment gate resource type. + Type DeploymentGateDataType `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:"-"` +} + +// NewUpdateDeploymentGateParamsData instantiates a new UpdateDeploymentGateParamsData 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 NewUpdateDeploymentGateParamsData(attributes UpdateDeploymentGateParamsDataAttributes, id string, typeVar DeploymentGateDataType) *UpdateDeploymentGateParamsData { + this := UpdateDeploymentGateParamsData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewUpdateDeploymentGateParamsDataWithDefaults instantiates a new UpdateDeploymentGateParamsData 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 NewUpdateDeploymentGateParamsDataWithDefaults() *UpdateDeploymentGateParamsData { + this := UpdateDeploymentGateParamsData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *UpdateDeploymentGateParamsData) GetAttributes() UpdateDeploymentGateParamsDataAttributes { + if o == nil { + var ret UpdateDeploymentGateParamsDataAttributes + 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 *UpdateDeploymentGateParamsData) GetAttributesOk() (*UpdateDeploymentGateParamsDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *UpdateDeploymentGateParamsData) SetAttributes(v UpdateDeploymentGateParamsDataAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *UpdateDeploymentGateParamsData) 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 *UpdateDeploymentGateParamsData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *UpdateDeploymentGateParamsData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *UpdateDeploymentGateParamsData) GetType() DeploymentGateDataType { + if o == nil { + var ret DeploymentGateDataType + 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 *UpdateDeploymentGateParamsData) GetTypeOk() (*DeploymentGateDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UpdateDeploymentGateParamsData) SetType(v DeploymentGateDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateDeploymentGateParamsData) 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 *UpdateDeploymentGateParamsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UpdateDeploymentGateParamsDataAttributes `json:"attributes"` + Id *string `json:"id"` + Type *DeploymentGateDataType `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_update_deployment_gate_params_data_attributes.go b/api/datadogV2/model_update_deployment_gate_params_data_attributes.go new file mode 100644 index 00000000000..f99068f57f4 --- /dev/null +++ b/api/datadogV2/model_update_deployment_gate_params_data_attributes.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// UpdateDeploymentGateParamsDataAttributes Attributes for updating a deployment gate. +type UpdateDeploymentGateParamsDataAttributes struct { + // Whether to run in dry-run mode. + DryRun bool `json:"dry_run"` + // 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:"-"` +} + +// NewUpdateDeploymentGateParamsDataAttributes instantiates a new UpdateDeploymentGateParamsDataAttributes 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 NewUpdateDeploymentGateParamsDataAttributes(dryRun bool) *UpdateDeploymentGateParamsDataAttributes { + this := UpdateDeploymentGateParamsDataAttributes{} + this.DryRun = dryRun + return &this +} + +// NewUpdateDeploymentGateParamsDataAttributesWithDefaults instantiates a new UpdateDeploymentGateParamsDataAttributes 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 NewUpdateDeploymentGateParamsDataAttributesWithDefaults() *UpdateDeploymentGateParamsDataAttributes { + this := UpdateDeploymentGateParamsDataAttributes{} + return &this +} + +// GetDryRun returns the DryRun field value. +func (o *UpdateDeploymentGateParamsDataAttributes) GetDryRun() bool { + if o == nil { + var ret bool + return ret + } + return o.DryRun +} + +// GetDryRunOk returns a tuple with the DryRun field value +// and a boolean to check if the value has been set. +func (o *UpdateDeploymentGateParamsDataAttributes) GetDryRunOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.DryRun, true +} + +// SetDryRun sets field value. +func (o *UpdateDeploymentGateParamsDataAttributes) SetDryRun(v bool) { + o.DryRun = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateDeploymentGateParamsDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["dry_run"] = o.DryRun + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateDeploymentGateParamsDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DryRun *bool `json:"dry_run"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DryRun == nil { + return fmt.Errorf("required field dry_run missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"dry_run"}) + } else { + return err + } + o.DryRun = *all.DryRun + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_update_deployment_rule_params.go b/api/datadogV2/model_update_deployment_rule_params.go new file mode 100644 index 00000000000..10a7b3803ae --- /dev/null +++ b/api/datadogV2/model_update_deployment_rule_params.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" +) + +// UpdateDeploymentRuleParams Parameters for updating a deployment rule. +type UpdateDeploymentRuleParams struct { + // Parameters for updating a deployment rule. + Data UpdateDeploymentRuleParamsData `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:"-"` +} + +// NewUpdateDeploymentRuleParams instantiates a new UpdateDeploymentRuleParams 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 NewUpdateDeploymentRuleParams(data UpdateDeploymentRuleParamsData) *UpdateDeploymentRuleParams { + this := UpdateDeploymentRuleParams{} + this.Data = data + return &this +} + +// NewUpdateDeploymentRuleParamsWithDefaults instantiates a new UpdateDeploymentRuleParams 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 NewUpdateDeploymentRuleParamsWithDefaults() *UpdateDeploymentRuleParams { + this := UpdateDeploymentRuleParams{} + return &this +} + +// GetData returns the Data field value. +func (o *UpdateDeploymentRuleParams) GetData() UpdateDeploymentRuleParamsData { + if o == nil { + var ret UpdateDeploymentRuleParamsData + 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 *UpdateDeploymentRuleParams) GetDataOk() (*UpdateDeploymentRuleParamsData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *UpdateDeploymentRuleParams) SetData(v UpdateDeploymentRuleParamsData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateDeploymentRuleParams) 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 *UpdateDeploymentRuleParams) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *UpdateDeploymentRuleParamsData `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_update_deployment_rule_params_data.go b/api/datadogV2/model_update_deployment_rule_params_data.go new file mode 100644 index 00000000000..e826a40ce94 --- /dev/null +++ b/api/datadogV2/model_update_deployment_rule_params_data.go @@ -0,0 +1,146 @@ +// 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" +) + +// UpdateDeploymentRuleParamsData Parameters for updating a deployment rule. +type UpdateDeploymentRuleParamsData struct { + // Parameters for updating a deployment rule. + Attributes UpdateDeploymentRuleParamsDataAttributes `json:"attributes"` + // Deployment rule resource type. + Type DeploymentRuleDataType `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:"-"` +} + +// NewUpdateDeploymentRuleParamsData instantiates a new UpdateDeploymentRuleParamsData 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 NewUpdateDeploymentRuleParamsData(attributes UpdateDeploymentRuleParamsDataAttributes, typeVar DeploymentRuleDataType) *UpdateDeploymentRuleParamsData { + this := UpdateDeploymentRuleParamsData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewUpdateDeploymentRuleParamsDataWithDefaults instantiates a new UpdateDeploymentRuleParamsData 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 NewUpdateDeploymentRuleParamsDataWithDefaults() *UpdateDeploymentRuleParamsData { + this := UpdateDeploymentRuleParamsData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *UpdateDeploymentRuleParamsData) GetAttributes() UpdateDeploymentRuleParamsDataAttributes { + if o == nil { + var ret UpdateDeploymentRuleParamsDataAttributes + 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 *UpdateDeploymentRuleParamsData) GetAttributesOk() (*UpdateDeploymentRuleParamsDataAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *UpdateDeploymentRuleParamsData) SetAttributes(v UpdateDeploymentRuleParamsDataAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *UpdateDeploymentRuleParamsData) GetType() DeploymentRuleDataType { + if o == nil { + var ret DeploymentRuleDataType + 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 *UpdateDeploymentRuleParamsData) GetTypeOk() (*DeploymentRuleDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UpdateDeploymentRuleParamsData) SetType(v DeploymentRuleDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateDeploymentRuleParamsData) 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 *UpdateDeploymentRuleParamsData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UpdateDeploymentRuleParamsDataAttributes `json:"attributes"` + Type *DeploymentRuleDataType `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_update_deployment_rule_params_data_attributes.go b/api/datadogV2/model_update_deployment_rule_params_data_attributes.go new file mode 100644 index 00000000000..e5f292188f5 --- /dev/null +++ b/api/datadogV2/model_update_deployment_rule_params_data_attributes.go @@ -0,0 +1,165 @@ +// 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" +) + +// UpdateDeploymentRuleParamsDataAttributes Parameters for updating a deployment rule. +type UpdateDeploymentRuleParamsDataAttributes struct { + // Whether to run this rule in dry-run mode. + DryRun bool `json:"dry_run"` + // The name of the deployment rule. + Name string `json:"name"` + // Options for deployment rule response representing either faulty deployment detection or monitor options. + Options DeploymentRulesOptions `json:"options"` + // 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:"-"` +} + +// NewUpdateDeploymentRuleParamsDataAttributes instantiates a new UpdateDeploymentRuleParamsDataAttributes 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 NewUpdateDeploymentRuleParamsDataAttributes(dryRun bool, name string, options DeploymentRulesOptions) *UpdateDeploymentRuleParamsDataAttributes { + this := UpdateDeploymentRuleParamsDataAttributes{} + this.DryRun = dryRun + this.Name = name + this.Options = options + return &this +} + +// NewUpdateDeploymentRuleParamsDataAttributesWithDefaults instantiates a new UpdateDeploymentRuleParamsDataAttributes 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 NewUpdateDeploymentRuleParamsDataAttributesWithDefaults() *UpdateDeploymentRuleParamsDataAttributes { + this := UpdateDeploymentRuleParamsDataAttributes{} + return &this +} + +// GetDryRun returns the DryRun field value. +func (o *UpdateDeploymentRuleParamsDataAttributes) GetDryRun() bool { + if o == nil { + var ret bool + return ret + } + return o.DryRun +} + +// GetDryRunOk returns a tuple with the DryRun field value +// and a boolean to check if the value has been set. +func (o *UpdateDeploymentRuleParamsDataAttributes) GetDryRunOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.DryRun, true +} + +// SetDryRun sets field value. +func (o *UpdateDeploymentRuleParamsDataAttributes) SetDryRun(v bool) { + o.DryRun = v +} + +// GetName returns the Name field value. +func (o *UpdateDeploymentRuleParamsDataAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateDeploymentRuleParamsDataAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *UpdateDeploymentRuleParamsDataAttributes) SetName(v string) { + o.Name = v +} + +// GetOptions returns the Options field value. +func (o *UpdateDeploymentRuleParamsDataAttributes) GetOptions() DeploymentRulesOptions { + if o == nil { + var ret DeploymentRulesOptions + return ret + } + return o.Options +} + +// GetOptionsOk returns a tuple with the Options field value +// and a boolean to check if the value has been set. +func (o *UpdateDeploymentRuleParamsDataAttributes) GetOptionsOk() (*DeploymentRulesOptions, bool) { + if o == nil { + return nil, false + } + return &o.Options, true +} + +// SetOptions sets field value. +func (o *UpdateDeploymentRuleParamsDataAttributes) SetOptions(v DeploymentRulesOptions) { + o.Options = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UpdateDeploymentRuleParamsDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["dry_run"] = o.DryRun + toSerialize["name"] = o.Name + toSerialize["options"] = o.Options + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UpdateDeploymentRuleParamsDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DryRun *bool `json:"dry_run"` + Name *string `json:"name"` + Options *DeploymentRulesOptions `json:"options"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DryRun == nil { + return fmt.Errorf("required field dry_run missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Options == nil { + return fmt.Errorf("required field options missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"dry_run", "name", "options"}) + } else { + return err + } + o.DryRun = *all.DryRun + o.Name = *all.Name + o.Options = *all.Options + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/deployment-gates/CreateDeploymentGate.go b/examples/v2/deployment-gates/CreateDeploymentGate.go new file mode 100644 index 00000000000..d1fe98eacac --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentGate.go @@ -0,0 +1,41 @@ +// Create deployment gate 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.CreateDeploymentGateParams{ + Data: datadogV2.CreateDeploymentGateParamsData{ + Attributes: datadogV2.CreateDeploymentGateParamsDataAttributes{ + DryRun: datadog.PtrBool(false), + Env: "production", + Identifier: datadog.PtrString("my-gate-1"), + Service: "my-service", + }, + Type: datadogV2.DEPLOYMENTGATEDATATYPE_DEPLOYMENT_GATE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateDeploymentGate", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + resp, r, err := api.CreateDeploymentGate(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.CreateDeploymentGate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DeploymentGatesApi.CreateDeploymentGate`:\n%s\n", responseContent) +} diff --git a/examples/v2/deployment-gates/CreateDeploymentRule.go b/examples/v2/deployment-gates/CreateDeploymentRule.go new file mode 100644 index 00000000000..823efec8338 --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentRule.go @@ -0,0 +1,47 @@ +// Create deployment rule 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() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + body := datadogV2.CreateDeploymentRuleParams{ + Data: &datadogV2.CreateDeploymentRuleParamsData{ + Attributes: datadogV2.CreateDeploymentRuleParamsDataAttributes{ + DryRun: datadog.PtrBool(false), + Name: "My deployment rule", + Options: datadogV2.DeploymentRulesOptions{ + DeploymentRuleOptionsFaultyDeploymentDetection: &datadogV2.DeploymentRuleOptionsFaultyDeploymentDetection{ + ExcludedResources: []string{}, + }}, + Type: "faulty_deployment_detection", + }, + Type: datadogV2.DEPLOYMENTRULEDATATYPE_DEPLOYMENT_RULE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateDeploymentRule", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + resp, r, err := api.CreateDeploymentRule(ctx, DeploymentGateDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.CreateDeploymentRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DeploymentGatesApi.CreateDeploymentRule`:\n%s\n", responseContent) +} diff --git a/examples/v2/deployment-gates/DeleteDeploymentGate.go b/examples/v2/deployment-gates/DeleteDeploymentGate.go new file mode 100644 index 00000000000..8f2fcca4924 --- /dev/null +++ b/examples/v2/deployment-gates/DeleteDeploymentGate.go @@ -0,0 +1,29 @@ +// Delete deployment gate returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteDeploymentGate", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + r, err := api.DeleteDeploymentGate(ctx, DeploymentGateDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.DeleteDeploymentGate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/deployment-gates/DeleteDeploymentRule.go b/examples/v2/deployment-gates/DeleteDeploymentRule.go new file mode 100644 index 00000000000..cc9f3ac00f0 --- /dev/null +++ b/examples/v2/deployment-gates/DeleteDeploymentRule.go @@ -0,0 +1,32 @@ +// Delete deployment rule returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + // there is a valid "deployment_rule" in the system + DeploymentRuleDataID := os.Getenv("DEPLOYMENT_RULE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteDeploymentRule", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + r, err := api.DeleteDeploymentRule(ctx, DeploymentGateDataID, DeploymentRuleDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.DeleteDeploymentRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/deployment-gates/GetDeploymentGate.go b/examples/v2/deployment-gates/GetDeploymentGate.go new file mode 100644 index 00000000000..6c98e0965d7 --- /dev/null +++ b/examples/v2/deployment-gates/GetDeploymentGate.go @@ -0,0 +1,33 @@ +// Get deployment gate 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() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetDeploymentGate", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + resp, r, err := api.GetDeploymentGate(ctx, DeploymentGateDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.GetDeploymentGate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DeploymentGatesApi.GetDeploymentGate`:\n%s\n", responseContent) +} diff --git a/examples/v2/deployment-gates/GetDeploymentRule.go b/examples/v2/deployment-gates/GetDeploymentRule.go new file mode 100644 index 00000000000..1a91a583f89 --- /dev/null +++ b/examples/v2/deployment-gates/GetDeploymentRule.go @@ -0,0 +1,36 @@ +// Get deployment rule 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() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + // there is a valid "deployment_rule" in the system + DeploymentRuleDataID := os.Getenv("DEPLOYMENT_RULE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetDeploymentRule", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + resp, r, err := api.GetDeploymentRule(ctx, DeploymentGateDataID, DeploymentRuleDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.GetDeploymentRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DeploymentGatesApi.GetDeploymentRule`:\n%s\n", responseContent) +} diff --git a/examples/v2/deployment-gates/UpdateDeploymentGate.go b/examples/v2/deployment-gates/UpdateDeploymentGate.go new file mode 100644 index 00000000000..d008d861e98 --- /dev/null +++ b/examples/v2/deployment-gates/UpdateDeploymentGate.go @@ -0,0 +1,42 @@ +// Update deployment gate 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() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + body := datadogV2.UpdateDeploymentGateParams{ + Data: datadogV2.UpdateDeploymentGateParamsData{ + Attributes: datadogV2.UpdateDeploymentGateParamsDataAttributes{ + DryRun: false, + }, + Id: "12345678-1234-1234-1234-123456789012", + Type: datadogV2.DEPLOYMENTGATEDATATYPE_DEPLOYMENT_GATE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateDeploymentGate", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + resp, r, err := api.UpdateDeploymentGate(ctx, DeploymentGateDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.UpdateDeploymentGate`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DeploymentGatesApi.UpdateDeploymentGate`:\n%s\n", responseContent) +} diff --git a/examples/v2/deployment-gates/UpdateDeploymentRule.go b/examples/v2/deployment-gates/UpdateDeploymentRule.go new file mode 100644 index 00000000000..3c12e3d682e --- /dev/null +++ b/examples/v2/deployment-gates/UpdateDeploymentRule.go @@ -0,0 +1,49 @@ +// Update deployment rule 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() { + // there is a valid "deployment_gate" in the system + DeploymentGateDataID := os.Getenv("DEPLOYMENT_GATE_DATA_ID") + + // there is a valid "deployment_rule" in the system + DeploymentRuleDataID := os.Getenv("DEPLOYMENT_RULE_DATA_ID") + + body := datadogV2.UpdateDeploymentRuleParams{ + Data: datadogV2.UpdateDeploymentRuleParamsData{ + Attributes: datadogV2.UpdateDeploymentRuleParamsDataAttributes{ + DryRun: false, + Name: "Updated deployment rule", + Options: datadogV2.DeploymentRulesOptions{ + DeploymentRuleOptionsFaultyDeploymentDetection: &datadogV2.DeploymentRuleOptionsFaultyDeploymentDetection{ + ExcludedResources: []string{}, + }}, + }, + Type: datadogV2.DEPLOYMENTRULEDATATYPE_DEPLOYMENT_RULE, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateDeploymentRule", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewDeploymentGatesApi(apiClient) + resp, r, err := api.UpdateDeploymentRule(ctx, DeploymentGateDataID, DeploymentRuleDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DeploymentGatesApi.UpdateDeploymentRule`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DeploymentGatesApi.UpdateDeploymentRule`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 58d16ea4b1c..4e0a4fdca3f 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -71,6 +71,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "DashboardListsApi": reflect.ValueOf(datadogV2.NewDashboardListsApi), "DatasetsApi": reflect.ValueOf(datadogV2.NewDatasetsApi), "DataDeletionApi": reflect.ValueOf(datadogV2.NewDataDeletionApi), + "DeploymentGatesApi": reflect.ValueOf(datadogV2.NewDeploymentGatesApi), "DomainAllowlistApi": reflect.ValueOf(datadogV2.NewDomainAllowlistApi), "DORAMetricsApi": reflect.ValueOf(datadogV2.NewDORAMetricsApi), "DowntimesApi": reflect.ValueOf(datadogV2.NewDowntimesApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..3c155e79017 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:03:25.410Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..55d7a56177c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"env":"","identifier":"my-gate","service":"test-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"env\" + is required"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_OK_response.freeze new file mode 100644 index 00000000000..89457259cee --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:03:26.103Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_OK_response.yaml new file mode 100644 index 00000000000..06fb2e62f5a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_gate_returns_OK_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate-1","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"0cc075c2-fec1-4ed3-9e43-0882646fac07","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:03:26.337009Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate-1","service":"my-service","updated_at":"2025-10-28T14:03:26.337009Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/0cc075c2-fec1-4ed3-9e43-0882646fac07 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..70cc3602d60 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:12.459Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..2ce6ebf0eea --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_Bad_Request_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"c7d0bed9-01dc-45d5-88ad-242123881f81","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:13.006792Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:13.006792Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"test","options":{"excluded_resources":[]},"type":"fdd"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/c7d0bed9-01dc-45d5-88ad-242123881f81/rules + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"type\" + must be one of \"monitor faulty_deployment_detection\""}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/c7d0bed9-01dc-45d5-88ad-242123881f81 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..44db2e7bb5f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:13.363Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_OK_response.yaml new file mode 100644 index 00000000000..f945a181289 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Create_deployment_rule_returns_OK_response.yaml @@ -0,0 +1,77 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"58066a8e-44e7-4119-8ac6-a5ecc3b31c1b","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:13.477518Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:13.477518Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/58066a8e-44e7-4119-8ac6-a5ecc3b31c1b/rules + response: + body: '{"data":{"id":"8330bf79-6906-4cea-85d5-a4da6767458e","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:13.852895Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"58066a8e-44e7-4119-8ac6-a5ecc3b31c1b","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:13.852895Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/58066a8e-44e7-4119-8ac6-a5ecc3b31c1b/rules/8330bf79-6906-4cea-85d5-a4da6767458e + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/58066a8e-44e7-4119-8ac6-a5ecc3b31c1b + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..a5e028feae2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:03:29.170Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..f669cb7c678 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"id\" + Invalid id"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_No_Content_response.freeze new file mode 100644 index 00000000000..88c603c5ccf --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:14.192Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_No_Content_response.yaml new file mode 100644 index 00000000000..a6f918380c2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_gate_returns_No_Content_response.yaml @@ -0,0 +1,57 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"dba6d48b-b7ac-4ac8-b2d5-70e45b500eed","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:14.313688Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:14.313688Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/dba6d48b-b7ac-4ac8-b2d5-70e45b500eed + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/dba6d48b-b7ac-4ac8-b2d5-70e45b500eed + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"Gate does not + exist"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..8a22d65c1ac --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:03:30.230Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..7676d53a1b5 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id/rules/invalid-rule-id + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"gate_id\" + Invalid id"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_No_Content_response.freeze new file mode 100644 index 00000000000..6685aa65afe --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:14.630Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_No_Content_response.yaml new file mode 100644 index 00000000000..d554b2d4357 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Delete_deployment_rule_returns_No_Content_response.yaml @@ -0,0 +1,95 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"8e202ae7-a86b-4f4a-a213-585801a42630","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:14.754979Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:14.754979Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630/rules + response: + body: '{"data":{"id":"31e6717f-2eaa-45e5-9559-a55ca9d45f8d","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:14.911642Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"8e202ae7-a86b-4f4a-a213-585801a42630","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:14.911642Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630/rules/31e6717f-2eaa-45e5-9559-a55ca9d45f8d + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630/rules/31e6717f-2eaa-45e5-9559-a55ca9d45f8d + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"Rule does not + exist"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..818f6bcc35a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:03:31.887Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..73b48eb679c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_Bad_Request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"id\" + Invalid id"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_OK_response.freeze new file mode 100644 index 00000000000..b38e931fdba --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:15.372Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_OK_response.yaml new file mode 100644 index 00000000000..8bba4f62711 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_gate_returns_OK_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"ed4085c5-e8d3-4bf8-89a6-c257164d8952","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:15.478086Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:15.478086Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/deployment_gates/ed4085c5-e8d3-4bf8-89a6-c257164d8952 + response: + body: '{"data":{"id":"ed4085c5-e8d3-4bf8-89a6-c257164d8952","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:15.478086Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:15.478086Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/ed4085c5-e8d3-4bf8-89a6-c257164d8952 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..3246cdbd649 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:15.883Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..cf8ef2a90fd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_Bad_Request_response.yaml @@ -0,0 +1,95 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"d49e6d82-2dc4-45b6-ab50-4fb09feae18e","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:16.013862Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:16.013862Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/d49e6d82-2dc4-45b6-ab50-4fb09feae18e/rules + response: + body: '{"data":{"id":"611707d2-276e-4dc5-b754-db8f94eab0b5","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:16.184094Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"d49e6d82-2dc4-45b6-ab50-4fb09feae18e","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:16.184094Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 2 + method: GET + url: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id/rules/invalid-rule-id + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"gate_id\" + Invalid id"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/d49e6d82-2dc4-45b6-ab50-4fb09feae18e/rules/611707d2-276e-4dc5-b754-db8f94eab0b5 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/d49e6d82-2dc4-45b6-ab50-4fb09feae18e + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..f1e5e963932 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:16.642Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_OK_response.yaml new file mode 100644 index 00000000000..9eebd396f26 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Get_deployment_rule_returns_OK_response.yaml @@ -0,0 +1,97 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:16.752908Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:16.752908Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56/rules + response: + body: '{"data":{"id":"a38ab685-4ef9-4000-a938-740da6c37296","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:16.947341Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:16.947341Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 2 + method: GET + url: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56/rules/a38ab685-4ef9-4000-a938-740da6c37296 + response: + body: '{"data":{"id":"a38ab685-4ef9-4000-a938-740da6c37296","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:16.947341Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:16.947341Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56/rules/a38ab685-4ef9-4000-a938-740da6c37296 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..88eba0b9804 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:03:35.734Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..85640903be9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":true},"id":"invalid-gate-id","type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"id\" + Invalid id"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_OK_response.freeze new file mode 100644 index 00000000000..b67d99b534d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:17.586Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_OK_response.yaml new file mode 100644 index 00000000000..98f92cf32e0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_gate_returns_OK_response.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"ef672c2e-81fc-4fcc-9690-392a9cf0d70c","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:17.693361Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:17.693361Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false},"id":"12345678-1234-1234-1234-123456789012","type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: PUT + url: https://api.datadoghq.com/api/v2/deployment_gates/ef672c2e-81fc-4fcc-9690-392a9cf0d70c + response: + body: '{"data":{"id":"ef672c2e-81fc-4fcc-9690-392a9cf0d70c","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:17.693361Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:17.841019Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/ef672c2e-81fc-4fcc-9690-392a9cf0d70c + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..1691ea92422 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:18.004Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..a0b6da80b62 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_Bad_Request_response.yaml @@ -0,0 +1,98 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:18.108594Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:18.108594Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d/rules + response: + body: '{"data":{"id":"189846d6-3c19-46e8-98d1-9d05a2f43361","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:18.251816Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:18.251816Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"Updated deployment rule","options":{"excluded_resources":[]}},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: PUT + url: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id/rules/invalid-rule-id + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute \"gate_id\" + Invalid id"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d/rules/189846d6-3c19-46e8-98d1-9d05a2f43361 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..7ae0c5541e9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-10-28T14:51:18.721Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_OK_response.yaml new file mode 100644 index 00000000000..18d6a4d5f68 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Deployment_Gates/Scenario_Update_deployment_rule_returns_OK_response.yaml @@ -0,0 +1,100 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: '{"data":{"id":"301122dd-9022-40f0-886f-f9a6c227dc9a","type":"deployment_gate","attributes":{"created_at":"2025-10-28T14:51:18.845469Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service","updated_at":"2025-10-28T14:51:18.845469Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a/rules + response: + body: '{"data":{"id":"483937d1-efc4-4a7c-95a6-89bd6b2e4e75","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:19.007448Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"301122dd-9022-40f0-886f-f9a6c227dc9a","name":"My + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:19.007448Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"dry_run":false,"name":"Updated deployment rule","options":{"excluded_resources":[]}},"type":"deployment_rule"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: PUT + url: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a/rules/483937d1-efc4-4a7c-95a6-89bd6b2e4e75 + response: + body: '{"data":{"id":"483937d1-efc4-4a7c-95a6-89bd6b2e4e75","type":"deployment_rule","attributes":{"created_at":"2025-10-28T14:51:19.007448Z","created_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"},"dry_run":false,"gate_id":"301122dd-9022-40f0-886f-f9a6c227dc9a","name":"Updated + deployment rule","options":{},"type":"faulty_deployment_detection","updated_at":"2025-10-28T14:51:19.134366Z","updated_by":{"id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca"}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a/rules/483937d1-efc4-4a7c-95a6-89bd6b2e4e75 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/features/v2/deployment_gates.feature b/tests/scenarios/features/v2/deployment_gates.feature new file mode 100644 index 00000000000..e4023c5650b --- /dev/null +++ b/tests/scenarios/features/v2/deployment_gates.feature @@ -0,0 +1,289 @@ +@endpoint(deployment-gates) @endpoint(deployment-gates-v2) +Feature: Deployment Gates + Manage Deployment Gates using this API to reduce the likelihood and impact + of incidents caused by deployments. See the [Deployment Gates + documentation](https://docs.datadoghq.com/deployment_gates/) for more + information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "DeploymentGates" API + + @team:DataDog/ci-app-backend + Scenario: Create deployment gate returns "Bad Request" response + Given operation "CreateDeploymentGate" enabled + And new "CreateDeploymentGate" request + And body with value {"data": {"attributes": {"env": "", "service":"test-service", "identifier": "my-gate"}, "type": "deployment_gate"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Create deployment gate returns "Bad request." response + Given operation "CreateDeploymentGate" enabled + And new "CreateDeploymentGate" request + And body with value {"data": {"attributes": {"dry_run": false, "env": "production", "identifier": "pre", "service": "my-service"}, "type": "deployment_gate"}} + When the request is sent + Then the response status is 400 Bad request. + + @team:DataDog/ci-app-backend + Scenario: Create deployment gate returns "OK" response + Given operation "CreateDeploymentGate" enabled + And new "CreateDeploymentGate" request + And body with value {"data": {"attributes": {"dry_run": false, "env": "production", "identifier": "my-gate-1", "service": "my-service"}, "type": "deployment_gate"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ci-app-backend + Scenario: Create deployment rule returns "Bad Request" response + Given there is a valid "deployment_gate" in the system + And operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name":"test", "options": {"excluded_resources": []}, "type": "fdd"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Create deployment rule returns "Bad request." response + Given operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"dry_run": false, "name": "My deployment rule", "options": {"duration": 3600, "excluded_resources": ["resource1", "resource2"]}, "type": "faulty_deployment_detection"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 400 Bad request. + + @team:DataDog/ci-app-backend + Scenario: Create deployment rule returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "CreateDeploymentRule" enabled + And new "CreateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "My deployment rule", "options": {"excluded_resources": []}, "type": "faulty_deployment_detection"}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ci-app-backend + Scenario: Delete deployment gate returns "Bad Request" response + Given operation "DeleteDeploymentGate" enabled + And new "DeleteDeploymentGate" request + And request contains "id" parameter with value "invalid-gate-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Delete deployment gate returns "Bad request." response + Given operation "DeleteDeploymentGate" enabled + And new "DeleteDeploymentGate" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Delete deployment gate returns "Deployment gate not found." response + Given operation "DeleteDeploymentGate" enabled + And new "DeleteDeploymentGate" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Deployment gate not found. + + @team:DataDog/ci-app-backend + Scenario: Delete deployment gate returns "No Content" response + Given there is a valid "deployment_gate" in the system + And operation "DeleteDeploymentGate" enabled + And new "DeleteDeploymentGate" request + And request contains "id" parameter from "deployment_gate.data.id" + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/ci-app-backend + Scenario: Delete deployment rule returns "Bad Request" response + Given operation "DeleteDeploymentRule" enabled + And new "DeleteDeploymentRule" request + And request contains "gate_id" parameter with value "invalid-gate-id" + And request contains "id" parameter with value "invalid-rule-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Delete deployment rule returns "Bad request." response + Given operation "DeleteDeploymentRule" enabled + And new "DeleteDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Delete deployment rule returns "Deployment gate not found." response + Given operation "DeleteDeploymentRule" enabled + And new "DeleteDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Deployment gate not found. + + @team:DataDog/ci-app-backend + Scenario: Delete deployment rule returns "No Content" response + Given there is a valid "deployment_gate" in the system + And there is a valid "deployment_rule" in the system + And operation "DeleteDeploymentRule" enabled + And new "DeleteDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And request contains "id" parameter from "deployment_rule.data.id" + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/ci-app-backend + Scenario: Get deployment gate returns "Bad Request" response + Given operation "GetDeploymentGate" enabled + And new "GetDeploymentGate" request + And request contains "id" parameter with value "invalid-gate-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get deployment gate returns "Bad request." response + Given operation "GetDeploymentGate" enabled + And new "GetDeploymentGate" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get deployment gate returns "Deployment gate not found." response + Given operation "GetDeploymentGate" enabled + And new "GetDeploymentGate" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Deployment gate not found. + + @team:DataDog/ci-app-backend + Scenario: Get deployment gate returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "GetDeploymentGate" enabled + And new "GetDeploymentGate" request + And request contains "id" parameter from "deployment_gate.data.id" + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ci-app-backend + Scenario: Get deployment rule returns "Bad Request" response + Given there is a valid "deployment_gate" in the system + And there is a valid "deployment_rule" in the system + And operation "GetDeploymentRule" enabled + And new "GetDeploymentRule" request + And request contains "gate_id" parameter with value "invalid-gate-id" + And request contains "id" parameter with value "invalid-rule-id" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get deployment rule returns "Bad request." response + Given operation "GetDeploymentRule" enabled + And new "GetDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Get deployment rule returns "Deployment rule not found." response + Given operation "GetDeploymentRule" enabled + And new "GetDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Deployment rule not found. + + @team:DataDog/ci-app-backend + Scenario: Get deployment rule returns "OK" response + Given there is a valid "deployment_gate" in the system + And there is a valid "deployment_rule" in the system + And operation "GetDeploymentRule" enabled + And new "GetDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And request contains "id" parameter from "deployment_rule.data.id" + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ci-app-backend + Scenario: Update deployment gate returns "Bad Request" response + Given operation "UpdateDeploymentGate" enabled + And new "UpdateDeploymentGate" request + And request contains "id" parameter with value "invalid-gate-id" + And body with value {"data": {"attributes": {"dry_run":true}, "id": "invalid-gate-id", "type": "deployment_gate"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update deployment gate returns "Bad request." response + Given operation "UpdateDeploymentGate" enabled + And new "UpdateDeploymentGate" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"dry_run": false}, "id": "12345678-1234-1234-1234-123456789012", "type": "deployment_gate"}} + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update deployment gate returns "Deployment gate not found." response + Given operation "UpdateDeploymentGate" enabled + And new "UpdateDeploymentGate" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"dry_run": false}, "id": "12345678-1234-1234-1234-123456789012", "type": "deployment_gate"}} + When the request is sent + Then the response status is 404 Deployment gate not found. + + @team:DataDog/ci-app-backend + Scenario: Update deployment gate returns "OK" response + Given there is a valid "deployment_gate" in the system + And operation "UpdateDeploymentGate" enabled + And new "UpdateDeploymentGate" request + And request contains "id" parameter from "deployment_gate.data.id" + And body with value {"data": {"attributes": {"dry_run": false}, "id": "12345678-1234-1234-1234-123456789012", "type": "deployment_gate"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ci-app-backend + Scenario: Update deployment rule returns "Bad Request" response + Given there is a valid "deployment_gate" in the system + And there is a valid "deployment_rule" in the system + And operation "UpdateDeploymentRule" enabled + And new "UpdateDeploymentRule" request + And request contains "gate_id" parameter with value "invalid-gate-id" + And request contains "id" parameter with value "invalid-rule-id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Updated deployment rule", "options": {"excluded_resources": []}}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update deployment rule returns "Bad request." response + Given operation "UpdateDeploymentRule" enabled + And new "UpdateDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Updated deployment rule", "options": {"duration": 3600, "excluded_resources": ["resource1", "resource2"]}}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update deployment rule returns "Deployment rule not found." response + Given operation "UpdateDeploymentRule" enabled + And new "UpdateDeploymentRule" request + And request contains "gate_id" parameter from "REPLACE.ME" + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Updated deployment rule", "options": {"duration": 3600, "excluded_resources": ["resource1", "resource2"]}}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 404 Deployment rule not found. + + @team:DataDog/ci-app-backend + Scenario: Update deployment rule returns "OK" response + Given there is a valid "deployment_gate" in the system + And there is a valid "deployment_rule" in the system + And operation "UpdateDeploymentRule" enabled + And new "UpdateDeploymentRule" request + And request contains "gate_id" parameter from "deployment_gate.data.id" + And request contains "id" parameter from "deployment_rule.data.id" + And body with value {"data": {"attributes": {"dry_run": false, "name": "Updated deployment rule", "options": {"excluded_resources": []}}, "type": "deployment_rule"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 7c9df160aad..dcd224b3e7d 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -320,6 +320,34 @@ "tag": "Data Deletion", "operationId": "CreateDataDeletionRequest" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"deployment_gate\",\n \"attributes\": {\n \"service\": \"my-service\",\n \"env\": \"production\",\n \"identifier\": \"my-gate\",\n \"dry_run\": false\n }\n }\n}" + } + ], + "step": "there is a valid \"deployment_gate\" in the system", + "key": "deployment_gate", + "tag": "Deployment Gates", + "operationId": "CreateDeploymentGate" + }, + { + "parameters": [ + { + "name": "gate_id", + "source": "deployment_gate.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"deployment_rule\",\n \"attributes\": {\n \"name\": \"My deployment rule\",\n \"type\": \"faulty_deployment_detection\",\n \"options\": {\n \"excluded_resources\": []\n },\n \"dry_run\": false\n }\n }\n}" + } + ], + "step": "there is a valid \"deployment_rule\" in the system", + "key": "deployment_rule", + "tag": "Deployment Gates", + "operationId": "CreateDeploymentRule" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index f4a7f9e7f8d..26f29e81abe 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1235,6 +1235,72 @@ "type": "idempotent" } }, + "CreateDeploymentGate": { + "tag": "Deployment Gates", + "undo": { + "operationId": "DeleteDeploymentGate", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "CreateDeploymentRule": { + "tag": "Deployment Gates", + "undo": { + "operationId": "DeleteDeploymentRule", + "parameters": [ + { + "name": "gate_id", + "source": "data.attributes.gate_id" + }, + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteDeploymentRule": { + "tag": "Deployment Gates", + "undo": { + "type": "idempotent" + } + }, + "GetDeploymentRule": { + "tag": "Deployment Gates", + "undo": { + "type": "safe" + } + }, + "UpdateDeploymentRule": { + "tag": "Deployment Gates", + "undo": { + "type": "idempotent" + } + }, + "DeleteDeploymentGate": { + "tag": "Deployment Gates", + "undo": { + "type": "idempotent" + } + }, + "GetDeploymentGate": { + "tag": "Deployment Gates", + "undo": { + "type": "safe" + } + }, + "UpdateDeploymentGate": { + "tag": "Deployment Gates", + "undo": { + "type": "idempotent" + } + }, "GetDomainAllowlist": { "tag": "Domain Allowlist", "undo": {