diff --git a/.apigentools-info b/.apigentools-info index 2073c0c7575..e28d205a18f 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-09 19:42:40.863227", - "spec_repo_commit": "c7bad6f6" + "regenerated": "2025-05-12 09:40:18.860888", + "spec_repo_commit": "c4d0aeef" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-09 19:42:40.879656", - "spec_repo_commit": "c7bad6f6" + "regenerated": "2025-05-12 09:40:18.876442", + "spec_repo_commit": "c4d0aeef" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 537d23fc716..cd58a11bc08 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9471,6 +9471,108 @@ components: id: $ref: '#/components/schemas/ApiID' type: object + CreatePageRequest: + description: Full request to trigger an On-Call Page. + example: + data: + attributes: + description: Page details. + tags: + - service:test + target: + identifier: my-team + type: team_handle + title: Page title + urgency: low + type: pages + properties: + data: + $ref: '#/components/schemas/CreatePageRequestData' + type: object + CreatePageRequestData: + description: The main request body, including attributes and resource type. + properties: + attributes: + $ref: '#/components/schemas/CreatePageRequestDataAttributes' + type: + $ref: '#/components/schemas/CreatePageRequestDataType' + required: + - type + type: object + CreatePageRequestDataAttributes: + description: Details about the On-Call Page you want to create. + properties: + description: + description: A short summary of the issue or context. + type: string + tags: + description: Tags to help categorize or filter the page. + items: + type: string + type: array + target: + $ref: '#/components/schemas/CreatePageRequestDataAttributesTarget' + title: + description: The title of the page. + example: 'Service: Test is down' + type: string + urgency: + $ref: '#/components/schemas/PageUrgency' + required: + - target + - title + - urgency + type: object + CreatePageRequestDataAttributesTarget: + description: Information about the target to notify (such as a team or user). + properties: + identifier: + description: A unique ID for the target (for example, team handle or user + UUID). + type: string + type: + description: The kind of target, `team_uuid` | `team_handle` | `user_uuid`. + type: string + type: object + CreatePageRequestDataType: + default: pages + description: The type of resource used when creating an On-Call Page. + enum: + - pages + example: pages + type: string + x-enum-varnames: + - PAGES + CreatePageResponse: + description: The full response object after creating a new On-Call Page. + example: + data: + id: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + type: pages + properties: + data: + $ref: '#/components/schemas/CreatePageResponseData' + type: object + CreatePageResponseData: + description: The information returned after successfully creating a page. + properties: + id: + description: The unique ID of the created page. + type: string + type: + $ref: '#/components/schemas/CreatePageResponseDataType' + required: + - type + type: object + CreatePageResponseDataType: + default: pages + description: The type of resource used when creating an On-Call Page. + enum: + - pages + example: pages + type: string + x-enum-varnames: + - PAGES CreateRuleRequest: description: Scorecard create rule request. properties: @@ -27104,6 +27206,17 @@ components: - ARRAY_NUMBER - ARRAY_BOOLEAN - ARRAY_OBJECT + PageUrgency: + default: high + description: On-Call Page urgency level. + enum: + - low + - high + example: high + type: string + x-enum-varnames: + - LOW + - HIGH Pagination: description: Pagination object. properties: @@ -38863,6 +38976,7 @@ components: - low - high - dynamic + example: low type: string x-enum-varnames: - LOW @@ -51416,6 +51530,227 @@ paths: operator: AND permissions: - on_call_write + /api/v2/on-call/pages: + post: + description: 'Trigger a new On-Call Page. + + ' + operationId: CreateOnCallPage + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePageRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePageResponse' + description: OK. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Create On-Call Page + tags: + - On-Call Paging + /api/v2/on-call/pages/{page_id}/acknowledge: + post: + description: 'Acknowledges an On-Call Page. + + ' + operationId: AcknowledgeOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + responses: + '202': + description: Accepted. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Acknowledge On-Call Page + tags: + - On-Call Paging + /api/v2/on-call/pages/{page_id}/escalate: + post: + description: 'Escalates an On-Call Page. + + ' + operationId: EscalateOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + responses: + '202': + description: Accepted. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Escalate On-Call Page + tags: + - On-Call Paging + /api/v2/on-call/pages/{page_id}/resolve: + post: + description: 'Resolves an On-Call Page. + + ' + operationId: ResolveOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + responses: + '202': + description: Accepted. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + servers: + - url: https://{site} + variables: + site: + default: navy.oncall.datadoghq.com + description: The globally available endpoint for On-Call. + enum: + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - url: '{protocol}://{name}' + variables: + name: + default: api.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: api + description: The subdomain where the API is deployed. + summary: Resolve On-Call Page + tags: + - On-Call Paging /api/v2/on-call/schedules: post: description: Create a new on-call schedule @@ -61556,6 +61891,12 @@ tags: externalDocs: url: https://docs.datadoghq.com/service_management/on-call/ name: On-Call +- description: 'Trigger and manage [Datadog On-Call](https://docs.datadoghq.com/service_management/on-call/) + + pages directly through the Datadog API.' + externalDocs: + url: https://docs.datadoghq.com/service_management/on-call/ + name: On-Call Paging - description: 'Configure your [Datadog Opsgenie integration](https://docs.datadoghq.com/integrations/opsgenie/) directly through the Datadog API.' diff --git a/examples/v2/on-call-paging/AcknowledgeOnCallPage.java b/examples/v2/on-call-paging/AcknowledgeOnCallPage.java new file mode 100644 index 00000000000..0ad40cfb44c --- /dev/null +++ b/examples/v2/on-call-paging/AcknowledgeOnCallPage.java @@ -0,0 +1,23 @@ +// Acknowledge On-Call Page returns "Accepted." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallPagingApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallPagingApi apiInstance = new OnCallPagingApi(defaultClient); + + try { + apiInstance.acknowledgeOnCallPage(UUID.fromString("15e74b8b-f865-48d0-bcc5-453323ed2c8f")); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallPagingApi#acknowledgeOnCallPage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call-paging/CreateOnCallPage.java b/examples/v2/on-call-paging/CreateOnCallPage.java new file mode 100644 index 00000000000..24d6e31f666 --- /dev/null +++ b/examples/v2/on-call-paging/CreateOnCallPage.java @@ -0,0 +1,47 @@ +// Create On-Call Page returns "OK." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallPagingApi; +import com.datadog.api.client.v2.model.CreatePageRequest; +import com.datadog.api.client.v2.model.CreatePageRequestData; +import com.datadog.api.client.v2.model.CreatePageRequestDataAttributes; +import com.datadog.api.client.v2.model.CreatePageRequestDataAttributesTarget; +import com.datadog.api.client.v2.model.CreatePageRequestDataType; +import com.datadog.api.client.v2.model.CreatePageResponse; +import com.datadog.api.client.v2.model.PageUrgency; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallPagingApi apiInstance = new OnCallPagingApi(defaultClient); + + CreatePageRequest body = + new CreatePageRequest() + .data( + new CreatePageRequestData() + .attributes( + new CreatePageRequestDataAttributes() + .description("Page details.") + .tags(Collections.singletonList("service:test")) + .target( + new CreatePageRequestDataAttributesTarget() + .identifier("my-team") + .type("team_handle")) + .title("Page title") + .urgency(PageUrgency.LOW)) + .type(CreatePageRequestDataType.PAGES)); + + try { + CreatePageResponse result = apiInstance.createOnCallPage(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallPagingApi#createOnCallPage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call-paging/EscalateOnCallPage.java b/examples/v2/on-call-paging/EscalateOnCallPage.java new file mode 100644 index 00000000000..ff284545e8a --- /dev/null +++ b/examples/v2/on-call-paging/EscalateOnCallPage.java @@ -0,0 +1,23 @@ +// Escalate On-Call Page returns "Accepted." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallPagingApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallPagingApi apiInstance = new OnCallPagingApi(defaultClient); + + try { + apiInstance.escalateOnCallPage(UUID.fromString("15e74b8b-f865-48d0-bcc5-453323ed2c8f")); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallPagingApi#escalateOnCallPage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/on-call-paging/ResolveOnCallPage.java b/examples/v2/on-call-paging/ResolveOnCallPage.java new file mode 100644 index 00000000000..352546077f1 --- /dev/null +++ b/examples/v2/on-call-paging/ResolveOnCallPage.java @@ -0,0 +1,23 @@ +// Resolve On-Call Page returns "Accepted." response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.OnCallPagingApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + OnCallPagingApi apiInstance = new OnCallPagingApi(defaultClient); + + try { + apiInstance.resolveOnCallPage(UUID.fromString("15e74b8b-f865-48d0-bcc5-453323ed2c8f")); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallPagingApi#resolveOnCallPage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 3b585511eb0..f2344f23607 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -345,6 +345,250 @@ public class ApiClient { new HashSet())); } })))); + put( + "v2.OnCallPagingApi.createOnCallPage", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The globally available endpoint for On-Call.", + "navy.oncall.datadoghq.com", + new HashSet( + Arrays.asList( + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu")))); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "api.datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "api", + new HashSet())); + } + })))); + put( + "v2.OnCallPagingApi.acknowledgeOnCallPage", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The globally available endpoint for On-Call.", + "navy.oncall.datadoghq.com", + new HashSet( + Arrays.asList( + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu")))); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "api.datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "api", + new HashSet())); + } + })))); + put( + "v2.OnCallPagingApi.escalateOnCallPage", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The globally available endpoint for On-Call.", + "navy.oncall.datadoghq.com", + new HashSet( + Arrays.asList( + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu")))); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "api.datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "api", + new HashSet())); + } + })))); + put( + "v2.OnCallPagingApi.resolveOnCallPage", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The globally available endpoint for On-Call.", + "navy.oncall.datadoghq.com", + new HashSet( + Arrays.asList( + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu")))); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "api.datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "api", + new HashSet())); + } + })))); } }; protected Map operationServerIndex = new HashMap(); diff --git a/src/main/java/com/datadog/api/client/v2/api/OnCallPagingApi.java b/src/main/java/com/datadog/api/client/v2/api/OnCallPagingApi.java new file mode 100644 index 00000000000..82c435d0d4e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/OnCallPagingApi.java @@ -0,0 +1,566 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CreatePageRequest; +import com.datadog.api.client.v2.model.CreatePageResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OnCallPagingApi { + private ApiClient apiClient; + + public OnCallPagingApi() { + this(ApiClient.getDefaultApiClient()); + } + + public OnCallPagingApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Acknowledge On-Call Page. + * + *

