diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e0e9db98e4a..9fb14379521 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -105453,6 +105453,54 @@ components: type: string x-enum-varnames: - SCHEDULE + RerouteOnCallPageRequest: + description: Full request to reroute an On-Call Page to a different team or user. + example: + data: + attributes: + comment: Rerouting to the database team. + target: + identifier: my-team + type: team_handle + type: reroute + properties: + data: + $ref: "#/components/schemas/RerouteOnCallPageRequestData" + required: + - data + type: object + RerouteOnCallPageRequestData: + description: The data for rerouting an On-Call Page, including attributes and resource type. + properties: + attributes: + $ref: "#/components/schemas/RerouteOnCallPageRequestDataAttributes" + type: + $ref: "#/components/schemas/RerouteOnCallPageRequestDataType" + required: + - attributes + - type + type: object + RerouteOnCallPageRequestDataAttributes: + description: Details about where to reroute the On-Call Page. + properties: + comment: + description: An optional comment explaining why the page is being rerouted. + example: Rerouting to the database team. + type: string + target: + $ref: "#/components/schemas/CreatePageRequestDataAttributesTarget" + required: + - target + type: object + RerouteOnCallPageRequestDataType: + default: reroute + description: The type of resource used when rerouting an On-Call Page. + enum: + - reroute + example: reroute + type: string + x-enum-varnames: + - REROUTE ResolveVulnerableSymbolsRequest: description: The top-level request object for resolving vulnerable symbols in a set of packages. properties: @@ -208728,6 +208776,142 @@ paths: summary: Escalate On-Call Page tags: - On-Call Paging + /api/v2/on-call/pages/{page_id}/reroute: + post: + description: |- + Reroutes an On-Call Page. + operationId: RerouteOnCallPage + parameters: + - description: The page ID. + in: path + name: page_id + required: true + schema: + example: 15e74b8b-f865-48d0-bcc5-453323ed2c8f + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + comment: Rerouting to the database team. + target: + identifier: my-team + type: team_handle + type: reroute + schema: + $ref: "#/components/schemas/RerouteOnCallPageRequest" + required: true + responses: + "204": + description: No Content. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "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: + - lava.oncall.datadoghq.com + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - scarlet.oncall.datadoghq.com + x-enum-varnames: + - LAVA + - SAFFRON + - NAVY + - CORAL + - TEAL + - BEIGE + - SCARLET + - url: "{protocol}://{name}" + variables: + name: + default: navy.oncall.datadoghq.com + description: The full DNS name of the On-Call paging endpoint. + enum: + - lava.oncall.datadoghq.com + - saffron.oncall.datadoghq.com + - navy.oncall.datadoghq.com + - coral.oncall.datadoghq.com + - teal.oncall.datadoghq.com + - beige.oncall.datadoghq.eu + - scarlet.oncall.datadoghq.com + x-enum-varnames: + - LAVA + - SAFFRON + - NAVY + - CORAL + - TEAL + - BEIGE + - SCARLET + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: The Datadog site where the On-Call paging endpoint is deployed. + enum: + - datadoghq.com + - datadoghq.eu + x-enum-varnames: + - DATADOGHQ_COM + - DATADOGHQ_EU + subdomain: + default: navy.oncall + description: The On-Call paging subdomain. + enum: + - lava.oncall + - saffron.oncall + - navy.oncall + - coral.oncall + - teal.oncall + - beige.oncall + - scarlet.oncall + x-enum-varnames: + - LAVA + - SAFFRON + - NAVY + - CORAL + - TEAL + - BEIGE + - SCARLET + summary: Reroute On-Call Page + tags: + - On-Call Paging /api/v2/on-call/pages/{page_id}/resolve: post: description: |- diff --git a/examples/v2/on-call-paging/RerouteOnCallPage.java b/examples/v2/on-call-paging/RerouteOnCallPage.java new file mode 100644 index 00000000000..dc5ed5a511a --- /dev/null +++ b/examples/v2/on-call-paging/RerouteOnCallPage.java @@ -0,0 +1,43 @@ +// Reroute On-Call Page returns "No Content." 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.CreatePageRequestDataAttributesTarget; +import com.datadog.api.client.v2.model.OnCallPageTargetType; +import com.datadog.api.client.v2.model.RerouteOnCallPageRequest; +import com.datadog.api.client.v2.model.RerouteOnCallPageRequestData; +import com.datadog.api.client.v2.model.RerouteOnCallPageRequestDataAttributes; +import com.datadog.api.client.v2.model.RerouteOnCallPageRequestDataType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN")); + OnCallPagingApi apiInstance = new OnCallPagingApi(defaultClient); + + RerouteOnCallPageRequest body = + new RerouteOnCallPageRequest() + .data( + new RerouteOnCallPageRequestData() + .attributes( + new RerouteOnCallPageRequestDataAttributes() + .comment("Rerouting to the database team.") + .target( + new CreatePageRequestDataAttributesTarget() + .identifier("my-team") + .type(OnCallPageTargetType.TEAM_HANDLE))) + .type(RerouteOnCallPageRequestDataType.REROUTE)); + + try { + apiInstance.rerouteOnCallPage(UUID.fromString("15e74b8b-f865-48d0-bcc5-453323ed2c8f"), body); + } catch (ApiException e) { + System.err.println("Exception when calling OnCallPagingApi#rerouteOnCallPage"); + 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 1511d27dff6..adfd4fbe11f 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -813,6 +813,87 @@ public class ApiClient { "scarlet.oncall")))); } })))); + put( + "v2.OnCallPagingApi.rerouteOnCallPage", + 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( + "lava.oncall.datadoghq.com", + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu", + "scarlet.oncall.datadoghq.com")))); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "The full DNS name of the On-Call paging endpoint.", + "navy.oncall.datadoghq.com", + new HashSet( + Arrays.asList( + "lava.oncall.datadoghq.com", + "saffron.oncall.datadoghq.com", + "navy.oncall.datadoghq.com", + "coral.oncall.datadoghq.com", + "teal.oncall.datadoghq.com", + "beige.oncall.datadoghq.eu", + "scarlet.oncall.datadoghq.com")))); + 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( + "The Datadog site where the On-Call paging endpoint is" + + " deployed.", + "datadoghq.com", + new HashSet( + Arrays.asList("datadoghq.com", "datadoghq.eu")))); + put( + "subdomain", + new ServerVariable( + "The On-Call paging subdomain.", + "navy.oncall", + new HashSet( + Arrays.asList( + "lava.oncall", + "saffron.oncall", + "navy.oncall", + "coral.oncall", + "teal.oncall", + "beige.oncall", + "scarlet.oncall")))); + } + })))); put( "v2.OnCallPagingApi.resolveOnCallPage", new ArrayList( 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 index fc7a11299a0..5be756ed9e6 100644 --- a/src/main/java/com/datadog/api/client/v2/api/OnCallPagingApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/OnCallPagingApi.java @@ -6,6 +6,7 @@ import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.CreatePageRequest; import com.datadog.api.client.v2.model.CreatePageResponse; +import com.datadog.api.client.v2.model.RerouteOnCallPageRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -434,6 +435,161 @@ public CompletableFuture> escalateOnCallPageWithHttpInfoAsync( null); } + /** + * Reroute On-Call Page. + * + *

