diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml
index 93efc78e5..9632e2d7d 100644
--- a/.generator/schemas/v2/openapi.yaml
+++ b/.generator/schemas/v2/openapi.yaml
@@ -1157,6 +1157,24 @@ components:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
+ HTTPCDGatesBadRequestResponse:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCDGatesBadRequestResponse'
+ description: Bad request.
+ HTTPCDGatesNotFoundResponse:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCDGatesNotFoundResponse'
+ description: Deployment gate not found.
+ HTTPCDRulesNotFoundResponse:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCDRulesNotFoundResponse'
+ description: Deployment rule not found.
NotAuthorizedResponse:
content:
application/json:
@@ -12576,6 +12594,91 @@ components:
meta:
$ref: '#/components/schemas/DataDeletionResponseMeta'
type: object
+ CreateDeploymentGateParams:
+ description: Parameters for creating a deployment gate.
+ properties:
+ data:
+ $ref: '#/components/schemas/CreateDeploymentGateParamsData'
+ required:
+ - data
+ type: object
+ CreateDeploymentGateParamsData:
+ description: Parameters for creating a deployment gate.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/CreateDeploymentGateParamsDataAttributes'
+ type:
+ $ref: '#/components/schemas/DeploymentGateDataType'
+ required:
+ - type
+ - attributes
+ type: object
+ CreateDeploymentGateParamsDataAttributes:
+ description: Parameters for creating a deployment gate.
+ properties:
+ dry_run:
+ default: false
+ description: Whether this gate is run in dry-run mode.
+ example: false
+ type: boolean
+ env:
+ description: The environment of the deployment gate.
+ example: production
+ type: string
+ identifier:
+ default: default
+ description: The identifier of the deployment gate.
+ example: pre
+ type: string
+ service:
+ description: The service of the deployment gate.
+ example: my-service
+ type: string
+ required:
+ - env
+ - service
+ type: object
+ CreateDeploymentRuleParams:
+ description: Parameters for creating a deployment rule.
+ properties:
+ data:
+ $ref: '#/components/schemas/CreateDeploymentRuleParamsData'
+ type: object
+ CreateDeploymentRuleParamsData:
+ description: Parameters for creating a deployment rule.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/CreateDeploymentRuleParamsDataAttributes'
+ type:
+ $ref: '#/components/schemas/DeploymentRuleDataType'
+ required:
+ - type
+ - attributes
+ type: object
+ CreateDeploymentRuleParamsDataAttributes:
+ description: Parameters for creating a deployment rule.
+ properties:
+ dry_run:
+ default: false
+ description: Whether this rule is run in dry-run mode.
+ example: false
+ type: boolean
+ name:
+ description: The name of the deployment rule.
+ example: My deployment rule
+ type: string
+ options:
+ $ref: '#/components/schemas/DeploymentRulesOptions'
+ type:
+ description: The type of the deployment rule (faulty_deployment_detection
+ or monitor).
+ example: faulty_deployment_detection
+ type: string
+ required:
+ - name
+ - options
+ - type
+ type: object
CreateIncidentNotificationRuleRequest:
description: Create request for a notification rule.
properties:
@@ -16284,6 +16387,113 @@ components:
format: uuid
type: string
type: object
+ DeploymentGateDataType:
+ description: Deployment gate resource type.
+ enum:
+ - deployment_gate
+ example: deployment_gate
+ type: string
+ x-enum-varnames:
+ - DEPLOYMENT_GATE
+ DeploymentGateResponse:
+ description: Response for a deployment gate.
+ properties:
+ data:
+ $ref: '#/components/schemas/DeploymentGateResponseData'
+ type: object
+ DeploymentGateResponseData:
+ description: Data for a deployment gate.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/DeploymentGateResponseDataAttributes'
+ id:
+ description: Unique identifier of the deployment gate.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ type:
+ $ref: '#/components/schemas/DeploymentGateDataType'
+ required:
+ - type
+ - attributes
+ - id
+ type: object
+ DeploymentGateResponseDataAttributes:
+ description: Basic information about a deployment gate.
+ properties:
+ created_at:
+ description: The timestamp when the deployment gate was created.
+ example: '2021-01-01T00:00:00Z'
+ format: date-time
+ type: string
+ created_by:
+ $ref: '#/components/schemas/DeploymentGateResponseDataAttributesCreatedBy'
+ dry_run:
+ description: Whether this gate is run in dry-run mode.
+ example: false
+ type: boolean
+ env:
+ description: The environment of the deployment gate.
+ example: production
+ type: string
+ identifier:
+ description: The identifier of the deployment gate.
+ example: pre
+ type: string
+ service:
+ description: The service of the deployment gate.
+ example: my-service
+ type: string
+ updated_at:
+ description: The timestamp when the deployment gate was last updated.
+ example: '2021-01-01T00:00:00Z'
+ format: date-time
+ type: string
+ updated_by:
+ $ref: '#/components/schemas/DeploymentGateResponseDataAttributesUpdatedBy'
+ required:
+ - created_at
+ - created_by
+ - dry_run
+ - env
+ - identifier
+ - service
+ type: object
+ DeploymentGateResponseDataAttributesCreatedBy:
+ description: Information about the user who created the deployment gate.
+ properties:
+ handle:
+ description: The handle of the user who created the deployment rule.
+ example: test-user
+ type: string
+ id:
+ description: The ID of the user who created the deployment rule.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ name:
+ description: The name of the user who created the deployment rule.
+ example: Test User
+ type: string
+ required:
+ - id
+ type: object
+ DeploymentGateResponseDataAttributesUpdatedBy:
+ description: Information about the user who updated the deployment gate.
+ properties:
+ handle:
+ description: The handle of the user who updated the deployment rule.
+ example: test-user
+ type: string
+ id:
+ description: The ID of the user who updated the deployment rule.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ name:
+ description: The name of the user who updated the deployment rule.
+ example: Test User
+ type: string
+ required:
+ - id
+ type: object
DeploymentMetadata:
description: Metadata object containing the publication creation information.
properties:
@@ -16323,6 +16533,164 @@ components:
type:
$ref: '#/components/schemas/AppDeploymentType'
type: object
+ DeploymentRuleDataType:
+ description: Deployment rule resource type.
+ enum:
+ - deployment_rule
+ example: deployment_rule
+ type: string
+ x-enum-varnames:
+ - DEPLOYMENT_RULE
+ DeploymentRuleOptionsFaultyDeploymentDetection:
+ additionalProperties: false
+ description: Faulty deployment detection options for deployment rules.
+ properties:
+ duration:
+ description: The duration for faulty deployment detection.
+ example: 3600
+ format: int64
+ type: integer
+ excluded_resources:
+ description: Resources to exclude from faulty deployment detection.
+ example:
+ - resource1
+ - resource2
+ items:
+ type: string
+ type: array
+ type: object
+ DeploymentRuleOptionsMonitor:
+ additionalProperties: false
+ description: Monitor options for deployment rules.
+ properties:
+ duration:
+ description: Seconds the monitor needs to stay in OK status for the rule
+ to pass.
+ example: 3600
+ format: int64
+ type: integer
+ query:
+ description: Monitors that match this query are evaluated.
+ example: service:my-service env:prod
+ type: string
+ required:
+ - query
+ type: object
+ DeploymentRuleResponse:
+ description: Response for a deployment rule.
+ properties:
+ data:
+ $ref: '#/components/schemas/DeploymentRuleResponseData'
+ type: object
+ DeploymentRuleResponseData:
+ description: Data for a deployment rule.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/DeploymentRuleResponseDataAttributes'
+ id:
+ description: Unique identifier of the deployment rule.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ type:
+ $ref: '#/components/schemas/DeploymentRuleDataType'
+ required:
+ - type
+ - attributes
+ - id
+ type: object
+ DeploymentRuleResponseDataAttributes:
+ description: Basic information about a deployment rule.
+ properties:
+ created_at:
+ description: The timestamp when the deployment rule was created.
+ example: '2021-01-01T00:00:00Z'
+ format: date-time
+ type: string
+ created_by:
+ $ref: '#/components/schemas/DeploymentRuleResponseDataAttributesCreatedBy'
+ dry_run:
+ description: Whether this rule is run in dry-run mode.
+ example: false
+ type: boolean
+ gate_id:
+ description: The ID of the deployment gate.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ name:
+ description: The name of the deployment rule.
+ example: My deployment rule
+ type: string
+ options:
+ $ref: '#/components/schemas/DeploymentRulesOptions'
+ type:
+ $ref: '#/components/schemas/DeploymentRuleResponseDataAttributesType'
+ updated_at:
+ description: The timestamp when the deployment rule was last updated.
+ format: date-time
+ type: string
+ updated_by:
+ $ref: '#/components/schemas/DeploymentRuleResponseDataAttributesUpdatedBy'
+ required:
+ - created_at
+ - created_by
+ - dry_run
+ - gate_id
+ - name
+ - options
+ - type
+ type: object
+ DeploymentRuleResponseDataAttributesCreatedBy:
+ description: Information about the user who created the deployment rule.
+ properties:
+ handle:
+ description: The handle of the user who created the deployment rule.
+ example: test-user
+ type: string
+ id:
+ description: The ID of the user who created the deployment rule.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ name:
+ description: The name of the user who created the deployment rule.
+ example: Test User
+ type: string
+ required:
+ - id
+ type: object
+ DeploymentRuleResponseDataAttributesType:
+ description: The type of the deployment rule.
+ enum:
+ - faulty_deployment_detection
+ - monitor
+ example: faulty_deployment_detection
+ type: string
+ x-enum-varnames:
+ - FAULTY_DEPLOYMENT_DETECTION
+ - MONITOR
+ DeploymentRuleResponseDataAttributesUpdatedBy:
+ description: Information about the user who updated the deployment rule.
+ properties:
+ handle:
+ description: The handle of the user who updated the deployment rule.
+ example: test-user
+ type: string
+ id:
+ description: The ID of the user who updated the deployment rule.
+ example: 1111-2222-3333-4444-555566667777
+ type: string
+ name:
+ description: The name of the user who updated the deployment rule.
+ example: Test User
+ type: string
+ required:
+ - id
+ type: object
+ DeploymentRulesOptions:
+ description: Options for deployment rule response representing either faulty
+ deployment detection or monitor options.
+ oneOf:
+ - $ref: '#/components/schemas/DeploymentRuleOptionsFaultyDeploymentDetection'
+ - $ref: '#/components/schemas/DeploymentRuleOptionsMonitor'
DetailedFinding:
description: A single finding with with message and resource configuration.
properties:
@@ -22414,6 +22782,33 @@ components:
example: application/json
type: string
type: object
+ HTTPCDGatesBadRequestResponse:
+ description: Bad request.
+ properties:
+ errors:
+ description: Structured errors.
+ items:
+ $ref: '#/components/schemas/HTTPCIAppError'
+ type: array
+ type: object
+ HTTPCDGatesNotFoundResponse:
+ description: Deployment gate not found.
+ properties:
+ errors:
+ description: Structured errors.
+ items:
+ $ref: '#/components/schemas/HTTPCIAppError'
+ type: array
+ type: object
+ HTTPCDRulesNotFoundResponse:
+ description: Deployment rule not found.
+ properties:
+ errors:
+ description: Structured errors.
+ items:
+ $ref: '#/components/schemas/HTTPCIAppError'
+ type: array
+ type: object
HTTPCIAppError:
description: List of errors.
properties:
@@ -51896,6 +52291,77 @@ components:
required:
- data
type: object
+ UpdateDeploymentGateParams:
+ description: Parameters for updating a deployment gate.
+ properties:
+ data:
+ $ref: '#/components/schemas/UpdateDeploymentGateParamsData'
+ required:
+ - data
+ type: object
+ UpdateDeploymentGateParamsData:
+ description: Parameters for updating a deployment gate.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/UpdateDeploymentGateParamsDataAttributes'
+ id:
+ description: Unique identifier of the deployment gate.
+ example: 12345678-1234-1234-1234-123456789012
+ type: string
+ type:
+ $ref: '#/components/schemas/DeploymentGateDataType'
+ required:
+ - type
+ - id
+ - attributes
+ type: object
+ UpdateDeploymentGateParamsDataAttributes:
+ description: Attributes for updating a deployment gate.
+ properties:
+ dry_run:
+ description: Whether to run in dry-run mode.
+ example: false
+ type: boolean
+ required:
+ - dry_run
+ type: object
+ UpdateDeploymentRuleParams:
+ description: Parameters for updating a deployment rule.
+ properties:
+ data:
+ $ref: '#/components/schemas/UpdateDeploymentRuleParamsData'
+ required:
+ - data
+ type: object
+ UpdateDeploymentRuleParamsData:
+ description: Parameters for updating a deployment rule.
+ properties:
+ attributes:
+ $ref: '#/components/schemas/UpdateDeploymentRuleParamsDataAttributes'
+ type:
+ $ref: '#/components/schemas/DeploymentRuleDataType'
+ required:
+ - type
+ - attributes
+ type: object
+ UpdateDeploymentRuleParamsDataAttributes:
+ description: Parameters for updating a deployment rule.
+ properties:
+ dry_run:
+ description: Whether to run this rule in dry-run mode.
+ example: false
+ type: boolean
+ name:
+ description: The name of the deployment rule.
+ example: Updated deployment rule
+ type: string
+ options:
+ $ref: '#/components/schemas/DeploymentRulesOptions'
+ required:
+ - dry_run
+ - name
+ - options
+ type: object
UpdateOpenAPIResponse:
description: Response for `UpdateOpenAPI`.
properties:
@@ -61541,6 +62007,403 @@ paths:
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,
contact [Datadog support](https://docs.datadoghq.com/help/).'
+ /api/v2/deployment_gates:
+ post:
+ description: Endpoint to create a deployment gate.
+ operationId: CreateDeploymentGate
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CreateDeploymentGateParams'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeploymentGateResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Create deployment gate
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_write
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ /api/v2/deployment_gates/{gate_id}/rules:
+ post:
+ description: Endpoint to create a deployment rule. A gate for the rule must
+ already exist.
+ operationId: CreateDeploymentRule
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: gate_id
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/CreateDeploymentRuleParams'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeploymentRuleResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Create deployment rule
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_write
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ /api/v2/deployment_gates/{gate_id}/rules/{id}:
+ delete:
+ description: Endpoint to delete a deployment rule.
+ operationId: DeleteDeploymentRule
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: gate_id
+ required: true
+ schema:
+ type: string
+ - description: The ID of the deployment rule.
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: No Content
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/HTTPCDGatesNotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Delete deployment rule
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_write
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ get:
+ description: Endpoint to get a deployment rule.
+ operationId: GetDeploymentRule
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: gate_id
+ required: true
+ schema:
+ type: string
+ - description: The ID of the deployment rule.
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeploymentRuleResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/HTTPCDRulesNotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Get deployment rule
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_read
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ put:
+ description: Endpoint to update a deployment rule.
+ operationId: UpdateDeploymentRule
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: gate_id
+ required: true
+ schema:
+ type: string
+ - description: The ID of the deployment rule.
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UpdateDeploymentRuleParams'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeploymentRuleResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/HTTPCDRulesNotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Update deployment rule
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_write
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ /api/v2/deployment_gates/{id}:
+ delete:
+ description: Endpoint to delete a deployment gate. Rules associated with the
+ gate are also deleted.
+ operationId: DeleteDeploymentGate
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: No Content
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/HTTPCDGatesNotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Delete deployment gate
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_write
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ get:
+ description: Endpoint to get a deployment gate.
+ operationId: GetDeploymentGate
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeploymentGateResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/HTTPCDGatesNotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Get deployment gate
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_read
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
+ put:
+ description: Endpoint to update a deployment gate.
+ operationId: UpdateDeploymentGate
+ parameters:
+ - description: The ID of the deployment gate.
+ in: path
+ name: id
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/UpdateDeploymentGateParams'
+ required: true
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeploymentGateResponse'
+ description: OK
+ '400':
+ $ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
+ '401':
+ $ref: '#/components/responses/UnauthorizedResponse'
+ '403':
+ $ref: '#/components/responses/ForbiddenResponse'
+ '404':
+ $ref: '#/components/responses/HTTPCDGatesNotFoundResponse'
+ '429':
+ $ref: '#/components/responses/TooManyRequestsResponse'
+ '500':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/HTTPCIAppErrors'
+ description: Internal Server Error
+ security:
+ - apiKeyAuth: []
+ appKeyAuth: []
+ summary: Update deployment gate
+ tags:
+ - Deployment Gates
+ x-permission:
+ operator: OR
+ permissions:
+ - deployment_gates_write
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
+
+ If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/domain_allowlist:
get:
description: Get the domain allowlist for an organization.
@@ -79554,8 +80417,7 @@ paths:
operator: OR
permissions:
- test_optimization_read
- x-unstable: '**Note**: This endpoint is in public beta and may be subject to
- change.
+ x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/usage/application_security:
@@ -81289,6 +82151,10 @@ tags:
view certain types of telemetry (for example, logs, traces, metrics, and RUM data).'
name: Datasets
+- description: Manage Deployment Gates using this API to reduce the likelihood and
+ impact of incidents caused by deployments. See the [Deployment Gates documentation](https://docs.datadoghq.com/deployment_gates/)
+ for more information.
+ name: Deployment Gates
- description: 'Configure your Datadog Email Domain Allowlist directly through the
Datadog API.
diff --git a/examples/v2_deployment-gates_CreateDeploymentGate.rs b/examples/v2_deployment-gates_CreateDeploymentGate.rs
new file mode 100644
index 000000000..efa61fc3a
--- /dev/null
+++ b/examples/v2_deployment-gates_CreateDeploymentGate.rs
@@ -0,0 +1,29 @@
+// Create deployment gate returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+use datadog_api_client::datadogV2::model::CreateDeploymentGateParams;
+use datadog_api_client::datadogV2::model::CreateDeploymentGateParamsData;
+use datadog_api_client::datadogV2::model::CreateDeploymentGateParamsDataAttributes;
+use datadog_api_client::datadogV2::model::DeploymentGateDataType;
+
+#[tokio::main]
+async fn main() {
+ let body = CreateDeploymentGateParams::new(CreateDeploymentGateParamsData::new(
+ CreateDeploymentGateParamsDataAttributes::new(
+ "production".to_string(),
+ "my-service".to_string(),
+ )
+ .dry_run(false)
+ .identifier("my-gate-1".to_string()),
+ DeploymentGateDataType::DEPLOYMENT_GATE,
+ ));
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.CreateDeploymentGate", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api.create_deployment_gate(body).await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_CreateDeploymentRule.rs b/examples/v2_deployment-gates_CreateDeploymentRule.rs
new file mode 100644
index 000000000..1c85310c7
--- /dev/null
+++ b/examples/v2_deployment-gates_CreateDeploymentRule.rs
@@ -0,0 +1,37 @@
+// Create deployment rule returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+use datadog_api_client::datadogV2::model::CreateDeploymentRuleParams;
+use datadog_api_client::datadogV2::model::CreateDeploymentRuleParamsData;
+use datadog_api_client::datadogV2::model::CreateDeploymentRuleParamsDataAttributes;
+use datadog_api_client::datadogV2::model::DeploymentRuleDataType;
+use datadog_api_client::datadogV2::model::DeploymentRuleOptionsFaultyDeploymentDetection;
+use datadog_api_client::datadogV2::model::DeploymentRulesOptions;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+ let body = CreateDeploymentRuleParams::new().data(CreateDeploymentRuleParamsData::new(
+ CreateDeploymentRuleParamsDataAttributes::new(
+ "My deployment rule".to_string(),
+ DeploymentRulesOptions::DeploymentRuleOptionsFaultyDeploymentDetection(Box::new(
+ DeploymentRuleOptionsFaultyDeploymentDetection::new().excluded_resources(vec![]),
+ )),
+ "faulty_deployment_detection".to_string(),
+ )
+ .dry_run(false),
+ DeploymentRuleDataType::DEPLOYMENT_RULE,
+ ));
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.CreateDeploymentRule", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .create_deployment_rule(deployment_gate_data_id.clone(), body)
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_DeleteDeploymentGate.rs b/examples/v2_deployment-gates_DeleteDeploymentGate.rs
new file mode 100644
index 000000000..4475133e5
--- /dev/null
+++ b/examples/v2_deployment-gates_DeleteDeploymentGate.rs
@@ -0,0 +1,20 @@
+// Delete deployment gate returns "No Content" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.DeleteDeploymentGate", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .delete_deployment_gate(deployment_gate_data_id.clone())
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_DeleteDeploymentRule.rs b/examples/v2_deployment-gates_DeleteDeploymentRule.rs
new file mode 100644
index 000000000..e7671fb14
--- /dev/null
+++ b/examples/v2_deployment-gates_DeleteDeploymentRule.rs
@@ -0,0 +1,26 @@
+// Delete deployment rule returns "No Content" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+
+ // there is a valid "deployment_rule" in the system
+ let deployment_rule_data_id = std::env::var("DEPLOYMENT_RULE_DATA_ID").unwrap();
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.DeleteDeploymentRule", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .delete_deployment_rule(
+ deployment_gate_data_id.clone(),
+ deployment_rule_data_id.clone(),
+ )
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_GetDeploymentGate.rs b/examples/v2_deployment-gates_GetDeploymentGate.rs
new file mode 100644
index 000000000..3e1f3ed60
--- /dev/null
+++ b/examples/v2_deployment-gates_GetDeploymentGate.rs
@@ -0,0 +1,20 @@
+// Get deployment gate returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.GetDeploymentGate", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .get_deployment_gate(deployment_gate_data_id.clone())
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_GetDeploymentRule.rs b/examples/v2_deployment-gates_GetDeploymentRule.rs
new file mode 100644
index 000000000..78a6c1669
--- /dev/null
+++ b/examples/v2_deployment-gates_GetDeploymentRule.rs
@@ -0,0 +1,26 @@
+// Get deployment rule returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+
+ // there is a valid "deployment_rule" in the system
+ let deployment_rule_data_id = std::env::var("DEPLOYMENT_RULE_DATA_ID").unwrap();
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.GetDeploymentRule", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .get_deployment_rule(
+ deployment_gate_data_id.clone(),
+ deployment_rule_data_id.clone(),
+ )
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_UpdateDeploymentGate.rs b/examples/v2_deployment-gates_UpdateDeploymentGate.rs
new file mode 100644
index 000000000..dafe45e08
--- /dev/null
+++ b/examples/v2_deployment-gates_UpdateDeploymentGate.rs
@@ -0,0 +1,29 @@
+// Update deployment gate returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+use datadog_api_client::datadogV2::model::DeploymentGateDataType;
+use datadog_api_client::datadogV2::model::UpdateDeploymentGateParams;
+use datadog_api_client::datadogV2::model::UpdateDeploymentGateParamsData;
+use datadog_api_client::datadogV2::model::UpdateDeploymentGateParamsDataAttributes;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+ let body = UpdateDeploymentGateParams::new(UpdateDeploymentGateParamsData::new(
+ UpdateDeploymentGateParamsDataAttributes::new(false),
+ "12345678-1234-1234-1234-123456789012".to_string(),
+ DeploymentGateDataType::DEPLOYMENT_GATE,
+ ));
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.UpdateDeploymentGate", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .update_deployment_gate(deployment_gate_data_id.clone(), body)
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/examples/v2_deployment-gates_UpdateDeploymentRule.rs b/examples/v2_deployment-gates_UpdateDeploymentRule.rs
new file mode 100644
index 000000000..2c9bfa03f
--- /dev/null
+++ b/examples/v2_deployment-gates_UpdateDeploymentRule.rs
@@ -0,0 +1,43 @@
+// Update deployment rule returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_deployment_gates::DeploymentGatesAPI;
+use datadog_api_client::datadogV2::model::DeploymentRuleDataType;
+use datadog_api_client::datadogV2::model::DeploymentRuleOptionsFaultyDeploymentDetection;
+use datadog_api_client::datadogV2::model::DeploymentRulesOptions;
+use datadog_api_client::datadogV2::model::UpdateDeploymentRuleParams;
+use datadog_api_client::datadogV2::model::UpdateDeploymentRuleParamsData;
+use datadog_api_client::datadogV2::model::UpdateDeploymentRuleParamsDataAttributes;
+
+#[tokio::main]
+async fn main() {
+ // there is a valid "deployment_gate" in the system
+ let deployment_gate_data_id = std::env::var("DEPLOYMENT_GATE_DATA_ID").unwrap();
+
+ // there is a valid "deployment_rule" in the system
+ let deployment_rule_data_id = std::env::var("DEPLOYMENT_RULE_DATA_ID").unwrap();
+ let body = UpdateDeploymentRuleParams::new(UpdateDeploymentRuleParamsData::new(
+ UpdateDeploymentRuleParamsDataAttributes::new(
+ false,
+ "Updated deployment rule".to_string(),
+ DeploymentRulesOptions::DeploymentRuleOptionsFaultyDeploymentDetection(Box::new(
+ DeploymentRuleOptionsFaultyDeploymentDetection::new().excluded_resources(vec![]),
+ )),
+ ),
+ DeploymentRuleDataType::DEPLOYMENT_RULE,
+ ));
+ let mut configuration = datadog::Configuration::new();
+ configuration.set_unstable_operation_enabled("v2.UpdateDeploymentRule", true);
+ let api = DeploymentGatesAPI::with_config(configuration);
+ let resp = api
+ .update_deployment_rule(
+ deployment_gate_data_id.clone(),
+ deployment_rule_data_id.clone(),
+ body,
+ )
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs
index 0de39ef54..83d833ce8 100644
--- a/src/datadog/configuration.rs
+++ b/src/datadog/configuration.rs
@@ -166,6 +166,14 @@ impl Default for Configuration {
("v2.cancel_data_deletion_request".to_owned(), false),
("v2.create_data_deletion_request".to_owned(), false),
("v2.get_data_deletion_requests".to_owned(), false),
+ ("v2.create_deployment_gate".to_owned(), false),
+ ("v2.create_deployment_rule".to_owned(), false),
+ ("v2.delete_deployment_gate".to_owned(), false),
+ ("v2.delete_deployment_rule".to_owned(), false),
+ ("v2.get_deployment_gate".to_owned(), false),
+ ("v2.get_deployment_rule".to_owned(), false),
+ ("v2.update_deployment_gate".to_owned(), false),
+ ("v2.update_deployment_rule".to_owned(), false),
("v2.create_incident".to_owned(), false),
("v2.create_incident_impact".to_owned(), false),
("v2.create_incident_integration".to_owned(), false),
diff --git a/src/datadogV2/api/api_deployment_gates.rs b/src/datadogV2/api/api_deployment_gates.rs
new file mode 100644
index 000000000..bb6810ef0
--- /dev/null
+++ b/src/datadogV2/api/api_deployment_gates.rs
@@ -0,0 +1,1265 @@
+// 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.
+use crate::datadog;
+use flate2::{
+ write::{GzEncoder, ZlibEncoder},
+ Compression,
+};
+use log::warn;
+use reqwest::header::{HeaderMap, HeaderValue};
+use serde::{Deserialize, Serialize};
+use std::io::Write;
+
+/// CreateDeploymentGateError is a struct for typed errors of method [`DeploymentGatesAPI::create_deployment_gate`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum CreateDeploymentGateError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// CreateDeploymentRuleError is a struct for typed errors of method [`DeploymentGatesAPI::create_deployment_rule`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum CreateDeploymentRuleError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// DeleteDeploymentGateError is a struct for typed errors of method [`DeploymentGatesAPI::delete_deployment_gate`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum DeleteDeploymentGateError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCDGatesNotFoundResponse(crate::datadogV2::model::HTTPCDGatesNotFoundResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// DeleteDeploymentRuleError is a struct for typed errors of method [`DeploymentGatesAPI::delete_deployment_rule`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum DeleteDeploymentRuleError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCDGatesNotFoundResponse(crate::datadogV2::model::HTTPCDGatesNotFoundResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// GetDeploymentGateError is a struct for typed errors of method [`DeploymentGatesAPI::get_deployment_gate`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum GetDeploymentGateError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCDGatesNotFoundResponse(crate::datadogV2::model::HTTPCDGatesNotFoundResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// GetDeploymentRuleError is a struct for typed errors of method [`DeploymentGatesAPI::get_deployment_rule`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum GetDeploymentRuleError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCDRulesNotFoundResponse(crate::datadogV2::model::HTTPCDRulesNotFoundResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// UpdateDeploymentGateError is a struct for typed errors of method [`DeploymentGatesAPI::update_deployment_gate`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum UpdateDeploymentGateError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCDGatesNotFoundResponse(crate::datadogV2::model::HTTPCDGatesNotFoundResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// UpdateDeploymentRuleError is a struct for typed errors of method [`DeploymentGatesAPI::update_deployment_rule`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum UpdateDeploymentRuleError {
+ HTTPCDGatesBadRequestResponse(crate::datadogV2::model::HTTPCDGatesBadRequestResponse),
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ HTTPCDRulesNotFoundResponse(crate::datadogV2::model::HTTPCDRulesNotFoundResponse),
+ HTTPCIAppErrors(crate::datadogV2::model::HTTPCIAppErrors),
+ UnknownValue(serde_json::Value),
+}
+
+/// 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.
+#[derive(Debug, Clone)]
+pub struct DeploymentGatesAPI {
+ config: datadog::Configuration,
+ client: reqwest_middleware::ClientWithMiddleware,
+}
+
+impl Default for DeploymentGatesAPI {
+ fn default() -> Self {
+ Self::with_config(datadog::Configuration::default())
+ }
+}
+
+impl DeploymentGatesAPI {
+ pub fn new() -> Self {
+ Self::default()
+ }
+ pub fn with_config(config: datadog::Configuration) -> Self {
+ let mut reqwest_client_builder = reqwest::Client::builder();
+
+ if let Some(proxy_url) = &config.proxy_url {
+ let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL");
+ reqwest_client_builder = reqwest_client_builder.proxy(proxy);
+ }
+
+ let mut middleware_client_builder =
+ reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap());
+
+ if config.enable_retry {
+ struct RetryableStatus;
+ impl reqwest_retry::RetryableStrategy for RetryableStatus {
+ fn handle(
+ &self,
+ res: &Result,
+ ) -> Option {
+ match res {
+ Ok(success) => reqwest_retry::default_on_request_success(success),
+ Err(_) => None,
+ }
+ }
+ }
+ let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder()
+ .build_with_max_retries(config.max_retries);
+
+ let retry_middleware =
+ reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy(
+ backoff_policy,
+ RetryableStatus,
+ );
+
+ middleware_client_builder = middleware_client_builder.with(retry_middleware);
+ }
+
+ let client = middleware_client_builder.build();
+
+ Self { config, client }
+ }
+
+ pub fn with_client_and_config(
+ config: datadog::Configuration,
+ client: reqwest_middleware::ClientWithMiddleware,
+ ) -> Self {
+ Self { config, client }
+ }
+
+ /// Endpoint to create a deployment gate.
+ pub async fn create_deployment_gate(
+ &self,
+ body: crate::datadogV2::model::CreateDeploymentGateParams,
+ ) -> Result<
+ crate::datadogV2::model::DeploymentGateResponse,
+ datadog::Error,
+ > {
+ match self.create_deployment_gate_with_http_info(body).await {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to create a deployment gate.
+ pub async fn create_deployment_gate_with_http_info(
+ &self,
+ body: crate::datadogV2::model::CreateDeploymentGateParams,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.create_deployment_gate";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.create_deployment_gate' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates",
+ local_configuration.get_operation_host(operation_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::POST, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Content-Type", HeaderValue::from_static("application/json"));
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ // build body parameters
+ let output = Vec::new();
+ let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
+ if body.serialize(&mut ser).is_ok() {
+ if let Some(content_encoding) = headers.get("Content-Encoding") {
+ match content_encoding.to_str().unwrap_or_default() {
+ "gzip" => {
+ let mut enc = GzEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "deflate" => {
+ let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "zstd1" => {
+ let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ _ => {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+ } else {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to create a deployment rule. A gate for the rule must already exist.
+ pub async fn create_deployment_rule(
+ &self,
+ gate_id: String,
+ body: crate::datadogV2::model::CreateDeploymentRuleParams,
+ ) -> Result<
+ crate::datadogV2::model::DeploymentRuleResponse,
+ datadog::Error,
+ > {
+ match self
+ .create_deployment_rule_with_http_info(gate_id, body)
+ .await
+ {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to create a deployment rule. A gate for the rule must already exist.
+ pub async fn create_deployment_rule_with_http_info(
+ &self,
+ gate_id: String,
+ body: crate::datadogV2::model::CreateDeploymentRuleParams,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.create_deployment_rule";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.create_deployment_rule' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{gate_id}/rules",
+ local_configuration.get_operation_host(operation_id),
+ gate_id = datadog::urlencode(gate_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::POST, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Content-Type", HeaderValue::from_static("application/json"));
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ // build body parameters
+ let output = Vec::new();
+ let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
+ if body.serialize(&mut ser).is_ok() {
+ if let Some(content_encoding) = headers.get("Content-Encoding") {
+ match content_encoding.to_str().unwrap_or_default() {
+ "gzip" => {
+ let mut enc = GzEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "deflate" => {
+ let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "zstd1" => {
+ let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ _ => {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+ } else {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to delete a deployment gate. Rules associated with the gate are also deleted.
+ pub async fn delete_deployment_gate(
+ &self,
+ id: String,
+ ) -> Result<(), datadog::Error> {
+ match self.delete_deployment_gate_with_http_info(id).await {
+ Ok(_) => Ok(()),
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to delete a deployment gate. Rules associated with the gate are also deleted.
+ pub async fn delete_deployment_gate_with_http_info(
+ &self,
+ id: String,
+ ) -> Result, datadog::Error> {
+ let local_configuration = &self.config;
+ let operation_id = "v2.delete_deployment_gate";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.delete_deployment_gate' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{id}",
+ local_configuration.get_operation_host(operation_id),
+ id = datadog::urlencode(id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("*/*"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: None,
+ })
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to delete a deployment rule.
+ pub async fn delete_deployment_rule(
+ &self,
+ gate_id: String,
+ id: String,
+ ) -> Result<(), datadog::Error> {
+ match self
+ .delete_deployment_rule_with_http_info(gate_id, id)
+ .await
+ {
+ Ok(_) => Ok(()),
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to delete a deployment rule.
+ pub async fn delete_deployment_rule_with_http_info(
+ &self,
+ gate_id: String,
+ id: String,
+ ) -> Result, datadog::Error> {
+ let local_configuration = &self.config;
+ let operation_id = "v2.delete_deployment_rule";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.delete_deployment_rule' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{gate_id}/rules/{id}",
+ local_configuration.get_operation_host(operation_id),
+ gate_id = datadog::urlencode(gate_id),
+ id = datadog::urlencode(id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("*/*"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: None,
+ })
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to get a deployment gate.
+ pub async fn get_deployment_gate(
+ &self,
+ id: String,
+ ) -> Result<
+ crate::datadogV2::model::DeploymentGateResponse,
+ datadog::Error,
+ > {
+ match self.get_deployment_gate_with_http_info(id).await {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to get a deployment gate.
+ pub async fn get_deployment_gate_with_http_info(
+ &self,
+ id: String,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.get_deployment_gate";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.get_deployment_gate' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{id}",
+ local_configuration.get_operation_host(operation_id),
+ id = datadog::urlencode(id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::GET, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to get a deployment rule.
+ pub async fn get_deployment_rule(
+ &self,
+ gate_id: String,
+ id: String,
+ ) -> Result<
+ crate::datadogV2::model::DeploymentRuleResponse,
+ datadog::Error,
+ > {
+ match self.get_deployment_rule_with_http_info(gate_id, id).await {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to get a deployment rule.
+ pub async fn get_deployment_rule_with_http_info(
+ &self,
+ gate_id: String,
+ id: String,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.get_deployment_rule";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.get_deployment_rule' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{gate_id}/rules/{id}",
+ local_configuration.get_operation_host(operation_id),
+ gate_id = datadog::urlencode(gate_id),
+ id = datadog::urlencode(id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::GET, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to update a deployment gate.
+ pub async fn update_deployment_gate(
+ &self,
+ id: String,
+ body: crate::datadogV2::model::UpdateDeploymentGateParams,
+ ) -> Result<
+ crate::datadogV2::model::DeploymentGateResponse,
+ datadog::Error,
+ > {
+ match self.update_deployment_gate_with_http_info(id, body).await {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to update a deployment gate.
+ pub async fn update_deployment_gate_with_http_info(
+ &self,
+ id: String,
+ body: crate::datadogV2::model::UpdateDeploymentGateParams,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.update_deployment_gate";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.update_deployment_gate' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{id}",
+ local_configuration.get_operation_host(operation_id),
+ id = datadog::urlencode(id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::PUT, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Content-Type", HeaderValue::from_static("application/json"));
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ // build body parameters
+ let output = Vec::new();
+ let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
+ if body.serialize(&mut ser).is_ok() {
+ if let Some(content_encoding) = headers.get("Content-Encoding") {
+ match content_encoding.to_str().unwrap_or_default() {
+ "gzip" => {
+ let mut enc = GzEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "deflate" => {
+ let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "zstd1" => {
+ let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ _ => {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+ } else {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+
+ /// Endpoint to update a deployment rule.
+ pub async fn update_deployment_rule(
+ &self,
+ gate_id: String,
+ id: String,
+ body: crate::datadogV2::model::UpdateDeploymentRuleParams,
+ ) -> Result<
+ crate::datadogV2::model::DeploymentRuleResponse,
+ datadog::Error,
+ > {
+ match self
+ .update_deployment_rule_with_http_info(gate_id, id, body)
+ .await
+ {
+ Ok(response_content) => {
+ if let Some(e) = response_content.entity {
+ Ok(e)
+ } else {
+ Err(datadog::Error::Serde(serde::de::Error::custom(
+ "response content was None",
+ )))
+ }
+ }
+ Err(err) => Err(err),
+ }
+ }
+
+ /// Endpoint to update a deployment rule.
+ pub async fn update_deployment_rule_with_http_info(
+ &self,
+ gate_id: String,
+ id: String,
+ body: crate::datadogV2::model::UpdateDeploymentRuleParams,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.update_deployment_rule";
+ if local_configuration.is_unstable_operation_enabled(operation_id) {
+ warn!("Using unstable operation {operation_id}");
+ } else {
+ let local_error = datadog::UnstableOperationDisabledError {
+ msg: "Operation 'v2.update_deployment_rule' is not enabled".to_string(),
+ };
+ return Err(datadog::Error::UnstableOperationDisabledError(local_error));
+ }
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/deployment_gates/{gate_id}/rules/{id}",
+ local_configuration.get_operation_host(operation_id),
+ gate_id = datadog::urlencode(gate_id),
+ id = datadog::urlencode(id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::PUT, local_uri_str.as_str());
+
+ // build headers
+ let mut headers = HeaderMap::new();
+ headers.insert("Content-Type", HeaderValue::from_static("application/json"));
+ headers.insert("Accept", HeaderValue::from_static("application/json"));
+
+ // build user agent
+ match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
+ Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
+ Err(e) => {
+ log::warn!("Failed to parse user agent header: {e}, falling back to default");
+ headers.insert(
+ reqwest::header::USER_AGENT,
+ HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
+ )
+ }
+ };
+
+ // build auth
+ if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
+ headers.insert(
+ "DD-API-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-API-KEY header"),
+ );
+ };
+ if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
+ headers.insert(
+ "DD-APPLICATION-KEY",
+ HeaderValue::from_str(local_key.key.as_str())
+ .expect("failed to parse DD-APPLICATION-KEY header"),
+ );
+ };
+
+ // build body parameters
+ let output = Vec::new();
+ let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
+ if body.serialize(&mut ser).is_ok() {
+ if let Some(content_encoding) = headers.get("Content-Encoding") {
+ match content_encoding.to_str().unwrap_or_default() {
+ "gzip" => {
+ let mut enc = GzEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "deflate" => {
+ let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ "zstd1" => {
+ let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
+ let _ = enc.write_all(ser.into_inner().as_slice());
+ match enc.finish() {
+ Ok(buf) => {
+ local_req_builder = local_req_builder.body(buf);
+ }
+ Err(e) => return Err(datadog::Error::Io(e)),
+ }
+ }
+ _ => {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+ } else {
+ local_req_builder = local_req_builder.body(ser.into_inner());
+ }
+ }
+
+ local_req_builder = local_req_builder.headers(headers);
+ let local_req = local_req_builder.build()?;
+ log::debug!("request content: {:?}", local_req.body());
+ let local_resp = local_client.execute(local_req).await?;
+
+ let local_status = local_resp.status();
+ let local_content = local_resp.text().await?;
+ log::debug!("response content: {}", local_content);
+
+ if !local_status.is_client_error() && !local_status.is_server_error() {
+ match serde_json::from_str::(
+ &local_content,
+ ) {
+ Ok(e) => {
+ return Ok(datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: Some(e),
+ })
+ }
+ Err(e) => return Err(datadog::Error::Serde(e)),
+ };
+ } else {
+ let local_entity: Option =
+ serde_json::from_str(&local_content).ok();
+ let local_error = datadog::ResponseContent {
+ status: local_status,
+ content: local_content,
+ entity: local_entity,
+ };
+ Err(datadog::Error::ResponseError(local_error))
+ }
+ }
+}
diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs
index 4675e95e7..68998149b 100644
--- a/src/datadogV2/api/mod.rs
+++ b/src/datadogV2/api/mod.rs
@@ -30,6 +30,7 @@ pub mod api_csm_threats;
pub mod api_dashboard_lists;
pub mod api_data_deletion;
pub mod api_datasets;
+pub mod api_deployment_gates;
pub mod api_domain_allowlist;
pub mod api_dora_metrics;
pub mod api_downtimes;
diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs
index 17059324e..2ecac8a35 100644
--- a/src/datadogV2/mod.rs
+++ b/src/datadogV2/mod.rs
@@ -31,6 +31,7 @@ pub use self::api::api_csm_threats;
pub use self::api::api_dashboard_lists;
pub use self::api::api_data_deletion;
pub use self::api::api_datasets;
+pub use self::api::api_deployment_gates;
pub use self::api::api_domain_allowlist;
pub use self::api::api_dora_metrics;
pub use self::api::api_downtimes;
diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs
index 0a29a3b35..0bdae5157 100644
--- a/src/datadogV2/model/mod.rs
+++ b/src/datadogV2/model/mod.rs
@@ -2068,6 +2068,68 @@ pub mod model_get_data_deletions_response_body;
pub use self::model_get_data_deletions_response_body::GetDataDeletionsResponseBody;
pub mod model_cancel_data_deletion_response_body;
pub use self::model_cancel_data_deletion_response_body::CancelDataDeletionResponseBody;
+pub mod model_create_deployment_gate_params;
+pub use self::model_create_deployment_gate_params::CreateDeploymentGateParams;
+pub mod model_create_deployment_gate_params_data;
+pub use self::model_create_deployment_gate_params_data::CreateDeploymentGateParamsData;
+pub mod model_create_deployment_gate_params_data_attributes;
+pub use self::model_create_deployment_gate_params_data_attributes::CreateDeploymentGateParamsDataAttributes;
+pub mod model_deployment_gate_data_type;
+pub use self::model_deployment_gate_data_type::DeploymentGateDataType;
+pub mod model_deployment_gate_response;
+pub use self::model_deployment_gate_response::DeploymentGateResponse;
+pub mod model_deployment_gate_response_data;
+pub use self::model_deployment_gate_response_data::DeploymentGateResponseData;
+pub mod model_deployment_gate_response_data_attributes;
+pub use self::model_deployment_gate_response_data_attributes::DeploymentGateResponseDataAttributes;
+pub mod model_deployment_gate_response_data_attributes_created_by;
+pub use self::model_deployment_gate_response_data_attributes_created_by::DeploymentGateResponseDataAttributesCreatedBy;
+pub mod model_deployment_gate_response_data_attributes_updated_by;
+pub use self::model_deployment_gate_response_data_attributes_updated_by::DeploymentGateResponseDataAttributesUpdatedBy;
+pub mod model_httpcd_gates_bad_request_response;
+pub use self::model_httpcd_gates_bad_request_response::HTTPCDGatesBadRequestResponse;
+pub mod model_create_deployment_rule_params;
+pub use self::model_create_deployment_rule_params::CreateDeploymentRuleParams;
+pub mod model_create_deployment_rule_params_data;
+pub use self::model_create_deployment_rule_params_data::CreateDeploymentRuleParamsData;
+pub mod model_create_deployment_rule_params_data_attributes;
+pub use self::model_create_deployment_rule_params_data_attributes::CreateDeploymentRuleParamsDataAttributes;
+pub mod model_deployment_rule_options_faulty_deployment_detection;
+pub use self::model_deployment_rule_options_faulty_deployment_detection::DeploymentRuleOptionsFaultyDeploymentDetection;
+pub mod model_deployment_rule_options_monitor;
+pub use self::model_deployment_rule_options_monitor::DeploymentRuleOptionsMonitor;
+pub mod model_deployment_rules_options;
+pub use self::model_deployment_rules_options::DeploymentRulesOptions;
+pub mod model_deployment_rule_data_type;
+pub use self::model_deployment_rule_data_type::DeploymentRuleDataType;
+pub mod model_deployment_rule_response;
+pub use self::model_deployment_rule_response::DeploymentRuleResponse;
+pub mod model_deployment_rule_response_data;
+pub use self::model_deployment_rule_response_data::DeploymentRuleResponseData;
+pub mod model_deployment_rule_response_data_attributes;
+pub use self::model_deployment_rule_response_data_attributes::DeploymentRuleResponseDataAttributes;
+pub mod model_deployment_rule_response_data_attributes_created_by;
+pub use self::model_deployment_rule_response_data_attributes_created_by::DeploymentRuleResponseDataAttributesCreatedBy;
+pub mod model_deployment_rule_response_data_attributes_type;
+pub use self::model_deployment_rule_response_data_attributes_type::DeploymentRuleResponseDataAttributesType;
+pub mod model_deployment_rule_response_data_attributes_updated_by;
+pub use self::model_deployment_rule_response_data_attributes_updated_by::DeploymentRuleResponseDataAttributesUpdatedBy;
+pub mod model_httpcd_gates_not_found_response;
+pub use self::model_httpcd_gates_not_found_response::HTTPCDGatesNotFoundResponse;
+pub mod model_httpcd_rules_not_found_response;
+pub use self::model_httpcd_rules_not_found_response::HTTPCDRulesNotFoundResponse;
+pub mod model_update_deployment_rule_params;
+pub use self::model_update_deployment_rule_params::UpdateDeploymentRuleParams;
+pub mod model_update_deployment_rule_params_data;
+pub use self::model_update_deployment_rule_params_data::UpdateDeploymentRuleParamsData;
+pub mod model_update_deployment_rule_params_data_attributes;
+pub use self::model_update_deployment_rule_params_data_attributes::UpdateDeploymentRuleParamsDataAttributes;
+pub mod model_update_deployment_gate_params;
+pub use self::model_update_deployment_gate_params::UpdateDeploymentGateParams;
+pub mod model_update_deployment_gate_params_data;
+pub use self::model_update_deployment_gate_params_data::UpdateDeploymentGateParamsData;
+pub mod model_update_deployment_gate_params_data_attributes;
+pub use self::model_update_deployment_gate_params_data_attributes::UpdateDeploymentGateParamsDataAttributes;
pub mod model_domain_allowlist_response;
pub use self::model_domain_allowlist_response::DomainAllowlistResponse;
pub mod model_domain_allowlist_response_data;
diff --git a/src/datadogV2/model/model_create_deployment_gate_params.rs b/src/datadogV2/model/model_create_deployment_gate_params.rs
new file mode 100644
index 000000000..66420a6b5
--- /dev/null
+++ b/src/datadogV2/model/model_create_deployment_gate_params.rs
@@ -0,0 +1,95 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Parameters for creating a deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct CreateDeploymentGateParams {
+ /// Parameters for creating a deployment gate.
+ #[serde(rename = "data")]
+ pub data: crate::datadogV2::model::CreateDeploymentGateParamsData,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl CreateDeploymentGateParams {
+ pub fn new(
+ data: crate::datadogV2::model::CreateDeploymentGateParamsData,
+ ) -> CreateDeploymentGateParams {
+ CreateDeploymentGateParams {
+ data,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for CreateDeploymentGateParams {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct CreateDeploymentGateParamsVisitor;
+ impl<'a> Visitor<'a> for CreateDeploymentGateParamsVisitor {
+ type Value = CreateDeploymentGateParams;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let data = data.ok_or_else(|| M::Error::missing_field("data"))?;
+
+ let content = CreateDeploymentGateParams {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(CreateDeploymentGateParamsVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_create_deployment_gate_params_data.rs b/src/datadogV2/model/model_create_deployment_gate_params_data.rs
new file mode 100644
index 000000000..936da44ee
--- /dev/null
+++ b/src/datadogV2/model/model_create_deployment_gate_params_data.rs
@@ -0,0 +1,115 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Parameters for creating a deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct CreateDeploymentGateParamsData {
+ /// Parameters for creating a deployment gate.
+ #[serde(rename = "attributes")]
+ pub attributes: crate::datadogV2::model::CreateDeploymentGateParamsDataAttributes,
+ /// Deployment gate resource type.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::DeploymentGateDataType,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl CreateDeploymentGateParamsData {
+ pub fn new(
+ attributes: crate::datadogV2::model::CreateDeploymentGateParamsDataAttributes,
+ type_: crate::datadogV2::model::DeploymentGateDataType,
+ ) -> CreateDeploymentGateParamsData {
+ CreateDeploymentGateParamsData {
+ attributes,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for CreateDeploymentGateParamsData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct CreateDeploymentGateParamsDataVisitor;
+ impl<'a> Visitor<'a> for CreateDeploymentGateParamsDataVisitor {
+ type Value = CreateDeploymentGateParamsData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::CreateDeploymentGateParamsDataAttributes,
+ > = None;
+ let mut type_: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::DeploymentGateDataType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = CreateDeploymentGateParamsData {
+ attributes,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(CreateDeploymentGateParamsDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_create_deployment_gate_params_data_attributes.rs b/src/datadogV2/model/model_create_deployment_gate_params_data_attributes.rs
new file mode 100644
index 000000000..b929195f3
--- /dev/null
+++ b/src/datadogV2/model/model_create_deployment_gate_params_data_attributes.rs
@@ -0,0 +1,136 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Parameters for creating a deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct CreateDeploymentGateParamsDataAttributes {
+ /// Whether this gate is run in dry-run mode.
+ #[serde(rename = "dry_run")]
+ pub dry_run: Option,
+ /// The environment of the deployment gate.
+ #[serde(rename = "env")]
+ pub env: String,
+ /// The identifier of the deployment gate.
+ #[serde(rename = "identifier")]
+ pub identifier: Option,
+ /// The service of the deployment gate.
+ #[serde(rename = "service")]
+ pub service: String,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl CreateDeploymentGateParamsDataAttributes {
+ pub fn new(env: String, service: String) -> CreateDeploymentGateParamsDataAttributes {
+ CreateDeploymentGateParamsDataAttributes {
+ dry_run: None,
+ env,
+ identifier: None,
+ service,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn dry_run(mut self, value: bool) -> Self {
+ self.dry_run = Some(value);
+ self
+ }
+
+ pub fn identifier(mut self, value: String) -> Self {
+ self.identifier = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for CreateDeploymentGateParamsDataAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct CreateDeploymentGateParamsDataAttributesVisitor;
+ impl<'a> Visitor<'a> for CreateDeploymentGateParamsDataAttributesVisitor {
+ type Value = CreateDeploymentGateParamsDataAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut dry_run: Option = None;
+ let mut env: Option = None;
+ let mut identifier: Option = None;
+ let mut service: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "dry_run" => {
+ if v.is_null() {
+ continue;
+ }
+ dry_run = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "env" => {
+ env = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "identifier" => {
+ if v.is_null() {
+ continue;
+ }
+ identifier = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "service" => {
+ service = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let env = env.ok_or_else(|| M::Error::missing_field("env"))?;
+ let service = service.ok_or_else(|| M::Error::missing_field("service"))?;
+
+ let content = CreateDeploymentGateParamsDataAttributes {
+ dry_run,
+ env,
+ identifier,
+ service,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(CreateDeploymentGateParamsDataAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_create_deployment_rule_params.rs b/src/datadogV2/model/model_create_deployment_rule_params.rs
new file mode 100644
index 000000000..47b4c7758
--- /dev/null
+++ b/src/datadogV2/model/model_create_deployment_rule_params.rs
@@ -0,0 +1,106 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Parameters for creating a deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct CreateDeploymentRuleParams {
+ /// Parameters for creating a deployment rule.
+ #[serde(rename = "data")]
+ pub data: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl CreateDeploymentRuleParams {
+ pub fn new() -> CreateDeploymentRuleParams {
+ CreateDeploymentRuleParams {
+ data: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn data(mut self, value: crate::datadogV2::model::CreateDeploymentRuleParamsData) -> Self {
+ self.data = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for CreateDeploymentRuleParams {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for CreateDeploymentRuleParams {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct CreateDeploymentRuleParamsVisitor;
+ impl<'a> Visitor<'a> for CreateDeploymentRuleParamsVisitor {
+ type Value = CreateDeploymentRuleParams;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option =
+ None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ if v.is_null() {
+ continue;
+ }
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = CreateDeploymentRuleParams {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(CreateDeploymentRuleParamsVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_create_deployment_rule_params_data.rs b/src/datadogV2/model/model_create_deployment_rule_params_data.rs
new file mode 100644
index 000000000..ec3d933dd
--- /dev/null
+++ b/src/datadogV2/model/model_create_deployment_rule_params_data.rs
@@ -0,0 +1,115 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Parameters for creating a deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct CreateDeploymentRuleParamsData {
+ /// Parameters for creating a deployment rule.
+ #[serde(rename = "attributes")]
+ pub attributes: crate::datadogV2::model::CreateDeploymentRuleParamsDataAttributes,
+ /// Deployment rule resource type.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::DeploymentRuleDataType,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl CreateDeploymentRuleParamsData {
+ pub fn new(
+ attributes: crate::datadogV2::model::CreateDeploymentRuleParamsDataAttributes,
+ type_: crate::datadogV2::model::DeploymentRuleDataType,
+ ) -> CreateDeploymentRuleParamsData {
+ CreateDeploymentRuleParamsData {
+ attributes,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for CreateDeploymentRuleParamsData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct CreateDeploymentRuleParamsDataVisitor;
+ impl<'a> Visitor<'a> for CreateDeploymentRuleParamsDataVisitor {
+ type Value = CreateDeploymentRuleParamsData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::CreateDeploymentRuleParamsDataAttributes,
+ > = None;
+ let mut type_: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::DeploymentRuleDataType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = CreateDeploymentRuleParamsData {
+ attributes,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(CreateDeploymentRuleParamsDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_create_deployment_rule_params_data_attributes.rs b/src/datadogV2/model/model_create_deployment_rule_params_data_attributes.rs
new file mode 100644
index 000000000..35d244004
--- /dev/null
+++ b/src/datadogV2/model/model_create_deployment_rule_params_data_attributes.rs
@@ -0,0 +1,141 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Parameters for creating a deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct CreateDeploymentRuleParamsDataAttributes {
+ /// Whether this rule is run in dry-run mode.
+ #[serde(rename = "dry_run")]
+ pub dry_run: Option,
+ /// The name of the deployment rule.
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Options for deployment rule response representing either faulty deployment detection or monitor options.
+ #[serde(rename = "options")]
+ pub options: crate::datadogV2::model::DeploymentRulesOptions,
+ /// The type of the deployment rule (faulty_deployment_detection or monitor).
+ #[serde(rename = "type")]
+ pub type_: String,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl CreateDeploymentRuleParamsDataAttributes {
+ pub fn new(
+ name: String,
+ options: crate::datadogV2::model::DeploymentRulesOptions,
+ type_: String,
+ ) -> CreateDeploymentRuleParamsDataAttributes {
+ CreateDeploymentRuleParamsDataAttributes {
+ dry_run: None,
+ name,
+ options,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn dry_run(mut self, value: bool) -> Self {
+ self.dry_run = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for CreateDeploymentRuleParamsDataAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct CreateDeploymentRuleParamsDataAttributesVisitor;
+ impl<'a> Visitor<'a> for CreateDeploymentRuleParamsDataAttributesVisitor {
+ type Value = CreateDeploymentRuleParamsDataAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut dry_run: Option = None;
+ let mut name: Option = None;
+ let mut options: Option = None;
+ let mut type_: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "dry_run" => {
+ if v.is_null() {
+ continue;
+ }
+ dry_run = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "options" => {
+ options = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _options) = options {
+ match _options {
+ crate::datadogV2::model::DeploymentRulesOptions::UnparsedObject(_options) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let name = name.ok_or_else(|| M::Error::missing_field("name"))?;
+ let options = options.ok_or_else(|| M::Error::missing_field("options"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = CreateDeploymentRuleParamsDataAttributes {
+ dry_run,
+ name,
+ options,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(CreateDeploymentRuleParamsDataAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_gate_data_type.rs b/src/datadogV2/model/model_deployment_gate_data_type.rs
new file mode 100644
index 000000000..638d775ae
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_gate_data_type.rs
@@ -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.
+
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
+
+#[non_exhaustive]
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum DeploymentGateDataType {
+ DEPLOYMENT_GATE,
+ UnparsedObject(crate::datadog::UnparsedObject),
+}
+
+impl ToString for DeploymentGateDataType {
+ fn to_string(&self) -> String {
+ match self {
+ Self::DEPLOYMENT_GATE => String::from("deployment_gate"),
+ Self::UnparsedObject(v) => v.value.to_string(),
+ }
+ }
+}
+
+impl Serialize for DeploymentGateDataType {
+ fn serialize(&self, serializer: S) -> Result
+ where
+ S: Serializer,
+ {
+ match self {
+ Self::UnparsedObject(v) => v.serialize(serializer),
+ _ => serializer.serialize_str(self.to_string().as_str()),
+ }
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentGateDataType {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ let s: String = String::deserialize(deserializer)?;
+ Ok(match s.as_str() {
+ "deployment_gate" => Self::DEPLOYMENT_GATE,
+ _ => Self::UnparsedObject(crate::datadog::UnparsedObject {
+ value: serde_json::Value::String(s.into()),
+ }),
+ })
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_gate_response.rs b/src/datadogV2/model/model_deployment_gate_response.rs
new file mode 100644
index 000000000..ad5909926
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_gate_response.rs
@@ -0,0 +1,105 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Response for a deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentGateResponse {
+ /// Data for a deployment gate.
+ #[serde(rename = "data")]
+ pub data: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentGateResponse {
+ pub fn new() -> DeploymentGateResponse {
+ DeploymentGateResponse {
+ data: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn data(mut self, value: crate::datadogV2::model::DeploymentGateResponseData) -> Self {
+ self.data = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for DeploymentGateResponse {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentGateResponse {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentGateResponseVisitor;
+ impl<'a> Visitor<'a> for DeploymentGateResponseVisitor {
+ type Value = DeploymentGateResponse;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ if v.is_null() {
+ continue;
+ }
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = DeploymentGateResponse {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentGateResponseVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_gate_response_data.rs b/src/datadogV2/model/model_deployment_gate_response_data.rs
new file mode 100644
index 000000000..318163831
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_gate_response_data.rs
@@ -0,0 +1,126 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Data for a deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentGateResponseData {
+ /// Basic information about a deployment gate.
+ #[serde(rename = "attributes")]
+ pub attributes: crate::datadogV2::model::DeploymentGateResponseDataAttributes,
+ /// Unique identifier of the deployment gate.
+ #[serde(rename = "id")]
+ pub id: String,
+ /// Deployment gate resource type.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::DeploymentGateDataType,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentGateResponseData {
+ pub fn new(
+ attributes: crate::datadogV2::model::DeploymentGateResponseDataAttributes,
+ id: String,
+ type_: crate::datadogV2::model::DeploymentGateDataType,
+ ) -> DeploymentGateResponseData {
+ DeploymentGateResponseData {
+ attributes,
+ id,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentGateResponseData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentGateResponseDataVisitor;
+ impl<'a> Visitor<'a> for DeploymentGateResponseDataVisitor {
+ type Value = DeploymentGateResponseData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::DeploymentGateResponseDataAttributes,
+ > = None;
+ let mut id: Option = None;
+ let mut type_: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::DeploymentGateDataType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?;
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = DeploymentGateResponseData {
+ attributes,
+ id,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentGateResponseDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_gate_response_data_attributes.rs b/src/datadogV2/model/model_deployment_gate_response_data_attributes.rs
new file mode 100644
index 000000000..85562c891
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_gate_response_data_attributes.rs
@@ -0,0 +1,190 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Basic information about a deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentGateResponseDataAttributes {
+ /// The timestamp when the deployment gate was created.
+ #[serde(rename = "created_at")]
+ pub created_at: chrono::DateTime,
+ /// Information about the user who created the deployment gate.
+ #[serde(rename = "created_by")]
+ pub created_by: crate::datadogV2::model::DeploymentGateResponseDataAttributesCreatedBy,
+ /// Whether this gate is run in dry-run mode.
+ #[serde(rename = "dry_run")]
+ pub dry_run: bool,
+ /// The environment of the deployment gate.
+ #[serde(rename = "env")]
+ pub env: String,
+ /// The identifier of the deployment gate.
+ #[serde(rename = "identifier")]
+ pub identifier: String,
+ /// The service of the deployment gate.
+ #[serde(rename = "service")]
+ pub service: String,
+ /// The timestamp when the deployment gate was last updated.
+ #[serde(rename = "updated_at")]
+ pub updated_at: Option>,
+ /// Information about the user who updated the deployment gate.
+ #[serde(rename = "updated_by")]
+ pub updated_by: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentGateResponseDataAttributes {
+ pub fn new(
+ created_at: chrono::DateTime,
+ created_by: crate::datadogV2::model::DeploymentGateResponseDataAttributesCreatedBy,
+ dry_run: bool,
+ env: String,
+ identifier: String,
+ service: String,
+ ) -> DeploymentGateResponseDataAttributes {
+ DeploymentGateResponseDataAttributes {
+ created_at,
+ created_by,
+ dry_run,
+ env,
+ identifier,
+ service,
+ updated_at: None,
+ updated_by: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn updated_at(mut self, value: chrono::DateTime) -> Self {
+ self.updated_at = Some(value);
+ self
+ }
+
+ pub fn updated_by(
+ mut self,
+ value: crate::datadogV2::model::DeploymentGateResponseDataAttributesUpdatedBy,
+ ) -> Self {
+ self.updated_by = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentGateResponseDataAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentGateResponseDataAttributesVisitor;
+ impl<'a> Visitor<'a> for DeploymentGateResponseDataAttributesVisitor {
+ type Value = DeploymentGateResponseDataAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut created_at: Option> = None;
+ let mut created_by: Option<
+ crate::datadogV2::model::DeploymentGateResponseDataAttributesCreatedBy,
+ > = None;
+ let mut dry_run: Option = None;
+ let mut env: Option = None;
+ let mut identifier: Option = None;
+ let mut service: Option = None;
+ let mut updated_at: Option> = None;
+ let mut updated_by: Option<
+ crate::datadogV2::model::DeploymentGateResponseDataAttributesUpdatedBy,
+ > = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "created_at" => {
+ created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "created_by" => {
+ created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "dry_run" => {
+ dry_run = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "env" => {
+ env = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "identifier" => {
+ identifier = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "service" => {
+ service = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "updated_at" => {
+ if v.is_null() {
+ continue;
+ }
+ updated_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "updated_by" => {
+ if v.is_null() {
+ continue;
+ }
+ updated_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?;
+ let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?;
+ let dry_run = dry_run.ok_or_else(|| M::Error::missing_field("dry_run"))?;
+ let env = env.ok_or_else(|| M::Error::missing_field("env"))?;
+ let identifier = identifier.ok_or_else(|| M::Error::missing_field("identifier"))?;
+ let service = service.ok_or_else(|| M::Error::missing_field("service"))?;
+
+ let content = DeploymentGateResponseDataAttributes {
+ created_at,
+ created_by,
+ dry_run,
+ env,
+ identifier,
+ service,
+ updated_at,
+ updated_by,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentGateResponseDataAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_gate_response_data_attributes_created_by.rs b/src/datadogV2/model/model_deployment_gate_response_data_attributes_created_by.rs
new file mode 100644
index 000000000..866ea6324
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_gate_response_data_attributes_created_by.rs
@@ -0,0 +1,126 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Information about the user who created the deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentGateResponseDataAttributesCreatedBy {
+ /// The handle of the user who created the deployment rule.
+ #[serde(rename = "handle")]
+ pub handle: Option,
+ /// The ID of the user who created the deployment rule.
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The name of the user who created the deployment rule.
+ #[serde(rename = "name")]
+ pub name: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentGateResponseDataAttributesCreatedBy {
+ pub fn new(id: String) -> DeploymentGateResponseDataAttributesCreatedBy {
+ DeploymentGateResponseDataAttributesCreatedBy {
+ handle: None,
+ id,
+ name: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn handle(mut self, value: String) -> Self {
+ self.handle = Some(value);
+ self
+ }
+
+ pub fn name(mut self, value: String) -> Self {
+ self.name = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentGateResponseDataAttributesCreatedBy {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentGateResponseDataAttributesCreatedByVisitor;
+ impl<'a> Visitor<'a> for DeploymentGateResponseDataAttributesCreatedByVisitor {
+ type Value = DeploymentGateResponseDataAttributesCreatedBy;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut handle: Option = None;
+ let mut id: Option = None;
+ let mut name: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "handle" => {
+ if v.is_null() {
+ continue;
+ }
+ handle = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ if v.is_null() {
+ continue;
+ }
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+
+ let content = DeploymentGateResponseDataAttributesCreatedBy {
+ handle,
+ id,
+ name,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentGateResponseDataAttributesCreatedByVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_gate_response_data_attributes_updated_by.rs b/src/datadogV2/model/model_deployment_gate_response_data_attributes_updated_by.rs
new file mode 100644
index 000000000..6d99d2596
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_gate_response_data_attributes_updated_by.rs
@@ -0,0 +1,126 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Information about the user who updated the deployment gate.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentGateResponseDataAttributesUpdatedBy {
+ /// The handle of the user who updated the deployment rule.
+ #[serde(rename = "handle")]
+ pub handle: Option,
+ /// The ID of the user who updated the deployment rule.
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The name of the user who updated the deployment rule.
+ #[serde(rename = "name")]
+ pub name: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentGateResponseDataAttributesUpdatedBy {
+ pub fn new(id: String) -> DeploymentGateResponseDataAttributesUpdatedBy {
+ DeploymentGateResponseDataAttributesUpdatedBy {
+ handle: None,
+ id,
+ name: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn handle(mut self, value: String) -> Self {
+ self.handle = Some(value);
+ self
+ }
+
+ pub fn name(mut self, value: String) -> Self {
+ self.name = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentGateResponseDataAttributesUpdatedBy {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentGateResponseDataAttributesUpdatedByVisitor;
+ impl<'a> Visitor<'a> for DeploymentGateResponseDataAttributesUpdatedByVisitor {
+ type Value = DeploymentGateResponseDataAttributesUpdatedBy;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut handle: Option = None;
+ let mut id: Option = None;
+ let mut name: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "handle" => {
+ if v.is_null() {
+ continue;
+ }
+ handle = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ if v.is_null() {
+ continue;
+ }
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+
+ let content = DeploymentGateResponseDataAttributesUpdatedBy {
+ handle,
+ id,
+ name,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentGateResponseDataAttributesUpdatedByVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_data_type.rs b/src/datadogV2/model/model_deployment_rule_data_type.rs
new file mode 100644
index 000000000..b341763da
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_data_type.rs
@@ -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.
+
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
+
+#[non_exhaustive]
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum DeploymentRuleDataType {
+ DEPLOYMENT_RULE,
+ UnparsedObject(crate::datadog::UnparsedObject),
+}
+
+impl ToString for DeploymentRuleDataType {
+ fn to_string(&self) -> String {
+ match self {
+ Self::DEPLOYMENT_RULE => String::from("deployment_rule"),
+ Self::UnparsedObject(v) => v.value.to_string(),
+ }
+ }
+}
+
+impl Serialize for DeploymentRuleDataType {
+ fn serialize(&self, serializer: S) -> Result
+ where
+ S: Serializer,
+ {
+ match self {
+ Self::UnparsedObject(v) => v.serialize(serializer),
+ _ => serializer.serialize_str(self.to_string().as_str()),
+ }
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleDataType {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ let s: String = String::deserialize(deserializer)?;
+ Ok(match s.as_str() {
+ "deployment_rule" => Self::DEPLOYMENT_RULE,
+ _ => Self::UnparsedObject(crate::datadog::UnparsedObject {
+ value: serde_json::Value::String(s.into()),
+ }),
+ })
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_options_faulty_deployment_detection.rs b/src/datadogV2/model/model_deployment_rule_options_faulty_deployment_detection.rs
new file mode 100644
index 000000000..a73fade48
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_options_faulty_deployment_detection.rs
@@ -0,0 +1,107 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Faulty deployment detection options for deployment rules.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleOptionsFaultyDeploymentDetection {
+ /// The duration for faulty deployment detection.
+ #[serde(rename = "duration")]
+ pub duration: Option,
+ /// Resources to exclude from faulty deployment detection.
+ #[serde(rename = "excluded_resources")]
+ pub excluded_resources: Option>,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleOptionsFaultyDeploymentDetection {
+ pub fn new() -> DeploymentRuleOptionsFaultyDeploymentDetection {
+ DeploymentRuleOptionsFaultyDeploymentDetection {
+ duration: None,
+ excluded_resources: None,
+ _unparsed: false,
+ }
+ }
+
+ pub fn duration(mut self, value: i64) -> Self {
+ self.duration = Some(value);
+ self
+ }
+
+ pub fn excluded_resources(mut self, value: Vec) -> Self {
+ self.excluded_resources = Some(value);
+ self
+ }
+}
+
+impl Default for DeploymentRuleOptionsFaultyDeploymentDetection {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleOptionsFaultyDeploymentDetection {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleOptionsFaultyDeploymentDetectionVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleOptionsFaultyDeploymentDetectionVisitor {
+ type Value = DeploymentRuleOptionsFaultyDeploymentDetection;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut duration: Option = None;
+ let mut excluded_resources: Option> = None;
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "duration" => {
+ if v.is_null() {
+ continue;
+ }
+ duration = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "excluded_resources" => {
+ if v.is_null() {
+ continue;
+ }
+ excluded_resources =
+ Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ return Err(serde::de::Error::custom(
+ "Additional properties not allowed",
+ ));
+ }
+ }
+ }
+
+ let content = DeploymentRuleOptionsFaultyDeploymentDetection {
+ duration,
+ excluded_resources,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleOptionsFaultyDeploymentDetectionVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_options_monitor.rs b/src/datadogV2/model/model_deployment_rule_options_monitor.rs
new file mode 100644
index 000000000..e6d6b284f
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_options_monitor.rs
@@ -0,0 +1,93 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Monitor options for deployment rules.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleOptionsMonitor {
+ /// Seconds the monitor needs to stay in OK status for the rule to pass.
+ #[serde(rename = "duration")]
+ pub duration: Option,
+ /// Monitors that match this query are evaluated.
+ #[serde(rename = "query")]
+ pub query: String,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleOptionsMonitor {
+ pub fn new(query: String) -> DeploymentRuleOptionsMonitor {
+ DeploymentRuleOptionsMonitor {
+ duration: None,
+ query,
+ _unparsed: false,
+ }
+ }
+
+ pub fn duration(mut self, value: i64) -> Self {
+ self.duration = Some(value);
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleOptionsMonitor {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleOptionsMonitorVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleOptionsMonitorVisitor {
+ type Value = DeploymentRuleOptionsMonitor;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut duration: Option = None;
+ let mut query: Option = None;
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "duration" => {
+ if v.is_null() {
+ continue;
+ }
+ duration = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "query" => {
+ query = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ return Err(serde::de::Error::custom(
+ "Additional properties not allowed",
+ ));
+ }
+ }
+ }
+ let query = query.ok_or_else(|| M::Error::missing_field("query"))?;
+
+ let content = DeploymentRuleOptionsMonitor {
+ duration,
+ query,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleOptionsMonitorVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_response.rs b/src/datadogV2/model/model_deployment_rule_response.rs
new file mode 100644
index 000000000..7b8d652ad
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_response.rs
@@ -0,0 +1,105 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Response for a deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleResponse {
+ /// Data for a deployment rule.
+ #[serde(rename = "data")]
+ pub data: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleResponse {
+ pub fn new() -> DeploymentRuleResponse {
+ DeploymentRuleResponse {
+ data: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn data(mut self, value: crate::datadogV2::model::DeploymentRuleResponseData) -> Self {
+ self.data = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for DeploymentRuleResponse {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleResponse {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleResponseVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleResponseVisitor {
+ type Value = DeploymentRuleResponse;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ if v.is_null() {
+ continue;
+ }
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = DeploymentRuleResponse {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleResponseVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_response_data.rs b/src/datadogV2/model/model_deployment_rule_response_data.rs
new file mode 100644
index 000000000..85d24f7a8
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_response_data.rs
@@ -0,0 +1,126 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Data for a deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleResponseData {
+ /// Basic information about a deployment rule.
+ #[serde(rename = "attributes")]
+ pub attributes: crate::datadogV2::model::DeploymentRuleResponseDataAttributes,
+ /// Unique identifier of the deployment rule.
+ #[serde(rename = "id")]
+ pub id: String,
+ /// Deployment rule resource type.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::DeploymentRuleDataType,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleResponseData {
+ pub fn new(
+ attributes: crate::datadogV2::model::DeploymentRuleResponseDataAttributes,
+ id: String,
+ type_: crate::datadogV2::model::DeploymentRuleDataType,
+ ) -> DeploymentRuleResponseData {
+ DeploymentRuleResponseData {
+ attributes,
+ id,
+ type_,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleResponseData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleResponseDataVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleResponseDataVisitor {
+ type Value = DeploymentRuleResponseData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut attributes: Option<
+ crate::datadogV2::model::DeploymentRuleResponseDataAttributes,
+ > = None;
+ let mut id: Option = None;
+ let mut type_: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "attributes" => {
+ attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::DeploymentRuleDataType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?;
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = DeploymentRuleResponseData {
+ attributes,
+ id,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleResponseDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_response_data_attributes.rs b/src/datadogV2/model/model_deployment_rule_response_data_attributes.rs
new file mode 100644
index 000000000..ac4e07140
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_response_data_attributes.rs
@@ -0,0 +1,219 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Basic information about a deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleResponseDataAttributes {
+ /// The timestamp when the deployment rule was created.
+ #[serde(rename = "created_at")]
+ pub created_at: chrono::DateTime,
+ /// Information about the user who created the deployment rule.
+ #[serde(rename = "created_by")]
+ pub created_by: crate::datadogV2::model::DeploymentRuleResponseDataAttributesCreatedBy,
+ /// Whether this rule is run in dry-run mode.
+ #[serde(rename = "dry_run")]
+ pub dry_run: bool,
+ /// The ID of the deployment gate.
+ #[serde(rename = "gate_id")]
+ pub gate_id: String,
+ /// The name of the deployment rule.
+ #[serde(rename = "name")]
+ pub name: String,
+ /// Options for deployment rule response representing either faulty deployment detection or monitor options.
+ #[serde(rename = "options")]
+ pub options: crate::datadogV2::model::DeploymentRulesOptions,
+ /// The type of the deployment rule.
+ #[serde(rename = "type")]
+ pub type_: crate::datadogV2::model::DeploymentRuleResponseDataAttributesType,
+ /// The timestamp when the deployment rule was last updated.
+ #[serde(rename = "updated_at")]
+ pub updated_at: Option>,
+ /// Information about the user who updated the deployment rule.
+ #[serde(rename = "updated_by")]
+ pub updated_by: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleResponseDataAttributes {
+ pub fn new(
+ created_at: chrono::DateTime,
+ created_by: crate::datadogV2::model::DeploymentRuleResponseDataAttributesCreatedBy,
+ dry_run: bool,
+ gate_id: String,
+ name: String,
+ options: crate::datadogV2::model::DeploymentRulesOptions,
+ type_: crate::datadogV2::model::DeploymentRuleResponseDataAttributesType,
+ ) -> DeploymentRuleResponseDataAttributes {
+ DeploymentRuleResponseDataAttributes {
+ created_at,
+ created_by,
+ dry_run,
+ gate_id,
+ name,
+ options,
+ type_,
+ updated_at: None,
+ updated_by: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn updated_at(mut self, value: chrono::DateTime) -> Self {
+ self.updated_at = Some(value);
+ self
+ }
+
+ pub fn updated_by(
+ mut self,
+ value: crate::datadogV2::model::DeploymentRuleResponseDataAttributesUpdatedBy,
+ ) -> Self {
+ self.updated_by = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleResponseDataAttributes {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleResponseDataAttributesVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleResponseDataAttributesVisitor {
+ type Value = DeploymentRuleResponseDataAttributes;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut created_at: Option> = None;
+ let mut created_by: Option<
+ crate::datadogV2::model::DeploymentRuleResponseDataAttributesCreatedBy,
+ > = None;
+ let mut dry_run: Option = None;
+ let mut gate_id: Option = None;
+ let mut name: Option = None;
+ let mut options: Option = None;
+ let mut type_: Option<
+ crate::datadogV2::model::DeploymentRuleResponseDataAttributesType,
+ > = None;
+ let mut updated_at: Option> = None;
+ let mut updated_by: Option<
+ crate::datadogV2::model::DeploymentRuleResponseDataAttributesUpdatedBy,
+ > = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "created_at" => {
+ created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "created_by" => {
+ created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "dry_run" => {
+ dry_run = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "gate_id" => {
+ gate_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "options" => {
+ options = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _options) = options {
+ match _options {
+ crate::datadogV2::model::DeploymentRulesOptions::UnparsedObject(_options) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ "type" => {
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::DeploymentRuleResponseDataAttributesType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ "updated_at" => {
+ if v.is_null() {
+ continue;
+ }
+ updated_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "updated_by" => {
+ if v.is_null() {
+ continue;
+ }
+ updated_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?;
+ let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?;
+ let dry_run = dry_run.ok_or_else(|| M::Error::missing_field("dry_run"))?;
+ let gate_id = gate_id.ok_or_else(|| M::Error::missing_field("gate_id"))?;
+ let name = name.ok_or_else(|| M::Error::missing_field("name"))?;
+ let options = options.ok_or_else(|| M::Error::missing_field("options"))?;
+ let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
+
+ let content = DeploymentRuleResponseDataAttributes {
+ created_at,
+ created_by,
+ dry_run,
+ gate_id,
+ name,
+ options,
+ type_,
+ updated_at,
+ updated_by,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleResponseDataAttributesVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_response_data_attributes_created_by.rs b/src/datadogV2/model/model_deployment_rule_response_data_attributes_created_by.rs
new file mode 100644
index 000000000..0b1a70259
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_response_data_attributes_created_by.rs
@@ -0,0 +1,126 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Information about the user who created the deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleResponseDataAttributesCreatedBy {
+ /// The handle of the user who created the deployment rule.
+ #[serde(rename = "handle")]
+ pub handle: Option,
+ /// The ID of the user who created the deployment rule.
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The name of the user who created the deployment rule.
+ #[serde(rename = "name")]
+ pub name: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleResponseDataAttributesCreatedBy {
+ pub fn new(id: String) -> DeploymentRuleResponseDataAttributesCreatedBy {
+ DeploymentRuleResponseDataAttributesCreatedBy {
+ handle: None,
+ id,
+ name: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn handle(mut self, value: String) -> Self {
+ self.handle = Some(value);
+ self
+ }
+
+ pub fn name(mut self, value: String) -> Self {
+ self.name = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleResponseDataAttributesCreatedBy {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleResponseDataAttributesCreatedByVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleResponseDataAttributesCreatedByVisitor {
+ type Value = DeploymentRuleResponseDataAttributesCreatedBy;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut handle: Option = None;
+ let mut id: Option = None;
+ let mut name: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "handle" => {
+ if v.is_null() {
+ continue;
+ }
+ handle = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ if v.is_null() {
+ continue;
+ }
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+
+ let content = DeploymentRuleResponseDataAttributesCreatedBy {
+ handle,
+ id,
+ name,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleResponseDataAttributesCreatedByVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_response_data_attributes_type.rs b/src/datadogV2/model/model_deployment_rule_response_data_attributes_type.rs
new file mode 100644
index 000000000..e6ebe8946
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_response_data_attributes_type.rs
@@ -0,0 +1,51 @@
+// 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.
+
+use serde::{Deserialize, Deserializer, Serialize, Serializer};
+
+#[non_exhaustive]
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum DeploymentRuleResponseDataAttributesType {
+ FAULTY_DEPLOYMENT_DETECTION,
+ MONITOR,
+ UnparsedObject(crate::datadog::UnparsedObject),
+}
+
+impl ToString for DeploymentRuleResponseDataAttributesType {
+ fn to_string(&self) -> String {
+ match self {
+ Self::FAULTY_DEPLOYMENT_DETECTION => String::from("faulty_deployment_detection"),
+ Self::MONITOR => String::from("monitor"),
+ Self::UnparsedObject(v) => v.value.to_string(),
+ }
+ }
+}
+
+impl Serialize for DeploymentRuleResponseDataAttributesType {
+ fn serialize(&self, serializer: S) -> Result
+ where
+ S: Serializer,
+ {
+ match self {
+ Self::UnparsedObject(v) => v.serialize(serializer),
+ _ => serializer.serialize_str(self.to_string().as_str()),
+ }
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleResponseDataAttributesType {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ let s: String = String::deserialize(deserializer)?;
+ Ok(match s.as_str() {
+ "faulty_deployment_detection" => Self::FAULTY_DEPLOYMENT_DETECTION,
+ "monitor" => Self::MONITOR,
+ _ => Self::UnparsedObject(crate::datadog::UnparsedObject {
+ value: serde_json::Value::String(s.into()),
+ }),
+ })
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rule_response_data_attributes_updated_by.rs b/src/datadogV2/model/model_deployment_rule_response_data_attributes_updated_by.rs
new file mode 100644
index 000000000..0d5906685
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rule_response_data_attributes_updated_by.rs
@@ -0,0 +1,126 @@
+// 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.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Information about the user who updated the deployment rule.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct DeploymentRuleResponseDataAttributesUpdatedBy {
+ /// The handle of the user who updated the deployment rule.
+ #[serde(rename = "handle")]
+ pub handle: Option,
+ /// The ID of the user who updated the deployment rule.
+ #[serde(rename = "id")]
+ pub id: String,
+ /// The name of the user who updated the deployment rule.
+ #[serde(rename = "name")]
+ pub name: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl DeploymentRuleResponseDataAttributesUpdatedBy {
+ pub fn new(id: String) -> DeploymentRuleResponseDataAttributesUpdatedBy {
+ DeploymentRuleResponseDataAttributesUpdatedBy {
+ handle: None,
+ id,
+ name: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn handle(mut self, value: String) -> Self {
+ self.handle = Some(value);
+ self
+ }
+
+ pub fn name(mut self, value: String) -> Self {
+ self.name = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for DeploymentRuleResponseDataAttributesUpdatedBy {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct DeploymentRuleResponseDataAttributesUpdatedByVisitor;
+ impl<'a> Visitor<'a> for DeploymentRuleResponseDataAttributesUpdatedByVisitor {
+ type Value = DeploymentRuleResponseDataAttributesUpdatedBy;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut handle: Option = None;
+ let mut id: Option = None;
+ let mut name: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "handle" => {
+ if v.is_null() {
+ continue;
+ }
+ handle = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "id" => {
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "name" => {
+ if v.is_null() {
+ continue;
+ }
+ name = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let id = id.ok_or_else(|| M::Error::missing_field("id"))?;
+
+ let content = DeploymentRuleResponseDataAttributesUpdatedBy {
+ handle,
+ id,
+ name,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(DeploymentRuleResponseDataAttributesUpdatedByVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_deployment_rules_options.rs b/src/datadogV2/model/model_deployment_rules_options.rs
new file mode 100644
index 000000000..30b1bf64d
--- /dev/null
+++ b/src/datadogV2/model/model_deployment_rules_options.rs
@@ -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.
+use serde::{Deserialize, Deserializer, Serialize};
+
+/// Options for deployment rule response representing either faulty deployment detection or monitor options.
+#[non_exhaustive]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+#[serde(untagged)]
+pub enum DeploymentRulesOptions {
+ DeploymentRuleOptionsFaultyDeploymentDetection(
+ Box,
+ ),
+ DeploymentRuleOptionsMonitor(Box),
+ UnparsedObject(crate::datadog::UnparsedObject),
+}
+
+impl<'de> Deserialize<'de> for DeploymentRulesOptions {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ let value: serde_json::Value = Deserialize::deserialize(deserializer)?;
+ if let Ok(_v) = serde_json::from_value::<
+ Box,
+ >(value.clone())
+ {
+ if !_v._unparsed {
+ return Ok(
+ DeploymentRulesOptions::DeploymentRuleOptionsFaultyDeploymentDetection(_v),
+ );
+ }
+ }
+ if let Ok(_v) = serde_json::from_value::<
+ Box,
+ >(value.clone())
+ {
+ if !_v._unparsed {
+ return Ok(DeploymentRulesOptions::DeploymentRuleOptionsMonitor(_v));
+ }
+ }
+
+ return Ok(DeploymentRulesOptions::UnparsedObject(
+ crate::datadog::UnparsedObject { value },
+ ));
+ }
+}
diff --git a/src/datadogV2/model/model_httpcd_gates_bad_request_response.rs b/src/datadogV2/model/model_httpcd_gates_bad_request_response.rs
new file mode 100644
index 000000000..5a1c2a3bf
--- /dev/null
+++ b/src/datadogV2/model/model_httpcd_gates_bad_request_response.rs
@@ -0,0 +1,105 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+use serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Bad request.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct HTTPCDGatesBadRequestResponse {
+ /// Structured errors.
+ #[serde(rename = "errors")]
+ pub errors: Option