From a625a5bf1fd202bf7b31a24acbd32c90ab3d82a4 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 12 May 2025 09:40:55 +0000 Subject: [PATCH] Regenerate client from commit c4d0aeef of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 341 +++++++++++++++++ docs/datadog_api_client.v2.api.rst | 7 + docs/datadog_api_client.v2.model.rst | 63 +++ .../on-call-paging/AcknowledgeOnCallPage.py | 14 + .../v2/on-call-paging/CreateOnCallPage.py | 37 ++ .../v2/on-call-paging/EscalateOnCallPage.py | 14 + .../v2/on-call-paging/ResolveOnCallPage.py | 14 + .../v2/api/on_call_paging_api.py | 358 ++++++++++++++++++ src/datadog_api_client/v2/apis/__init__.py | 2 + .../v2/model/create_page_request.py | 42 ++ .../v2/model/create_page_request_data.py | 56 +++ .../create_page_request_data_attributes.py | 82 ++++ ...ate_page_request_data_attributes_target.py | 43 +++ .../v2/model/create_page_request_data_type.py | 35 ++ .../v2/model/create_page_response.py | 42 ++ .../v2/model/create_page_response_data.py | 49 +++ .../model/create_page_response_data_type.py | 35 ++ .../v2/model/page_urgency.py | 38 ++ src/datadog_api_client/v2/models/__init__.py | 18 + tests/v2/features/on-call_paging.feature | 38 ++ tests/v2/features/undo.json | 28 ++ 22 files changed, 1360 insertions(+), 4 deletions(-) create mode 100644 examples/v2/on-call-paging/AcknowledgeOnCallPage.py create mode 100644 examples/v2/on-call-paging/CreateOnCallPage.py create mode 100644 examples/v2/on-call-paging/EscalateOnCallPage.py create mode 100644 examples/v2/on-call-paging/ResolveOnCallPage.py create mode 100644 src/datadog_api_client/v2/api/on_call_paging_api.py create mode 100644 src/datadog_api_client/v2/model/create_page_request.py create mode 100644 src/datadog_api_client/v2/model/create_page_request_data.py create mode 100644 src/datadog_api_client/v2/model/create_page_request_data_attributes.py create mode 100644 src/datadog_api_client/v2/model/create_page_request_data_attributes_target.py create mode 100644 src/datadog_api_client/v2/model/create_page_request_data_type.py create mode 100644 src/datadog_api_client/v2/model/create_page_response.py create mode 100644 src/datadog_api_client/v2/model/create_page_response_data.py create mode 100644 src/datadog_api_client/v2/model/create_page_response_data_type.py create mode 100644 src/datadog_api_client/v2/model/page_urgency.py create mode 100644 tests/v2/features/on-call_paging.feature diff --git a/.apigentools-info b/.apigentools-info index 7a70ee4a62..213b21e574 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-09 19:42:44.655290", - "spec_repo_commit": "c7bad6f6" + "regenerated": "2025-05-12 09:40:13.024429", + "spec_repo_commit": "c4d0aeef" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-09 19:42:44.706830", - "spec_repo_commit": "c7bad6f6" + "regenerated": "2025-05-12 09:40:13.041082", + "spec_repo_commit": "c4d0aeef" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 537d23fc71..cd58a11bc0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9471,6 +9471,108 @@ components: id: $ref: '#/components/schemas/ApiID' type: object + CreatePageRequest: + description: Full request to trigger an On-Call Page. + example: + data: + attributes: + description: Page details. + tags: + - service:test + target: + identifier: my-team + type: team_handle + title: Page title + urgency: low + type: pages + properties: + data: + $ref: '#/components/schemas/CreatePageRequestData' + type: object + CreatePageRequestData: + description: The main request body, including attributes and resource type. + properties: + attributes: + $ref: '#/components/schemas/CreatePageRequestDataAttributes' + type: + $ref: '#/components/schemas/CreatePageRequestDataType' + required: + - type + type: object + CreatePageRequestDataAttributes: + description: Details about the On-Call Page you want to create. + properties: + description: + description: A short summary of the issue or context. + type: string + tags: + description: Tags to help categorize or filter the page. + items: + type: string + type: array + target: + $ref: '#/components/schemas/CreatePageRequestDataAttributesTarget' + title: + description: The title of the page. + example: 'Service: Test is down' + type: string + urgency: + $ref: '#/components/schemas/PageUrgency' + required: + - target + - title + - urgency + type: object + CreatePageRequestDataAttributesTarget: + description: Information about the target to notify (such as a team or user). + properties: + identifier: + description: A unique ID for the target (for example, team handle or user + UUID). + type: string + type: + description: The kind of target, `team_uuid` | `team_handle` | `user_uuid`. + type: string + type: object + CreatePageRequestDataType: + default: pages + description: The type of resource used when creating an On-Call Page. + enum: + - pages + example: pages + type: string + x-enum-varnames: + - PAGES + CreatePageResponse: + description: The full response object after creating a new On-Call Page. + example: + data: + id: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + type: pages + properties: + data: + $ref: '#/components/schemas/CreatePageResponseData' + type: object + CreatePageResponseData: + description: The information returned after successfully creating a page. + properties: + id: + description: The unique ID of the created page. + type: string + type: + $ref: '#/components/schemas/CreatePageResponseDataType' + required: + - type + type: object + CreatePageResponseDataType: + default: pages + description: The type of resource used when creating an On-Call Page. + enum: + - pages + example: pages + type: string + x-enum-varnames: + - PAGES CreateRuleRequest: description: Scorecard create rule request. properties: @@ -27104,6 +27206,17 @@ components: - ARRAY_NUMBER - ARRAY_BOOLEAN - ARRAY_OBJECT + PageUrgency: + default: high + description: On-Call Page urgency level. + enum: + - low + - high + example: high + type: string + x-enum-varnames: + - LOW + - HIGH Pagination: description: Pagination object. properties: @@ -38863,6 +38976,7 @@ components: - low - high - dynamic + example: low type: string x-enum-varnames: - LOW @@ -51416,6 +51530,227 @@ paths: operator: AND permissions: - on_call_write + /api/v2/on-call/pages: + post: + description: 'Trigger a new On-Call Page. + + ' + operationId: CreateOnCallPage + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePageRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePageResponse' + description: OK. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Create On-Call Page + tags: + - On-Call Paging + /api/v2/on-call/pages/{page_id}/acknowledge: + post: + description: 'Acknowledges an On-Call Page. + + ' + operationId: AcknowledgeOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + responses: + '202': + description: Accepted. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Acknowledge On-Call Page + tags: + - On-Call Paging + /api/v2/on-call/pages/{page_id}/escalate: + post: + description: 'Escalates an On-Call Page. + + ' + operationId: EscalateOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + responses: + '202': + description: Accepted. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Escalate On-Call Page + tags: + - On-Call Paging + /api/v2/on-call/pages/{page_id}/resolve: + post: + description: 'Resolves an On-Call Page. + + ' + operationId: ResolveOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + responses: + '202': + description: Accepted. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Resolve On-Call Page + tags: + - On-Call Paging /api/v2/on-call/schedules: post: description: Create a new on-call schedule @@ -61556,6 +61891,12 @@ tags: externalDocs: url: https://docs.datadoghq.com/service_management/on-call/ name: On-Call +- description: 'Trigger and manage [Datadog On-Call](https://docs.datadoghq.com/service_management/on-call/) + + pages directly through the Datadog API.' + externalDocs: + url: https://docs.datadoghq.com/service_management/on-call/ + name: On-Call Paging - description: 'Configure your [Datadog Opsgenie integration](https://docs.datadoghq.com/integrations/opsgenie/) directly through the Datadog API.' diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index 126a48c009..105b7ea3a8 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -326,6 +326,13 @@ datadog\_api\_client.v2.api.on\_call\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.on\_call\_paging\_api module +-------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.on_call_paging_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.opsgenie\_integration\_api module ------------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 87b9e927ce..27c5916c53 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -3714,6 +3714,62 @@ datadog\_api\_client.v2.model.create\_open\_api\_response\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.create\_page\_request module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_request\_data module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_request\_data\_attributes module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_request_data_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_request\_data\_attributes\_target module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.create_page_request_data_attributes_target + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_request\_data\_type module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_request_data_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_response module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_response\_data module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_page\_response\_data\_type module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_page_response_data_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_rule\_request module ---------------------------------------------------------- @@ -11631,6 +11687,13 @@ datadog\_api\_client.v2.model.output\_schema\_parameters\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.page\_urgency module +-------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.page_urgency + :members: + :show-inheritance: + datadog\_api\_client.v2.model.pagination module ----------------------------------------------- diff --git a/examples/v2/on-call-paging/AcknowledgeOnCallPage.py b/examples/v2/on-call-paging/AcknowledgeOnCallPage.py new file mode 100644 index 0000000000..30589c1cb9 --- /dev/null +++ b/examples/v2/on-call-paging/AcknowledgeOnCallPage.py @@ -0,0 +1,14 @@ +""" +Acknowledge On-Call Page returns "Accepted." response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_paging_api import OnCallPagingApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OnCallPagingApi(api_client) + api_instance.acknowledge_on_call_page( + page_id=UUID("15e74b8b-f865-48d0-bcc5-453323ed2c8f"), + ) diff --git a/examples/v2/on-call-paging/CreateOnCallPage.py b/examples/v2/on-call-paging/CreateOnCallPage.py new file mode 100644 index 0000000000..441d565341 --- /dev/null +++ b/examples/v2/on-call-paging/CreateOnCallPage.py @@ -0,0 +1,37 @@ +""" +Create On-Call Page returns "OK." response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_paging_api import OnCallPagingApi +from datadog_api_client.v2.model.create_page_request import CreatePageRequest +from datadog_api_client.v2.model.create_page_request_data import CreatePageRequestData +from datadog_api_client.v2.model.create_page_request_data_attributes import CreatePageRequestDataAttributes +from datadog_api_client.v2.model.create_page_request_data_attributes_target import CreatePageRequestDataAttributesTarget +from datadog_api_client.v2.model.create_page_request_data_type import CreatePageRequestDataType +from datadog_api_client.v2.model.page_urgency import PageUrgency + +body = CreatePageRequest( + data=CreatePageRequestData( + attributes=CreatePageRequestDataAttributes( + description="Page details.", + tags=[ + "service:test", + ], + target=CreatePageRequestDataAttributesTarget( + identifier="my-team", + type="team_handle", + ), + title="Page title", + urgency=PageUrgency.LOW, + ), + type=CreatePageRequestDataType.PAGES, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OnCallPagingApi(api_client) + response = api_instance.create_on_call_page(body=body) + + print(response) diff --git a/examples/v2/on-call-paging/EscalateOnCallPage.py b/examples/v2/on-call-paging/EscalateOnCallPage.py new file mode 100644 index 0000000000..f9ed286ad6 --- /dev/null +++ b/examples/v2/on-call-paging/EscalateOnCallPage.py @@ -0,0 +1,14 @@ +""" +Escalate On-Call Page returns "Accepted." response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_paging_api import OnCallPagingApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OnCallPagingApi(api_client) + api_instance.escalate_on_call_page( + page_id=UUID("15e74b8b-f865-48d0-bcc5-453323ed2c8f"), + ) diff --git a/examples/v2/on-call-paging/ResolveOnCallPage.py b/examples/v2/on-call-paging/ResolveOnCallPage.py new file mode 100644 index 0000000000..16efec57bc --- /dev/null +++ b/examples/v2/on-call-paging/ResolveOnCallPage.py @@ -0,0 +1,14 @@ +""" +Resolve On-Call Page returns "Accepted." response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.on_call_paging_api import OnCallPagingApi +from uuid import UUID + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = OnCallPagingApi(api_client) + api_instance.resolve_on_call_page( + page_id=UUID("15e74b8b-f865-48d0-bcc5-453323ed2c8f"), + ) diff --git a/src/datadog_api_client/v2/api/on_call_paging_api.py b/src/datadog_api_client/v2/api/on_call_paging_api.py new file mode 100644 index 0000000000..7736dcd386 --- /dev/null +++ b/src/datadog_api_client/v2/api/on_call_paging_api.py @@ -0,0 +1,358 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UUID, +) +from datadog_api_client.v2.model.create_page_response import CreatePageResponse +from datadog_api_client.v2.model.create_page_request import CreatePageRequest + + +class OnCallPagingApi: + """ + Trigger and manage `Datadog On-Call `_ + pages directly through the Datadog API. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._acknowledge_on_call_page_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/pages/{page_id}/acknowledge", + "operation_id": "acknowledge_on_call_page", + "http_method": "POST", + "version": "v2", + "servers": [ + { + "url": "https://{site}", + "variables": { + "site": { + "description": "The globally available endpoint for On-Call.", + "default_value": "navy.oncall.datadoghq.com", + "enum_values": [ + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu", + ], + }, + }, + }, + { + "url": "{protocol}://{name}", + "variables": { + "name": { + "description": "Full site DNS name.", + "default_value": "api.datadoghq.com", + }, + "protocol": { + "description": "The protocol for accessing the API.", + "default_value": "https", + }, + }, + }, + { + "url": "https://{subdomain}.{site}", + "variables": { + "site": { + "description": "Any Datadog deployment.", + "default_value": "datadoghq.com", + }, + "subdomain": { + "description": "The subdomain where the API is deployed.", + "default_value": "api", + }, + }, + }, + ], + }, + params_map={ + "page_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "page_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._create_on_call_page_endpoint = _Endpoint( + settings={ + "response_type": (CreatePageResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/pages", + "operation_id": "create_on_call_page", + "http_method": "POST", + "version": "v2", + "servers": [ + { + "url": "https://{site}", + "variables": { + "site": { + "description": "The globally available endpoint for On-Call.", + "default_value": "navy.oncall.datadoghq.com", + "enum_values": [ + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu", + ], + }, + }, + }, + { + "url": "{protocol}://{name}", + "variables": { + "name": { + "description": "Full site DNS name.", + "default_value": "api.datadoghq.com", + }, + "protocol": { + "description": "The protocol for accessing the API.", + "default_value": "https", + }, + }, + }, + { + "url": "https://{subdomain}.{site}", + "variables": { + "site": { + "description": "Any Datadog deployment.", + "default_value": "datadoghq.com", + }, + "subdomain": { + "description": "The subdomain where the API is deployed.", + "default_value": "api", + }, + }, + }, + ], + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CreatePageRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._escalate_on_call_page_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/pages/{page_id}/escalate", + "operation_id": "escalate_on_call_page", + "http_method": "POST", + "version": "v2", + "servers": [ + { + "url": "https://{site}", + "variables": { + "site": { + "description": "The globally available endpoint for On-Call.", + "default_value": "navy.oncall.datadoghq.com", + "enum_values": [ + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu", + ], + }, + }, + }, + { + "url": "{protocol}://{name}", + "variables": { + "name": { + "description": "Full site DNS name.", + "default_value": "api.datadoghq.com", + }, + "protocol": { + "description": "The protocol for accessing the API.", + "default_value": "https", + }, + }, + }, + { + "url": "https://{subdomain}.{site}", + "variables": { + "site": { + "description": "Any Datadog deployment.", + "default_value": "datadoghq.com", + }, + "subdomain": { + "description": "The subdomain where the API is deployed.", + "default_value": "api", + }, + }, + }, + ], + }, + params_map={ + "page_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "page_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + self._resolve_on_call_page_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/on-call/pages/{page_id}/resolve", + "operation_id": "resolve_on_call_page", + "http_method": "POST", + "version": "v2", + "servers": [ + { + "url": "https://{site}", + "variables": { + "site": { + "description": "The globally available endpoint for On-Call.", + "default_value": "navy.oncall.datadoghq.com", + "enum_values": [ + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu", + ], + }, + }, + }, + { + "url": "{protocol}://{name}", + "variables": { + "name": { + "description": "Full site DNS name.", + "default_value": "api.datadoghq.com", + }, + "protocol": { + "description": "The protocol for accessing the API.", + "default_value": "https", + }, + }, + }, + { + "url": "https://{subdomain}.{site}", + "variables": { + "site": { + "description": "Any Datadog deployment.", + "default_value": "datadoghq.com", + }, + "subdomain": { + "description": "The subdomain where the API is deployed.", + "default_value": "api", + }, + }, + }, + ], + }, + params_map={ + "page_id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "page_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + + def acknowledge_on_call_page( + self, + page_id: UUID, + ) -> None: + """Acknowledge On-Call Page. + + Acknowledges an On-Call Page. + + :param page_id: The page ID. + :type page_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["page_id"] = page_id + + return self._acknowledge_on_call_page_endpoint.call_with_http_info(**kwargs) + + def create_on_call_page( + self, + body: CreatePageRequest, + ) -> CreatePageResponse: + """Create On-Call Page. + + Trigger a new On-Call Page. + + :type body: CreatePageRequest + :rtype: CreatePageResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_on_call_page_endpoint.call_with_http_info(**kwargs) + + def escalate_on_call_page( + self, + page_id: UUID, + ) -> None: + """Escalate On-Call Page. + + Escalates an On-Call Page. + + :param page_id: The page ID. + :type page_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["page_id"] = page_id + + return self._escalate_on_call_page_endpoint.call_with_http_info(**kwargs) + + def resolve_on_call_page( + self, + page_id: UUID, + ) -> None: + """Resolve On-Call Page. + + Resolves an On-Call Page. + + :param page_id: The page ID. + :type page_id: UUID + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["page_id"] = page_id + + return self._resolve_on_call_page_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index d4783b9a14..241e856db3 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -44,6 +44,7 @@ from datadog_api_client.v2.api.observability_pipelines_api import ObservabilityPipelinesApi from datadog_api_client.v2.api.okta_integration_api import OktaIntegrationApi from datadog_api_client.v2.api.on_call_api import OnCallApi +from datadog_api_client.v2.api.on_call_paging_api import OnCallPagingApi from datadog_api_client.v2.api.opsgenie_integration_api import OpsgenieIntegrationApi from datadog_api_client.v2.api.organizations_api import OrganizationsApi from datadog_api_client.v2.api.powerpack_api import PowerpackApi @@ -116,6 +117,7 @@ "ObservabilityPipelinesApi", "OktaIntegrationApi", "OnCallApi", + "OnCallPagingApi", "OpsgenieIntegrationApi", "OrganizationsApi", "PowerpackApi", diff --git a/src/datadog_api_client/v2/model/create_page_request.py b/src/datadog_api_client/v2/model/create_page_request.py new file mode 100644 index 0000000000..e02c256797 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_page_request_data import CreatePageRequestData + + +class CreatePageRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_page_request_data import CreatePageRequestData + + return { + "data": (CreatePageRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CreatePageRequestData, UnsetType] = unset, **kwargs): + """ + Full request to trigger an On-Call Page. + + :param data: The main request body, including attributes and resource type. + :type data: CreatePageRequestData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/create_page_request_data.py b/src/datadog_api_client/v2/model/create_page_request_data.py new file mode 100644 index 0000000000..2dc6c7945e --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_request_data.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_page_request_data_attributes import CreatePageRequestDataAttributes + from datadog_api_client.v2.model.create_page_request_data_type import CreatePageRequestDataType + + +class CreatePageRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_page_request_data_attributes import CreatePageRequestDataAttributes + from datadog_api_client.v2.model.create_page_request_data_type import CreatePageRequestDataType + + return { + "attributes": (CreatePageRequestDataAttributes,), + "type": (CreatePageRequestDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + type: CreatePageRequestDataType, + attributes: Union[CreatePageRequestDataAttributes, UnsetType] = unset, + **kwargs, + ): + """ + The main request body, including attributes and resource type. + + :param attributes: Details about the On-Call Page you want to create. + :type attributes: CreatePageRequestDataAttributes, optional + + :param type: The type of resource used when creating an On-Call Page. + :type type: CreatePageRequestDataType + """ + if attributes is not unset: + kwargs["attributes"] = attributes + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_page_request_data_attributes.py b/src/datadog_api_client/v2/model/create_page_request_data_attributes.py new file mode 100644 index 0000000000..ed9064d9ff --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_request_data_attributes.py @@ -0,0 +1,82 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_page_request_data_attributes_target import ( + CreatePageRequestDataAttributesTarget, + ) + from datadog_api_client.v2.model.page_urgency import PageUrgency + + +class CreatePageRequestDataAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_page_request_data_attributes_target import ( + CreatePageRequestDataAttributesTarget, + ) + from datadog_api_client.v2.model.page_urgency import PageUrgency + + return { + "description": (str,), + "tags": ([str],), + "target": (CreatePageRequestDataAttributesTarget,), + "title": (str,), + "urgency": (PageUrgency,), + } + + attribute_map = { + "description": "description", + "tags": "tags", + "target": "target", + "title": "title", + "urgency": "urgency", + } + + def __init__( + self_, + target: CreatePageRequestDataAttributesTarget, + title: str, + urgency: PageUrgency, + description: Union[str, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Details about the On-Call Page you want to create. + + :param description: A short summary of the issue or context. + :type description: str, optional + + :param tags: Tags to help categorize or filter the page. + :type tags: [str], optional + + :param target: Information about the target to notify (such as a team or user). + :type target: CreatePageRequestDataAttributesTarget + + :param title: The title of the page. + :type title: str + + :param urgency: On-Call Page urgency level. + :type urgency: PageUrgency + """ + if description is not unset: + kwargs["description"] = description + if tags is not unset: + kwargs["tags"] = tags + super().__init__(kwargs) + + self_.target = target + self_.title = title + self_.urgency = urgency diff --git a/src/datadog_api_client/v2/model/create_page_request_data_attributes_target.py b/src/datadog_api_client/v2/model/create_page_request_data_attributes_target.py new file mode 100644 index 0000000000..dab8d6b0ad --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_request_data_attributes_target.py @@ -0,0 +1,43 @@ +# 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 CreatePageRequestDataAttributesTarget(ModelNormal): + @cached_property + def openapi_types(_): + return { + "identifier": (str,), + "type": (str,), + } + + attribute_map = { + "identifier": "identifier", + "type": "type", + } + + def __init__(self_, identifier: Union[str, UnsetType] = unset, type: Union[str, UnsetType] = unset, **kwargs): + """ + Information about the target to notify (such as a team or user). + + :param identifier: A unique ID for the target (for example, team handle or user UUID). + :type identifier: str, optional + + :param type: The kind of target, ``team_uuid`` | ``team_handle`` | ``user_uuid``. + :type type: str, optional + """ + if identifier is not unset: + kwargs["identifier"] = identifier + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/create_page_request_data_type.py b/src/datadog_api_client/v2/model/create_page_request_data_type.py new file mode 100644 index 0000000000..58e99a4d29 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_request_data_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CreatePageRequestDataType(ModelSimple): + """ + The type of resource used when creating an On-Call Page. + + :param value: If omitted defaults to "pages". Must be one of ["pages"]. + :type value: str + """ + + allowed_values = { + "pages", + } + PAGES: ClassVar["CreatePageRequestDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CreatePageRequestDataType.PAGES = CreatePageRequestDataType("pages") diff --git a/src/datadog_api_client/v2/model/create_page_response.py b/src/datadog_api_client/v2/model/create_page_response.py new file mode 100644 index 0000000000..72e4ea4a6e --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_response.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_page_response_data import CreatePageResponseData + + +class CreatePageResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_page_response_data import CreatePageResponseData + + return { + "data": (CreatePageResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[CreatePageResponseData, UnsetType] = unset, **kwargs): + """ + The full response object after creating a new On-Call Page. + + :param data: The information returned after successfully creating a page. + :type data: CreatePageResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/create_page_response_data.py b/src/datadog_api_client/v2/model/create_page_response_data.py new file mode 100644 index 0000000000..42cc90e630 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_response_data.py @@ -0,0 +1,49 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_page_response_data_type import CreatePageResponseDataType + + +class CreatePageResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_page_response_data_type import CreatePageResponseDataType + + return { + "id": (str,), + "type": (CreatePageResponseDataType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, type: CreatePageResponseDataType, id: Union[str, UnsetType] = unset, **kwargs): + """ + The information returned after successfully creating a page. + + :param id: The unique ID of the created page. + :type id: str, optional + + :param type: The type of resource used when creating an On-Call Page. + :type type: CreatePageResponseDataType + """ + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_page_response_data_type.py b/src/datadog_api_client/v2/model/create_page_response_data_type.py new file mode 100644 index 0000000000..d4280c385d --- /dev/null +++ b/src/datadog_api_client/v2/model/create_page_response_data_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CreatePageResponseDataType(ModelSimple): + """ + The type of resource used when creating an On-Call Page. + + :param value: If omitted defaults to "pages". Must be one of ["pages"]. + :type value: str + """ + + allowed_values = { + "pages", + } + PAGES: ClassVar["CreatePageResponseDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CreatePageResponseDataType.PAGES = CreatePageResponseDataType("pages") diff --git a/src/datadog_api_client/v2/model/page_urgency.py b/src/datadog_api_client/v2/model/page_urgency.py new file mode 100644 index 0000000000..b7353aee89 --- /dev/null +++ b/src/datadog_api_client/v2/model/page_urgency.py @@ -0,0 +1,38 @@ +# 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 PageUrgency(ModelSimple): + """ + On-Call Page urgency level. + + :param value: If omitted defaults to "high". Must be one of ["low", "high"]. + :type value: str + """ + + allowed_values = { + "low", + "high", + } + LOW: ClassVar["PageUrgency"] + HIGH: ClassVar["PageUrgency"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PageUrgency.LOW = PageUrgency("low") +PageUrgency.HIGH = PageUrgency("high") diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 7bbc02c184..8ce0bf2b47 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -694,6 +694,14 @@ from datadog_api_client.v2.model.create_open_api_response import CreateOpenAPIResponse from datadog_api_client.v2.model.create_open_api_response_attributes import CreateOpenAPIResponseAttributes from datadog_api_client.v2.model.create_open_api_response_data import CreateOpenAPIResponseData +from datadog_api_client.v2.model.create_page_request import CreatePageRequest +from datadog_api_client.v2.model.create_page_request_data import CreatePageRequestData +from datadog_api_client.v2.model.create_page_request_data_attributes import CreatePageRequestDataAttributes +from datadog_api_client.v2.model.create_page_request_data_attributes_target import CreatePageRequestDataAttributesTarget +from datadog_api_client.v2.model.create_page_request_data_type import CreatePageRequestDataType +from datadog_api_client.v2.model.create_page_response import CreatePageResponse +from datadog_api_client.v2.model.create_page_response_data import CreatePageResponseData +from datadog_api_client.v2.model.create_page_response_data_type import CreatePageResponseDataType from datadog_api_client.v2.model.create_rule_request import CreateRuleRequest from datadog_api_client.v2.model.create_rule_request_data import CreateRuleRequestData from datadog_api_client.v2.model.create_rule_response import CreateRuleResponse @@ -2375,6 +2383,7 @@ from datadog_api_client.v2.model.output_schema import OutputSchema from datadog_api_client.v2.model.output_schema_parameters import OutputSchemaParameters from datadog_api_client.v2.model.output_schema_parameters_type import OutputSchemaParametersType +from datadog_api_client.v2.model.page_urgency import PageUrgency from datadog_api_client.v2.model.pagination import Pagination from datadog_api_client.v2.model.parameter import Parameter from datadog_api_client.v2.model.partial_api_key import PartialAPIKey @@ -3982,6 +3991,14 @@ "CreateOpenAPIResponse", "CreateOpenAPIResponseAttributes", "CreateOpenAPIResponseData", + "CreatePageRequest", + "CreatePageRequestData", + "CreatePageRequestDataAttributes", + "CreatePageRequestDataAttributesTarget", + "CreatePageRequestDataType", + "CreatePageResponse", + "CreatePageResponseData", + "CreatePageResponseDataType", "CreateRuleRequest", "CreateRuleRequestData", "CreateRuleResponse", @@ -5113,6 +5130,7 @@ "OutputSchema", "OutputSchemaParameters", "OutputSchemaParametersType", + "PageUrgency", "Pagination", "Parameter", "PartialAPIKey", diff --git a/tests/v2/features/on-call_paging.feature b/tests/v2/features/on-call_paging.feature new file mode 100644 index 0000000000..69221bff41 --- /dev/null +++ b/tests/v2/features/on-call_paging.feature @@ -0,0 +1,38 @@ +@endpoint(on-call-paging) @endpoint(on-call-paging-v2) +Feature: On-Call Paging + Trigger and manage [Datadog On- + Call](https://docs.datadoghq.com/service_management/on-call/) pages + directly through the Datadog API. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "On-CallPaging" API + + @generated @skip @team:DataDog/bugle + Scenario: Acknowledge On-Call Page returns "Accepted." response + Given new "AcknowledgeOnCallPage" request + And request contains "page_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted. + + @generated @skip @team:DataDog/bugle + Scenario: Create On-Call Page returns "OK." response + Given new "CreateOnCallPage" request + And body with value {"data": {"attributes": {"description": "Page details.", "tags": ["service:test"], "target": {"identifier": "my-team", "type": "team_handle"}, "title": "Page title", "urgency": "low"}, "type": "pages"}} + When the request is sent + Then the response status is 200 OK. + + @generated @skip @team:DataDog/bugle + Scenario: Escalate On-Call Page returns "Accepted." response + Given new "EscalateOnCallPage" request + And request contains "page_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted. + + @generated @skip @team:DataDog/bugle + Scenario: Resolve On-Call Page returns "Accepted." response + Given new "ResolveOnCallPage" request + And request contains "page_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 202 Accepted. diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index aad61cf15e..2b53228c62 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1884,6 +1884,34 @@ "type": "idempotent" } }, + "CreateOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, + "AcknowledgeOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, + "EscalateOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, + "ResolveOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, "CreateOnCallSchedule": { "tag": "On-Call", "undo": {