diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 7acea8a971..764230d1a1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -35572,6 +35572,126 @@ components: type: string x-enum-varnames: - DEPLOYMENT_GATE + DeploymentGateEvaluationAttributes: + description: Attributes of a deployment gate evaluation. + properties: + dry_run: + description: Whether this evaluation used gate-level dry run. + example: true + type: boolean + duration_seconds: + description: Evaluation duration in seconds. Null while it is in progress. + example: 900 + format: int64 + nullable: true + type: integer + env: + description: Deployment environment evaluated by the gate. + example: prod + type: string + evaluation_id: + description: Gate evaluation UUID. Matches the resource `id`. + example: 7853af70-e6bf-49d8-a6cc-1b9b50ef0537 + format: uuid + type: string + finished_at: + description: Time the evaluation finished. Null while it is in progress. + example: "2026-09-14T08:15:00Z" + format: date-time + nullable: true + type: string + gate_id: + description: Configured deployment gate UUID. Null for just-in-time evaluations. + example: e7cd2af1-b67b-11ee-8d0d-2a7caf4aa214 + format: uuid + nullable: true + type: string + identifier: + description: Deployment gate identifier. + example: default + type: string + service: + description: Service evaluated by the deployment gate. + example: checkout + type: string + started_at: + description: Time the evaluation started. + example: "2026-09-14T08:00:00Z" + format: date-time + type: string + status: + $ref: "#/components/schemas/DeploymentGatesEvaluationResultResponseAttributesGateStatus" + version: + description: Evaluated deployment version. Empty when no version was provided. + example: "2026.09.14.1" + type: string + required: + - evaluation_id + - gate_id + - service + - env + - identifier + - version + - status + - dry_run + - started_at + - finished_at + - duration_seconds + type: object + DeploymentGateEvaluationData: + description: JSON:API deployment gate evaluation resource. + properties: + attributes: + $ref: "#/components/schemas/DeploymentGateEvaluationAttributes" + id: + description: Deployment gate evaluation UUID. + example: 7853af70-e6bf-49d8-a6cc-1b9b50ef0537 + format: uuid + type: string + type: + $ref: "#/components/schemas/DeploymentGateEvaluationDataType" + required: [id, type, attributes] + type: object + DeploymentGateEvaluationDataType: + default: deployment_gate_evaluation + description: JSON:API type for a deployment gate evaluation. + enum: [deployment_gate_evaluation] + example: deployment_gate_evaluation + type: string + x-enum-varnames: [DEPLOYMENT_GATE_EVALUATION] + DeploymentGateEvaluationListMeta: + description: Pagination metadata. + properties: + page: + $ref: "#/components/schemas/DeploymentGateEvaluationPage" + required: [page] + type: object + DeploymentGateEvaluationPage: + description: Cursor pagination information. + properties: + next_cursor: + description: Opaque cursor for the next page. Absent on the final page. + type: string + size: + description: Requested maximum number of resources in this page. + example: 1 + format: int64 + maximum: 100 + minimum: 1 + type: integer + required: [size] + type: object + DeploymentGateEvaluationsResponse: + description: Paginated deployment gate evaluations. + properties: + data: + items: + $ref: "#/components/schemas/DeploymentGateEvaluationData" + type: array + meta: + $ref: "#/components/schemas/DeploymentGateEvaluationListMeta" + required: [data, meta] + type: object DeploymentGateResponse: description: Response for a deployment gate. properties: @@ -35671,6 +35791,237 @@ components: required: - id type: object + DeploymentGateRuleEvaluationAttributes: + description: Attributes of a deployment gate rule evaluation. + properties: + configuration: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationConfiguration" + dry_run: + description: Whether this rule is non-enforcing. A failed dry-run rule is ignored when computing the gate outcome. Independent of `gate_dry_run`. + example: false + type: boolean + duration_seconds: + description: Rule evaluation duration in seconds. Null while it is in progress. + example: 0 + format: int64 + nullable: true + type: integer + env: + description: Evaluated environment. + example: prod + type: string + evaluation_id: + description: Rule evaluation UUID. Matches the resource `id`. + example: 4f66c1c6-8346-59e5-be44-238214133260 + format: uuid + type: string + failures: + $ref: "#/components/schemas/DeploymentGateRuleFailures" + finished_at: + description: Time the rule evaluation finished. Null while it is in progress. + example: "2026-09-14T08:15:00Z" + format: date-time + nullable: true + type: string + gate_dry_run: + description: Whether the parent gate is dry-run. A failed dry-run gate blocks but does not stop deployment. Independent of rule-level `dry_run`. + example: false + type: boolean + gate_evaluation_id: + description: Deployment gate evaluation UUID. + example: 426a8f7b-b3e8-45f9-9d99-a1ed2f7fea04 + format: uuid + type: string + gate_id: + description: Configured deployment gate UUID. Null for just-in-time evaluations. + example: e7cd2af1-b67b-11ee-8d0d-2a7caf4aa214 + format: uuid + nullable: true + type: string + identifier: + description: Deployment gate identifier. + example: default + type: string + name: + description: Rule name. + example: APM faulty deployment detection + type: string + reason: + description: Reason for the rule result. + example: A faulty resource was detected. + type: string + rule_id: + description: Configured deployment rule UUID. Null for just-in-time rules. + example: 5cb4e76f-2937-47d7-80c8-7255ce2b76a4 + format: uuid + nullable: true + type: string + service: + description: Evaluated service. + example: checkout + type: string + started_at: + description: Time the rule evaluation started. + example: "2026-09-14T08:00:00Z" + format: date-time + type: string + status: + $ref: "#/components/schemas/DeploymentGatesEvaluationResultResponseAttributesGateStatus" + type: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationType" + version: + description: Evaluated deployment version. Empty when no version was provided. + example: "2026.09.14.1" + type: string + required: + - evaluation_id + - gate_evaluation_id + - gate_id + - rule_id + - service + - env + - identifier + - version + - gate_dry_run + - name + - type + - status + - dry_run + - reason + - started_at + - finished_at + - duration_seconds + - configuration + - failures + type: object + DeploymentGateRuleEvaluationConfiguration: + additionalProperties: false + description: |- + Evaluated rule configuration. Fields depend on rule type and unset fields are omitted. + Monitor rules can include `duration`, `query`, `monitor_ids`, `warmup`, `fail_on_no_groups_found`, and `fail_on_no_data`. + Faulty deployment detection rules can include `duration`, `allowed_resources`, and `excluded_resources`. + properties: + allowed_resources: + description: APM resources explicitly allowed by faulty deployment detection. + items: + type: string + type: array + duration: + description: Evaluation duration configured for this rule. + format: int64 + type: integer + excluded_resources: + description: APM resources excluded from faulty deployment detection. + items: + type: string + type: array + fail_on_no_data: + description: Whether a monitor rule fails when no data is found. + type: boolean + fail_on_no_groups_found: + description: Whether a monitor rule fails when no groups are found. + type: boolean + monitor_ids: + description: Monitor IDs evaluated by a monitor rule. + items: + type: string + type: array + query: + description: Monitor query used by a monitor rule. + type: string + warmup: + description: Warm-up duration in seconds for a monitor rule. Omitted when zero. + format: int64 + type: integer + type: object + DeploymentGateRuleEvaluationData: + description: JSON:API deployment gate rule evaluation resource. + properties: + attributes: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationAttributes" + id: + description: Rule evaluation UUID. + example: 4f66c1c6-8346-59e5-be44-238214133260 + format: uuid + type: string + type: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationDataType" + required: [id, type, attributes] + type: object + DeploymentGateRuleEvaluationDataType: + default: deployment_gate_rule_evaluation + description: JSON:API type for a deployment gate rule evaluation. + enum: [deployment_gate_rule_evaluation] + example: deployment_gate_rule_evaluation + type: string + x-enum-varnames: [DEPLOYMENT_GATE_RULE_EVALUATION] + DeploymentGateRuleEvaluationType: + description: Type of deployment gate rule. + enum: [monitor, faulty_deployment_detection] + example: faulty_deployment_detection + type: string + x-enum-varnames: [MONITOR, FAULTY_DEPLOYMENT_DETECTION] + DeploymentGateRuleEvaluationsResponse: + description: Paginated deployment gate rule evaluations. + properties: + data: + items: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationData" + type: array + meta: + $ref: "#/components/schemas/DeploymentGateEvaluationListMeta" + required: [data, meta] + type: object + DeploymentGateRuleFailureMonitor: + description: Failed monitor reference. + properties: + id: + description: Monitor ID. + example: "12345678" + type: string + state: + description: Monitor state that caused the failure. + example: alert + type: string + url: + description: URL for inspecting the monitor during the evaluation window. + example: https://app.datadoghq.com/monitors/12345678 + type: string + required: [id, url, state] + type: object + DeploymentGateRuleFailureNarrative: + description: Faulty deployment detection narrative reference. + properties: + hostgroup: + description: Host group associated with the narrative. + example: service:checkout,env:prod + type: string + id: + description: Narrative ID. + example: narrative-123 + type: string + required: [id, hostgroup] + type: object + DeploymentGateRuleFailures: + description: Rule failure details. + properties: + faulty_apm_resources: + description: Names of faulty APM resources. + example: + - GET /checkout + items: + type: string + type: array + monitors: + items: + $ref: "#/components/schemas/DeploymentGateRuleFailureMonitor" + type: array + narratives: + items: + $ref: "#/components/schemas/DeploymentGateRuleFailureNarrative" + type: array + required: [monitors, faulty_apm_resources, narratives] + type: object DeploymentGateRulesResponse: description: Response for a deployment gate rules. properties: @@ -161841,7 +162192,31 @@ paths: Use `page[cursor]` and `page[size]` query parameters to paginate through results. operationId: ListDeploymentGates parameters: - - description: Cursor for pagination. Use the `meta.page.next_cursor` value from the previous response. + - description: Service name. + in: query + name: filter[service] + required: false + schema: + type: string + - description: Environment name. + in: query + name: filter[env] + required: false + schema: + type: string + - description: Gate identifier. + in: query + name: filter[identifier] + required: false + schema: + type: string + - description: Dry-run state. + in: query + name: filter[dry_run] + required: false + schema: + type: boolean + - description: Cursor for pagination. Use the `meta.page.next_cursor` value from the previous response. Invalid cursors return 400. in: query name: page[cursor] required: false @@ -161978,6 +162353,372 @@ paths: 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/evaluations: + get: + description: |- + Returns deployment gate evaluations started in a maximum 30-day window (the default is the previous 24 hours). + Results are ordered by start time, newest first. + In-progress state is near-real-time and mutable. Finished state is eventually consistent. + operationId: ListDeploymentGateEvaluations + parameters: + - description: Inclusive evaluation start time. Defaults to 24 hours before the request. Together with `filter[to]`, the window may span no more than 30 days. + in: query + name: filter[from] + required: false + schema: + format: date-time + type: string + - description: Exclusive evaluation start time. Defaults to the request time. Must be after `filter[from]`; the window may span no more than 30 days. + in: query + name: filter[to] + required: false + schema: + format: date-time + type: string + - description: Service values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[service] + required: false + schema: + items: + type: string + type: array + - description: Environment values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[env] + required: false + schema: + items: + type: string + type: array + - description: Gate identifier values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[identifier] + required: false + schema: + items: + type: string + type: array + - description: Gate outcomes. Repeated or comma-separated values are combined with OR. + in: query + name: filter[status] + required: false + schema: + items: + $ref: "#/components/schemas/DeploymentGatesEvaluationResultResponseAttributesGateStatus" + type: array + - description: Gate-level dry-run state. + in: query + name: filter[dry_run] + required: false + schema: + type: boolean + - description: Gate evaluation UUID. No match returns an empty list. + in: query + name: filter[evaluation_id] + required: false + schema: + format: uuid + type: string + - description: Configured gate UUID. Just-in-time evaluations have no gate ID. + in: query + name: filter[gate_id] + required: false + schema: + format: uuid + type: string + - description: Deployment version values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[version] + required: false + schema: + items: + type: string + type: array + - description: Maximum evaluations returned. + in: query + name: page[size] + required: false + schema: + default: 20 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: Opaque cursor returned in `meta.page.next_cursor` by the previous page. Invalid cursors return 400. + in: query + name: page[cursor] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + dry_run: true + duration_seconds: 900 + env: prod + evaluation_id: 7853af70-e6bf-49d8-a6cc-1b9b50ef0537 + finished_at: "2026-09-14T08:15:00Z" + gate_id: e7cd2af1-b67b-11ee-8d0d-2a7caf4aa214 + identifier: default + service: checkout + started_at: "2026-09-14T08:00:00Z" + status: fail + version: "2026.09.14.1" + id: 7853af70-e6bf-49d8-a6cc-1b9b50ef0537 + type: deployment_gate_evaluation + meta: + page: + next_cursor: MTc4OTM3MjgwMFx4MDA3ODUzYWY3MC1lNmJmLTQ5ZDgtYTZjYy0xYjliNTBlZjA1Mzc= + size: 20 + schema: + $ref: "#/components/schemas/DeploymentGateEvaluationsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad request. + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - deployment_gates_read + summary: List deployment gate evaluations + tags: ["Deployment Gates"] + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.page.next_cursor + limitParam: page[size] + resultsPath: data + 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/). + /api/v2/deployment_gates/evaluations/rules: + get: + description: |- + Returns rule evaluations whose gate evaluation started in a maximum 30-day window (the default is the previous 24 hours). + Filter by gate, rule, gate evaluation, or rule evaluation ID; omit IDs for cross-evaluation searches. + Results are ordered by start time, newest first. + In-progress state is near-real-time and mutable. Finished state is eventually consistent. + Gate-level and rule-level dry-run states are independent. + Pagination is deterministic but not snapshot isolated; clients should deduplicate by rule evaluation ID. + operationId: ListDeploymentRuleEvaluations + parameters: + - description: Inclusive gate evaluation start time. Defaults to 24 hours before the request. Together with `filter[to]`, the window may span no more than 30 days. + in: query + name: filter[from] + required: false + schema: + format: date-time + type: string + - description: Exclusive gate evaluation start time. Defaults to the request time. Must be after `filter[from]`; the window may span no more than 30 days. + in: query + name: filter[to] + required: false + schema: + format: date-time + type: string + - description: Gate evaluation UUID. No match returns an empty list. + in: query + name: filter[gate_evaluation_id] + required: false + schema: + format: uuid + type: string + - description: Rule evaluation UUID. No match returns an empty list. + in: query + name: filter[evaluation_id] + required: false + schema: + format: uuid + type: string + - description: Configured gate UUID. Just-in-time evaluations have no gate ID. + in: query + name: filter[gate_id] + required: false + schema: + format: uuid + type: string + - description: Configured rule UUID. Just-in-time rules have no rule ID. + in: query + name: filter[rule_id] + required: false + schema: + format: uuid + type: string + - description: Evaluated service values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[service] + required: false + schema: + items: + type: string + type: array + - description: Evaluated environment values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[env] + required: false + schema: + items: + type: string + type: array + - description: Gate identifier values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[identifier] + required: false + schema: + items: + type: string + type: array + - description: Evaluated deployment version values. Repeated or comma-separated values are combined with OR. + in: query + name: filter[version] + required: false + schema: + items: + type: string + type: array + - description: Rule statuses. Repeated or comma-separated values are combined with OR. + in: query + name: filter[status] + required: false + schema: + items: + $ref: "#/components/schemas/DeploymentGatesEvaluationResultResponseAttributesGateStatus" + type: array + - description: |- + Rule types. Repeated or comma-separated values are combined with OR. + Defaults to all rule types. + in: query + name: filter[type] + required: false + schema: + items: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationType" + type: array + - description: Rule-level dry-run state. A failed dry-run rule is ignored when computing the gate outcome. + in: query + name: filter[dry_run] + required: false + schema: + type: boolean + - description: Gate-level dry-run state. A failed dry-run gate blocks but does not stop deployment. + in: query + name: filter[gate_dry_run] + required: false + schema: + type: boolean + - description: Rule names. Repeated or comma-separated values are combined with OR. + in: query + name: filter[name] + required: false + schema: + items: + type: string + type: array + - description: Maximum rule evaluations returned. + in: query + name: page[size] + required: false + schema: + default: 50 + format: int64 + maximum: 100 + minimum: 1 + type: integer + - description: Opaque cursor returned in `meta.page.next_cursor` by the previous page. Invalid cursors return 400. + in: query + name: page[cursor] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + configuration: + duration: 900 + dry_run: false + duration_seconds: 900 + env: prod + evaluation_id: 4f66c1c6-8346-59e5-be44-238214133260 + failures: + faulty_apm_resources: [GET /checkout] + monitors: [] + narratives: [] + finished_at: "2026-09-14T08:15:00Z" + gate_dry_run: false + gate_evaluation_id: 426a8f7b-b3e8-45f9-9d99-a1ed2f7fea04 + gate_id: + identifier: default + name: APM faulty deployment detection + reason: A faulty resource was detected. + rule_id: + service: checkout + started_at: "2026-09-14T08:00:00Z" + status: fail + type: faulty_deployment_detection + version: "2026.09.14.1" + id: 4f66c1c6-8346-59e5-be44-238214133260 + type: deployment_gate_rule_evaluation + meta: + page: + size: 50 + schema: + $ref: "#/components/schemas/DeploymentGateRuleEvaluationsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad request. + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - deployment_gates_read + summary: List deployment gate rule evaluations + tags: ["Deployment Gates"] + x-pagination: + cursorParam: page[cursor] + cursorPath: meta.page.next_cursor + limitParam: page[size] + resultsPath: data + 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/). /api/v2/deployment_gates/{gate_id}/rules: get: description: |- diff --git a/examples/v2/deployment-gates/ListDeploymentGateEvaluations.py b/examples/v2/deployment-gates/ListDeploymentGateEvaluations.py new file mode 100644 index 0000000000..ac88404980 --- /dev/null +++ b/examples/v2/deployment-gates/ListDeploymentGateEvaluations.py @@ -0,0 +1,16 @@ +""" +List deployment gate evaluations returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_deployment_gate_evaluations"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.list_deployment_gate_evaluations() + + print(response) diff --git a/examples/v2/deployment-gates/ListDeploymentGateEvaluations_2875333232.py b/examples/v2/deployment-gates/ListDeploymentGateEvaluations_2875333232.py new file mode 100644 index 0000000000..68498fcad4 --- /dev/null +++ b/examples/v2/deployment-gates/ListDeploymentGateEvaluations_2875333232.py @@ -0,0 +1,16 @@ +""" +List deployment gate evaluations returns "OK" response with pagination +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_deployment_gate_evaluations"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + items = api_instance.list_deployment_gate_evaluations_with_pagination() + for item in items: + print(item) diff --git a/examples/v2/deployment-gates/ListDeploymentRuleEvaluations.py b/examples/v2/deployment-gates/ListDeploymentRuleEvaluations.py new file mode 100644 index 0000000000..1036885397 --- /dev/null +++ b/examples/v2/deployment-gates/ListDeploymentRuleEvaluations.py @@ -0,0 +1,16 @@ +""" +List deployment gate rule evaluations returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_deployment_rule_evaluations"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + response = api_instance.list_deployment_rule_evaluations() + + print(response) diff --git a/examples/v2/deployment-gates/ListDeploymentRuleEvaluations_861936712.py b/examples/v2/deployment-gates/ListDeploymentRuleEvaluations_861936712.py new file mode 100644 index 0000000000..63b52fd5b8 --- /dev/null +++ b/examples/v2/deployment-gates/ListDeploymentRuleEvaluations_861936712.py @@ -0,0 +1,16 @@ +""" +List deployment gate rule evaluations returns "OK" response with pagination +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.deployment_gates_api import DeploymentGatesApi + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_deployment_rule_evaluations"] = True +with ApiClient(configuration) as api_client: + api_instance = DeploymentGatesApi(api_client) + items = api_instance.list_deployment_rule_evaluations_with_pagination() + for item in items: + print(item) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index dcb0731661..1303bf3cff 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -532,7 +532,9 @@ def __init__( "v2.get_deployment_gate_rules": False, "v2.get_deployment_gates_evaluation_result": False, "v2.get_deployment_rule": False, + "v2.list_deployment_gate_evaluations": False, "v2.list_deployment_gates": False, + "v2.list_deployment_rule_evaluations": False, "v2.trigger_deployment_gates_evaluation": False, "v2.update_deployment_gate": False, "v2.update_deployment_rule": False, diff --git a/src/datadog_api_client/v2/api/deployment_gates_api.py b/src/datadog_api_client/v2/api/deployment_gates_api.py index 1a7fafc0af..ff2dcd159d 100644 --- a/src/datadog_api_client/v2/api/deployment_gates_api.py +++ b/src/datadog_api_client/v2/api/deployment_gates_api.py @@ -3,11 +3,15 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Any, Dict, Union +import collections +from typing import Any, Dict, List, Union from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint from datadog_api_client.configuration import Configuration from datadog_api_client.model_utils import ( + datetime, + set_attribute_from_path, + get_attribute_from_path, UnsetType, unset, UUID, @@ -15,6 +19,14 @@ from datadog_api_client.v2.model.deployment_gates_list_response import DeploymentGatesListResponse from datadog_api_client.v2.model.deployment_gate_response import DeploymentGateResponse from datadog_api_client.v2.model.create_deployment_gate_params import CreateDeploymentGateParams +from datadog_api_client.v2.model.deployment_gate_evaluations_response import DeploymentGateEvaluationsResponse +from datadog_api_client.v2.model.deployment_gates_evaluation_result_response_attributes_gate_status import ( + DeploymentGatesEvaluationResultResponseAttributesGateStatus, +) +from datadog_api_client.v2.model.deployment_gate_evaluation_data import DeploymentGateEvaluationData +from datadog_api_client.v2.model.deployment_gate_rule_evaluations_response import DeploymentGateRuleEvaluationsResponse +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_type import DeploymentGateRuleEvaluationType +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data import DeploymentGateRuleEvaluationData from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse from datadog_api_client.v2.model.deployment_rule_response import DeploymentRuleResponse from datadog_api_client.v2.model.create_deployment_rule_params import CreateDeploymentRuleParams @@ -233,6 +245,92 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_deployment_gate_evaluations_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentGateEvaluationsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/deployment_gates/evaluations", + "operation_id": "list_deployment_gate_evaluations", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_from": { + "openapi_types": (datetime,), + "attribute": "filter[from]", + "location": "query", + }, + "filter_to": { + "openapi_types": (datetime,), + "attribute": "filter[to]", + "location": "query", + }, + "filter_service": { + "openapi_types": ([str],), + "attribute": "filter[service]", + "location": "query", + "collection_format": "multi", + }, + "filter_env": { + "openapi_types": ([str],), + "attribute": "filter[env]", + "location": "query", + "collection_format": "multi", + }, + "filter_identifier": { + "openapi_types": ([str],), + "attribute": "filter[identifier]", + "location": "query", + "collection_format": "multi", + }, + "filter_status": { + "openapi_types": ([DeploymentGatesEvaluationResultResponseAttributesGateStatus],), + "attribute": "filter[status]", + "location": "query", + "collection_format": "multi", + }, + "filter_dry_run": { + "openapi_types": (bool,), + "attribute": "filter[dry_run]", + "location": "query", + }, + "filter_evaluation_id": { + "openapi_types": (UUID,), + "attribute": "filter[evaluation_id]", + "location": "query", + }, + "filter_gate_id": { + "openapi_types": (UUID,), + "attribute": "filter[gate_id]", + "location": "query", + }, + "filter_version": { + "openapi_types": ([str],), + "attribute": "filter[version]", + "location": "query", + "collection_format": "multi", + }, + "page_size": { + "validation": { + "inclusive_maximum": 100, + "inclusive_minimum": 1, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_cursor": { + "openapi_types": (str,), + "attribute": "page[cursor]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_deployment_gates_endpoint = _Endpoint( settings={ "response_type": (DeploymentGatesListResponse,), @@ -243,6 +341,26 @@ def __init__(self, api_client=None): "version": "v2", }, params_map={ + "filter_service": { + "openapi_types": (str,), + "attribute": "filter[service]", + "location": "query", + }, + "filter_env": { + "openapi_types": (str,), + "attribute": "filter[env]", + "location": "query", + }, + "filter_identifier": { + "openapi_types": (str,), + "attribute": "filter[identifier]", + "location": "query", + }, + "filter_dry_run": { + "openapi_types": (bool,), + "attribute": "filter[dry_run]", + "location": "query", + }, "page_cursor": { "openapi_types": (str,), "attribute": "page[cursor]", @@ -264,6 +382,119 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_deployment_rule_evaluations_endpoint = _Endpoint( + settings={ + "response_type": (DeploymentGateRuleEvaluationsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/deployment_gates/evaluations/rules", + "operation_id": "list_deployment_rule_evaluations", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_from": { + "openapi_types": (datetime,), + "attribute": "filter[from]", + "location": "query", + }, + "filter_to": { + "openapi_types": (datetime,), + "attribute": "filter[to]", + "location": "query", + }, + "filter_gate_evaluation_id": { + "openapi_types": (UUID,), + "attribute": "filter[gate_evaluation_id]", + "location": "query", + }, + "filter_evaluation_id": { + "openapi_types": (UUID,), + "attribute": "filter[evaluation_id]", + "location": "query", + }, + "filter_gate_id": { + "openapi_types": (UUID,), + "attribute": "filter[gate_id]", + "location": "query", + }, + "filter_rule_id": { + "openapi_types": (UUID,), + "attribute": "filter[rule_id]", + "location": "query", + }, + "filter_service": { + "openapi_types": ([str],), + "attribute": "filter[service]", + "location": "query", + "collection_format": "multi", + }, + "filter_env": { + "openapi_types": ([str],), + "attribute": "filter[env]", + "location": "query", + "collection_format": "multi", + }, + "filter_identifier": { + "openapi_types": ([str],), + "attribute": "filter[identifier]", + "location": "query", + "collection_format": "multi", + }, + "filter_version": { + "openapi_types": ([str],), + "attribute": "filter[version]", + "location": "query", + "collection_format": "multi", + }, + "filter_status": { + "openapi_types": ([DeploymentGatesEvaluationResultResponseAttributesGateStatus],), + "attribute": "filter[status]", + "location": "query", + "collection_format": "multi", + }, + "filter_type": { + "openapi_types": ([DeploymentGateRuleEvaluationType],), + "attribute": "filter[type]", + "location": "query", + "collection_format": "multi", + }, + "filter_dry_run": { + "openapi_types": (bool,), + "attribute": "filter[dry_run]", + "location": "query", + }, + "filter_gate_dry_run": { + "openapi_types": (bool,), + "attribute": "filter[gate_dry_run]", + "location": "query", + }, + "filter_name": { + "openapi_types": ([str],), + "attribute": "filter[name]", + "location": "query", + "collection_format": "multi", + }, + "page_size": { + "validation": { + "inclusive_maximum": 100, + "inclusive_minimum": 1, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_cursor": { + "openapi_types": (str,), + "attribute": "page[cursor]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._trigger_deployment_gates_evaluation_endpoint = _Endpoint( settings={ "response_type": (DeploymentGatesEvaluationResponse,), @@ -495,9 +726,198 @@ def get_deployment_rule( return self._get_deployment_rule_endpoint.call_with_http_info(**kwargs) + def list_deployment_gate_evaluations( + self, + *, + filter_from: Union[datetime, UnsetType] = unset, + filter_to: Union[datetime, UnsetType] = unset, + filter_service: Union[List[str], UnsetType] = unset, + filter_env: Union[List[str], UnsetType] = unset, + filter_identifier: Union[List[str], UnsetType] = unset, + filter_status: Union[List[DeploymentGatesEvaluationResultResponseAttributesGateStatus], UnsetType] = unset, + filter_dry_run: Union[bool, UnsetType] = unset, + filter_evaluation_id: Union[UUID, UnsetType] = unset, + filter_gate_id: Union[UUID, UnsetType] = unset, + filter_version: Union[List[str], UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + page_cursor: Union[str, UnsetType] = unset, + ) -> DeploymentGateEvaluationsResponse: + """List deployment gate evaluations. + + Returns deployment gate evaluations started in a maximum 30-day window (the default is the previous 24 hours). + Results are ordered by start time, newest first. + In-progress state is near-real-time and mutable. Finished state is eventually consistent. + + :param filter_from: Inclusive evaluation start time. Defaults to 24 hours before the request. Together with ``filter[to]`` , the window may span no more than 30 days. + :type filter_from: datetime, optional + :param filter_to: Exclusive evaluation start time. Defaults to the request time. Must be after ``filter[from]`` ; the window may span no more than 30 days. + :type filter_to: datetime, optional + :param filter_service: Service values. Repeated or comma-separated values are combined with OR. + :type filter_service: [str], optional + :param filter_env: Environment values. Repeated or comma-separated values are combined with OR. + :type filter_env: [str], optional + :param filter_identifier: Gate identifier values. Repeated or comma-separated values are combined with OR. + :type filter_identifier: [str], optional + :param filter_status: Gate outcomes. Repeated or comma-separated values are combined with OR. + :type filter_status: [DeploymentGatesEvaluationResultResponseAttributesGateStatus], optional + :param filter_dry_run: Gate-level dry-run state. + :type filter_dry_run: bool, optional + :param filter_evaluation_id: Gate evaluation UUID. No match returns an empty list. + :type filter_evaluation_id: UUID, optional + :param filter_gate_id: Configured gate UUID. Just-in-time evaluations have no gate ID. + :type filter_gate_id: UUID, optional + :param filter_version: Deployment version values. Repeated or comma-separated values are combined with OR. + :type filter_version: [str], optional + :param page_size: Maximum evaluations returned. + :type page_size: int, optional + :param page_cursor: Opaque cursor returned in ``meta.page.next_cursor`` by the previous page. Invalid cursors return 400. + :type page_cursor: str, optional + :rtype: DeploymentGateEvaluationsResponse + """ + kwargs: Dict[str, Any] = {} + if filter_from is not unset: + kwargs["filter_from"] = filter_from + + if filter_to is not unset: + kwargs["filter_to"] = filter_to + + if filter_service is not unset: + kwargs["filter_service"] = filter_service + + if filter_env is not unset: + kwargs["filter_env"] = filter_env + + if filter_identifier is not unset: + kwargs["filter_identifier"] = filter_identifier + + if filter_status is not unset: + kwargs["filter_status"] = filter_status + + if filter_dry_run is not unset: + kwargs["filter_dry_run"] = filter_dry_run + + if filter_evaluation_id is not unset: + kwargs["filter_evaluation_id"] = filter_evaluation_id + + if filter_gate_id is not unset: + kwargs["filter_gate_id"] = filter_gate_id + + if filter_version is not unset: + kwargs["filter_version"] = filter_version + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_cursor is not unset: + kwargs["page_cursor"] = page_cursor + + return self._list_deployment_gate_evaluations_endpoint.call_with_http_info(**kwargs) + + def list_deployment_gate_evaluations_with_pagination( + self, + *, + filter_from: Union[datetime, UnsetType] = unset, + filter_to: Union[datetime, UnsetType] = unset, + filter_service: Union[List[str], UnsetType] = unset, + filter_env: Union[List[str], UnsetType] = unset, + filter_identifier: Union[List[str], UnsetType] = unset, + filter_status: Union[List[DeploymentGatesEvaluationResultResponseAttributesGateStatus], UnsetType] = unset, + filter_dry_run: Union[bool, UnsetType] = unset, + filter_evaluation_id: Union[UUID, UnsetType] = unset, + filter_gate_id: Union[UUID, UnsetType] = unset, + filter_version: Union[List[str], UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + page_cursor: Union[str, UnsetType] = unset, + ) -> collections.abc.Iterable[DeploymentGateEvaluationData]: + """List deployment gate evaluations. + + Provide a paginated version of :meth:`list_deployment_gate_evaluations`, returning all items. + + :param filter_from: Inclusive evaluation start time. Defaults to 24 hours before the request. Together with ``filter[to]`` , the window may span no more than 30 days. + :type filter_from: datetime, optional + :param filter_to: Exclusive evaluation start time. Defaults to the request time. Must be after ``filter[from]`` ; the window may span no more than 30 days. + :type filter_to: datetime, optional + :param filter_service: Service values. Repeated or comma-separated values are combined with OR. + :type filter_service: [str], optional + :param filter_env: Environment values. Repeated or comma-separated values are combined with OR. + :type filter_env: [str], optional + :param filter_identifier: Gate identifier values. Repeated or comma-separated values are combined with OR. + :type filter_identifier: [str], optional + :param filter_status: Gate outcomes. Repeated or comma-separated values are combined with OR. + :type filter_status: [DeploymentGatesEvaluationResultResponseAttributesGateStatus], optional + :param filter_dry_run: Gate-level dry-run state. + :type filter_dry_run: bool, optional + :param filter_evaluation_id: Gate evaluation UUID. No match returns an empty list. + :type filter_evaluation_id: UUID, optional + :param filter_gate_id: Configured gate UUID. Just-in-time evaluations have no gate ID. + :type filter_gate_id: UUID, optional + :param filter_version: Deployment version values. Repeated or comma-separated values are combined with OR. + :type filter_version: [str], optional + :param page_size: Maximum evaluations returned. + :type page_size: int, optional + :param page_cursor: Opaque cursor returned in ``meta.page.next_cursor`` by the previous page. Invalid cursors return 400. + :type page_cursor: str, optional + + :return: A generator of paginated results. + :rtype: collections.abc.Iterable[DeploymentGateEvaluationData] + """ + kwargs: Dict[str, Any] = {} + if filter_from is not unset: + kwargs["filter_from"] = filter_from + + if filter_to is not unset: + kwargs["filter_to"] = filter_to + + if filter_service is not unset: + kwargs["filter_service"] = filter_service + + if filter_env is not unset: + kwargs["filter_env"] = filter_env + + if filter_identifier is not unset: + kwargs["filter_identifier"] = filter_identifier + + if filter_status is not unset: + kwargs["filter_status"] = filter_status + + if filter_dry_run is not unset: + kwargs["filter_dry_run"] = filter_dry_run + + if filter_evaluation_id is not unset: + kwargs["filter_evaluation_id"] = filter_evaluation_id + + if filter_gate_id is not unset: + kwargs["filter_gate_id"] = filter_gate_id + + if filter_version is not unset: + kwargs["filter_version"] = filter_version + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_cursor is not unset: + kwargs["page_cursor"] = page_cursor + + local_page_size = get_attribute_from_path(kwargs, "page_size", 20) + endpoint = self._list_deployment_gate_evaluations_endpoint + set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map) + pagination = { + "limit_value": local_page_size, + "results_path": "data", + "cursor_param": "page_cursor", + "cursor_path": "meta.page.next_cursor", + "endpoint": endpoint, + "kwargs": kwargs, + } + return endpoint.call_with_http_info_paginated(pagination) + def list_deployment_gates( self, *, + filter_service: Union[str, UnsetType] = unset, + filter_env: Union[str, UnsetType] = unset, + filter_identifier: Union[str, UnsetType] = unset, + filter_dry_run: Union[bool, UnsetType] = unset, page_cursor: Union[str, UnsetType] = unset, page_size: Union[int, UnsetType] = unset, ) -> DeploymentGatesListResponse: @@ -506,13 +926,33 @@ def list_deployment_gates( Returns a paginated list of all deployment gates for the organization. Use ``page[cursor]`` and ``page[size]`` query parameters to paginate through results. - :param page_cursor: Cursor for pagination. Use the ``meta.page.next_cursor`` value from the previous response. + :param filter_service: Service name. + :type filter_service: str, optional + :param filter_env: Environment name. + :type filter_env: str, optional + :param filter_identifier: Gate identifier. + :type filter_identifier: str, optional + :param filter_dry_run: Dry-run state. + :type filter_dry_run: bool, optional + :param page_cursor: Cursor for pagination. Use the ``meta.page.next_cursor`` value from the previous response. Invalid cursors return 400. :type page_cursor: str, optional :param page_size: Number of results per page. Defaults to 50. Must be between 1 and 1000. :type page_size: int, optional :rtype: DeploymentGatesListResponse """ kwargs: Dict[str, Any] = {} + if filter_service is not unset: + kwargs["filter_service"] = filter_service + + if filter_env is not unset: + kwargs["filter_env"] = filter_env + + if filter_identifier is not unset: + kwargs["filter_identifier"] = filter_identifier + + if filter_dry_run is not unset: + kwargs["filter_dry_run"] = filter_dry_run + if page_cursor is not unset: kwargs["page_cursor"] = page_cursor @@ -521,6 +961,256 @@ def list_deployment_gates( return self._list_deployment_gates_endpoint.call_with_http_info(**kwargs) + def list_deployment_rule_evaluations( + self, + *, + filter_from: Union[datetime, UnsetType] = unset, + filter_to: Union[datetime, UnsetType] = unset, + filter_gate_evaluation_id: Union[UUID, UnsetType] = unset, + filter_evaluation_id: Union[UUID, UnsetType] = unset, + filter_gate_id: Union[UUID, UnsetType] = unset, + filter_rule_id: Union[UUID, UnsetType] = unset, + filter_service: Union[List[str], UnsetType] = unset, + filter_env: Union[List[str], UnsetType] = unset, + filter_identifier: Union[List[str], UnsetType] = unset, + filter_version: Union[List[str], UnsetType] = unset, + filter_status: Union[List[DeploymentGatesEvaluationResultResponseAttributesGateStatus], UnsetType] = unset, + filter_type: Union[List[DeploymentGateRuleEvaluationType], UnsetType] = unset, + filter_dry_run: Union[bool, UnsetType] = unset, + filter_gate_dry_run: Union[bool, UnsetType] = unset, + filter_name: Union[List[str], UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + page_cursor: Union[str, UnsetType] = unset, + ) -> DeploymentGateRuleEvaluationsResponse: + """List deployment gate rule evaluations. + + Returns rule evaluations whose gate evaluation started in a maximum 30-day window (the default is the previous 24 hours). + Filter by gate, rule, gate evaluation, or rule evaluation ID; omit IDs for cross-evaluation searches. + Results are ordered by start time, newest first. + In-progress state is near-real-time and mutable. Finished state is eventually consistent. + Gate-level and rule-level dry-run states are independent. + Pagination is deterministic but not snapshot isolated; clients should deduplicate by rule evaluation ID. + + :param filter_from: Inclusive gate evaluation start time. Defaults to 24 hours before the request. Together with ``filter[to]`` , the window may span no more than 30 days. + :type filter_from: datetime, optional + :param filter_to: Exclusive gate evaluation start time. Defaults to the request time. Must be after ``filter[from]`` ; the window may span no more than 30 days. + :type filter_to: datetime, optional + :param filter_gate_evaluation_id: Gate evaluation UUID. No match returns an empty list. + :type filter_gate_evaluation_id: UUID, optional + :param filter_evaluation_id: Rule evaluation UUID. No match returns an empty list. + :type filter_evaluation_id: UUID, optional + :param filter_gate_id: Configured gate UUID. Just-in-time evaluations have no gate ID. + :type filter_gate_id: UUID, optional + :param filter_rule_id: Configured rule UUID. Just-in-time rules have no rule ID. + :type filter_rule_id: UUID, optional + :param filter_service: Evaluated service values. Repeated or comma-separated values are combined with OR. + :type filter_service: [str], optional + :param filter_env: Evaluated environment values. Repeated or comma-separated values are combined with OR. + :type filter_env: [str], optional + :param filter_identifier: Gate identifier values. Repeated or comma-separated values are combined with OR. + :type filter_identifier: [str], optional + :param filter_version: Evaluated deployment version values. Repeated or comma-separated values are combined with OR. + :type filter_version: [str], optional + :param filter_status: Rule statuses. Repeated or comma-separated values are combined with OR. + :type filter_status: [DeploymentGatesEvaluationResultResponseAttributesGateStatus], optional + :param filter_type: Rule types. Repeated or comma-separated values are combined with OR. + Defaults to all rule types. + :type filter_type: [DeploymentGateRuleEvaluationType], optional + :param filter_dry_run: Rule-level dry-run state. A failed dry-run rule is ignored when computing the gate outcome. + :type filter_dry_run: bool, optional + :param filter_gate_dry_run: Gate-level dry-run state. A failed dry-run gate blocks but does not stop deployment. + :type filter_gate_dry_run: bool, optional + :param filter_name: Rule names. Repeated or comma-separated values are combined with OR. + :type filter_name: [str], optional + :param page_size: Maximum rule evaluations returned. + :type page_size: int, optional + :param page_cursor: Opaque cursor returned in ``meta.page.next_cursor`` by the previous page. Invalid cursors return 400. + :type page_cursor: str, optional + :rtype: DeploymentGateRuleEvaluationsResponse + """ + kwargs: Dict[str, Any] = {} + if filter_from is not unset: + kwargs["filter_from"] = filter_from + + if filter_to is not unset: + kwargs["filter_to"] = filter_to + + if filter_gate_evaluation_id is not unset: + kwargs["filter_gate_evaluation_id"] = filter_gate_evaluation_id + + if filter_evaluation_id is not unset: + kwargs["filter_evaluation_id"] = filter_evaluation_id + + if filter_gate_id is not unset: + kwargs["filter_gate_id"] = filter_gate_id + + if filter_rule_id is not unset: + kwargs["filter_rule_id"] = filter_rule_id + + if filter_service is not unset: + kwargs["filter_service"] = filter_service + + if filter_env is not unset: + kwargs["filter_env"] = filter_env + + if filter_identifier is not unset: + kwargs["filter_identifier"] = filter_identifier + + if filter_version is not unset: + kwargs["filter_version"] = filter_version + + if filter_status is not unset: + kwargs["filter_status"] = filter_status + + if filter_type is not unset: + kwargs["filter_type"] = filter_type + + if filter_dry_run is not unset: + kwargs["filter_dry_run"] = filter_dry_run + + if filter_gate_dry_run is not unset: + kwargs["filter_gate_dry_run"] = filter_gate_dry_run + + if filter_name is not unset: + kwargs["filter_name"] = filter_name + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_cursor is not unset: + kwargs["page_cursor"] = page_cursor + + return self._list_deployment_rule_evaluations_endpoint.call_with_http_info(**kwargs) + + def list_deployment_rule_evaluations_with_pagination( + self, + *, + filter_from: Union[datetime, UnsetType] = unset, + filter_to: Union[datetime, UnsetType] = unset, + filter_gate_evaluation_id: Union[UUID, UnsetType] = unset, + filter_evaluation_id: Union[UUID, UnsetType] = unset, + filter_gate_id: Union[UUID, UnsetType] = unset, + filter_rule_id: Union[UUID, UnsetType] = unset, + filter_service: Union[List[str], UnsetType] = unset, + filter_env: Union[List[str], UnsetType] = unset, + filter_identifier: Union[List[str], UnsetType] = unset, + filter_version: Union[List[str], UnsetType] = unset, + filter_status: Union[List[DeploymentGatesEvaluationResultResponseAttributesGateStatus], UnsetType] = unset, + filter_type: Union[List[DeploymentGateRuleEvaluationType], UnsetType] = unset, + filter_dry_run: Union[bool, UnsetType] = unset, + filter_gate_dry_run: Union[bool, UnsetType] = unset, + filter_name: Union[List[str], UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + page_cursor: Union[str, UnsetType] = unset, + ) -> collections.abc.Iterable[DeploymentGateRuleEvaluationData]: + """List deployment gate rule evaluations. + + Provide a paginated version of :meth:`list_deployment_rule_evaluations`, returning all items. + + :param filter_from: Inclusive gate evaluation start time. Defaults to 24 hours before the request. Together with ``filter[to]`` , the window may span no more than 30 days. + :type filter_from: datetime, optional + :param filter_to: Exclusive gate evaluation start time. Defaults to the request time. Must be after ``filter[from]`` ; the window may span no more than 30 days. + :type filter_to: datetime, optional + :param filter_gate_evaluation_id: Gate evaluation UUID. No match returns an empty list. + :type filter_gate_evaluation_id: UUID, optional + :param filter_evaluation_id: Rule evaluation UUID. No match returns an empty list. + :type filter_evaluation_id: UUID, optional + :param filter_gate_id: Configured gate UUID. Just-in-time evaluations have no gate ID. + :type filter_gate_id: UUID, optional + :param filter_rule_id: Configured rule UUID. Just-in-time rules have no rule ID. + :type filter_rule_id: UUID, optional + :param filter_service: Evaluated service values. Repeated or comma-separated values are combined with OR. + :type filter_service: [str], optional + :param filter_env: Evaluated environment values. Repeated or comma-separated values are combined with OR. + :type filter_env: [str], optional + :param filter_identifier: Gate identifier values. Repeated or comma-separated values are combined with OR. + :type filter_identifier: [str], optional + :param filter_version: Evaluated deployment version values. Repeated or comma-separated values are combined with OR. + :type filter_version: [str], optional + :param filter_status: Rule statuses. Repeated or comma-separated values are combined with OR. + :type filter_status: [DeploymentGatesEvaluationResultResponseAttributesGateStatus], optional + :param filter_type: Rule types. Repeated or comma-separated values are combined with OR. + Defaults to all rule types. + :type filter_type: [DeploymentGateRuleEvaluationType], optional + :param filter_dry_run: Rule-level dry-run state. A failed dry-run rule is ignored when computing the gate outcome. + :type filter_dry_run: bool, optional + :param filter_gate_dry_run: Gate-level dry-run state. A failed dry-run gate blocks but does not stop deployment. + :type filter_gate_dry_run: bool, optional + :param filter_name: Rule names. Repeated or comma-separated values are combined with OR. + :type filter_name: [str], optional + :param page_size: Maximum rule evaluations returned. + :type page_size: int, optional + :param page_cursor: Opaque cursor returned in ``meta.page.next_cursor`` by the previous page. Invalid cursors return 400. + :type page_cursor: str, optional + + :return: A generator of paginated results. + :rtype: collections.abc.Iterable[DeploymentGateRuleEvaluationData] + """ + kwargs: Dict[str, Any] = {} + if filter_from is not unset: + kwargs["filter_from"] = filter_from + + if filter_to is not unset: + kwargs["filter_to"] = filter_to + + if filter_gate_evaluation_id is not unset: + kwargs["filter_gate_evaluation_id"] = filter_gate_evaluation_id + + if filter_evaluation_id is not unset: + kwargs["filter_evaluation_id"] = filter_evaluation_id + + if filter_gate_id is not unset: + kwargs["filter_gate_id"] = filter_gate_id + + if filter_rule_id is not unset: + kwargs["filter_rule_id"] = filter_rule_id + + if filter_service is not unset: + kwargs["filter_service"] = filter_service + + if filter_env is not unset: + kwargs["filter_env"] = filter_env + + if filter_identifier is not unset: + kwargs["filter_identifier"] = filter_identifier + + if filter_version is not unset: + kwargs["filter_version"] = filter_version + + if filter_status is not unset: + kwargs["filter_status"] = filter_status + + if filter_type is not unset: + kwargs["filter_type"] = filter_type + + if filter_dry_run is not unset: + kwargs["filter_dry_run"] = filter_dry_run + + if filter_gate_dry_run is not unset: + kwargs["filter_gate_dry_run"] = filter_gate_dry_run + + if filter_name is not unset: + kwargs["filter_name"] = filter_name + + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_cursor is not unset: + kwargs["page_cursor"] = page_cursor + + local_page_size = get_attribute_from_path(kwargs, "page_size", 50) + endpoint = self._list_deployment_rule_evaluations_endpoint + set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map) + pagination = { + "limit_value": local_page_size, + "results_path": "data", + "cursor_param": "page_cursor", + "cursor_path": "meta.page.next_cursor", + "endpoint": endpoint, + "kwargs": kwargs, + } + return endpoint.call_with_http_info_paginated(pagination) + def trigger_deployment_gates_evaluation( self, body: DeploymentGatesEvaluationRequest, diff --git a/src/datadog_api_client/v2/model/deployment_gate_evaluation_attributes.py b/src/datadog_api_client/v2/model/deployment_gate_evaluation_attributes.py new file mode 100644 index 0000000000..4c507adeaf --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_evaluation_attributes.py @@ -0,0 +1,125 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gates_evaluation_result_response_attributes_gate_status import ( + DeploymentGatesEvaluationResultResponseAttributesGateStatus, + ) + + +class DeploymentGateEvaluationAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gates_evaluation_result_response_attributes_gate_status import ( + DeploymentGatesEvaluationResultResponseAttributesGateStatus, + ) + + return { + "dry_run": (bool,), + "duration_seconds": (int, none_type), + "env": (str,), + "evaluation_id": (UUID,), + "finished_at": (datetime, none_type), + "gate_id": (UUID, none_type), + "identifier": (str,), + "service": (str,), + "started_at": (datetime,), + "status": (DeploymentGatesEvaluationResultResponseAttributesGateStatus,), + "version": (str,), + } + + attribute_map = { + "dry_run": "dry_run", + "duration_seconds": "duration_seconds", + "env": "env", + "evaluation_id": "evaluation_id", + "finished_at": "finished_at", + "gate_id": "gate_id", + "identifier": "identifier", + "service": "service", + "started_at": "started_at", + "status": "status", + "version": "version", + } + + def __init__( + self_, + dry_run: bool, + duration_seconds: Union[int, none_type], + env: str, + evaluation_id: UUID, + finished_at: Union[datetime, none_type], + gate_id: Union[UUID, none_type], + identifier: str, + service: str, + started_at: datetime, + status: DeploymentGatesEvaluationResultResponseAttributesGateStatus, + version: str, + **kwargs, + ): + """ + Attributes of a deployment gate evaluation. + + :param dry_run: Whether this evaluation used gate-level dry run. + :type dry_run: bool + + :param duration_seconds: Evaluation duration in seconds. Null while it is in progress. + :type duration_seconds: int, none_type + + :param env: Deployment environment evaluated by the gate. + :type env: str + + :param evaluation_id: Gate evaluation UUID. Matches the resource ``id``. + :type evaluation_id: UUID + + :param finished_at: Time the evaluation finished. Null while it is in progress. + :type finished_at: datetime, none_type + + :param gate_id: Configured deployment gate UUID. Null for just-in-time evaluations. + :type gate_id: UUID, none_type + + :param identifier: Deployment gate identifier. + :type identifier: str + + :param service: Service evaluated by the deployment gate. + :type service: str + + :param started_at: Time the evaluation started. + :type started_at: datetime + + :param status: The recorded result of a gate or rule evaluation. + + * ``in_progress`` : The evaluation is still running. + * ``pass`` : All rules passed successfully. + * ``fail`` : One or more rules did not pass. + :type status: DeploymentGatesEvaluationResultResponseAttributesGateStatus + + :param version: Evaluated deployment version. Empty when no version was provided. + :type version: str + """ + super().__init__(kwargs) + + self_.dry_run = dry_run + self_.duration_seconds = duration_seconds + self_.env = env + self_.evaluation_id = evaluation_id + self_.finished_at = finished_at + self_.gate_id = gate_id + self_.identifier = identifier + self_.service = service + self_.started_at = started_at + self_.status = status + self_.version = version diff --git a/src/datadog_api_client/v2/model/deployment_gate_evaluation_data.py b/src/datadog_api_client/v2/model/deployment_gate_evaluation_data.py new file mode 100644 index 0000000000..6ed33a33ce --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_evaluation_data.py @@ -0,0 +1,61 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_evaluation_attributes import DeploymentGateEvaluationAttributes + from datadog_api_client.v2.model.deployment_gate_evaluation_data_type import DeploymentGateEvaluationDataType + + +class DeploymentGateEvaluationData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_evaluation_attributes import DeploymentGateEvaluationAttributes + from datadog_api_client.v2.model.deployment_gate_evaluation_data_type import DeploymentGateEvaluationDataType + + return { + "attributes": (DeploymentGateEvaluationAttributes,), + "id": (UUID,), + "type": (DeploymentGateEvaluationDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: DeploymentGateEvaluationAttributes, + id: UUID, + type: DeploymentGateEvaluationDataType, + **kwargs, + ): + """ + JSON:API deployment gate evaluation resource. + + :param attributes: Attributes of a deployment gate evaluation. + :type attributes: DeploymentGateEvaluationAttributes + + :param id: Deployment gate evaluation UUID. + :type id: UUID + + :param type: JSON:API type for a deployment gate evaluation. + :type type: DeploymentGateEvaluationDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_gate_evaluation_data_type.py b/src/datadog_api_client/v2/model/deployment_gate_evaluation_data_type.py new file mode 100644 index 0000000000..cb5f93dc73 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_evaluation_data_type.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentGateEvaluationDataType(ModelSimple): + """ + JSON:API type for a deployment gate evaluation. + + :param value: If omitted defaults to "deployment_gate_evaluation". Must be one of ["deployment_gate_evaluation"]. + :type value: str + """ + + allowed_values = { + "deployment_gate_evaluation", + } + DEPLOYMENT_GATE_EVALUATION: ClassVar["DeploymentGateEvaluationDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentGateEvaluationDataType.DEPLOYMENT_GATE_EVALUATION = DeploymentGateEvaluationDataType( + "deployment_gate_evaluation" +) diff --git a/src/datadog_api_client/v2/model/deployment_gate_evaluation_list_meta.py b/src/datadog_api_client/v2/model/deployment_gate_evaluation_list_meta.py new file mode 100644 index 0000000000..e78f3ef0be --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_evaluation_list_meta.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_evaluation_page import DeploymentGateEvaluationPage + + +class DeploymentGateEvaluationListMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_evaluation_page import DeploymentGateEvaluationPage + + return { + "page": (DeploymentGateEvaluationPage,), + } + + attribute_map = { + "page": "page", + } + + def __init__(self_, page: DeploymentGateEvaluationPage, **kwargs): + """ + Pagination metadata. + + :param page: Cursor pagination information. + :type page: DeploymentGateEvaluationPage + """ + super().__init__(kwargs) + + self_.page = page diff --git a/src/datadog_api_client/v2/model/deployment_gate_evaluation_page.py b/src/datadog_api_client/v2/model/deployment_gate_evaluation_page.py new file mode 100644 index 0000000000..58fea158d5 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_evaluation_page.py @@ -0,0 +1,50 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentGateEvaluationPage(ModelNormal): + validations = { + "size": { + "inclusive_maximum": 100, + "inclusive_minimum": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "next_cursor": (str,), + "size": (int,), + } + + attribute_map = { + "next_cursor": "next_cursor", + "size": "size", + } + + def __init__(self_, size: int, next_cursor: Union[str, UnsetType] = unset, **kwargs): + """ + Cursor pagination information. + + :param next_cursor: Opaque cursor for the next page. Absent on the final page. + :type next_cursor: str, optional + + :param size: Requested maximum number of resources in this page. + :type size: int + """ + if next_cursor is not unset: + kwargs["next_cursor"] = next_cursor + super().__init__(kwargs) + + self_.size = size diff --git a/src/datadog_api_client/v2/model/deployment_gate_evaluations_response.py b/src/datadog_api_client/v2/model/deployment_gate_evaluations_response.py new file mode 100644 index 0000000000..34ed19fb56 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_evaluations_response.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_evaluation_data import DeploymentGateEvaluationData + from datadog_api_client.v2.model.deployment_gate_evaluation_list_meta import DeploymentGateEvaluationListMeta + + +class DeploymentGateEvaluationsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_evaluation_data import DeploymentGateEvaluationData + from datadog_api_client.v2.model.deployment_gate_evaluation_list_meta import DeploymentGateEvaluationListMeta + + return { + "data": ([DeploymentGateEvaluationData],), + "meta": (DeploymentGateEvaluationListMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__(self_, data: List[DeploymentGateEvaluationData], meta: DeploymentGateEvaluationListMeta, **kwargs): + """ + Paginated deployment gate evaluations. + + :param data: + :type data: [DeploymentGateEvaluationData] + + :param meta: Pagination metadata. + :type meta: DeploymentGateEvaluationListMeta + """ + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_attributes.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_attributes.py new file mode 100644 index 0000000000..e027ee3752 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_attributes.py @@ -0,0 +1,193 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_configuration import ( + DeploymentGateRuleEvaluationConfiguration, + ) + from datadog_api_client.v2.model.deployment_gate_rule_failures import DeploymentGateRuleFailures + from datadog_api_client.v2.model.deployment_gates_evaluation_result_response_attributes_gate_status import ( + DeploymentGatesEvaluationResultResponseAttributesGateStatus, + ) + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_type import DeploymentGateRuleEvaluationType + + +class DeploymentGateRuleEvaluationAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_configuration import ( + DeploymentGateRuleEvaluationConfiguration, + ) + from datadog_api_client.v2.model.deployment_gate_rule_failures import DeploymentGateRuleFailures + from datadog_api_client.v2.model.deployment_gates_evaluation_result_response_attributes_gate_status import ( + DeploymentGatesEvaluationResultResponseAttributesGateStatus, + ) + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_type import DeploymentGateRuleEvaluationType + + return { + "configuration": (DeploymentGateRuleEvaluationConfiguration,), + "dry_run": (bool,), + "duration_seconds": (int, none_type), + "env": (str,), + "evaluation_id": (UUID,), + "failures": (DeploymentGateRuleFailures,), + "finished_at": (datetime, none_type), + "gate_dry_run": (bool,), + "gate_evaluation_id": (UUID,), + "gate_id": (UUID, none_type), + "identifier": (str,), + "name": (str,), + "reason": (str,), + "rule_id": (UUID, none_type), + "service": (str,), + "started_at": (datetime,), + "status": (DeploymentGatesEvaluationResultResponseAttributesGateStatus,), + "type": (DeploymentGateRuleEvaluationType,), + "version": (str,), + } + + attribute_map = { + "configuration": "configuration", + "dry_run": "dry_run", + "duration_seconds": "duration_seconds", + "env": "env", + "evaluation_id": "evaluation_id", + "failures": "failures", + "finished_at": "finished_at", + "gate_dry_run": "gate_dry_run", + "gate_evaluation_id": "gate_evaluation_id", + "gate_id": "gate_id", + "identifier": "identifier", + "name": "name", + "reason": "reason", + "rule_id": "rule_id", + "service": "service", + "started_at": "started_at", + "status": "status", + "type": "type", + "version": "version", + } + + def __init__( + self_, + configuration: DeploymentGateRuleEvaluationConfiguration, + dry_run: bool, + duration_seconds: Union[int, none_type], + env: str, + evaluation_id: UUID, + failures: DeploymentGateRuleFailures, + finished_at: Union[datetime, none_type], + gate_dry_run: bool, + gate_evaluation_id: UUID, + gate_id: Union[UUID, none_type], + identifier: str, + name: str, + reason: str, + rule_id: Union[UUID, none_type], + service: str, + started_at: datetime, + status: DeploymentGatesEvaluationResultResponseAttributesGateStatus, + type: DeploymentGateRuleEvaluationType, + version: str, + **kwargs, + ): + """ + Attributes of a deployment gate rule evaluation. + + :param configuration: Evaluated rule configuration. Fields depend on rule type and unset fields are omitted. + Monitor rules can include ``duration`` , ``query`` , ``monitor_ids`` , ``warmup`` , ``fail_on_no_groups_found`` , and ``fail_on_no_data``. + Faulty deployment detection rules can include ``duration`` , ``allowed_resources`` , and ``excluded_resources``. + :type configuration: DeploymentGateRuleEvaluationConfiguration + + :param dry_run: Whether this rule is non-enforcing. A failed dry-run rule is ignored when computing the gate outcome. Independent of ``gate_dry_run``. + :type dry_run: bool + + :param duration_seconds: Rule evaluation duration in seconds. Null while it is in progress. + :type duration_seconds: int, none_type + + :param env: Evaluated environment. + :type env: str + + :param evaluation_id: Rule evaluation UUID. Matches the resource ``id``. + :type evaluation_id: UUID + + :param failures: Rule failure details. + :type failures: DeploymentGateRuleFailures + + :param finished_at: Time the rule evaluation finished. Null while it is in progress. + :type finished_at: datetime, none_type + + :param gate_dry_run: Whether the parent gate is dry-run. A failed dry-run gate blocks but does not stop deployment. Independent of rule-level ``dry_run``. + :type gate_dry_run: bool + + :param gate_evaluation_id: Deployment gate evaluation UUID. + :type gate_evaluation_id: UUID + + :param gate_id: Configured deployment gate UUID. Null for just-in-time evaluations. + :type gate_id: UUID, none_type + + :param identifier: Deployment gate identifier. + :type identifier: str + + :param name: Rule name. + :type name: str + + :param reason: Reason for the rule result. + :type reason: str + + :param rule_id: Configured deployment rule UUID. Null for just-in-time rules. + :type rule_id: UUID, none_type + + :param service: Evaluated service. + :type service: str + + :param started_at: Time the rule evaluation started. + :type started_at: datetime + + :param status: The recorded result of a gate or rule evaluation. + + * ``in_progress`` : The evaluation is still running. + * ``pass`` : All rules passed successfully. + * ``fail`` : One or more rules did not pass. + :type status: DeploymentGatesEvaluationResultResponseAttributesGateStatus + + :param type: Type of deployment gate rule. + :type type: DeploymentGateRuleEvaluationType + + :param version: Evaluated deployment version. Empty when no version was provided. + :type version: str + """ + super().__init__(kwargs) + + self_.configuration = configuration + self_.dry_run = dry_run + self_.duration_seconds = duration_seconds + self_.env = env + self_.evaluation_id = evaluation_id + self_.failures = failures + self_.finished_at = finished_at + self_.gate_dry_run = gate_dry_run + self_.gate_evaluation_id = gate_evaluation_id + self_.gate_id = gate_id + self_.identifier = identifier + self_.name = name + self_.reason = reason + self_.rule_id = rule_id + self_.service = service + self_.started_at = started_at + self_.status = status + self_.type = type + self_.version = version diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_configuration.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_configuration.py new file mode 100644 index 0000000000..ec0e0192a8 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_configuration.py @@ -0,0 +1,102 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DeploymentGateRuleEvaluationConfiguration(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "allowed_resources": ([str],), + "duration": (int,), + "excluded_resources": ([str],), + "fail_on_no_data": (bool,), + "fail_on_no_groups_found": (bool,), + "monitor_ids": ([str],), + "query": (str,), + "warmup": (int,), + } + + attribute_map = { + "allowed_resources": "allowed_resources", + "duration": "duration", + "excluded_resources": "excluded_resources", + "fail_on_no_data": "fail_on_no_data", + "fail_on_no_groups_found": "fail_on_no_groups_found", + "monitor_ids": "monitor_ids", + "query": "query", + "warmup": "warmup", + } + + def __init__( + self_, + allowed_resources: Union[List[str], UnsetType] = unset, + duration: Union[int, UnsetType] = unset, + excluded_resources: Union[List[str], UnsetType] = unset, + fail_on_no_data: Union[bool, UnsetType] = unset, + fail_on_no_groups_found: Union[bool, UnsetType] = unset, + monitor_ids: Union[List[str], UnsetType] = unset, + query: Union[str, UnsetType] = unset, + warmup: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Evaluated rule configuration. Fields depend on rule type and unset fields are omitted. + Monitor rules can include ``duration`` , ``query`` , ``monitor_ids`` , ``warmup`` , ``fail_on_no_groups_found`` , and ``fail_on_no_data``. + Faulty deployment detection rules can include ``duration`` , ``allowed_resources`` , and ``excluded_resources``. + + :param allowed_resources: APM resources explicitly allowed by faulty deployment detection. + :type allowed_resources: [str], optional + + :param duration: Evaluation duration configured for this rule. + :type duration: int, optional + + :param excluded_resources: APM resources excluded from faulty deployment detection. + :type excluded_resources: [str], optional + + :param fail_on_no_data: Whether a monitor rule fails when no data is found. + :type fail_on_no_data: bool, optional + + :param fail_on_no_groups_found: Whether a monitor rule fails when no groups are found. + :type fail_on_no_groups_found: bool, optional + + :param monitor_ids: Monitor IDs evaluated by a monitor rule. + :type monitor_ids: [str], optional + + :param query: Monitor query used by a monitor rule. + :type query: str, optional + + :param warmup: Warm-up duration in seconds for a monitor rule. Omitted when zero. + :type warmup: int, optional + """ + if allowed_resources is not unset: + kwargs["allowed_resources"] = allowed_resources + if duration is not unset: + kwargs["duration"] = duration + if excluded_resources is not unset: + kwargs["excluded_resources"] = excluded_resources + if fail_on_no_data is not unset: + kwargs["fail_on_no_data"] = fail_on_no_data + if fail_on_no_groups_found is not unset: + kwargs["fail_on_no_groups_found"] = fail_on_no_groups_found + if monitor_ids is not unset: + kwargs["monitor_ids"] = monitor_ids + if query is not unset: + kwargs["query"] = query + if warmup is not unset: + kwargs["warmup"] = warmup + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_data.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_data.py new file mode 100644 index 0000000000..9d99507a2b --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_data.py @@ -0,0 +1,69 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_attributes import ( + DeploymentGateRuleEvaluationAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data_type import ( + DeploymentGateRuleEvaluationDataType, + ) + + +class DeploymentGateRuleEvaluationData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_attributes import ( + DeploymentGateRuleEvaluationAttributes, + ) + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data_type import ( + DeploymentGateRuleEvaluationDataType, + ) + + return { + "attributes": (DeploymentGateRuleEvaluationAttributes,), + "id": (UUID,), + "type": (DeploymentGateRuleEvaluationDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: DeploymentGateRuleEvaluationAttributes, + id: UUID, + type: DeploymentGateRuleEvaluationDataType, + **kwargs, + ): + """ + JSON:API deployment gate rule evaluation resource. + + :param attributes: Attributes of a deployment gate rule evaluation. + :type attributes: DeploymentGateRuleEvaluationAttributes + + :param id: Rule evaluation UUID. + :type id: UUID + + :param type: JSON:API type for a deployment gate rule evaluation. + :type type: DeploymentGateRuleEvaluationDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_data_type.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_data_type.py new file mode 100644 index 0000000000..a44954d0e3 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_data_type.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentGateRuleEvaluationDataType(ModelSimple): + """ + JSON:API type for a deployment gate rule evaluation. + + :param value: If omitted defaults to "deployment_gate_rule_evaluation". Must be one of ["deployment_gate_rule_evaluation"]. + :type value: str + """ + + allowed_values = { + "deployment_gate_rule_evaluation", + } + DEPLOYMENT_GATE_RULE_EVALUATION: ClassVar["DeploymentGateRuleEvaluationDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentGateRuleEvaluationDataType.DEPLOYMENT_GATE_RULE_EVALUATION = DeploymentGateRuleEvaluationDataType( + "deployment_gate_rule_evaluation" +) diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py new file mode 100644 index 0000000000..4b52656a3b --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluation_type.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DeploymentGateRuleEvaluationType(ModelSimple): + """ + Type of deployment gate rule. + + :param value: Must be one of ["monitor", "faulty_deployment_detection"]. + :type value: str + """ + + allowed_values = { + "monitor", + "faulty_deployment_detection", + } + MONITOR: ClassVar["DeploymentGateRuleEvaluationType"] + FAULTY_DEPLOYMENT_DETECTION: ClassVar["DeploymentGateRuleEvaluationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DeploymentGateRuleEvaluationType.MONITOR = DeploymentGateRuleEvaluationType("monitor") +DeploymentGateRuleEvaluationType.FAULTY_DEPLOYMENT_DETECTION = DeploymentGateRuleEvaluationType( + "faulty_deployment_detection" +) diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_evaluations_response.py b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluations_response.py new file mode 100644 index 0000000000..47d08dc28c --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_evaluations_response.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data import DeploymentGateRuleEvaluationData + from datadog_api_client.v2.model.deployment_gate_evaluation_list_meta import DeploymentGateEvaluationListMeta + + +class DeploymentGateRuleEvaluationsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data import DeploymentGateRuleEvaluationData + from datadog_api_client.v2.model.deployment_gate_evaluation_list_meta import DeploymentGateEvaluationListMeta + + return { + "data": ([DeploymentGateRuleEvaluationData],), + "meta": (DeploymentGateEvaluationListMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__(self_, data: List[DeploymentGateRuleEvaluationData], meta: DeploymentGateEvaluationListMeta, **kwargs): + """ + Paginated deployment gate rule evaluations. + + :param data: + :type data: [DeploymentGateRuleEvaluationData] + + :param meta: Pagination metadata. + :type meta: DeploymentGateEvaluationListMeta + """ + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_failure_monitor.py b/src/datadog_api_client/v2/model/deployment_gate_rule_failure_monitor.py new file mode 100644 index 0000000000..07349fea03 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_failure_monitor.py @@ -0,0 +1,45 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class DeploymentGateRuleFailureMonitor(ModelNormal): + @cached_property + def openapi_types(_): + return { + "id": (str,), + "state": (str,), + "url": (str,), + } + + attribute_map = { + "id": "id", + "state": "state", + "url": "url", + } + + def __init__(self_, id: str, state: str, url: str, **kwargs): + """ + Failed monitor reference. + + :param id: Monitor ID. + :type id: str + + :param state: Monitor state that caused the failure. + :type state: str + + :param url: URL for inspecting the monitor during the evaluation window. + :type url: str + """ + super().__init__(kwargs) + + self_.id = id + self_.state = state + self_.url = url diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_failure_narrative.py b/src/datadog_api_client/v2/model/deployment_gate_rule_failure_narrative.py new file mode 100644 index 0000000000..e2c78d5735 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_failure_narrative.py @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class DeploymentGateRuleFailureNarrative(ModelNormal): + @cached_property + def openapi_types(_): + return { + "hostgroup": (str,), + "id": (str,), + } + + attribute_map = { + "hostgroup": "hostgroup", + "id": "id", + } + + def __init__(self_, hostgroup: str, id: str, **kwargs): + """ + Faulty deployment detection narrative reference. + + :param hostgroup: Host group associated with the narrative. + :type hostgroup: str + + :param id: Narrative ID. + :type id: str + """ + super().__init__(kwargs) + + self_.hostgroup = hostgroup + self_.id = id diff --git a/src/datadog_api_client/v2/model/deployment_gate_rule_failures.py b/src/datadog_api_client/v2/model/deployment_gate_rule_failures.py new file mode 100644 index 0000000000..ad83613b55 --- /dev/null +++ b/src/datadog_api_client/v2/model/deployment_gate_rule_failures.py @@ -0,0 +1,62 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.deployment_gate_rule_failure_monitor import DeploymentGateRuleFailureMonitor + from datadog_api_client.v2.model.deployment_gate_rule_failure_narrative import DeploymentGateRuleFailureNarrative + + +class DeploymentGateRuleFailures(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.deployment_gate_rule_failure_monitor import DeploymentGateRuleFailureMonitor + from datadog_api_client.v2.model.deployment_gate_rule_failure_narrative import ( + DeploymentGateRuleFailureNarrative, + ) + + return { + "faulty_apm_resources": ([str],), + "monitors": ([DeploymentGateRuleFailureMonitor],), + "narratives": ([DeploymentGateRuleFailureNarrative],), + } + + attribute_map = { + "faulty_apm_resources": "faulty_apm_resources", + "monitors": "monitors", + "narratives": "narratives", + } + + def __init__( + self_, + faulty_apm_resources: List[str], + monitors: List[DeploymentGateRuleFailureMonitor], + narratives: List[DeploymentGateRuleFailureNarrative], + **kwargs, + ): + """ + Rule failure details. + + :param faulty_apm_resources: Names of faulty APM resources. + :type faulty_apm_resources: [str] + + :param monitors: + :type monitors: [DeploymentGateRuleFailureMonitor] + + :param narratives: + :type narratives: [DeploymentGateRuleFailureNarrative] + """ + super().__init__(kwargs) + + self_.faulty_apm_resources = faulty_apm_resources + self_.monitors = monitors + self_.narratives = narratives diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 6347854124..be7f23c911 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2714,6 +2714,12 @@ from datadog_api_client.v2.model.deployment import Deployment from datadog_api_client.v2.model.deployment_attributes import DeploymentAttributes from datadog_api_client.v2.model.deployment_gate_data_type import DeploymentGateDataType +from datadog_api_client.v2.model.deployment_gate_evaluation_attributes import DeploymentGateEvaluationAttributes +from datadog_api_client.v2.model.deployment_gate_evaluation_data import DeploymentGateEvaluationData +from datadog_api_client.v2.model.deployment_gate_evaluation_data_type import DeploymentGateEvaluationDataType +from datadog_api_client.v2.model.deployment_gate_evaluation_list_meta import DeploymentGateEvaluationListMeta +from datadog_api_client.v2.model.deployment_gate_evaluation_page import DeploymentGateEvaluationPage +from datadog_api_client.v2.model.deployment_gate_evaluations_response import DeploymentGateEvaluationsResponse from datadog_api_client.v2.model.deployment_gate_response import DeploymentGateResponse from datadog_api_client.v2.model.deployment_gate_response_data import DeploymentGateResponseData from datadog_api_client.v2.model.deployment_gate_response_data_attributes import DeploymentGateResponseDataAttributes @@ -2723,6 +2729,19 @@ from datadog_api_client.v2.model.deployment_gate_response_data_attributes_updated_by import ( DeploymentGateResponseDataAttributesUpdatedBy, ) +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_attributes import ( + DeploymentGateRuleEvaluationAttributes, +) +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_configuration import ( + DeploymentGateRuleEvaluationConfiguration, +) +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data import DeploymentGateRuleEvaluationData +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_data_type import DeploymentGateRuleEvaluationDataType +from datadog_api_client.v2.model.deployment_gate_rule_evaluation_type import DeploymentGateRuleEvaluationType +from datadog_api_client.v2.model.deployment_gate_rule_evaluations_response import DeploymentGateRuleEvaluationsResponse +from datadog_api_client.v2.model.deployment_gate_rule_failure_monitor import DeploymentGateRuleFailureMonitor +from datadog_api_client.v2.model.deployment_gate_rule_failure_narrative import DeploymentGateRuleFailureNarrative +from datadog_api_client.v2.model.deployment_gate_rule_failures import DeploymentGateRuleFailures from datadog_api_client.v2.model.deployment_gate_rules_response import DeploymentGateRulesResponse from datadog_api_client.v2.model.deployment_gates_evaluation_configuration import DeploymentGatesEvaluationConfiguration from datadog_api_client.v2.model.deployment_gates_evaluation_request import DeploymentGatesEvaluationRequest @@ -14580,11 +14599,26 @@ "Deployment", "DeploymentAttributes", "DeploymentGateDataType", + "DeploymentGateEvaluationAttributes", + "DeploymentGateEvaluationData", + "DeploymentGateEvaluationDataType", + "DeploymentGateEvaluationListMeta", + "DeploymentGateEvaluationPage", + "DeploymentGateEvaluationsResponse", "DeploymentGateResponse", "DeploymentGateResponseData", "DeploymentGateResponseDataAttributes", "DeploymentGateResponseDataAttributesCreatedBy", "DeploymentGateResponseDataAttributesUpdatedBy", + "DeploymentGateRuleEvaluationAttributes", + "DeploymentGateRuleEvaluationConfiguration", + "DeploymentGateRuleEvaluationData", + "DeploymentGateRuleEvaluationDataType", + "DeploymentGateRuleEvaluationType", + "DeploymentGateRuleEvaluationsResponse", + "DeploymentGateRuleFailureMonitor", + "DeploymentGateRuleFailureNarrative", + "DeploymentGateRuleFailures", "DeploymentGateRulesResponse", "DeploymentGatesEvaluationConfiguration", "DeploymentGatesEvaluationRequest", diff --git a/tests/v2/features/deployment_gates.feature b/tests/v2/features/deployment_gates.feature index 7037aacc3c..90df4cad68 100644 --- a/tests/v2/features/deployment_gates.feature +++ b/tests/v2/features/deployment_gates.feature @@ -313,6 +313,48 @@ Feature: Deployment Gates When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/ci-app-backend + Scenario: List deployment gate evaluations returns "Bad request." response + Given operation "ListDeploymentGateEvaluations" enabled + And new "ListDeploymentGateEvaluations" request + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: List deployment gate evaluations returns "OK" response + Given operation "ListDeploymentGateEvaluations" enabled + And new "ListDeploymentGateEvaluations" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/ci-app-backend @with-pagination + Scenario: List deployment gate evaluations returns "OK" response with pagination + Given operation "ListDeploymentGateEvaluations" enabled + And new "ListDeploymentGateEvaluations" request + When the request with pagination is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: List deployment gate rule evaluations returns "Bad request." response + Given operation "ListDeploymentRuleEvaluations" enabled + And new "ListDeploymentRuleEvaluations" request + When the request is sent + Then the response status is 400 Bad request. + + @generated @skip @team:ddoghq/ci-app-backend + Scenario: List deployment gate rule evaluations returns "OK" response + Given operation "ListDeploymentRuleEvaluations" enabled + And new "ListDeploymentRuleEvaluations" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:ddoghq/ci-app-backend @with-pagination + Scenario: List deployment gate rule evaluations returns "OK" response with pagination + Given operation "ListDeploymentRuleEvaluations" enabled + And new "ListDeploymentRuleEvaluations" request + When the request with pagination is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/ci-app-backend Scenario: Trigger a deployment gate evaluation returns "Accepted" response Given operation "TriggerDeploymentGatesEvaluation" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 3c60ae2cd5..e91c6c62c9 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2563,6 +2563,18 @@ "type": "unsafe" } }, + "ListDeploymentGateEvaluations": { + "tag": "Deployment Gates", + "undo": { + "type": "safe" + } + }, + "ListDeploymentRuleEvaluations": { + "tag": "Deployment Gates", + "undo": { + "type": "safe" + } + }, "GetDeploymentGateRules": { "tag": "Deployment Gates", "undo": {