diff --git a/.apigentools-info b/.apigentools-info index 2b7d2248919f..bba1578d75eb 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.410949", - "spec_repo_commit": "77cf469a" + "regenerated": "2025-05-06 14:30:49.809720", + "spec_repo_commit": "381bcc9e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-02 09:33:55.426962", - "spec_repo_commit": "77cf469a" + "regenerated": "2025-05-06 14:30:49.825312", + "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 37a8f69d15c8..e5dba27869a8 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.rb b/examples/v2/on-call-paging/AcknowledgeOnCallPage.rb new file mode 100644 index 000000000000..2babb9cafbfa --- /dev/null +++ b/examples/v2/on-call-paging/AcknowledgeOnCallPage.rb @@ -0,0 +1,5 @@ +# Acknowledge On-Call Page returns "Accepted." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallPagingAPI.new +p api_instance.acknowledge_on_call_page("15e74b8b-f865-48d0-bcc5-453323ed2c8f") diff --git a/examples/v2/on-call-paging/CreateOnCallPage.rb b/examples/v2/on-call-paging/CreateOnCallPage.rb new file mode 100644 index 000000000000..67e5d668023a --- /dev/null +++ b/examples/v2/on-call-paging/CreateOnCallPage.rb @@ -0,0 +1,23 @@ +# Create On-Call Page returns "OK." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallPagingAPI.new + +body = DatadogAPIClient::V2::CreatePageRequest.new({ + data: DatadogAPIClient::V2::CreatePageRequestData.new({ + attributes: DatadogAPIClient::V2::CreatePageRequestDataAttributes.new({ + description: "Page details.", + tags: [ + "service:test", + ], + target: DatadogAPIClient::V2::CreatePageRequestDataAttributesTarget.new({ + identifier: "my-team", + type: "team_handle", + }), + title: "Page title", + urgency: "low", + }), + type: DatadogAPIClient::V2::CreatePageRequestDataType::PAGES, + }), +}) +p api_instance.create_on_call_page(body) diff --git a/examples/v2/on-call-paging/EscalateOnCallPage.rb b/examples/v2/on-call-paging/EscalateOnCallPage.rb new file mode 100644 index 000000000000..b69a8674461f --- /dev/null +++ b/examples/v2/on-call-paging/EscalateOnCallPage.rb @@ -0,0 +1,5 @@ +# Escalate On-Call Page returns "Accepted." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallPagingAPI.new +p api_instance.escalate_on_call_page("15e74b8b-f865-48d0-bcc5-453323ed2c8f") diff --git a/examples/v2/on-call-paging/ResolveOnCallPage.rb b/examples/v2/on-call-paging/ResolveOnCallPage.rb new file mode 100644 index 000000000000..29958e432cc0 --- /dev/null +++ b/examples/v2/on-call-paging/ResolveOnCallPage.rb @@ -0,0 +1,5 @@ +# Resolve On-Call Page returns "Accepted." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::On - CallPagingAPI.new +p api_instance.resolve_on_call_page("15e74b8b-f865-48d0-bcc5-453323ed2c8f") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 728b23f0b622..1d8a2f9ed0f0 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2080,6 +2080,18 @@ "include" => "String", "body" => "TeamRoutingRulesRequest", }, + "v2.CreateOnCallPage" => { + "body" => "CreatePageRequest", + }, + "v2.AcknowledgeOnCallPage" => { + "page_id" => "UUID", + }, + "v2.EscalateOnCallPage" => { + "page_id" => "UUID", + }, + "v2.ResolveOnCallPage" => { + "page_id" => "UUID", + }, "v2.GetOrgConfig" => { "org_config_name" => "String", }, diff --git a/features/v2/on-call_paging.feature b/features/v2/on-call_paging.feature new file mode 100644 index 000000000000..69221bff418f --- /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 6e56bb44319e..12927e9537c7 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/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index a9c1e720df0c..a8c39490c85c 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -586,6 +586,194 @@ def operation_server_settings } } ], + "v2.create_on_call_page": [ + { + url: "https://{site}", + description: "No description provided", + 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}", + description: "No description provided", + 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}", + description: "No description provided", + variables: { + site: { + description: "Any Datadog deployment.", + default_value: "datadoghq.com", + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "api", + } + } + } + ], + "v2.acknowledge_on_call_page": [ + { + url: "https://{site}", + description: "No description provided", + 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}", + description: "No description provided", + 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}", + description: "No description provided", + variables: { + site: { + description: "Any Datadog deployment.", + default_value: "datadoghq.com", + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "api", + } + } + } + ], + "v2.escalate_on_call_page": [ + { + url: "https://{site}", + description: "No description provided", + 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}", + description: "No description provided", + 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}", + description: "No description provided", + variables: { + site: { + description: "Any Datadog deployment.", + default_value: "datadoghq.com", + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "api", + } + } + } + ], + "v2.resolve_on_call_page": [ + { + url: "https://{site}", + description: "No description provided", + 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}", + description: "No description provided", + 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}", + description: "No description provided", + variables: { + site: { + description: "Any Datadog deployment.", + default_value: "datadoghq.com", + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "api", + } + } + } + ], } end diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b31ae532c475..90f01c70c472 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1439,6 +1439,14 @@ def overrides "v2.create_open_api_response" => "CreateOpenAPIResponse", "v2.create_open_api_response_attributes" => "CreateOpenAPIResponseAttributes", "v2.create_open_api_response_data" => "CreateOpenAPIResponseData", + "v2.create_page_request" => "CreatePageRequest", + "v2.create_page_request_data" => "CreatePageRequestData", + "v2.create_page_request_data_attributes" => "CreatePageRequestDataAttributes", + "v2.create_page_request_data_attributes_target" => "CreatePageRequestDataAttributesTarget", + "v2.create_page_request_data_type" => "CreatePageRequestDataType", + "v2.create_page_response" => "CreatePageResponse", + "v2.create_page_response_data" => "CreatePageResponseData", + "v2.create_page_response_data_type" => "CreatePageResponseDataType", "v2.create_rule_request" => "CreateRuleRequest", "v2.create_rule_request_data" => "CreateRuleRequestData", "v2.create_rule_response" => "CreateRuleResponse", @@ -3494,6 +3502,7 @@ def overrides "v2.observability_pipelines_api" => "ObservabilityPipelinesAPI", "v2.okta_integration_api" => "OktaIntegrationAPI", "v2.on_call_api" => "OnCallAPI", + "v2.on_call_paging_api" => "OnCallPagingAPI", "v2.opsgenie_integration_api" => "OpsgenieIntegrationAPI", "v2.organizations_api" => "OrganizationsAPI", "v2.powerpack_api" => "PowerpackAPI", diff --git a/lib/datadog_api_client/v2/api/on_call_paging_api.rb b/lib/datadog_api_client/v2/api/on_call_paging_api.rb new file mode 100644 index 000000000000..218ba6d7962e --- /dev/null +++ b/lib/datadog_api_client/v2/api/on_call_paging_api.rb @@ -0,0 +1,332 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class OnCallPagingAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Acknowledge On-Call Page. + # + # @see #acknowledge_on_call_page_with_http_info + def acknowledge_on_call_page(page_id, opts = {}) + acknowledge_on_call_page_with_http_info(page_id, opts) + nil + end + + # Acknowledge On-Call Page. + # + # 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 page_id [UUID] The page ID. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def acknowledge_on_call_page_with_http_info(page_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallPagingAPI.acknowledge_on_call_page ...' + end + # verify the required parameter 'page_id' is set + if @api_client.config.client_side_validation && page_id.nil? + fail ArgumentError, "Missing the required parameter 'page_id' when calling OnCallPagingAPI.acknowledge_on_call_page" + end + # resource path + local_var_path = '/api/v2/on-call/pages/{page_id}/acknowledge'.sub('{page_id}', CGI.escape(page_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :acknowledge_on_call_page, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallPagingAPI#acknowledge_on_call_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create On-Call Page. + # + # @see #create_on_call_page_with_http_info + def create_on_call_page(body, opts = {}) + data, _status_code, _headers = create_on_call_page_with_http_info(body, opts) + data + end + + # Create On-Call Page. + # + # 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 body [CreatePageRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(CreatePageResponse, Integer, Hash)>] CreatePageResponse data, response status code and response headers + def create_on_call_page_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallPagingAPI.create_on_call_page ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling OnCallPagingAPI.create_on_call_page" + end + # resource path + local_var_path = '/api/v2/on-call/pages' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CreatePageResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_on_call_page, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallPagingAPI#create_on_call_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Escalate On-Call Page. + # + # @see #escalate_on_call_page_with_http_info + def escalate_on_call_page(page_id, opts = {}) + escalate_on_call_page_with_http_info(page_id, opts) + nil + end + + # Escalate On-Call Page. + # + # 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 page_id [UUID] The page ID. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def escalate_on_call_page_with_http_info(page_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallPagingAPI.escalate_on_call_page ...' + end + # verify the required parameter 'page_id' is set + if @api_client.config.client_side_validation && page_id.nil? + fail ArgumentError, "Missing the required parameter 'page_id' when calling OnCallPagingAPI.escalate_on_call_page" + end + # resource path + local_var_path = '/api/v2/on-call/pages/{page_id}/escalate'.sub('{page_id}', CGI.escape(page_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :escalate_on_call_page, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallPagingAPI#escalate_on_call_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resolve On-Call Page. + # + # @see #resolve_on_call_page_with_http_info + def resolve_on_call_page(page_id, opts = {}) + resolve_on_call_page_with_http_info(page_id, opts) + nil + end + + # Resolve On-Call Page. + # + # 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 page_id [UUID] The page ID. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def resolve_on_call_page_with_http_info(page_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OnCallPagingAPI.resolve_on_call_page ...' + end + # verify the required parameter 'page_id' is set + if @api_client.config.client_side_validation && page_id.nil? + fail ArgumentError, "Missing the required parameter 'page_id' when calling OnCallPagingAPI.resolve_on_call_page" + end + # resource path + local_var_path = '/api/v2/on-call/pages/{page_id}/resolve'.sub('{page_id}', CGI.escape(page_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :resolve_on_call_page, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OnCallPagingAPI#resolve_on_call_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_request.rb b/lib/datadog_api_client/v2/models/create_page_request.rb new file mode 100644 index 000000000000..450eed40bad1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_request.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Full request to trigger an On-Call Page. + class CreatePageRequest + include BaseGenericModel + + # The main request body, including attributes and resource type. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CreatePageRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreatePageRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_request_data.rb b/lib/datadog_api_client/v2/models/create_page_request_data.rb new file mode 100644 index 000000000000..6cd3813b0bbc --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_request_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The main request body, including attributes and resource type. + class CreatePageRequestData + include BaseGenericModel + + # Details about the On-Call Page you want to create. + attr_accessor :attributes + + # The type of resource used when creating an On-Call Page. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CreatePageRequestDataAttributes', + :'type' => :'CreatePageRequestDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreatePageRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_request_data_attributes.rb b/lib/datadog_api_client/v2/models/create_page_request_data_attributes.rb new file mode 100644 index 000000000000..25032fe77b6f --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_request_data_attributes.rb @@ -0,0 +1,187 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Details about the On-Call Page you want to create. + class CreatePageRequestDataAttributes + include BaseGenericModel + + # A short summary of the issue or context. + attr_accessor :description + + # Tags to help categorize or filter the page. + attr_accessor :tags + + # Information about the target to notify (such as a team or user). + attr_reader :target + + # The title of the page. + attr_reader :title + + # The level of urgency for the alert. Possible value `low` or `high`. + attr_reader :urgency + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'tags' => :'tags', + :'target' => :'target', + :'title' => :'title', + :'urgency' => :'urgency' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'tags' => :'Array', + :'target' => :'CreatePageRequestDataAttributesTarget', + :'title' => :'String', + :'urgency' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreatePageRequestDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'target') + self.target = attributes[:'target'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'urgency') + self.urgency = attributes[:'urgency'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @target.nil? + return false if @title.nil? + return false if @urgency.nil? + true + end + + # Custom attribute writer method with validation + # @param target [Object] Object to be assigned + # @!visibility private + def target=(target) + if target.nil? + fail ArgumentError, 'invalid value for "target", target cannot be nil.' + end + @target = target + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Custom attribute writer method with validation + # @param urgency [Object] Object to be assigned + # @!visibility private + def urgency=(urgency) + if urgency.nil? + fail ArgumentError, 'invalid value for "urgency", urgency cannot be nil.' + end + @urgency = urgency + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + tags == o.tags && + target == o.target && + title == o.title && + urgency == o.urgency && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, tags, target, title, urgency, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_request_data_attributes_target.rb b/lib/datadog_api_client/v2/models/create_page_request_data_attributes_target.rb new file mode 100644 index 000000000000..f987a18db5d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_request_data_attributes_target.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Information about the target to notify (such as a team or user). + class CreatePageRequestDataAttributesTarget + include BaseGenericModel + + # A unique ID for the target (for example, team handle or user UUID). + attr_accessor :identifier + + # The kind of target, `team_uuid` | `team_handle` | `user_uuid`. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'identifier' => :'identifier', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'identifier' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreatePageRequestDataAttributesTarget` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'identifier') + self.identifier = attributes[:'identifier'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + identifier == o.identifier && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [identifier, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_request_data_type.rb b/lib/datadog_api_client/v2/models/create_page_request_data_type.rb new file mode 100644 index 000000000000..e1dd8e8c00ea --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_request_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of resource used when creating an On-Call Page. + class CreatePageRequestDataType + include BaseEnumModel + + PAGES = "pages".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_response.rb b/lib/datadog_api_client/v2/models/create_page_response.rb new file mode 100644 index 000000000000..1cd3678aff7f --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_response.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The full response object after creating a new On-Call Page. + class CreatePageResponse + include BaseGenericModel + + # The information returned after successfully creating a page. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CreatePageResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreatePageResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_response_data.rb b/lib/datadog_api_client/v2/models/create_page_response_data.rb new file mode 100644 index 000000000000..ead26fd4ecae --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_response_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The information returned after successfully creating a page. + class CreatePageResponseData + include BaseGenericModel + + # The unique ID of the created page. + attr_accessor :id + + # The type of resource used when creating an On-Call Page. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'CreatePageResponseDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreatePageResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_page_response_data_type.rb b/lib/datadog_api_client/v2/models/create_page_response_data_type.rb new file mode 100644 index 000000000000..24566eff874b --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_page_response_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of resource used when creating an On-Call Page. + class CreatePageResponseDataType + include BaseEnumModel + + PAGES = "pages".freeze + end +end