diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1907f9ce40..3340fb18c1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1158,6 +1158,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: @@ -12733,6 +12751,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: @@ -16434,6 +16537,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: @@ -16473,6 +16683,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: @@ -23420,6 +23788,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: @@ -53596,6 +53991,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: @@ -63852,6 +64318,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. @@ -82419,8 +83282,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: @@ -84154,6 +85016,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/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 670c94df3a..3768dae831 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -200,6 +200,13 @@ datadog\_api\_client.v2.api.datasets\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.deployment\_gates\_api module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.deployment_gates_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.domain\_allowlist\_api module --------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 3df09dbd2f..bba92040a9 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -5030,6 +5030,48 @@ datadog\_api\_client.v2.model.create\_data\_deletion\_response\_body module :members: :show-inheritance: +datadog\_api\_client.v2.model.create\_deployment\_gate\_params module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_deployment_gate_params + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_deployment\_gate\_params\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_deployment_gate_params_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_deployment\_gate\_params\_data\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_deployment_gate_params_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_deployment\_rule\_params module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_deployment_rule_params + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_deployment\_rule\_params\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_deployment_rule_params_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_deployment\_rule\_params\_data\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_deployment_rule_params_data_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_incident\_notification\_rule\_request module ---------------------------------------------------------------------------------- @@ -6521,6 +6563,48 @@ datadog\_api\_client.v2.model.deployment\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.deployment\_gate\_data\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_gate\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_gate\_response\_data module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_gate\_response\_data\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_response_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_gate\_response\_data\_attributes\_created\_by module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_response_data_attributes_created_by + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_gate\_response\_data\_attributes\_updated\_by module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by + :members: + :show-inheritance: + datadog\_api\_client.v2.model.deployment\_metadata module --------------------------------------------------------- @@ -6542,6 +6626,76 @@ datadog\_api\_client.v2.model.deployment\_relationship\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.deployment\_rule\_data\_type module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_options\_faulty\_deployment\_detection module +--------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_options\_monitor module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_options_monitor + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_response\_data module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_response\_data\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_response_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_response\_data\_attributes\_created\_by module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_response_data_attributes_created_by + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_response\_data\_attributes\_type module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_response_data_attributes_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rule\_response\_data\_attributes\_updated\_by module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rule_response_data_attributes_updated_by + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.deployment\_rules\_options module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.deployment_rules_options + :members: + :show-inheritance: + datadog\_api\_client.v2.model.detailed\_finding module ------------------------------------------------------ @@ -10105,6 +10259,27 @@ datadog\_api\_client.v2.model.http\_token\_update module :members: :show-inheritance: +datadog\_api\_client.v2.model.httpcd\_gates\_bad\_request\_response module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.httpcd_gates_bad_request_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.httpcd\_gates\_not\_found\_response module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.httpcd_gates_not_found_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.httpcd\_rules\_not\_found\_response module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.httpcd_rules_not_found_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.httpci\_app\_error module ------------------------------------------------------- @@ -23727,6 +23902,48 @@ datadog\_api\_client.v2.model.update\_custom\_framework\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.update\_deployment\_gate\_params module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_deployment_gate_params + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_deployment\_gate\_params\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_deployment_gate_params_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_deployment\_gate\_params\_data\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_deployment_gate_params_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_deployment\_rule\_params module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_deployment_rule_params + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_deployment\_rule\_params\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_deployment_rule_params_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_deployment\_rule\_params\_data\_attributes module +--------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_deployment_rule_params_data_attributes + :members: + :show-inheritance: + datadog\_api\_client.v2.model.update\_open\_api\_response module ---------------------------------------------------------------- diff --git a/examples/v2/deployment-gates/CreateDeploymentGate.py b/examples/v2/deployment-gates/CreateDeploymentGate.py new file mode 100644 index 0000000000..c23ef16464 --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentGate.py @@ -0,0 +1,32 @@ +""" +Create deployment gate returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi +from datadog_api_client.v2.model.create_deployment_gate_params import CreateDeploymentGateParams +from datadog_api_client.v2.model.create_deployment_gate_params_data import CreateDeploymentGateParamsData +from datadog_api_client.v2.model.create_deployment_gate_params_data_attributes import ( + CreateDeploymentGateParamsDataAttributes, +) +from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + +body = CreateDeploymentGateParams( + data=CreateDeploymentGateParamsData( + attributes=CreateDeploymentGateParamsDataAttributes( + dry_run=False, + env="production", + identifier="my-gate-1", + service="my-service", + ), + type=DeploymentGateDataType.DEPLOYMENT_GATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_deployment_gate"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.create_deployment_gate(body=body) + + print(response) diff --git a/examples/v2/deployment-gates/CreateDeploymentRule.py b/examples/v2/deployment-gates/CreateDeploymentRule.py new file mode 100644 index 0000000000..d6b96b9566 --- /dev/null +++ b/examples/v2/deployment-gates/CreateDeploymentRule.py @@ -0,0 +1,41 @@ +""" +Create deployment rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi +from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams +from datadog_api_client.v2.model.create_deployment_rule_params_data import CreateDeploymentRuleParamsData +from datadog_api_client.v2.model.create_deployment_rule_params_data_attributes import ( + CreateDeploymentRuleParamsDataAttributes, +) +from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType +from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, +) + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +body = CreateDeploymentRuleParams( + data=CreateDeploymentRuleParamsData( + attributes=CreateDeploymentRuleParamsDataAttributes( + dry_run=False, + name="My deployment rule", + options=DeploymentRuleOptionsFaultyDeploymentDetection( + excluded_resources=[], + ), + type="faulty_deployment_detection", + ), + type=DeploymentRuleDataType.DEPLOYMENT_RULE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_deployment_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.create_deployment_rule(gate_id=DEPLOYMENT_GATE_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/deployment-gates/DeleteDeploymentGate.py b/examples/v2/deployment-gates/DeleteDeploymentGate.py new file mode 100644 index 0000000000..e196861004 --- /dev/null +++ b/examples/v2/deployment-gates/DeleteDeploymentGate.py @@ -0,0 +1,18 @@ +""" +Delete deployment gate returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["delete_deployment_gate"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + api_instance.delete_deployment_gate( + id=DEPLOYMENT_GATE_DATA_ID, + ) diff --git a/examples/v2/deployment-gates/DeleteDeploymentRule.py b/examples/v2/deployment-gates/DeleteDeploymentRule.py new file mode 100644 index 0000000000..dfacfdf650 --- /dev/null +++ b/examples/v2/deployment-gates/DeleteDeploymentRule.py @@ -0,0 +1,22 @@ +""" +Delete deployment rule returns "No Content" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +# there is a valid "deployment_rule" in the system +DEPLOYMENT_RULE_DATA_ID = environ["DEPLOYMENT_RULE_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["delete_deployment_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + api_instance.delete_deployment_rule( + gate_id=DEPLOYMENT_GATE_DATA_ID, + id=DEPLOYMENT_RULE_DATA_ID, + ) diff --git a/examples/v2/deployment-gates/GetDeploymentGate.py b/examples/v2/deployment-gates/GetDeploymentGate.py new file mode 100644 index 0000000000..ceb139b327 --- /dev/null +++ b/examples/v2/deployment-gates/GetDeploymentGate.py @@ -0,0 +1,20 @@ +""" +Get deployment gate returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_deployment_gate"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.get_deployment_gate( + id=DEPLOYMENT_GATE_DATA_ID, + ) + + print(response) diff --git a/examples/v2/deployment-gates/GetDeploymentRule.py b/examples/v2/deployment-gates/GetDeploymentRule.py new file mode 100644 index 0000000000..3746526cf8 --- /dev/null +++ b/examples/v2/deployment-gates/GetDeploymentRule.py @@ -0,0 +1,24 @@ +""" +Get deployment rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +# there is a valid "deployment_rule" in the system +DEPLOYMENT_RULE_DATA_ID = environ["DEPLOYMENT_RULE_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_deployment_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.get_deployment_rule( + gate_id=DEPLOYMENT_GATE_DATA_ID, + id=DEPLOYMENT_RULE_DATA_ID, + ) + + print(response) diff --git a/examples/v2/deployment-gates/UpdateDeploymentGate.py b/examples/v2/deployment-gates/UpdateDeploymentGate.py new file mode 100644 index 0000000000..dde173b177 --- /dev/null +++ b/examples/v2/deployment-gates/UpdateDeploymentGate.py @@ -0,0 +1,34 @@ +""" +Update deployment gate returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi +from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType +from datadog_api_client.v2.model.update_deployment_gate_params import UpdateDeploymentGateParams +from datadog_api_client.v2.model.update_deployment_gate_params_data import UpdateDeploymentGateParamsData +from datadog_api_client.v2.model.update_deployment_gate_params_data_attributes import ( + UpdateDeploymentGateParamsDataAttributes, +) + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +body = UpdateDeploymentGateParams( + data=UpdateDeploymentGateParamsData( + attributes=UpdateDeploymentGateParamsDataAttributes( + dry_run=False, + ), + id="12345678-1234-1234-1234-123456789012", + type=DeploymentGateDataType.DEPLOYMENT_GATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_deployment_gate"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.update_deployment_gate(id=DEPLOYMENT_GATE_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/deployment-gates/UpdateDeploymentRule.py b/examples/v2/deployment-gates/UpdateDeploymentRule.py new file mode 100644 index 0000000000..a7a333dc19 --- /dev/null +++ b/examples/v2/deployment-gates/UpdateDeploymentRule.py @@ -0,0 +1,45 @@ +""" +Update deployment rule returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi +from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType +from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, +) +from datadog_api_client.v2.model.update_deployment_rule_params import UpdateDeploymentRuleParams +from datadog_api_client.v2.model.update_deployment_rule_params_data import UpdateDeploymentRuleParamsData +from datadog_api_client.v2.model.update_deployment_rule_params_data_attributes import ( + UpdateDeploymentRuleParamsDataAttributes, +) + +# there is a valid "deployment_gate" in the system +DEPLOYMENT_GATE_DATA_ID = environ["DEPLOYMENT_GATE_DATA_ID"] + +# there is a valid "deployment_rule" in the system +DEPLOYMENT_RULE_DATA_ID = environ["DEPLOYMENT_RULE_DATA_ID"] + +body = UpdateDeploymentRuleParams( + data=UpdateDeploymentRuleParamsData( + attributes=UpdateDeploymentRuleParamsDataAttributes( + dry_run=False, + name="Updated deployment rule", + options=DeploymentRuleOptionsFaultyDeploymentDetection( + excluded_resources=[], + ), + ), + type=DeploymentRuleDataType.DEPLOYMENT_RULE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_deployment_rule"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.update_deployment_rule( + gate_id=DEPLOYMENT_GATE_DATA_ID, id=DEPLOYMENT_RULE_DATA_ID, body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 2464590e38..665081694b 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -293,6 +293,14 @@ def __init__( "v2.cancel_data_deletion_request": False, "v2.create_data_deletion_request": False, "v2.get_data_deletion_requests": False, + "v2.create_deployment_gate": False, + "v2.create_deployment_rule": False, + "v2.delete_deployment_gate": False, + "v2.delete_deployment_rule": False, + "v2.get_deployment_gate": False, + "v2.get_deployment_rule": False, + "v2.update_deployment_gate": False, + "v2.update_deployment_rule": False, "v2.create_incident": False, "v2.create_incident_impact": False, "v2.create_incident_integration": False, diff --git a/src/datadog_api_client/v2/api/deployment_gates_api.py b/src/datadog_api_client/v2/api/deployment_gates_api.py new file mode 100644 index 0000000000..84e3ea50b3 --- /dev/null +++ b/src/datadog_api_client/v2/api/deployment_gates_api.py @@ -0,0 +1,396 @@ +# 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. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.v2.model.deployment_gate_response import DeploymentGateResponse +from datadog_api_client.v2.model.create_deployment_gate_params import CreateDeploymentGateParams +from datadog_api_client.v2.model.deployment_rule_response import DeploymentRuleResponse +from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams +from datadog_api_client.v2.model.update_deployment_rule_params import UpdateDeploymentRuleParams +from datadog_api_client.v2.model.update_deployment_gate_params import UpdateDeploymentGateParams + + +class DeploymentGatesApi: + """ + Manage Deployment Gates using this API to reduce the likelihood and impact of incidents caused by deployments. See the `Deployment Gates documentation `_ for more information. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._create_deployment_gate_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentGateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates", + "operation_id": "create_deployment_gate", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CreateDeploymentGateParams,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._create_deployment_rule_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{gate_id}/rules", + "operation_id": "create_deployment_rule", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "gate_id": { + "required": True, + "openapi_types": (str,), + "attribute": "gate_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (CreateDeploymentRuleParams,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._delete_deployment_gate_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{id}", + "operation_id": "delete_deployment_gate", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._delete_deployment_rule_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{gate_id}/rules/{id}", + "operation_id": "delete_deployment_rule", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "gate_id": { + "required": True, + "openapi_types": (str,), + "attribute": "gate_id", + "location": "path", + }, + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._get_deployment_gate_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentGateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{id}", + "operation_id": "get_deployment_gate", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_deployment_rule_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{gate_id}/rules/{id}", + "operation_id": "get_deployment_rule", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "gate_id": { + "required": True, + "openapi_types": (str,), + "attribute": "gate_id", + "location": "path", + }, + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_deployment_gate_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentGateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{id}", + "operation_id": "update_deployment_gate", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (UpdateDeploymentGateParams,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._update_deployment_rule_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentRuleResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/deployment_gates/{gate_id}/rules/{id}", + "operation_id": "update_deployment_rule", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "gate_id": { + "required": True, + "openapi_types": (str,), + "attribute": "gate_id", + "location": "path", + }, + "id": { + "required": True, + "openapi_types": (str,), + "attribute": "id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (UpdateDeploymentRuleParams,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def create_deployment_gate( + self, + body: CreateDeploymentGateParams, + ) -> DeploymentGateResponse: + """Create deployment gate. + + Endpoint to create a deployment gate. + + :type body: CreateDeploymentGateParams + :rtype: DeploymentGateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_deployment_gate_endpoint.call_with_http_info(**kwargs) + + def create_deployment_rule( + self, + gate_id: str, + body: CreateDeploymentRuleParams, + ) -> DeploymentRuleResponse: + """Create deployment rule. + + Endpoint to create a deployment rule. A gate for the rule must already exist. + + :param gate_id: The ID of the deployment gate. + :type gate_id: str + :type body: CreateDeploymentRuleParams + :rtype: DeploymentRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["gate_id"] = gate_id + + kwargs["body"] = body + + return self._create_deployment_rule_endpoint.call_with_http_info(**kwargs) + + def delete_deployment_gate( + self, + id: str, + ) -> None: + """Delete deployment gate. + + Endpoint to delete a deployment gate. Rules associated with the gate are also deleted. + + :param id: The ID of the deployment gate. + :type id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + return self._delete_deployment_gate_endpoint.call_with_http_info(**kwargs) + + def delete_deployment_rule( + self, + gate_id: str, + id: str, + ) -> None: + """Delete deployment rule. + + Endpoint to delete a deployment rule. + + :param gate_id: The ID of the deployment gate. + :type gate_id: str + :param id: The ID of the deployment rule. + :type id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["gate_id"] = gate_id + + kwargs["id"] = id + + return self._delete_deployment_rule_endpoint.call_with_http_info(**kwargs) + + def get_deployment_gate( + self, + id: str, + ) -> DeploymentGateResponse: + """Get deployment gate. + + Endpoint to get a deployment gate. + + :param id: The ID of the deployment gate. + :type id: str + :rtype: DeploymentGateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + return self._get_deployment_gate_endpoint.call_with_http_info(**kwargs) + + def get_deployment_rule( + self, + gate_id: str, + id: str, + ) -> DeploymentRuleResponse: + """Get deployment rule. + + Endpoint to get a deployment rule. + + :param gate_id: The ID of the deployment gate. + :type gate_id: str + :param id: The ID of the deployment rule. + :type id: str + :rtype: DeploymentRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["gate_id"] = gate_id + + kwargs["id"] = id + + return self._get_deployment_rule_endpoint.call_with_http_info(**kwargs) + + def update_deployment_gate( + self, + id: str, + body: UpdateDeploymentGateParams, + ) -> DeploymentGateResponse: + """Update deployment gate. + + Endpoint to update a deployment gate. + + :param id: The ID of the deployment gate. + :type id: str + :type body: UpdateDeploymentGateParams + :rtype: DeploymentGateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + kwargs["body"] = body + + return self._update_deployment_gate_endpoint.call_with_http_info(**kwargs) + + def update_deployment_rule( + self, + gate_id: str, + id: str, + body: UpdateDeploymentRuleParams, + ) -> DeploymentRuleResponse: + """Update deployment rule. + + Endpoint to update a deployment rule. + + :param gate_id: The ID of the deployment gate. + :type gate_id: str + :param id: The ID of the deployment rule. + :type id: str + :type body: UpdateDeploymentRuleParams + :rtype: DeploymentRuleResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["gate_id"] = gate_id + + kwargs["id"] = id + + kwargs["body"] = body + + return self._update_deployment_rule_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index db2c3b8d0c..924b45b146 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -27,6 +27,7 @@ from datadog_api_client.v2.api.dashboard_lists_api import DashboardListsApi from datadog_api_client.v2.api.data_deletion_api import DataDeletionApi from datadog_api_client.v2.api.datasets_api import DatasetsApi +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi from datadog_api_client.v2.api.domain_allowlist_api import DomainAllowlistApi from datadog_api_client.v2.api.downtimes_api import DowntimesApi from datadog_api_client.v2.api.error_tracking_api import ErrorTrackingApi @@ -113,6 +114,7 @@ "DashboardListsApi", "DataDeletionApi", "DatasetsApi", + "DeploymentGatesApi", "DomainAllowlistApi", "DowntimesApi", "ErrorTrackingApi", diff --git a/src/datadog_api_client/v2/model/create_deployment_gate_params.py b/src/datadog_api_client/v2/model/create_deployment_gate_params.py new file mode 100644 index 0000000000..e26829e708 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_deployment_gate_params.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_deployment_gate_params_data import CreateDeploymentGateParamsData + + +class CreateDeploymentGateParams(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_deployment_gate_params_data import CreateDeploymentGateParamsData + + return { + "data": (CreateDeploymentGateParamsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CreateDeploymentGateParamsData, **kwargs): + """ + Parameters for creating a deployment gate. + + :param data: Parameters for creating a deployment gate. + :type data: CreateDeploymentGateParamsData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/create_deployment_gate_params_data.py b/src/datadog_api_client/v2/model/create_deployment_gate_params_data.py new file mode 100644 index 0000000000..a1f143a20c --- /dev/null +++ b/src/datadog_api_client/v2/model/create_deployment_gate_params_data.py @@ -0,0 +1,52 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_deployment_gate_params_data_attributes import ( + CreateDeploymentGateParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + + +class CreateDeploymentGateParamsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_deployment_gate_params_data_attributes import ( + CreateDeploymentGateParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + + return { + "attributes": (CreateDeploymentGateParamsDataAttributes,), + "type": (DeploymentGateDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateDeploymentGateParamsDataAttributes, type: DeploymentGateDataType, **kwargs): + """ + Parameters for creating a deployment gate. + + :param attributes: Parameters for creating a deployment gate. + :type attributes: CreateDeploymentGateParamsDataAttributes + + :param type: Deployment gate resource type. + :type type: DeploymentGateDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_deployment_gate_params_data_attributes.py b/src/datadog_api_client/v2/model/create_deployment_gate_params_data_attributes.py new file mode 100644 index 0000000000..91ccdd6502 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_deployment_gate_params_data_attributes.py @@ -0,0 +1,63 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class CreateDeploymentGateParamsDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "dry_run": (bool,), + "env": (str,), + "identifier": (str,), + "service": (str,), + } + + attribute_map = { + "dry_run": "dry_run", + "env": "env", + "identifier": "identifier", + "service": "service", + } + + def __init__( + self_, + env: str, + service: str, + dry_run: Union[bool, UnsetType] = unset, + identifier: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Parameters for creating a deployment gate. + + :param dry_run: Whether this gate is run in dry-run mode. + :type dry_run: bool, optional + + :param env: The environment of the deployment gate. + :type env: str + + :param identifier: The identifier of the deployment gate. + :type identifier: str, optional + + :param service: The service of the deployment gate. + :type service: str + """ + if dry_run is not unset: + kwargs["dry_run"] = dry_run + if identifier is not unset: + kwargs["identifier"] = identifier + super().__init__(kwargs) + + self_.env = env + self_.service = service diff --git a/src/datadog_api_client/v2/model/create_deployment_rule_params.py b/src/datadog_api_client/v2/model/create_deployment_rule_params.py new file mode 100644 index 0000000000..e4269a78da --- /dev/null +++ b/src/datadog_api_client/v2/model/create_deployment_rule_params.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_deployment_rule_params_data import CreateDeploymentRuleParamsData + + +class CreateDeploymentRuleParams(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_deployment_rule_params_data import CreateDeploymentRuleParamsData + + return { + "data": (CreateDeploymentRuleParamsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CreateDeploymentRuleParamsData, UnsetType] = unset, **kwargs): + """ + Parameters for creating a deployment rule. + + :param data: Parameters for creating a deployment rule. + :type data: CreateDeploymentRuleParamsData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/create_deployment_rule_params_data.py b/src/datadog_api_client/v2/model/create_deployment_rule_params_data.py new file mode 100644 index 0000000000..2d7114407d --- /dev/null +++ b/src/datadog_api_client/v2/model/create_deployment_rule_params_data.py @@ -0,0 +1,52 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_deployment_rule_params_data_attributes import ( + CreateDeploymentRuleParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType + + +class CreateDeploymentRuleParamsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_deployment_rule_params_data_attributes import ( + CreateDeploymentRuleParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType + + return { + "attributes": (CreateDeploymentRuleParamsDataAttributes,), + "type": (DeploymentRuleDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateDeploymentRuleParamsDataAttributes, type: DeploymentRuleDataType, **kwargs): + """ + Parameters for creating a deployment rule. + + :param attributes: Parameters for creating a deployment rule. + :type attributes: CreateDeploymentRuleParamsDataAttributes + + :param type: Deployment rule resource type. + :type type: DeploymentRuleDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py b/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py new file mode 100644 index 0000000000..504e7e7c96 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_deployment_rule_params_data_attributes.py @@ -0,0 +1,74 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions + from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, + ) + from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor + + +class CreateDeploymentRuleParamsDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions + + return { + "dry_run": (bool,), + "name": (str,), + "options": (DeploymentRulesOptions,), + "type": (str,), + } + + attribute_map = { + "dry_run": "dry_run", + "name": "name", + "options": "options", + "type": "type", + } + + def __init__( + self_, + name: str, + options: Union[ + DeploymentRulesOptions, DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor + ], + type: str, + dry_run: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + Parameters for creating a deployment rule. + + :param dry_run: Whether this rule is run in dry-run mode. + :type dry_run: bool, optional + + :param name: The name of the deployment rule. + :type name: str + + :param options: Options for deployment rule response representing either faulty deployment detection or monitor options. + :type options: DeploymentRulesOptions + + :param type: The type of the deployment rule (faulty_deployment_detection or monitor). + :type type: str + """ + if dry_run is not unset: + kwargs["dry_run"] = dry_run + super().__init__(kwargs) + + self_.name = name + self_.options = options + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_gate_data_type.py b/src/datadog_api_client/v2/model/deployment_gate_data_type.py new file mode 100644 index 0000000000..97648a5bf0 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_data_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentGateDataType(ModelSimple): + """ + Deployment gate resource type. + + :param value: If omitted defaults to "deployment_gate". Must be one of ["deployment_gate"]. + :type value: str + """ + + allowed_values = { + "deployment_gate", + } + DEPLOYMENT_GATE: ClassVar["DeploymentGateDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentGateDataType.DEPLOYMENT_GATE = DeploymentGateDataType("deployment_gate") diff --git a/src/datadog_api_client/v2/model/deployment_gate_response.py b/src/datadog_api_client/v2/model/deployment_gate_response.py new file mode 100644 index 0000000000..0cb423c38f --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_response_data import DeploymentGateResponseData + + +class DeploymentGateResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_response_data import DeploymentGateResponseData + + return { + "data": (DeploymentGateResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[DeploymentGateResponseData, UnsetType] = unset, **kwargs): + """ + Response for a deployment gate. + + :param data: Data for a deployment gate. + :type data: DeploymentGateResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/deployment_gate_response_data.py b/src/datadog_api_client/v2/model/deployment_gate_response_data.py new file mode 100644 index 0000000000..bd0d5834b3 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_response_data.py @@ -0,0 +1,60 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_response_data_attributes import ( + DeploymentGateResponseDataAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + + +class DeploymentGateResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_response_data_attributes import ( + DeploymentGateResponseDataAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + + return { + "attributes": (DeploymentGateResponseDataAttributes,), + "id": (str,), + "type": (DeploymentGateDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: DeploymentGateResponseDataAttributes, id: str, type: DeploymentGateDataType, **kwargs + ): + """ + Data for a deployment gate. + + :param attributes: Basic information about a deployment gate. + :type attributes: DeploymentGateResponseDataAttributes + + :param id: Unique identifier of the deployment gate. + :type id: str + + :param type: Deployment gate resource type. + :type type: DeploymentGateDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes.py b/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes.py new file mode 100644 index 0000000000..a9c90104e6 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes.py @@ -0,0 +1,108 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_response_data_attributes_created_by import ( + DeploymentGateResponseDataAttributesCreatedBy, + ) + from datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by import ( + DeploymentGateResponseDataAttributesUpdatedBy, + ) + + +class DeploymentGateResponseDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_response_data_attributes_created_by import ( + DeploymentGateResponseDataAttributesCreatedBy, + ) + from datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by import ( + DeploymentGateResponseDataAttributesUpdatedBy, + ) + + return { + "created_at": (datetime,), + "created_by": (DeploymentGateResponseDataAttributesCreatedBy,), + "dry_run": (bool,), + "env": (str,), + "identifier": (str,), + "service": (str,), + "updated_at": (datetime,), + "updated_by": (DeploymentGateResponseDataAttributesUpdatedBy,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "dry_run": "dry_run", + "env": "env", + "identifier": "identifier", + "service": "service", + "updated_at": "updated_at", + "updated_by": "updated_by", + } + + def __init__( + self_, + created_at: datetime, + created_by: DeploymentGateResponseDataAttributesCreatedBy, + dry_run: bool, + env: str, + identifier: str, + service: str, + updated_at: Union[datetime, UnsetType] = unset, + updated_by: Union[DeploymentGateResponseDataAttributesUpdatedBy, UnsetType] = unset, + **kwargs, + ): + """ + Basic information about a deployment gate. + + :param created_at: The timestamp when the deployment gate was created. + :type created_at: datetime + + :param created_by: Information about the user who created the deployment gate. + :type created_by: DeploymentGateResponseDataAttributesCreatedBy + + :param dry_run: Whether this gate is run in dry-run mode. + :type dry_run: bool + + :param env: The environment of the deployment gate. + :type env: str + + :param identifier: The identifier of the deployment gate. + :type identifier: str + + :param service: The service of the deployment gate. + :type service: str + + :param updated_at: The timestamp when the deployment gate was last updated. + :type updated_at: datetime, optional + + :param updated_by: Information about the user who updated the deployment gate. + :type updated_by: DeploymentGateResponseDataAttributesUpdatedBy, optional + """ + if updated_at is not unset: + kwargs["updated_at"] = updated_at + if updated_by is not unset: + kwargs["updated_by"] = updated_by + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.dry_run = dry_run + self_.env = env + self_.identifier = identifier + self_.service = service diff --git a/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes_created_by.py b/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes_created_by.py new file mode 100644 index 0000000000..93dad1f962 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes_created_by.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentGateResponseDataAttributesCreatedBy(ModelNormal): + @cached_property + def openapi_types(_): + return { + "handle": (str,), + "id": (str,), + "name": (str,), + } + + attribute_map = { + "handle": "handle", + "id": "id", + "name": "name", + } + + def __init__(self_, id: str, handle: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs): + """ + Information about the user who created the deployment gate. + + :param handle: The handle of the user who created the deployment rule. + :type handle: str, optional + + :param id: The ID of the user who created the deployment rule. + :type id: str + + :param name: The name of the user who created the deployment rule. + :type name: str, optional + """ + if handle is not unset: + kwargs["handle"] = handle + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) + + self_.id = id diff --git a/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes_updated_by.py b/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes_updated_by.py new file mode 100644 index 0000000000..8834d9545d --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_response_data_attributes_updated_by.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentGateResponseDataAttributesUpdatedBy(ModelNormal): + @cached_property + def openapi_types(_): + return { + "handle": (str,), + "id": (str,), + "name": (str,), + } + + attribute_map = { + "handle": "handle", + "id": "id", + "name": "name", + } + + def __init__(self_, id: str, handle: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs): + """ + Information about the user who updated the deployment gate. + + :param handle: The handle of the user who updated the deployment rule. + :type handle: str, optional + + :param id: The ID of the user who updated the deployment rule. + :type id: str + + :param name: The name of the user who updated the deployment rule. + :type name: str, optional + """ + if handle is not unset: + kwargs["handle"] = handle + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) + + self_.id = id diff --git a/src/datadog_api_client/v2/model/deployment_rule_data_type.py b/src/datadog_api_client/v2/model/deployment_rule_data_type.py new file mode 100644 index 0000000000..26a8b6643f --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_data_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentRuleDataType(ModelSimple): + """ + Deployment rule resource type. + + :param value: If omitted defaults to "deployment_rule". Must be one of ["deployment_rule"]. + :type value: str + """ + + allowed_values = { + "deployment_rule", + } + DEPLOYMENT_RULE: ClassVar["DeploymentRuleDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentRuleDataType.DEPLOYMENT_RULE = DeploymentRuleDataType("deployment_rule") diff --git a/src/datadog_api_client/v2/model/deployment_rule_options_faulty_deployment_detection.py b/src/datadog_api_client/v2/model/deployment_rule_options_faulty_deployment_detection.py new file mode 100644 index 0000000000..eea14f5e31 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_options_faulty_deployment_detection.py @@ -0,0 +1,52 @@ +# 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. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentRuleOptionsFaultyDeploymentDetection(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "duration": (int,), + "excluded_resources": ([str],), + } + + attribute_map = { + "duration": "duration", + "excluded_resources": "excluded_resources", + } + + def __init__( + self_, + duration: Union[int, UnsetType] = unset, + excluded_resources: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Faulty deployment detection options for deployment rules. + + :param duration: The duration for faulty deployment detection. + :type duration: int, optional + + :param excluded_resources: Resources to exclude from faulty deployment detection. + :type excluded_resources: [str], optional + """ + if duration is not unset: + kwargs["duration"] = duration + if excluded_resources is not unset: + kwargs["excluded_resources"] = excluded_resources + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/deployment_rule_options_monitor.py b/src/datadog_api_client/v2/model/deployment_rule_options_monitor.py new file mode 100644 index 0000000000..5ae363b33d --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_options_monitor.py @@ -0,0 +1,47 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentRuleOptionsMonitor(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "duration": (int,), + "query": (str,), + } + + attribute_map = { + "duration": "duration", + "query": "query", + } + + def __init__(self_, query: str, duration: Union[int, UnsetType] = unset, **kwargs): + """ + Monitor options for deployment rules. + + :param duration: Seconds the monitor needs to stay in OK status for the rule to pass. + :type duration: int, optional + + :param query: Monitors that match this query are evaluated. + :type query: str + """ + if duration is not unset: + kwargs["duration"] = duration + super().__init__(kwargs) + + self_.query = query diff --git a/src/datadog_api_client/v2/model/deployment_rule_response.py b/src/datadog_api_client/v2/model/deployment_rule_response.py new file mode 100644 index 0000000000..89469dfaca --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData + + +class DeploymentRuleResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData + + return { + "data": (DeploymentRuleResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[DeploymentRuleResponseData, UnsetType] = unset, **kwargs): + """ + Response for a deployment rule. + + :param data: Data for a deployment rule. + :type data: DeploymentRuleResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data.py b/src/datadog_api_client/v2/model/deployment_rule_response_data.py new file mode 100644 index 0000000000..cfbb6eeea4 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data.py @@ -0,0 +1,60 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_rule_response_data_attributes import ( + DeploymentRuleResponseDataAttributes, + ) + from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType + + +class DeploymentRuleResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_rule_response_data_attributes import ( + DeploymentRuleResponseDataAttributes, + ) + from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType + + return { + "attributes": (DeploymentRuleResponseDataAttributes,), + "id": (str,), + "type": (DeploymentRuleDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: DeploymentRuleResponseDataAttributes, id: str, type: DeploymentRuleDataType, **kwargs + ): + """ + Data for a deployment rule. + + :param attributes: Basic information about a deployment rule. + :type attributes: DeploymentRuleResponseDataAttributes + + :param id: Unique identifier of the deployment rule. + :type id: str + + :param type: Deployment rule resource type. + :type type: DeploymentRuleDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py new file mode 100644 index 0000000000..874e36f6bf --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes.py @@ -0,0 +1,129 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_rule_response_data_attributes_created_by import ( + DeploymentRuleResponseDataAttributesCreatedBy, + ) + from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions + from datadog_api_client.v2.model.deployment_rule_response_data_attributes_type import ( + DeploymentRuleResponseDataAttributesType, + ) + from datadog_api_client.v2.model.deployment_rule_response_data_attributes_updated_by import ( + DeploymentRuleResponseDataAttributesUpdatedBy, + ) + from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, + ) + from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor + + +class DeploymentRuleResponseDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_rule_response_data_attributes_created_by import ( + DeploymentRuleResponseDataAttributesCreatedBy, + ) + from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions + from datadog_api_client.v2.model.deployment_rule_response_data_attributes_type import ( + DeploymentRuleResponseDataAttributesType, + ) + from datadog_api_client.v2.model.deployment_rule_response_data_attributes_updated_by import ( + DeploymentRuleResponseDataAttributesUpdatedBy, + ) + + return { + "created_at": (datetime,), + "created_by": (DeploymentRuleResponseDataAttributesCreatedBy,), + "dry_run": (bool,), + "gate_id": (str,), + "name": (str,), + "options": (DeploymentRulesOptions,), + "type": (DeploymentRuleResponseDataAttributesType,), + "updated_at": (datetime,), + "updated_by": (DeploymentRuleResponseDataAttributesUpdatedBy,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "dry_run": "dry_run", + "gate_id": "gate_id", + "name": "name", + "options": "options", + "type": "type", + "updated_at": "updated_at", + "updated_by": "updated_by", + } + + def __init__( + self_, + created_at: datetime, + created_by: DeploymentRuleResponseDataAttributesCreatedBy, + dry_run: bool, + gate_id: str, + name: str, + options: Union[ + DeploymentRulesOptions, DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor + ], + type: DeploymentRuleResponseDataAttributesType, + updated_at: Union[datetime, UnsetType] = unset, + updated_by: Union[DeploymentRuleResponseDataAttributesUpdatedBy, UnsetType] = unset, + **kwargs, + ): + """ + Basic information about a deployment rule. + + :param created_at: The timestamp when the deployment rule was created. + :type created_at: datetime + + :param created_by: Information about the user who created the deployment rule. + :type created_by: DeploymentRuleResponseDataAttributesCreatedBy + + :param dry_run: Whether this rule is run in dry-run mode. + :type dry_run: bool + + :param gate_id: The ID of the deployment gate. + :type gate_id: str + + :param name: The name of the deployment rule. + :type name: str + + :param options: Options for deployment rule response representing either faulty deployment detection or monitor options. + :type options: DeploymentRulesOptions + + :param type: The type of the deployment rule. + :type type: DeploymentRuleResponseDataAttributesType + + :param updated_at: The timestamp when the deployment rule was last updated. + :type updated_at: datetime, optional + + :param updated_by: Information about the user who updated the deployment rule. + :type updated_by: DeploymentRuleResponseDataAttributesUpdatedBy, optional + """ + if updated_at is not unset: + kwargs["updated_at"] = updated_at + if updated_by is not unset: + kwargs["updated_by"] = updated_by + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.dry_run = dry_run + self_.gate_id = gate_id + self_.name = name + self_.options = options + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_created_by.py b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_created_by.py new file mode 100644 index 0000000000..c31ac43b91 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_created_by.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentRuleResponseDataAttributesCreatedBy(ModelNormal): + @cached_property + def openapi_types(_): + return { + "handle": (str,), + "id": (str,), + "name": (str,), + } + + attribute_map = { + "handle": "handle", + "id": "id", + "name": "name", + } + + def __init__(self_, id: str, handle: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs): + """ + Information about the user who created the deployment rule. + + :param handle: The handle of the user who created the deployment rule. + :type handle: str, optional + + :param id: The ID of the user who created the deployment rule. + :type id: str + + :param name: The name of the user who created the deployment rule. + :type name: str, optional + """ + if handle is not unset: + kwargs["handle"] = handle + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) + + self_.id = id diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py new file mode 100644 index 0000000000..bce3d06f20 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_type.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentRuleResponseDataAttributesType(ModelSimple): + """ + The type of the deployment rule. + + :param value: Must be one of ["faulty_deployment_detection", "monitor"]. + :type value: str + """ + + allowed_values = { + "faulty_deployment_detection", + "monitor", + } + FAULTY_DEPLOYMENT_DETECTION: ClassVar["DeploymentRuleResponseDataAttributesType"] + MONITOR: ClassVar["DeploymentRuleResponseDataAttributesType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentRuleResponseDataAttributesType.FAULTY_DEPLOYMENT_DETECTION = DeploymentRuleResponseDataAttributesType( + "faulty_deployment_detection" +) +DeploymentRuleResponseDataAttributesType.MONITOR = DeploymentRuleResponseDataAttributesType("monitor") diff --git a/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_updated_by.py b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_updated_by.py new file mode 100644 index 0000000000..f9ae2e41e7 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rule_response_data_attributes_updated_by.py @@ -0,0 +1,50 @@ +# 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. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentRuleResponseDataAttributesUpdatedBy(ModelNormal): + @cached_property + def openapi_types(_): + return { + "handle": (str,), + "id": (str,), + "name": (str,), + } + + attribute_map = { + "handle": "handle", + "id": "id", + "name": "name", + } + + def __init__(self_, id: str, handle: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, **kwargs): + """ + Information about the user who updated the deployment rule. + + :param handle: The handle of the user who updated the deployment rule. + :type handle: str, optional + + :param id: The ID of the user who updated the deployment rule. + :type id: str + + :param name: The name of the user who updated the deployment rule. + :type name: str, optional + """ + if handle is not unset: + kwargs["handle"] = handle + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) + + self_.id = id diff --git a/src/datadog_api_client/v2/model/deployment_rules_options.py b/src/datadog_api_client/v2/model/deployment_rules_options.py new file mode 100644 index 0000000000..5aaa95dd0a --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_rules_options.py @@ -0,0 +1,48 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class DeploymentRulesOptions(ModelComposed): + def __init__(self, **kwargs): + """ + Options for deployment rule response representing either faulty deployment detection or monitor options. + + :param duration: The duration for faulty deployment detection. + :type duration: int, optional + + :param excluded_resources: Resources to exclude from faulty deployment detection. + :type excluded_resources: [str], optional + + :param query: Monitors that match this query are evaluated. + :type query: str + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, + ) + from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor + + return { + "oneOf": [ + DeploymentRuleOptionsFaultyDeploymentDetection, + DeploymentRuleOptionsMonitor, + ], + } diff --git a/src/datadog_api_client/v2/model/httpcd_gates_bad_request_response.py b/src/datadog_api_client/v2/model/httpcd_gates_bad_request_response.py new file mode 100644 index 0000000000..4f5215acbe --- /dev/null +++ b/src/datadog_api_client/v2/model/httpcd_gates_bad_request_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError + + +class HTTPCDGatesBadRequestResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError + + return { + "errors": ([HTTPCIAppError],), + } + + attribute_map = { + "errors": "errors", + } + + def __init__(self_, errors: Union[List[HTTPCIAppError], UnsetType] = unset, **kwargs): + """ + Bad request. + + :param errors: Structured errors. + :type errors: [HTTPCIAppError], optional + """ + if errors is not unset: + kwargs["errors"] = errors + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/httpcd_gates_not_found_response.py b/src/datadog_api_client/v2/model/httpcd_gates_not_found_response.py new file mode 100644 index 0000000000..512d6c8def --- /dev/null +++ b/src/datadog_api_client/v2/model/httpcd_gates_not_found_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError + + +class HTTPCDGatesNotFoundResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError + + return { + "errors": ([HTTPCIAppError],), + } + + attribute_map = { + "errors": "errors", + } + + def __init__(self_, errors: Union[List[HTTPCIAppError], UnsetType] = unset, **kwargs): + """ + Deployment gate not found. + + :param errors: Structured errors. + :type errors: [HTTPCIAppError], optional + """ + if errors is not unset: + kwargs["errors"] = errors + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/httpcd_rules_not_found_response.py b/src/datadog_api_client/v2/model/httpcd_rules_not_found_response.py new file mode 100644 index 0000000000..a213ed264a --- /dev/null +++ b/src/datadog_api_client/v2/model/httpcd_rules_not_found_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError + + +class HTTPCDRulesNotFoundResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError + + return { + "errors": ([HTTPCIAppError],), + } + + attribute_map = { + "errors": "errors", + } + + def __init__(self_, errors: Union[List[HTTPCIAppError], UnsetType] = unset, **kwargs): + """ + Deployment rule not found. + + :param errors: Structured errors. + :type errors: [HTTPCIAppError], optional + """ + if errors is not unset: + kwargs["errors"] = errors + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/update_deployment_gate_params.py b/src/datadog_api_client/v2/model/update_deployment_gate_params.py new file mode 100644 index 0000000000..91e7a81626 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_deployment_gate_params.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_deployment_gate_params_data import UpdateDeploymentGateParamsData + + +class UpdateDeploymentGateParams(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_deployment_gate_params_data import UpdateDeploymentGateParamsData + + return { + "data": (UpdateDeploymentGateParamsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: UpdateDeploymentGateParamsData, **kwargs): + """ + Parameters for updating a deployment gate. + + :param data: Parameters for updating a deployment gate. + :type data: UpdateDeploymentGateParamsData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/update_deployment_gate_params_data.py b/src/datadog_api_client/v2/model/update_deployment_gate_params_data.py new file mode 100644 index 0000000000..d1da763c88 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_deployment_gate_params_data.py @@ -0,0 +1,60 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_deployment_gate_params_data_attributes import ( + UpdateDeploymentGateParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + + +class UpdateDeploymentGateParamsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_deployment_gate_params_data_attributes import ( + UpdateDeploymentGateParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType + + return { + "attributes": (UpdateDeploymentGateParamsDataAttributes,), + "id": (str,), + "type": (DeploymentGateDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: UpdateDeploymentGateParamsDataAttributes, id: str, type: DeploymentGateDataType, **kwargs + ): + """ + Parameters for updating a deployment gate. + + :param attributes: Attributes for updating a deployment gate. + :type attributes: UpdateDeploymentGateParamsDataAttributes + + :param id: Unique identifier of the deployment gate. + :type id: str + + :param type: Deployment gate resource type. + :type type: DeploymentGateDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/update_deployment_gate_params_data_attributes.py b/src/datadog_api_client/v2/model/update_deployment_gate_params_data_attributes.py new file mode 100644 index 0000000000..8f86fed503 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_deployment_gate_params_data_attributes.py @@ -0,0 +1,33 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class UpdateDeploymentGateParamsDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "dry_run": (bool,), + } + + attribute_map = { + "dry_run": "dry_run", + } + + def __init__(self_, dry_run: bool, **kwargs): + """ + Attributes for updating a deployment gate. + + :param dry_run: Whether to run in dry-run mode. + :type dry_run: bool + """ + super().__init__(kwargs) + + self_.dry_run = dry_run diff --git a/src/datadog_api_client/v2/model/update_deployment_rule_params.py b/src/datadog_api_client/v2/model/update_deployment_rule_params.py new file mode 100644 index 0000000000..4334e37345 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_deployment_rule_params.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_deployment_rule_params_data import UpdateDeploymentRuleParamsData + + +class UpdateDeploymentRuleParams(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_deployment_rule_params_data import UpdateDeploymentRuleParamsData + + return { + "data": (UpdateDeploymentRuleParamsData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: UpdateDeploymentRuleParamsData, **kwargs): + """ + Parameters for updating a deployment rule. + + :param data: Parameters for updating a deployment rule. + :type data: UpdateDeploymentRuleParamsData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/update_deployment_rule_params_data.py b/src/datadog_api_client/v2/model/update_deployment_rule_params_data.py new file mode 100644 index 0000000000..413150f789 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_deployment_rule_params_data.py @@ -0,0 +1,52 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_deployment_rule_params_data_attributes import ( + UpdateDeploymentRuleParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType + + +class UpdateDeploymentRuleParamsData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_deployment_rule_params_data_attributes import ( + UpdateDeploymentRuleParamsDataAttributes, + ) + from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType + + return { + "attributes": (UpdateDeploymentRuleParamsDataAttributes,), + "type": (DeploymentRuleDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: UpdateDeploymentRuleParamsDataAttributes, type: DeploymentRuleDataType, **kwargs): + """ + Parameters for updating a deployment rule. + + :param attributes: Parameters for updating a deployment rule. + :type attributes: UpdateDeploymentRuleParamsDataAttributes + + :param type: Deployment rule resource type. + :type type: DeploymentRuleDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py b/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py new file mode 100644 index 0000000000..cc51b544a3 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_deployment_rule_params_data_attributes.py @@ -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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions + from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, + ) + from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor + + +class UpdateDeploymentRuleParamsDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions + + return { + "dry_run": (bool,), + "name": (str,), + "options": (DeploymentRulesOptions,), + } + + attribute_map = { + "dry_run": "dry_run", + "name": "name", + "options": "options", + } + + def __init__( + self_, + dry_run: bool, + name: str, + options: Union[ + DeploymentRulesOptions, DeploymentRuleOptionsFaultyDeploymentDetection, DeploymentRuleOptionsMonitor + ], + **kwargs, + ): + """ + Parameters for updating a deployment rule. + + :param dry_run: Whether to run this rule in dry-run mode. + :type dry_run: bool + + :param name: The name of the deployment rule. + :type name: str + + :param options: Options for deployment rule response representing either faulty deployment detection or monitor options. + :type options: DeploymentRulesOptions + """ + super().__init__(kwargs) + + self_.dry_run = dry_run + self_.name = name + self_.options = options diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 82c2b4bf88..a43b11d44e 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -959,6 +959,16 @@ CreateDataDeletionRequestBodyDataType, ) from datadog_api_client.v2.model.create_data_deletion_response_body import CreateDataDeletionResponseBody +from datadog_api_client.v2.model.create_deployment_gate_params import CreateDeploymentGateParams +from datadog_api_client.v2.model.create_deployment_gate_params_data import CreateDeploymentGateParamsData +from datadog_api_client.v2.model.create_deployment_gate_params_data_attributes import ( + CreateDeploymentGateParamsDataAttributes, +) +from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams +from datadog_api_client.v2.model.create_deployment_rule_params_data import CreateDeploymentRuleParamsData +from datadog_api_client.v2.model.create_deployment_rule_params_data_attributes import ( + CreateDeploymentRuleParamsDataAttributes, +) from datadog_api_client.v2.model.create_incident_notification_rule_request import CreateIncidentNotificationRuleRequest from datadog_api_client.v2.model.create_incident_notification_template_request import ( CreateIncidentNotificationTemplateRequest, @@ -1314,9 +1324,37 @@ from datadog_api_client.v2.model.dependency_location import DependencyLocation from datadog_api_client.v2.model.deployment import Deployment from datadog_api_client.v2.model.deployment_attributes import DeploymentAttributes +from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType +from datadog_api_client.v2.model.deployment_gate_response import DeploymentGateResponse +from datadog_api_client.v2.model.deployment_gate_response_data import DeploymentGateResponseData +from datadog_api_client.v2.model.deployment_gate_response_data_attributes import DeploymentGateResponseDataAttributes +from datadog_api_client.v2.model.deployment_gate_response_data_attributes_created_by import ( + DeploymentGateResponseDataAttributesCreatedBy, +) +from datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by import ( + DeploymentGateResponseDataAttributesUpdatedBy, +) from datadog_api_client.v2.model.deployment_metadata import DeploymentMetadata from datadog_api_client.v2.model.deployment_relationship import DeploymentRelationship from datadog_api_client.v2.model.deployment_relationship_data import DeploymentRelationshipData +from datadog_api_client.v2.model.deployment_rule_data_type import DeploymentRuleDataType +from datadog_api_client.v2.model.deployment_rule_options_faulty_deployment_detection import ( + DeploymentRuleOptionsFaultyDeploymentDetection, +) +from datadog_api_client.v2.model.deployment_rule_options_monitor import DeploymentRuleOptionsMonitor +from datadog_api_client.v2.model.deployment_rule_response import DeploymentRuleResponse +from datadog_api_client.v2.model.deployment_rule_response_data import DeploymentRuleResponseData +from datadog_api_client.v2.model.deployment_rule_response_data_attributes import DeploymentRuleResponseDataAttributes +from datadog_api_client.v2.model.deployment_rule_response_data_attributes_created_by import ( + DeploymentRuleResponseDataAttributesCreatedBy, +) +from datadog_api_client.v2.model.deployment_rule_response_data_attributes_type import ( + DeploymentRuleResponseDataAttributesType, +) +from datadog_api_client.v2.model.deployment_rule_response_data_attributes_updated_by import ( + DeploymentRuleResponseDataAttributesUpdatedBy, +) +from datadog_api_client.v2.model.deployment_rules_options import DeploymentRulesOptions from datadog_api_client.v2.model.detailed_finding import DetailedFinding from datadog_api_client.v2.model.detailed_finding_attributes import DetailedFindingAttributes from datadog_api_client.v2.model.detailed_finding_type import DetailedFindingType @@ -1903,6 +1941,9 @@ from datadog_api_client.v2.model.group_scalar_column import GroupScalarColumn from datadog_api_client.v2.model.group_tags import GroupTags from datadog_api_client.v2.model.http_body import HTTPBody +from datadog_api_client.v2.model.httpcd_gates_bad_request_response import HTTPCDGatesBadRequestResponse +from datadog_api_client.v2.model.httpcd_gates_not_found_response import HTTPCDGatesNotFoundResponse +from datadog_api_client.v2.model.httpcd_rules_not_found_response import HTTPCDRulesNotFoundResponse from datadog_api_client.v2.model.httpci_app_error import HTTPCIAppError from datadog_api_client.v2.model.httpci_app_errors import HTTPCIAppErrors from datadog_api_client.v2.model.http_credentials import HTTPCredentials @@ -4718,6 +4759,16 @@ from datadog_api_client.v2.model.update_connection_request_data_type import UpdateConnectionRequestDataType from datadog_api_client.v2.model.update_custom_framework_request import UpdateCustomFrameworkRequest from datadog_api_client.v2.model.update_custom_framework_response import UpdateCustomFrameworkResponse +from datadog_api_client.v2.model.update_deployment_gate_params import UpdateDeploymentGateParams +from datadog_api_client.v2.model.update_deployment_gate_params_data import UpdateDeploymentGateParamsData +from datadog_api_client.v2.model.update_deployment_gate_params_data_attributes import ( + UpdateDeploymentGateParamsDataAttributes, +) +from datadog_api_client.v2.model.update_deployment_rule_params import UpdateDeploymentRuleParams +from datadog_api_client.v2.model.update_deployment_rule_params_data import UpdateDeploymentRuleParamsData +from datadog_api_client.v2.model.update_deployment_rule_params_data_attributes import ( + UpdateDeploymentRuleParamsDataAttributes, +) from datadog_api_client.v2.model.update_open_api_response import UpdateOpenAPIResponse from datadog_api_client.v2.model.update_open_api_response_attributes import UpdateOpenAPIResponseAttributes from datadog_api_client.v2.model.update_open_api_response_data import UpdateOpenAPIResponseData @@ -5617,6 +5668,12 @@ "CreateDataDeletionRequestBodyData", "CreateDataDeletionRequestBodyDataType", "CreateDataDeletionResponseBody", + "CreateDeploymentGateParams", + "CreateDeploymentGateParamsData", + "CreateDeploymentGateParamsDataAttributes", + "CreateDeploymentRuleParams", + "CreateDeploymentRuleParamsData", + "CreateDeploymentRuleParamsDataAttributes", "CreateIncidentNotificationRuleRequest", "CreateIncidentNotificationTemplateRequest", "CreateNotificationRuleParameters", @@ -5852,9 +5909,25 @@ "DependencyLocation", "Deployment", "DeploymentAttributes", + "DeploymentGateDataType", + "DeploymentGateResponse", + "DeploymentGateResponseData", + "DeploymentGateResponseDataAttributes", + "DeploymentGateResponseDataAttributesCreatedBy", + "DeploymentGateResponseDataAttributesUpdatedBy", "DeploymentMetadata", "DeploymentRelationship", "DeploymentRelationshipData", + "DeploymentRuleDataType", + "DeploymentRuleOptionsFaultyDeploymentDetection", + "DeploymentRuleOptionsMonitor", + "DeploymentRuleResponse", + "DeploymentRuleResponseData", + "DeploymentRuleResponseDataAttributes", + "DeploymentRuleResponseDataAttributesCreatedBy", + "DeploymentRuleResponseDataAttributesType", + "DeploymentRuleResponseDataAttributesUpdatedBy", + "DeploymentRulesOptions", "DetailedFinding", "DetailedFindingAttributes", "DetailedFindingType", @@ -6319,6 +6392,9 @@ "GroupScalarColumn", "GroupTags", "HTTPBody", + "HTTPCDGatesBadRequestResponse", + "HTTPCDGatesNotFoundResponse", + "HTTPCDRulesNotFoundResponse", "HTTPCIAppError", "HTTPCIAppErrors", "HTTPCredentials", @@ -8294,6 +8370,12 @@ "UpdateConnectionRequestDataType", "UpdateCustomFrameworkRequest", "UpdateCustomFrameworkResponse", + "UpdateDeploymentGateParams", + "UpdateDeploymentGateParamsData", + "UpdateDeploymentGateParamsDataAttributes", + "UpdateDeploymentRuleParams", + "UpdateDeploymentRuleParamsData", + "UpdateDeploymentRuleParamsDataAttributes", "UpdateOpenAPIResponse", "UpdateOpenAPIResponseAttributes", "UpdateOpenAPIResponseData", diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_bad_request_response.frozen new file mode 100644 index 0000000000..3c155e7901 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:03:25.410Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_bad_request_response.yaml new file mode 100644 index 0000000000..91e0f87af0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_bad_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"env":"","identifier":"my-gate","service":"test-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"env\" is required"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_ok_response.frozen new file mode 100644 index 0000000000..89457259ce --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:03:26.103Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_ok_response.yaml new file mode 100644 index 0000000000..e7f48e9534 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_gate_returns_ok_response.yaml @@ -0,0 +1,36 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate-1","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/0cc075c2-fec1-4ed3-9e43-0882646fac07 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_bad_request_response.frozen new file mode 100644 index 0000000000..70cc3602d6 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:12.459Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_bad_request_response.yaml new file mode 100644 index 0000000000..c72423f418 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_bad_request_response.yaml @@ -0,0 +1,55 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"test","options":{"excluded_resources":[]},"type":"fdd"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/c7d0bed9-01dc-45d5-88ad-242123881f81/rules + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"type\" must be one of \"monitor faulty_deployment_detection\""}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/c7d0bed9-01dc-45d5-88ad-242123881f81 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_ok_response.frozen new file mode 100644 index 0000000000..44db2e7bb5 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:13.363Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_ok_response.yaml new file mode 100644 index 0000000000..cf1ea04379 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_deployment_rule_returns_ok_response.yaml @@ -0,0 +1,71 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/58066a8e-44e7-4119-8ac6-a5ecc3b31c1b/rules + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/58066a8e-44e7-4119-8ac6-a5ecc3b31c1b/rules/8330bf79-6906-4cea-85d5-a4da6767458e + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/58066a8e-44e7-4119-8ac6-a5ecc3b31c1b + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_bad_request_response.frozen new file mode 100644 index 0000000000..a5e028feae --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:03:29.170Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_bad_request_response.yaml new file mode 100644 index 0000000000..27fb57b795 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_bad_request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"id\" Invalid id"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_no_content_response.frozen new file mode 100644 index 0000000000..88c603c5cc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_no_content_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:14.192Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_no_content_response.yaml new file mode 100644 index 0000000000..55ac8cdee7 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_gate_returns_no_content_response.yaml @@ -0,0 +1,53 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/dba6d48b-b7ac-4ac8-b2d5-70e45b500eed + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/dba6d48b-b7ac-4ac8-b2d5-70e45b500eed + response: + body: + string: '{"errors":[{"status":"404","title":"Not Found","detail":"Gate does + not exist"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_bad_request_response.frozen new file mode 100644 index 0000000000..8a22d65c1a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:03:30.230Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_bad_request_response.yaml new file mode 100644 index 0000000000..42ab54e1f7 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_bad_request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id/rules/invalid-rule-id + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"gate_id\" Invalid id"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_no_content_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_no_content_response.frozen new file mode 100644 index 0000000000..6685aa65af --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_no_content_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:14.630Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_no_content_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_no_content_response.yaml new file mode 100644 index 0000000000..47ba2b76c2 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_deployment_rule_returns_no_content_response.yaml @@ -0,0 +1,88 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630/rules + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630/rules/31e6717f-2eaa-45e5-9559-a55ca9d45f8d + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630/rules/31e6717f-2eaa-45e5-9559-a55ca9d45f8d + response: + body: + string: '{"errors":[{"status":"404","title":"Not Found","detail":"Rule does + not exist"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/8e202ae7-a86b-4f4a-a213-585801a42630 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_bad_request_response.frozen new file mode 100644 index 0000000000..818f6bcc35 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:03:31.887Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_bad_request_response.yaml new file mode 100644 index 0000000000..198e60a209 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_bad_request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"id\" Invalid id"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_ok_response.frozen new file mode 100644 index 0000000000..b38e931fdb --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:15.372Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_ok_response.yaml new file mode 100644 index 0000000000..1e4bf3d180 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_gate_returns_ok_response.yaml @@ -0,0 +1,54 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/deployment_gates/ed4085c5-e8d3-4bf8-89a6-c257164d8952 + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/ed4085c5-e8d3-4bf8-89a6-c257164d8952 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_bad_request_response.frozen new file mode 100644 index 0000000000..3246cdbd64 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:15.883Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_bad_request_response.yaml new file mode 100644 index 0000000000..1de282b311 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_bad_request_response.yaml @@ -0,0 +1,88 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/d49e6d82-2dc4-45b6-ab50-4fb09feae18e/rules + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id/rules/invalid-rule-id + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"gate_id\" Invalid id"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/d49e6d82-2dc4-45b6-ab50-4fb09feae18e/rules/611707d2-276e-4dc5-b754-db8f94eab0b5 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/d49e6d82-2dc4-45b6-ab50-4fb09feae18e + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_ok_response.frozen new file mode 100644 index 0000000000..f1e5e96393 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:16.642Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_ok_response.yaml new file mode 100644 index 0000000000..c7a35238e1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_deployment_rule_returns_ok_response.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56/rules + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56/rules/a38ab685-4ef9-4000-a938-740da6c37296 + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56/rules/a38ab685-4ef9-4000-a938-740da6c37296 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/50df9de0-aa0c-4d7c-8fc8-811ee2ab4e56 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_bad_request_response.frozen new file mode 100644 index 0000000000..88eba0b980 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:03:35.734Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_bad_request_response.yaml new file mode 100644 index 0000000000..2d86074255 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_bad_request_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":true},"id":"invalid-gate-id","type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"id\" Invalid id"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_ok_response.frozen new file mode 100644 index 0000000000..b67d99b534 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:17.586Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_ok_response.yaml new file mode 100644 index 0000000000..73a7a51b9b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_gate_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false},"id":"12345678-1234-1234-1234-123456789012","type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deployment_gates/ef672c2e-81fc-4fcc-9690-392a9cf0d70c + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/ef672c2e-81fc-4fcc-9690-392a9cf0d70c + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_bad_request_response.frozen new file mode 100644 index 0000000000..1691ea9242 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:18.004Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_bad_request_response.yaml new file mode 100644 index 0000000000..cc9590f62e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_bad_request_response.yaml @@ -0,0 +1,90 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d/rules + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"Updated deployment rule","options":{"excluded_resources":[]}},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deployment_gates/invalid-gate-id/rules/invalid-rule-id + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"gate_id\" Invalid id"}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d/rules/189846d6-3c19-46e8-98d1-9d05a2f43361 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/b2bd3ad3-f414-4f05-9ad6-248ed3f99f4d + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_ok_response.frozen new file mode 100644 index 0000000000..7ae0c5541e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-10-28T14:51:18.721Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_ok_response.yaml new file mode 100644 index 0000000000..4cc36a6472 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_deployment_rule_returns_ok_response.yaml @@ -0,0 +1,92 @@ +interactions: +- request: + body: '{"data":{"attributes":{"dry_run":false,"env":"production","identifier":"my-gate","service":"my-service"},"type":"deployment_gate"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"My deployment rule","options":{"excluded_resources":[]},"type":"faulty_deployment_detection"},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a/rules + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"dry_run":false,"name":"Updated deployment rule","options":{"excluded_resources":[]}},"type":"deployment_rule"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a/rules/483937d1-efc4-4a7c-95a6-89bd6b2e4e75 + response: + body: + string: '{"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"}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a/rules/483937d1-efc4-4a7c-95a6-89bd6b2e4e75 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/deployment_gates/301122dd-9022-40f0-886f-f9a6c227dc9a + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/deployment_gates.feature b/tests/v2/features/deployment_gates.feature new file mode 100644 index 0000000000..e4023c5650 --- /dev/null +++ b/tests/v2/features/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/v2/features/given.json b/tests/v2/features/given.json index 8afb9b89bd..198c7af1b5 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -346,6 +346,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/v2/features/undo.json b/tests/v2/features/undo.json index dba9a5e29d..0ed8bec8f3 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1310,6 +1310,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": {