See {@link #rerouteOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void rerouteOnCallPage(UUID pageId, RerouteOnCallPageRequest body) throws ApiException { + rerouteOnCallPageWithHttpInfo(pageId, body); + } + + /** + * Reroute On-Call Page. + * + *

See {@link #rerouteOnCallPageWithHttpInfoAsync}. + * + * @param pageId The page ID. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture rerouteOnCallPageAsync( + UUID pageId, RerouteOnCallPageRequest body) { + return rerouteOnCallPageWithHttpInfoAsync(pageId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Reroutes an On-Call Page. + * + * @param pageId The page ID. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse rerouteOnCallPageWithHttpInfo(UUID pageId, RerouteOnCallPageRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'pageId' is set + if (pageId == null) { + throw new ApiException( + 400, "Missing the required parameter 'pageId' when calling rerouteOnCallPage"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling rerouteOnCallPage"); + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/reroute" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.rerouteOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Reroute On-Call Page. + * + *

See {@link #rerouteOnCallPageWithHttpInfo}. + * + * @param pageId The page ID. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> rerouteOnCallPageWithHttpInfoAsync( + UUID pageId, RerouteOnCallPageRequest body) { + Object localVarPostBody = body; + + // 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 rerouteOnCallPage")); + return result; + } + + // 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 rerouteOnCallPage")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/on-call/pages/{page_id}/reroute" + .replaceAll("\\{" + "page_id" + "\\}", apiClient.escapeString(pageId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.OnCallPagingApi.rerouteOnCallPage", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } 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, + null); + } + /** * Resolve On-Call Page. * diff --git a/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequest.java b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequest.java new file mode 100644 index 00000000000..592c88af683 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequest.java @@ -0,0 +1,149 @@ +/* + * 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; + +/** Full request to reroute an On-Call Page to a different team or user. */ +@JsonPropertyOrder({RerouteOnCallPageRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RerouteOnCallPageRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RerouteOnCallPageRequestData data; + + public RerouteOnCallPageRequest() {} + + @JsonCreator + public RerouteOnCallPageRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + RerouteOnCallPageRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RerouteOnCallPageRequest data(RerouteOnCallPageRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The data for rerouting an On-Call Page, including attributes and resource type. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RerouteOnCallPageRequestData getData() { + return data; + } + + public void setData(RerouteOnCallPageRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 RerouteOnCallPageRequest + */ + @JsonAnySetter + public RerouteOnCallPageRequest 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 RerouteOnCallPageRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RerouteOnCallPageRequest rerouteOnCallPageRequest = (RerouteOnCallPageRequest) o; + return Objects.equals(this.data, rerouteOnCallPageRequest.data) + && Objects.equals(this.additionalProperties, rerouteOnCallPageRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RerouteOnCallPageRequest {\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/RerouteOnCallPageRequestData.java b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequestData.java new file mode 100644 index 00000000000..216790601b5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequestData.java @@ -0,0 +1,187 @@ +/* + * 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 data for rerouting an On-Call Page, including attributes and resource type. */ +@JsonPropertyOrder({ + RerouteOnCallPageRequestData.JSON_PROPERTY_ATTRIBUTES, + RerouteOnCallPageRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RerouteOnCallPageRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private RerouteOnCallPageRequestDataAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private RerouteOnCallPageRequestDataType type = RerouteOnCallPageRequestDataType.REROUTE; + + public RerouteOnCallPageRequestData() {} + + @JsonCreator + public RerouteOnCallPageRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + RerouteOnCallPageRequestDataAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + RerouteOnCallPageRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RerouteOnCallPageRequestData attributes( + RerouteOnCallPageRequestDataAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Details about where to reroute the On-Call Page. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RerouteOnCallPageRequestDataAttributes getAttributes() { + return attributes; + } + + public void setAttributes(RerouteOnCallPageRequestDataAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public RerouteOnCallPageRequestData type(RerouteOnCallPageRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of resource used when rerouting an On-Call Page. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RerouteOnCallPageRequestDataType getType() { + return type; + } + + public void setType(RerouteOnCallPageRequestDataType 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 RerouteOnCallPageRequestData + */ + @JsonAnySetter + public RerouteOnCallPageRequestData 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 RerouteOnCallPageRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RerouteOnCallPageRequestData rerouteOnCallPageRequestData = (RerouteOnCallPageRequestData) o; + return Objects.equals(this.attributes, rerouteOnCallPageRequestData.attributes) + && Objects.equals(this.type, rerouteOnCallPageRequestData.type) + && Objects.equals( + this.additionalProperties, rerouteOnCallPageRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RerouteOnCallPageRequestData {\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/RerouteOnCallPageRequestDataAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequestDataAttributes.java new file mode 100644 index 00000000000..fa51912eb7f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequestDataAttributes.java @@ -0,0 +1,181 @@ +/* + * 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; + +/** Details about where to reroute the On-Call Page. */ +@JsonPropertyOrder({ + RerouteOnCallPageRequestDataAttributes.JSON_PROPERTY_COMMENT, + RerouteOnCallPageRequestDataAttributes.JSON_PROPERTY_TARGET +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RerouteOnCallPageRequestDataAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COMMENT = "comment"; + private String comment; + + public static final String JSON_PROPERTY_TARGET = "target"; + private CreatePageRequestDataAttributesTarget target; + + public RerouteOnCallPageRequestDataAttributes() {} + + @JsonCreator + public RerouteOnCallPageRequestDataAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) + CreatePageRequestDataAttributesTarget target) { + this.target = target; + this.unparsed |= target.unparsed; + } + + public RerouteOnCallPageRequestDataAttributes comment(String comment) { + this.comment = comment; + return this; + } + + /** + * An optional comment explaining why the page is being rerouted. + * + * @return comment + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_COMMENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public RerouteOnCallPageRequestDataAttributes 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; + if (target != null) { + this.unparsed |= target.unparsed; + } + } + + /** + * 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 RerouteOnCallPageRequestDataAttributes + */ + @JsonAnySetter + public RerouteOnCallPageRequestDataAttributes 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 RerouteOnCallPageRequestDataAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RerouteOnCallPageRequestDataAttributes rerouteOnCallPageRequestDataAttributes = + (RerouteOnCallPageRequestDataAttributes) o; + return Objects.equals(this.comment, rerouteOnCallPageRequestDataAttributes.comment) + && Objects.equals(this.target, rerouteOnCallPageRequestDataAttributes.target) + && Objects.equals( + this.additionalProperties, rerouteOnCallPageRequestDataAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(comment, target, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RerouteOnCallPageRequestDataAttributes {\n"); + sb.append(" comment: ").append(toIndentedString(comment)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).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/RerouteOnCallPageRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequestDataType.java new file mode 100644 index 00000000000..42652f6475e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RerouteOnCallPageRequestDataType.java @@ -0,0 +1,57 @@ +/* + * 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 rerouting an On-Call Page. */ +@JsonSerialize( + using = RerouteOnCallPageRequestDataType.RerouteOnCallPageRequestDataTypeSerializer.class) +public class RerouteOnCallPageRequestDataType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("reroute")); + + public static final RerouteOnCallPageRequestDataType REROUTE = + new RerouteOnCallPageRequestDataType("reroute"); + + RerouteOnCallPageRequestDataType(String value) { + super(value, allowedValues); + } + + public static class RerouteOnCallPageRequestDataTypeSerializer + extends StdSerializer { + public RerouteOnCallPageRequestDataTypeSerializer(Class t) { + super(t); + } + + public RerouteOnCallPageRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + RerouteOnCallPageRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RerouteOnCallPageRequestDataType fromValue(String value) { + return new RerouteOnCallPageRequestDataType(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 index fc26fabd4c1..1a8b5a3b97c 100644 --- 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 @@ -30,6 +30,22 @@ Feature: On-Call Paging When the request is sent Then the response status is 202 Accepted. + @generated @skip @team:ddoghq/on-call + Scenario: Reroute On-Call Page returns "Bad Request" response + Given new "RerouteOnCallPage" request + And request contains "page_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Rerouting to the database team.", "target": {"identifier": "my-team", "type": "team_handle"}}, "type": "reroute"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/on-call + Scenario: Reroute On-Call Page returns "No Content." response + Given new "RerouteOnCallPage" request + And request contains "page_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"comment": "Rerouting to the database team.", "target": {"identifier": "my-team", "type": "team_handle"}}, "type": "reroute"}} + When the request is sent + Then the response status is 204 No Content. + @generated @skip @team:ddoghq/on-call Scenario: Resolve On-Call Page returns "Accepted." response Given new "ResolveOnCallPage" request 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 8ce55668e7f..fa3ab60a6b3 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 @@ -6801,6 +6801,12 @@ "type": "unsafe" } }, + "RerouteOnCallPage": { + "tag": "On-Call Paging", + "undo": { + "type": "idempotent" + } + }, "ResolveOnCallPage": { "tag": "On-Call Paging", "undo": {