From d77f0cbced7d9b3a98cb531e5944d66db03fdeba Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 6 May 2025 14:32:36 +0000 Subject: [PATCH] Regenerate client from commit 381bcc9e of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 408 +++++++++++++ .../on-call-paging/AcknowledgeOnCallPage.ts | 21 + .../v2/on-call-paging/CreateOnCallPage.ts | 35 ++ .../v2/on-call-paging/EscalateOnCallPage.ts | 21 + .../v2/on-call-paging/ResolveOnCallPage.ts | 21 + features/support/scenarios_model_mapping.ts | 28 + features/v2/on-call_paging.feature | 38 ++ features/v2/undo.json | 32 + packages/datadog-api-client-common/servers.ts | 104 ++++ .../apis/OnCallPagingApi.ts | 556 ++++++++++++++++++ packages/datadog-api-client-v2/index.ts | 16 + .../models/CreatePageRequest.ts | 53 ++ .../models/CreatePageRequestData.ts | 63 ++ .../models/CreatePageRequestDataAttributes.ts | 88 +++ .../CreatePageRequestDataAttributesTarget.ts | 60 ++ .../models/CreatePageRequestDataType.ts | 14 + .../models/CreatePageResponse.ts | 53 ++ .../models/CreatePageResponseData.ts | 62 ++ .../models/CreatePageResponseDataType.ts | 14 + .../models/ObjectSerializer.ts | 14 + 21 files changed, 1705 insertions(+), 4 deletions(-) create mode 100644 examples/v2/on-call-paging/AcknowledgeOnCallPage.ts create mode 100644 examples/v2/on-call-paging/CreateOnCallPage.ts create mode 100644 examples/v2/on-call-paging/EscalateOnCallPage.ts create mode 100644 examples/v2/on-call-paging/ResolveOnCallPage.ts create mode 100644 features/v2/on-call_paging.feature create mode 100644 packages/datadog-api-client-v2/apis/OnCallPagingApi.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageRequest.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageRequestData.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageRequestDataAttributes.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageRequestDataAttributesTarget.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageRequestDataType.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageResponse.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageResponseData.ts create mode 100644 packages/datadog-api-client-v2/models/CreatePageResponseDataType.ts diff --git a/.apigentools-info b/.apigentools-info index edf5be690a9..998812a2774 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 09:33:55.870850", - "spec_repo_commit": "77cf469a" + "regenerated": "2025-05-06 14:30:53.693323", + "spec_repo_commit": "381bcc9e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 09:33:55.887059", - "spec_repo_commit": "77cf469a" + "regenerated": "2025-05-06 14:30:53.709426", + "spec_repo_commit": "381bcc9e" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 37a8f69d15c..e5dba27869a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9200,6 +9200,111 @@ 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: + description: The level of urgency for the alert. Possible value `low` or + `high`. + example: high + type: string + 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: @@ -51309,6 +51414,303 @@ paths: summary: Update on-call escalation policy tags: - On-Call + /api/v2/on-call/pages: + post: + description: 'Trigger a new On-Call Page. + + + Note: This endpoint may be available even if the corresponding Datadog site + is unavailable. + + + | Datadog Site | On-Call Paging endpoint | + + |---------------|----------------------------------------------------------------------------------| + + | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages | + + | EU | `POST` https://beige.oncall.datadoghq.com/api/v2/on-call/pages/ | + + | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/ | + + | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/ | + + | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/ | + + ' + 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. + + + Note: This endpoint may be available even if the corresponding Datadog site + is unavailable. + + + | Datadog Site | On-Call Paging endpoint | + + |---------------|---------------------------------------------------------------------------------------------------| + + | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + + | EU | `POST` https://beige.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + + | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + + | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + + | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + + ' + 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. + + + Note: This endpoint may be available even if the corresponding Datadog site + is unavailable. + + + | Datadog Site | On-Call Paging endpoint | + + |---------------|---------------------------------------------------------------------------------------------------| + + | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + + | EU | `POST` https://beige.oncall.datadoghq.eu/api/v2/on-call/pages/{page_id}/escalate | + + | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + + | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + + | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + + ' + 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. + + + Note: This endpoint may be available even if the corresponding Datadog site + is unavailable. + + + | Datadog Site | On-Call Paging endpoint | + + |---------------|---------------------------------------------------------------------------------------------------| + + | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + + | EU | `POST` https://beige.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + + | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + + | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + + | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + + ' + 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 @@ -61295,6 +61697,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/examples/v2/on-call-paging/AcknowledgeOnCallPage.ts b/examples/v2/on-call-paging/AcknowledgeOnCallPage.ts new file mode 100644 index 00000000000..d38860adc76 --- /dev/null +++ b/examples/v2/on-call-paging/AcknowledgeOnCallPage.ts @@ -0,0 +1,21 @@ +/** + * Acknowledge On-Call Page returns "Accepted." response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallPagingApi(configuration); + +const params: v2.OnCallPagingApiAcknowledgeOnCallPageRequest = { + pageId: "15e74b8b-f865-48d0-bcc5-453323ed2c8f", +}; + +apiInstance + .acknowledgeOnCallPage(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call-paging/CreateOnCallPage.ts b/examples/v2/on-call-paging/CreateOnCallPage.ts new file mode 100644 index 00000000000..b87984ecf5e --- /dev/null +++ b/examples/v2/on-call-paging/CreateOnCallPage.ts @@ -0,0 +1,35 @@ +/** + * Create On-Call Page returns "OK." response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallPagingApi(configuration); + +const params: v2.OnCallPagingApiCreateOnCallPageRequest = { + body: { + data: { + attributes: { + description: "Page details.", + tags: ["service:test"], + target: { + identifier: "my-team", + type: "team_handle", + }, + title: "Page title", + urgency: "low", + }, + type: "pages", + }, + }, +}; + +apiInstance + .createOnCallPage(params) + .then((data: v2.CreatePageResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call-paging/EscalateOnCallPage.ts b/examples/v2/on-call-paging/EscalateOnCallPage.ts new file mode 100644 index 00000000000..891d4ce4b00 --- /dev/null +++ b/examples/v2/on-call-paging/EscalateOnCallPage.ts @@ -0,0 +1,21 @@ +/** + * Escalate On-Call Page returns "Accepted." response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallPagingApi(configuration); + +const params: v2.OnCallPagingApiEscalateOnCallPageRequest = { + pageId: "15e74b8b-f865-48d0-bcc5-453323ed2c8f", +}; + +apiInstance + .escalateOnCallPage(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/on-call-paging/ResolveOnCallPage.ts b/examples/v2/on-call-paging/ResolveOnCallPage.ts new file mode 100644 index 00000000000..8b76e587fdf --- /dev/null +++ b/examples/v2/on-call-paging/ResolveOnCallPage.ts @@ -0,0 +1,21 @@ +/** + * Resolve On-Call Page returns "Accepted." response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.OnCallPagingApi(configuration); + +const params: v2.OnCallPagingApiResolveOnCallPageRequest = { + pageId: "15e74b8b-f865-48d0-bcc5-453323ed2c8f", +}; + +apiInstance + .resolveOnCallPage(params) + .then((data: any) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index d4e92d729cd..e1b044a9c4b 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -5905,6 +5905,34 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "TeamRoutingRules", }, + "v2.CreateOnCallPage": { + "body": { + "type": "CreatePageRequest", + "format": "", + }, + "operationResponseType": "CreatePageResponse", + }, + "v2.AcknowledgeOnCallPage": { + "pageId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "void", + }, + "v2.EscalateOnCallPage": { + "pageId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "void", + }, + "v2.ResolveOnCallPage": { + "pageId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "void", + }, "v2.ListOrgConfigs": { "operationResponseType": "OrgConfigListResponse", }, diff --git a/features/v2/on-call_paging.feature b/features/v2/on-call_paging.feature new file mode 100644 index 00000000000..69221bff418 --- /dev/null +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 6e56bb44319..12927e9537c 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1884,6 +1884,38 @@ "type": "idempotent" } }, + "CreateOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "AcknowledgeOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "EscalateOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "ResolveOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, "CreateOnCallSchedule": { "tag": "On-Call", "undo": { diff --git a/packages/datadog-api-client-common/servers.ts b/packages/datadog-api-client-common/servers.ts index 00f033949a1..74ecd55bbea 100644 --- a/packages/datadog-api-client-common/servers.ts +++ b/packages/datadog-api-client-common/servers.ts @@ -182,4 +182,108 @@ export const operationServers: { subdomain: "http-intake.logs", }), ], + "v2.On-CallPagingApi.acknowledgeOnCallPage": [ + new ServerConfiguration<{ + site: + | "saffron.oncall.datadoghq.com" + | "navy.oncall.datadoghq.com" + | "coral.oncall.datadoghq.com" + | "teal.oncall.datadoghq.com" + | "beige.oncall.datadoghq.eu"; + }>("https://{site}", { + site: "navy.oncall.datadoghq.com", + }), + new ServerConfiguration<{ + name: string; + protocol: string; + }>("{protocol}://{name}", { + name: "api.datadoghq.com", + protocol: "https", + }), + new ServerConfiguration<{ + site: string; + subdomain: string; + }>("https://{subdomain}.{site}", { + site: "datadoghq.com", + subdomain: "api", + }), + ], + "v2.On-CallPagingApi.createOnCallPage": [ + new ServerConfiguration<{ + site: + | "saffron.oncall.datadoghq.com" + | "navy.oncall.datadoghq.com" + | "coral.oncall.datadoghq.com" + | "teal.oncall.datadoghq.com" + | "beige.oncall.datadoghq.eu"; + }>("https://{site}", { + site: "navy.oncall.datadoghq.com", + }), + new ServerConfiguration<{ + name: string; + protocol: string; + }>("{protocol}://{name}", { + name: "api.datadoghq.com", + protocol: "https", + }), + new ServerConfiguration<{ + site: string; + subdomain: string; + }>("https://{subdomain}.{site}", { + site: "datadoghq.com", + subdomain: "api", + }), + ], + "v2.On-CallPagingApi.escalateOnCallPage": [ + new ServerConfiguration<{ + site: + | "saffron.oncall.datadoghq.com" + | "navy.oncall.datadoghq.com" + | "coral.oncall.datadoghq.com" + | "teal.oncall.datadoghq.com" + | "beige.oncall.datadoghq.eu"; + }>("https://{site}", { + site: "navy.oncall.datadoghq.com", + }), + new ServerConfiguration<{ + name: string; + protocol: string; + }>("{protocol}://{name}", { + name: "api.datadoghq.com", + protocol: "https", + }), + new ServerConfiguration<{ + site: string; + subdomain: string; + }>("https://{subdomain}.{site}", { + site: "datadoghq.com", + subdomain: "api", + }), + ], + "v2.On-CallPagingApi.resolveOnCallPage": [ + new ServerConfiguration<{ + site: + | "saffron.oncall.datadoghq.com" + | "navy.oncall.datadoghq.com" + | "coral.oncall.datadoghq.com" + | "teal.oncall.datadoghq.com" + | "beige.oncall.datadoghq.eu"; + }>("https://{site}", { + site: "navy.oncall.datadoghq.com", + }), + new ServerConfiguration<{ + name: string; + protocol: string; + }>("{protocol}://{name}", { + name: "api.datadoghq.com", + protocol: "https", + }), + new ServerConfiguration<{ + site: string; + subdomain: string; + }>("https://{subdomain}.{site}", { + site: "datadoghq.com", + subdomain: "api", + }), + ], }; diff --git a/packages/datadog-api-client-v2/apis/OnCallPagingApi.ts b/packages/datadog-api-client-v2/apis/OnCallPagingApi.ts new file mode 100644 index 00000000000..71910669b7b --- /dev/null +++ b/packages/datadog-api-client-v2/apis/OnCallPagingApi.ts @@ -0,0 +1,556 @@ +import { + BaseAPIRequestFactory, + RequiredError, +} from "../../datadog-api-client-common/baseapi"; +import { + Configuration, + applySecurityAuthentication, +} from "../../datadog-api-client-common/configuration"; +import { + RequestContext, + HttpMethod, + ResponseContext, +} from "../../datadog-api-client-common/http/http"; + +import { logger } from "../../../logger"; +import { ObjectSerializer } from "../models/ObjectSerializer"; +import { ApiException } from "../../datadog-api-client-common/exception"; + +import { APIErrorResponse } from "../models/APIErrorResponse"; +import { CreatePageRequest } from "../models/CreatePageRequest"; +import { CreatePageResponse } from "../models/CreatePageResponse"; + +export class OnCallPagingApiRequestFactory extends BaseAPIRequestFactory { + public async acknowledgeOnCallPage( + pageId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'pageId' is not null or undefined + if (pageId === null || pageId === undefined) { + throw new RequiredError("pageId", "acknowledgeOnCallPage"); + } + + // Path Params + const localVarPath = "/api/v2/on-call/pages/{page_id}/acknowledge".replace( + "{page_id}", + encodeURIComponent(String(pageId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallPagingApi.acknowledgeOnCallPage") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async createOnCallPage( + body: CreatePageRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createOnCallPage"); + } + + // Path Params + const localVarPath = "/api/v2/on-call/pages"; + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallPagingApi.createOnCallPage") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "CreatePageRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async escalateOnCallPage( + pageId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'pageId' is not null or undefined + if (pageId === null || pageId === undefined) { + throw new RequiredError("pageId", "escalateOnCallPage"); + } + + // Path Params + const localVarPath = "/api/v2/on-call/pages/{page_id}/escalate".replace( + "{page_id}", + encodeURIComponent(String(pageId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallPagingApi.escalateOnCallPage") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async resolveOnCallPage( + pageId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'pageId' is not null or undefined + if (pageId === null || pageId === undefined) { + throw new RequiredError("pageId", "resolveOnCallPage"); + } + + // Path Params + const localVarPath = "/api/v2/on-call/pages/{page_id}/resolve".replace( + "{page_id}", + encodeURIComponent(String(pageId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.OnCallPagingApi.resolveOnCallPage") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "AuthZ", + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class OnCallPagingApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to acknowledgeOnCallPage + * @throws ApiException if the response code was not in [200, 299] + */ + public async acknowledgeOnCallPage(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 202) { + return; + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", + "" + ) as void; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createOnCallPage + * @throws ApiException if the response code was not in [200, 299] + */ + public async createOnCallPage( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: CreatePageResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CreatePageResponse" + ) as CreatePageResponse; + return body; + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CreatePageResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "CreatePageResponse", + "" + ) as CreatePageResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to escalateOnCallPage + * @throws ApiException if the response code was not in [200, 299] + */ + public async escalateOnCallPage(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 202) { + return; + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", + "" + ) as void; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to resolveOnCallPage + * @throws ApiException if the response code was not in [200, 299] + */ + public async resolveOnCallPage(response: ResponseContext): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 202) { + return; + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: void = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "void", + "" + ) as void; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } +} + +export interface OnCallPagingApiAcknowledgeOnCallPageRequest { + /** + * The page ID. + * @type string + */ + pageId: string; +} + +export interface OnCallPagingApiCreateOnCallPageRequest { + /** + * @type CreatePageRequest + */ + body: CreatePageRequest; +} + +export interface OnCallPagingApiEscalateOnCallPageRequest { + /** + * The page ID. + * @type string + */ + pageId: string; +} + +export interface OnCallPagingApiResolveOnCallPageRequest { + /** + * The page ID. + * @type string + */ + pageId: string; +} + +export class OnCallPagingApi { + private requestFactory: OnCallPagingApiRequestFactory; + private responseProcessor: OnCallPagingApiResponseProcessor; + private configuration: Configuration; + + public constructor( + configuration: Configuration, + requestFactory?: OnCallPagingApiRequestFactory, + responseProcessor?: OnCallPagingApiResponseProcessor + ) { + this.configuration = configuration; + this.requestFactory = + requestFactory || new OnCallPagingApiRequestFactory(configuration); + this.responseProcessor = + responseProcessor || new OnCallPagingApiResponseProcessor(); + } + + /** + * Acknowledges an On-Call Page. + * + * Note: This endpoint may be available even if the corresponding Datadog site is unavailable. + * + * | Datadog Site | On-Call Paging endpoint | + * |---------------|---------------------------------------------------------------------------------------------------| + * | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + * | EU | `POST` https://beige.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + * | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + * | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + * | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/acknowledge | + * @param param The request object + */ + public acknowledgeOnCallPage( + param: OnCallPagingApiAcknowledgeOnCallPageRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.acknowledgeOnCallPage( + param.pageId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.acknowledgeOnCallPage(responseContext); + }); + }); + } + + /** + * Trigger a new On-Call Page. + * + * Note: This endpoint may be available even if the corresponding Datadog site is unavailable. + * + * | Datadog Site | On-Call Paging endpoint | + * |---------------|----------------------------------------------------------------------------------| + * | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages | + * | EU | `POST` https://beige.oncall.datadoghq.com/api/v2/on-call/pages/ | + * | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/ | + * | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/ | + * | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/ | + * @param param The request object + */ + public createOnCallPage( + param: OnCallPagingApiCreateOnCallPageRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.createOnCallPage( + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createOnCallPage(responseContext); + }); + }); + } + + /** + * Escalates an On-Call Page. + * + * Note: This endpoint may be available even if the corresponding Datadog site is unavailable. + * + * | Datadog Site | On-Call Paging endpoint | + * |---------------|---------------------------------------------------------------------------------------------------| + * | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + * | EU | `POST` https://beige.oncall.datadoghq.eu/api/v2/on-call/pages/{page_id}/escalate | + * | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + * | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + * | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/escalate | + * @param param The request object + */ + public escalateOnCallPage( + param: OnCallPagingApiEscalateOnCallPageRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.escalateOnCallPage( + param.pageId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.escalateOnCallPage(responseContext); + }); + }); + } + + /** + * Resolves an On-Call Page. + * + * Note: This endpoint may be available even if the corresponding Datadog site is unavailable. + * + * | Datadog Site | On-Call Paging endpoint | + * |---------------|---------------------------------------------------------------------------------------------------| + * | AP1 | `POST` https://saffron.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + * | EU | `POST` https://beige.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + * | US1 | `POST` https://navy.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + * | US3 | `POST` https://teal.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + * | US5 | `POST` https://coral.oncall.datadoghq.com/api/v2/on-call/pages/{page_id}/resolve | + * @param param The request object + */ + public resolveOnCallPage( + param: OnCallPagingApiResolveOnCallPageRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.resolveOnCallPage( + param.pageId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.resolveOnCallPage(responseContext); + }); + }); + } +} diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index ac1d8f3cf04..365f8cbf552 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -442,6 +442,14 @@ export { OnCallApi, } from "./apis/OnCallApi"; +export { + OnCallPagingApiAcknowledgeOnCallPageRequest, + OnCallPagingApiCreateOnCallPageRequest, + OnCallPagingApiEscalateOnCallPageRequest, + OnCallPagingApiResolveOnCallPageRequest, + OnCallPagingApi, +} from "./apis/OnCallPagingApi"; + export { OpsgenieIntegrationApiCreateOpsgenieServiceRequest, OpsgenieIntegrationApiDeleteOpsgenieServiceRequest, @@ -1223,6 +1231,14 @@ export { CreateNotificationRuleParametersDataAttributes } from "./models/CreateN export { CreateOpenAPIResponse } from "./models/CreateOpenAPIResponse"; export { CreateOpenAPIResponseAttributes } from "./models/CreateOpenAPIResponseAttributes"; export { CreateOpenAPIResponseData } from "./models/CreateOpenAPIResponseData"; +export { CreatePageRequest } from "./models/CreatePageRequest"; +export { CreatePageRequestData } from "./models/CreatePageRequestData"; +export { CreatePageRequestDataAttributes } from "./models/CreatePageRequestDataAttributes"; +export { CreatePageRequestDataAttributesTarget } from "./models/CreatePageRequestDataAttributesTarget"; +export { CreatePageRequestDataType } from "./models/CreatePageRequestDataType"; +export { CreatePageResponse } from "./models/CreatePageResponse"; +export { CreatePageResponseData } from "./models/CreatePageResponseData"; +export { CreatePageResponseDataType } from "./models/CreatePageResponseDataType"; export { CreateRuleRequest } from "./models/CreateRuleRequest"; export { CreateRuleRequestData } from "./models/CreateRuleRequestData"; export { CreateRuleResponse } from "./models/CreateRuleResponse"; diff --git a/packages/datadog-api-client-v2/models/CreatePageRequest.ts b/packages/datadog-api-client-v2/models/CreatePageRequest.ts new file mode 100644 index 00000000000..e3bda681622 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageRequest.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CreatePageRequestData } from "./CreatePageRequestData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Full request to trigger an On-Call Page. + */ +export class CreatePageRequest { + /** + * The main request body, including attributes and resource type. + */ + "data"?: CreatePageRequestData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreatePageRequestData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePageRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePageRequestData.ts b/packages/datadog-api-client-v2/models/CreatePageRequestData.ts new file mode 100644 index 00000000000..48e6550327f --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageRequestData.ts @@ -0,0 +1,63 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { CreatePageRequestDataAttributes } from "./CreatePageRequestDataAttributes"; +import { CreatePageRequestDataType } from "./CreatePageRequestDataType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The main request body, including attributes and resource type. + */ +export class CreatePageRequestData { + /** + * Details about the On-Call Page you want to create. + */ + "attributes"?: CreatePageRequestDataAttributes; + /** + * The type of resource used when creating an On-Call Page. + */ + "type": CreatePageRequestDataType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "CreatePageRequestDataAttributes", + }, + type: { + baseName: "type", + type: "CreatePageRequestDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePageRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePageRequestDataAttributes.ts b/packages/datadog-api-client-v2/models/CreatePageRequestDataAttributes.ts new file mode 100644 index 00000000000..556dfccc9cc --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageRequestDataAttributes.ts @@ -0,0 +1,88 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CreatePageRequestDataAttributesTarget } from "./CreatePageRequestDataAttributesTarget"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Details about the On-Call Page you want to create. + */ +export class CreatePageRequestDataAttributes { + /** + * A short summary of the issue or context. + */ + "description"?: string; + /** + * Tags to help categorize or filter the page. + */ + "tags"?: Array; + /** + * Information about the target to notify (such as a team or user). + */ + "target": CreatePageRequestDataAttributesTarget; + /** + * The title of the page. + */ + "title": string; + /** + * The level of urgency for the alert. Possible value `low` or `high`. + */ + "urgency": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + description: { + baseName: "description", + type: "string", + }, + tags: { + baseName: "tags", + type: "Array", + }, + target: { + baseName: "target", + type: "CreatePageRequestDataAttributesTarget", + required: true, + }, + title: { + baseName: "title", + type: "string", + required: true, + }, + urgency: { + baseName: "urgency", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePageRequestDataAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePageRequestDataAttributesTarget.ts b/packages/datadog-api-client-v2/models/CreatePageRequestDataAttributesTarget.ts new file mode 100644 index 00000000000..e9f552ae918 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageRequestDataAttributesTarget.ts @@ -0,0 +1,60 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Information about the target to notify (such as a team or user). + */ +export class CreatePageRequestDataAttributesTarget { + /** + * A unique ID for the target (for example, team handle or user UUID). + */ + "identifier"?: string; + /** + * The kind of target, `team_uuid` | `team_handle` | `user_uuid`. + */ + "type"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + identifier: { + baseName: "identifier", + type: "string", + }, + type: { + baseName: "type", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePageRequestDataAttributesTarget.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePageRequestDataType.ts b/packages/datadog-api-client-v2/models/CreatePageRequestDataType.ts new file mode 100644 index 00000000000..704ce26d656 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageRequestDataType.ts @@ -0,0 +1,14 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The type of resource used when creating an On-Call Page. + */ + +export type CreatePageRequestDataType = typeof PAGES | UnparsedObject; +export const PAGES = "pages"; diff --git a/packages/datadog-api-client-v2/models/CreatePageResponse.ts b/packages/datadog-api-client-v2/models/CreatePageResponse.ts new file mode 100644 index 00000000000..fe7f13365a6 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageResponse.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { CreatePageResponseData } from "./CreatePageResponseData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The full response object after creating a new On-Call Page. + */ +export class CreatePageResponse { + /** + * The information returned after successfully creating a page. + */ + "data"?: CreatePageResponseData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreatePageResponseData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePageResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePageResponseData.ts b/packages/datadog-api-client-v2/models/CreatePageResponseData.ts new file mode 100644 index 00000000000..c4a3969f026 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageResponseData.ts @@ -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 2020-Present Datadog, Inc. + */ +import { CreatePageResponseDataType } from "./CreatePageResponseDataType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * The information returned after successfully creating a page. + */ +export class CreatePageResponseData { + /** + * The unique ID of the created page. + */ + "id"?: string; + /** + * The type of resource used when creating an On-Call Page. + */ + "type": CreatePageResponseDataType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "CreatePageResponseDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "any", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreatePageResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreatePageResponseDataType.ts b/packages/datadog-api-client-v2/models/CreatePageResponseDataType.ts new file mode 100644 index 00000000000..db3955f0ae0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreatePageResponseDataType.ts @@ -0,0 +1,14 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The type of resource used when creating an On-Call Page. + */ + +export type CreatePageResponseDataType = typeof PAGES | UnparsedObject; +export const PAGES = "pages"; diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 58061e62fcb..018faf8cd06 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -388,6 +388,12 @@ import { CreateNotificationRuleParametersDataAttributes } from "./CreateNotifica import { CreateOpenAPIResponse } from "./CreateOpenAPIResponse"; import { CreateOpenAPIResponseAttributes } from "./CreateOpenAPIResponseAttributes"; import { CreateOpenAPIResponseData } from "./CreateOpenAPIResponseData"; +import { CreatePageRequest } from "./CreatePageRequest"; +import { CreatePageRequestData } from "./CreatePageRequestData"; +import { CreatePageRequestDataAttributes } from "./CreatePageRequestDataAttributes"; +import { CreatePageRequestDataAttributesTarget } from "./CreatePageRequestDataAttributesTarget"; +import { CreatePageResponse } from "./CreatePageResponse"; +import { CreatePageResponseData } from "./CreatePageResponseData"; import { CreateRuleRequest } from "./CreateRuleRequest"; import { CreateRuleRequestData } from "./CreateRuleRequestData"; import { CreateRuleResponse } from "./CreateRuleResponse"; @@ -2161,6 +2167,8 @@ const enumsMap: { [key: string]: any[] } = { CostAttributionType: ["cost_by_tag"], CostByOrgType: ["cost_by_org"], CreateDataDeletionRequestBodyDataType: ["create_deletion_req"], + CreatePageRequestDataType: ["pages"], + CreatePageResponseDataType: ["pages"], CustomConnectionType: ["custom_connections"], CustomDestinationAttributeTagsRestrictionListType: [ "ALLOW_LIST", @@ -3595,6 +3603,12 @@ const typeMap: { [index: string]: any } = { CreateOpenAPIResponse: CreateOpenAPIResponse, CreateOpenAPIResponseAttributes: CreateOpenAPIResponseAttributes, CreateOpenAPIResponseData: CreateOpenAPIResponseData, + CreatePageRequest: CreatePageRequest, + CreatePageRequestData: CreatePageRequestData, + CreatePageRequestDataAttributes: CreatePageRequestDataAttributes, + CreatePageRequestDataAttributesTarget: CreatePageRequestDataAttributesTarget, + CreatePageResponse: CreatePageResponse, + CreatePageResponseData: CreatePageResponseData, CreateRuleRequest: CreateRuleRequest, CreateRuleRequestData: CreateRuleRequestData, CreateRuleResponse: CreateRuleResponse,