See {@link #acknowledgeOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @throws ApiException if fails to make API call + */ + public void acknowledgeOnCallPage(UUID pageId) throws ApiException { + acknowledgeOnCallPageWithHttpInfo(pageId); + } + + /** + * Acknowledge On-Call Page. + * + *

See {@link #acknowledgeOnCallPageWithHttpInfoAsync}. + * + * @param pageId The page ID. (required) + * @return CompletableFuture + */ + public CompletableFuture acknowledgeOnCallPageAsync(UUID pageId) { + return acknowledgeOnCallPageWithHttpInfoAsync(pageId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Acknowledges an On-Call Page. + * + * @param pageId The page ID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted. -
429 Too many requests -
+ */ + public ApiResponse acknowledgeOnCallPageWithHttpInfo(UUID pageId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + throw new ApiException( + 400, "Missing the required parameter 'pageId' when calling acknowledgeOnCallPage"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/acknowledge" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.acknowledgeOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Acknowledge On-Call Page. + * + *

See {@link #acknowledgeOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> acknowledgeOnCallPageWithHttpInfoAsync(UUID pageId) { + Object localVarPostBody = null; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'pageId' when calling acknowledgeOnCallPage")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/acknowledge" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.acknowledgeOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Create On-Call Page. + * + *

See {@link #createOnCallPageWithHttpInfo}. + * + * @param body (required) + * @return CreatePageResponse + * @throws ApiException if fails to make API call + */ + public CreatePageResponse createOnCallPage(CreatePageRequest body) throws ApiException { + return createOnCallPageWithHttpInfo(body).getData(); + } + + /** + * Create On-Call Page. + * + *

See {@link #createOnCallPageWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<CreatePageResponse> + */ + public CompletableFuture createOnCallPageAsync(CreatePageRequest body) { + return createOnCallPageWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Trigger a new On-Call Page. + * + * @param body (required) + * @return ApiResponse<CreatePageResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK. -
429 Too many requests -
+ */ + public ApiResponse createOnCallPageWithHttpInfo(CreatePageRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createOnCallPage"); + } + // create path and map variables + String localVarPath = "/api/v2/on-call/pages"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.createOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create On-Call Page. + * + *

See {@link #createOnCallPageWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<CreatePageResponse>> + */ + public CompletableFuture> createOnCallPageWithHttpInfoAsync( + CreatePageRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createOnCallPage")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/on-call/pages"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.createOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Escalate On-Call Page. + * + *

See {@link #escalateOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @throws ApiException if fails to make API call + */ + public void escalateOnCallPage(UUID pageId) throws ApiException { + escalateOnCallPageWithHttpInfo(pageId); + } + + /** + * Escalate On-Call Page. + * + *

See {@link #escalateOnCallPageWithHttpInfoAsync}. + * + * @param pageId The page ID. (required) + * @return CompletableFuture + */ + public CompletableFuture escalateOnCallPageAsync(UUID pageId) { + return escalateOnCallPageWithHttpInfoAsync(pageId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Escalates an On-Call Page. + * + * @param pageId The page ID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted. -
429 Too many requests -
+ */ + public ApiResponse escalateOnCallPageWithHttpInfo(UUID pageId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + throw new ApiException( + 400, "Missing the required parameter 'pageId' when calling escalateOnCallPage"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/escalate" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.escalateOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Escalate On-Call Page. + * + *

See {@link #escalateOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> escalateOnCallPageWithHttpInfoAsync(UUID pageId) { + Object localVarPostBody = null; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'pageId' when calling escalateOnCallPage")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/escalate" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.escalateOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Resolve On-Call Page. + * + *

See {@link #resolveOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @throws ApiException if fails to make API call + */ + public void resolveOnCallPage(UUID pageId) throws ApiException { + resolveOnCallPageWithHttpInfo(pageId); + } + + /** + * Resolve On-Call Page. + * + *

See {@link #resolveOnCallPageWithHttpInfoAsync}. + * + * @param pageId The page ID. (required) + * @return CompletableFuture + */ + public CompletableFuture resolveOnCallPageAsync(UUID pageId) { + return resolveOnCallPageWithHttpInfoAsync(pageId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Resolves an On-Call Page. + * + * @param pageId The page ID. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted. -
429 Too many requests -
+ */ + public ApiResponse resolveOnCallPageWithHttpInfo(UUID pageId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + throw new ApiException( + 400, "Missing the required parameter 'pageId' when calling resolveOnCallPage"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/resolve" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.resolveOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Resolve On-Call Page. + * + *

See {@link #resolveOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> resolveOnCallPageWithHttpInfoAsync(UUID pageId) { + Object localVarPostBody = null; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'pageId' when calling resolveOnCallPage")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/resolve" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.resolveOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequest.java new file mode 100644 index 00000000000..f8f2b06f7eb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequest.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Full request to trigger an On-Call Page. */ +@JsonPropertyOrder({CreatePageRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreatePageRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreatePageRequestData data; + + public CreatePageRequest data(CreatePageRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The main request body, including attributes and resource type. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreatePageRequestData getData() { + return data; + } + + public void setData(CreatePageRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreatePageRequest + */ + @JsonAnySetter + public CreatePageRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreatePageRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePageRequest createPageRequest = (CreatePageRequest) o; + return Objects.equals(this.data, createPageRequest.data) + && Objects.equals(this.additionalProperties, createPageRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePageRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestData.java new file mode 100644 index 00000000000..6c6d39940f2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestData.java @@ -0,0 +1,178 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The main request body, including attributes and resource type. */ +@JsonPropertyOrder({ + CreatePageRequestData.JSON_PROPERTY_ATTRIBUTES, + CreatePageRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreatePageRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreatePageRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CreatePageRequestDataType type = CreatePageRequestDataType.PAGES; + + public CreatePageRequestData() {} + + @JsonCreator + public CreatePageRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CreatePageRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreatePageRequestData attributes(CreatePageRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Details about the On-Call Page you want to create. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreatePageRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CreatePageRequestDataAttributes attributes) { + this.attributes = attributes; + } + + public CreatePageRequestData type(CreatePageRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of resource used when creating an On-Call Page. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreatePageRequestDataType getType() { + return type; + } + + public void setType(CreatePageRequestDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreatePageRequestData + */ + @JsonAnySetter + public CreatePageRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreatePageRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePageRequestData createPageRequestData = (CreatePageRequestData) o; + return Objects.equals(this.attributes, createPageRequestData.attributes) + && Objects.equals(this.type, createPageRequestData.type) + && Objects.equals(this.additionalProperties, createPageRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePageRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataAttributes.java new file mode 100644 index 00000000000..7f7838c0cae --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataAttributes.java @@ -0,0 +1,275 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Details about the On-Call Page you want to create. */ +@JsonPropertyOrder({ + CreatePageRequestDataAttributes.JSON_PROPERTY_DESCRIPTION, + CreatePageRequestDataAttributes.JSON_PROPERTY_TAGS, + CreatePageRequestDataAttributes.JSON_PROPERTY_TARGET, + CreatePageRequestDataAttributes.JSON_PROPERTY_TITLE, + CreatePageRequestDataAttributes.JSON_PROPERTY_URGENCY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreatePageRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public static final String JSON_PROPERTY_TARGET = "target"; + private CreatePageRequestDataAttributesTarget target; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_URGENCY = "urgency"; + private PageUrgency urgency = PageUrgency.HIGH; + + public CreatePageRequestDataAttributes() {} + + @JsonCreator + public CreatePageRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) + CreatePageRequestDataAttributesTarget target, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title, + @JsonProperty(required = true, value = JSON_PROPERTY_URGENCY) PageUrgency urgency) { + this.target = target; + this.unparsed |= target.unparsed; + this.title = title; + this.urgency = urgency; + this.unparsed |= !urgency.isValid(); + } + + public CreatePageRequestDataAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A short summary of the issue or context. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreatePageRequestDataAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public CreatePageRequestDataAttributes addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags to help categorize or filter the page. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public CreatePageRequestDataAttributes target(CreatePageRequestDataAttributesTarget target) { + this.target = target; + this.unparsed |= target.unparsed; + return this; + } + + /** + * Information about the target to notify (such as a team or user). + * + * @return target + */ + @JsonProperty(JSON_PROPERTY_TARGET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreatePageRequestDataAttributesTarget getTarget() { + return target; + } + + public void setTarget(CreatePageRequestDataAttributesTarget target) { + this.target = target; + } + + public CreatePageRequestDataAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the page. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public CreatePageRequestDataAttributes urgency(PageUrgency urgency) { + this.urgency = urgency; + this.unparsed |= !urgency.isValid(); + return this; + } + + /** + * On-Call Page urgency level. + * + * @return urgency + */ + @JsonProperty(JSON_PROPERTY_URGENCY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PageUrgency getUrgency() { + return urgency; + } + + public void setUrgency(PageUrgency urgency) { + if (!urgency.isValid()) { + this.unparsed = true; + } + this.urgency = urgency; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreatePageRequestDataAttributes + */ + @JsonAnySetter + public CreatePageRequestDataAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreatePageRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePageRequestDataAttributes createPageRequestDataAttributes = + (CreatePageRequestDataAttributes) o; + return Objects.equals(this.description, createPageRequestDataAttributes.description) + && Objects.equals(this.tags, createPageRequestDataAttributes.tags) + && Objects.equals(this.target, createPageRequestDataAttributes.target) + && Objects.equals(this.title, createPageRequestDataAttributes.title) + && Objects.equals(this.urgency, createPageRequestDataAttributes.urgency) + && Objects.equals( + this.additionalProperties, createPageRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, tags, target, title, urgency, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePageRequestDataAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" urgency: ").append(toIndentedString(urgency)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataAttributesTarget.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataAttributesTarget.java new file mode 100644 index 00000000000..5ce5a24d2cd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataAttributesTarget.java @@ -0,0 +1,166 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Information about the target to notify (such as a team or user). */ +@JsonPropertyOrder({ + CreatePageRequestDataAttributesTarget.JSON_PROPERTY_IDENTIFIER, + CreatePageRequestDataAttributesTarget.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreatePageRequestDataAttributesTarget { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IDENTIFIER = "identifier"; + private String identifier; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public CreatePageRequestDataAttributesTarget identifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * A unique ID for the target (for example, team handle or user UUID). + * + * @return identifier + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IDENTIFIER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public CreatePageRequestDataAttributesTarget type(String type) { + this.type = type; + return this; + } + + /** + * The kind of target, team_uuid | team_handle | user_uuid. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreatePageRequestDataAttributesTarget + */ + @JsonAnySetter + public CreatePageRequestDataAttributesTarget putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreatePageRequestDataAttributesTarget object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePageRequestDataAttributesTarget createPageRequestDataAttributesTarget = + (CreatePageRequestDataAttributesTarget) o; + return Objects.equals(this.identifier, createPageRequestDataAttributesTarget.identifier) + && Objects.equals(this.type, createPageRequestDataAttributesTarget.type) + && Objects.equals( + this.additionalProperties, createPageRequestDataAttributesTarget.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePageRequestDataAttributesTarget {\n"); + sb.append(" identifier: ").append(toIndentedString(identifier)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataType.java new file mode 100644 index 00000000000..add3adad0f9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageRequestDataType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of resource used when creating an On-Call Page. */ +@JsonSerialize(using = CreatePageRequestDataType.CreatePageRequestDataTypeSerializer.class) +public class CreatePageRequestDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("pages")); + + public static final CreatePageRequestDataType PAGES = new CreatePageRequestDataType("pages"); + + CreatePageRequestDataType(String value) { + super(value, allowedValues); + } + + public static class CreatePageRequestDataTypeSerializer + extends StdSerializer { + public CreatePageRequestDataTypeSerializer(Class t) { + super(t); + } + + public CreatePageRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CreatePageRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CreatePageRequestDataType fromValue(String value) { + return new CreatePageRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageResponse.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageResponse.java new file mode 100644 index 00000000000..381772ba4e0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The full response object after creating a new On-Call Page. */ +@JsonPropertyOrder({CreatePageResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreatePageResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreatePageResponseData data; + + public CreatePageResponse data(CreatePageResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The information returned after successfully creating a page. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CreatePageResponseData getData() { + return data; + } + + public void setData(CreatePageResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreatePageResponse + */ + @JsonAnySetter + public CreatePageResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreatePageResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePageResponse createPageResponse = (CreatePageResponse) o; + return Objects.equals(this.data, createPageResponse.data) + && Objects.equals(this.additionalProperties, createPageResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePageResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageResponseData.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageResponseData.java new file mode 100644 index 00000000000..51fe08e53ba --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageResponseData.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The information returned after successfully creating a page. */ +@JsonPropertyOrder({ + CreatePageResponseData.JSON_PROPERTY_ID, + CreatePageResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreatePageResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CreatePageResponseDataType type = CreatePageResponseDataType.PAGES; + + public CreatePageResponseData() {} + + @JsonCreator + public CreatePageResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CreatePageResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreatePageResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique ID of the created page. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CreatePageResponseData type(CreatePageResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of resource used when creating an On-Call Page. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreatePageResponseDataType getType() { + return type; + } + + public void setType(CreatePageResponseDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreatePageResponseData + */ + @JsonAnySetter + public CreatePageResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreatePageResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePageResponseData createPageResponseData = (CreatePageResponseData) o; + return Objects.equals(this.id, createPageResponseData.id) + && Objects.equals(this.type, createPageResponseData.type) + && Objects.equals(this.additionalProperties, createPageResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePageResponseData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreatePageResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/CreatePageResponseDataType.java new file mode 100644 index 00000000000..273fc737f21 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreatePageResponseDataType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of resource used when creating an On-Call Page. */ +@JsonSerialize(using = CreatePageResponseDataType.CreatePageResponseDataTypeSerializer.class) +public class CreatePageResponseDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("pages")); + + public static final CreatePageResponseDataType PAGES = new CreatePageResponseDataType("pages"); + + CreatePageResponseDataType(String value) { + super(value, allowedValues); + } + + public static class CreatePageResponseDataTypeSerializer + extends StdSerializer { + public CreatePageResponseDataTypeSerializer(Class t) { + super(t); + } + + public CreatePageResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + CreatePageResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CreatePageResponseDataType fromValue(String value) { + return new CreatePageResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PageUrgency.java b/src/main/java/com/datadog/api/client/v2/model/PageUrgency.java new file mode 100644 index 00000000000..853309049e1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PageUrgency.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** On-Call Page urgency level. */ +@JsonSerialize(using = PageUrgency.PageUrgencySerializer.class) +public class PageUrgency extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("low", "high")); + + public static final PageUrgency LOW = new PageUrgency("low"); + public static final PageUrgency HIGH = new PageUrgency("high"); + + PageUrgency(String value) { + super(value, allowedValues); + } + + public static class PageUrgencySerializer extends StdSerializer { + public PageUrgencySerializer(Class t) { + super(t); + } + + public PageUrgencySerializer() { + this(null); + } + + @Override + public void serialize(PageUrgency value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static PageUrgency fromValue(String value) { + return new PageUrgency(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/on-call_paging.feature b/src/test/resources/com/datadog/api/client/v2/api/on-call_paging.feature new file mode 100644 index 00000000000..69221bff418 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index aad61cf15e5..2b53228c62d 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -1884,6 +1884,34 @@ "type": "idempotent" } }, + "CreateOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, + "AcknowledgeOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, + "EscalateOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, + "ResolveOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, "CreateOnCallSchedule": { "tag": "On-Call", "undo": {