diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d3505929ef5..8a6b2eecc25 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21602,6 +21602,82 @@ components: - type - attributes type: object + IncidentCreatePageAttributes: + description: Attributes for creating a page from an incident. + properties: + description: + description: Description of the page. + example: Page created for incident response + nullable: true + type: string + services: + description: List of services associated with the page. + example: + - web-service + - api-service + items: + type: string + nullable: true + type: array + tags: + description: List of tags for the page. + example: + - urgent + - production + items: + type: string + nullable: true + type: array + target: + $ref: '#/components/schemas/IncidentPageTarget' + title: + description: Title of the page. + example: Incident Response Page + type: string + required: + - title + - target + type: object + IncidentCreatePageFromIncidentData: + description: Data for creating a page from an incident. + properties: + attributes: + $ref: '#/components/schemas/IncidentCreatePageAttributes' + type: + $ref: '#/components/schemas/IncidentPageType' + required: + - type + - attributes + type: object + IncidentCreatePageFromIncidentRequest: + description: Request to create a page from an incident. + properties: + data: + $ref: '#/components/schemas/IncidentCreatePageFromIncidentData' + required: + - data + type: object + IncidentCreatePageResponse: + description: Response from creating a page from an incident. + properties: + data: + $ref: '#/components/schemas/IncidentCreatePageResponseData' + required: + - data + type: object + IncidentCreatePageResponseData: + description: Data from creating a page. + properties: + id: + description: The UUID of the created page. + example: 00000000-0000-0000-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentPageIdType' + required: + - id + - type + type: object IncidentCreateRelationships: description: The relationships the incident will have with other resources once created. @@ -22586,6 +22662,48 @@ components: - id - type type: object + IncidentPageIdType: + description: Incident page ID type. + enum: + - page_uuid + example: page_uuid + type: string + x-enum-varnames: + - PAGE_UUID + IncidentPageTarget: + description: Target for creating a page from an incident. + properties: + identifier: + description: The identifier of the target (team handle, team UUID, or user + UUID). + example: team-handle + type: string + type: + $ref: '#/components/schemas/IncidentPageTargetType' + required: + - type + - identifier + type: object + IncidentPageTargetType: + description: Type of page target for incident pages. + enum: + - team_handle + - team_uuid + - user_uuid + example: team_handle + type: string + x-enum-varnames: + - TEAM_HANDLE + - TEAM_UUID + - USER_UUID + IncidentPageType: + description: Incident page type. + enum: + - page + example: page + type: string + x-enum-varnames: + - PAGE IncidentPostmortemType: default: incident_postmortems description: Incident postmortem resource type. @@ -50878,6 +50996,7 @@ components: is not required to set downtimes. monitors_read: View monitors. monitors_write: Edit, delete, and resolve individual monitors. + oncall_page: Create and manage on-call pages. org_connections_read: Read cross organization connections. org_connections_write: Create, edit, and delete cross organization connections. org_management: Edit org configurations, including authentication and @@ -59667,6 +59786,54 @@ paths: x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/page: + post: + description: Create a page from an incident. + operationId: CreatePageFromIncident + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentCreatePageFromIncidentRequest' + description: Page creation request payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentCreatePageResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + - oncall_page + summary: Create a page from an incident + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_read + - oncall_page + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/{incident_id}/relationships/integrations: get: description: Get all integration metadata for an incident. diff --git a/examples/v2/incidents/CreatePageFromIncident.java b/examples/v2/incidents/CreatePageFromIncident.java new file mode 100644 index 00000000000..01921cebc67 --- /dev/null +++ b/examples/v2/incidents/CreatePageFromIncident.java @@ -0,0 +1,48 @@ +// Create a page from an incident returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentCreatePageAttributes; +import com.datadog.api.client.v2.model.IncidentCreatePageFromIncidentData; +import com.datadog.api.client.v2.model.IncidentCreatePageFromIncidentRequest; +import com.datadog.api.client.v2.model.IncidentCreatePageResponse; +import com.datadog.api.client.v2.model.IncidentPageTarget; +import com.datadog.api.client.v2.model.IncidentPageTargetType; +import com.datadog.api.client.v2.model.IncidentPageType; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createPageFromIncident", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + IncidentCreatePageFromIncidentRequest body = + new IncidentCreatePageFromIncidentRequest() + .data( + new IncidentCreatePageFromIncidentData() + .attributes( + new IncidentCreatePageAttributes() + .description("Page created for incident response") + .services(Arrays.asList("web-service", "api-service")) + .tags(Arrays.asList("urgent", "production")) + .target( + new IncidentPageTarget() + .identifier("team-handle") + .type(IncidentPageTargetType.TEAM_HANDLE)) + .title("Incident Response Page")) + .type(IncidentPageType.PAGE)); + + try { + IncidentCreatePageResponse result = apiInstance.createPageFromIncident("incident_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createPageFromIncident"); + 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 3f0f46d69b5..68269703939 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -725,6 +725,7 @@ public class ApiClient { put("v2.createIncidentNotificationTemplate", false); put("v2.createIncidentTodo", false); put("v2.createIncidentType", false); + put("v2.createPageFromIncident", false); put("v2.deleteIncident", false); put("v2.deleteIncidentImpact", false); put("v2.deleteIncidentIntegration", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java index 190e750f515..30d70c2a071 100644 --- a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java @@ -12,6 +12,8 @@ import com.datadog.api.client.v2.model.IncidentAttachmentUpdateRequest; import com.datadog.api.client.v2.model.IncidentAttachmentUpdateResponse; import com.datadog.api.client.v2.model.IncidentAttachmentsResponse; +import com.datadog.api.client.v2.model.IncidentCreatePageFromIncidentRequest; +import com.datadog.api.client.v2.model.IncidentCreatePageResponse; import com.datadog.api.client.v2.model.IncidentCreateRequest; import com.datadog.api.client.v2.model.IncidentImpactCreateRequest; import com.datadog.api.client.v2.model.IncidentImpactRelatedObject; @@ -1315,6 +1317,185 @@ public CompletableFuture> createIncidentTypeWi new GenericType() {}); } + /** + * Create a page from an incident. + * + *

See {@link #createPageFromIncidentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Page creation request payload. (required) + * @return IncidentCreatePageResponse + * @throws ApiException if fails to make API call + */ + public IncidentCreatePageResponse createPageFromIncident( + String incidentId, IncidentCreatePageFromIncidentRequest body) throws ApiException { + return createPageFromIncidentWithHttpInfo(incidentId, body).getData(); + } + + /** + * Create a page from an incident. + * + *

See {@link #createPageFromIncidentWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Page creation request payload. (required) + * @return CompletableFuture<IncidentCreatePageResponse> + */ + public CompletableFuture createPageFromIncidentAsync( + String incidentId, IncidentCreatePageFromIncidentRequest body) { + return createPageFromIncidentWithHttpInfoAsync(incidentId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a page from an incident. + * + * @param incidentId The UUID of the incident. (required) + * @param body Page creation request payload. (required) + * @return ApiResponse<IncidentCreatePageResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createPageFromIncidentWithHttpInfo( + String incidentId, IncidentCreatePageFromIncidentRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createPageFromIncident"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling createPageFromIncident"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createPageFromIncident"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/page" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.createPageFromIncident", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a page from an incident. + * + *

See {@link #createPageFromIncidentWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param body Page creation request payload. (required) + * @return CompletableFuture<ApiResponse<IncidentCreatePageResponse>> + */ + public CompletableFuture> + createPageFromIncidentWithHttpInfoAsync( + String incidentId, IncidentCreatePageFromIncidentRequest body) { + // Check if unstable operation is enabled + String operationId = "createPageFromIncident"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'incidentId' when calling createPageFromIncident")); + 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 createPageFromIncident")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/page" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.createPageFromIncident", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + 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, + new GenericType() {}); + } + /** * Delete an existing incident. * diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageAttributes.java new file mode 100644 index 00000000000..73b1ecf6644 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageAttributes.java @@ -0,0 +1,314 @@ +/* + * 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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for creating a page from an incident. */ +@JsonPropertyOrder({ + IncidentCreatePageAttributes.JSON_PROPERTY_DESCRIPTION, + IncidentCreatePageAttributes.JSON_PROPERTY_SERVICES, + IncidentCreatePageAttributes.JSON_PROPERTY_TAGS, + IncidentCreatePageAttributes.JSON_PROPERTY_TARGET, + IncidentCreatePageAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentCreatePageAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SERVICES = "services"; + private JsonNullable> services = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + private JsonNullable> tags = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_TARGET = "target"; + private IncidentPageTarget target; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public IncidentCreatePageAttributes() {} + + @JsonCreator + public IncidentCreatePageAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_TARGET) IncidentPageTarget target, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { + this.target = target; + this.unparsed |= target.unparsed; + this.title = title; + } + + public IncidentCreatePageAttributes description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * Description of the page. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public IncidentCreatePageAttributes services(List services) { + this.services = JsonNullable.>of(services); + return this; + } + + public IncidentCreatePageAttributes addServicesItem(String servicesItem) { + if (this.services == null || !this.services.isPresent()) { + this.services = JsonNullable.>of(new ArrayList<>()); + } + try { + this.services.get().add(servicesItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of services associated with the page. + * + * @return services + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getServices() { + return services.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_SERVICES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getServices_JsonNullable() { + return services; + } + + @JsonProperty(JSON_PROPERTY_SERVICES) + public void setServices_JsonNullable(JsonNullable> services) { + this.services = services; + } + + public void setServices(List services) { + this.services = JsonNullable.>of(services); + } + + public IncidentCreatePageAttributes tags(List tags) { + this.tags = JsonNullable.>of(tags); + return this; + } + + public IncidentCreatePageAttributes addTagsItem(String tagsItem) { + if (this.tags == null || !this.tags.isPresent()) { + this.tags = JsonNullable.>of(new ArrayList<>()); + } + try { + this.tags.get().add(tagsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * List of tags for the page. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTags() { + return tags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTags_JsonNullable() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + public void setTags_JsonNullable(JsonNullable> tags) { + this.tags = tags; + } + + public void setTags(List tags) { + this.tags = JsonNullable.>of(tags); + } + + public IncidentCreatePageAttributes target(IncidentPageTarget target) { + this.target = target; + this.unparsed |= target.unparsed; + return this; + } + + /** + * Target for creating a page from an incident. + * + * @return target + */ + @JsonProperty(JSON_PROPERTY_TARGET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentPageTarget getTarget() { + return target; + } + + public void setTarget(IncidentPageTarget target) { + this.target = target; + } + + public IncidentCreatePageAttributes title(String title) { + this.title = title; + return this; + } + + /** + * 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; + } + + /** + * 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 IncidentCreatePageAttributes + */ + @JsonAnySetter + public IncidentCreatePageAttributes 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 IncidentCreatePageAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentCreatePageAttributes incidentCreatePageAttributes = (IncidentCreatePageAttributes) o; + return Objects.equals(this.description, incidentCreatePageAttributes.description) + && Objects.equals(this.services, incidentCreatePageAttributes.services) + && Objects.equals(this.tags, incidentCreatePageAttributes.tags) + && Objects.equals(this.target, incidentCreatePageAttributes.target) + && Objects.equals(this.title, incidentCreatePageAttributes.title) + && Objects.equals( + this.additionalProperties, incidentCreatePageAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, services, tags, target, title, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentCreatePageAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" services: ").append(toIndentedString(services)).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(" 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/IncidentCreatePageFromIncidentData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageFromIncidentData.java new file mode 100644 index 00000000000..9511df6cc16 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageFromIncidentData.java @@ -0,0 +1,183 @@ +/* + * 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; + +/** Data for creating a page from an incident. */ +@JsonPropertyOrder({ + IncidentCreatePageFromIncidentData.JSON_PROPERTY_ATTRIBUTES, + IncidentCreatePageFromIncidentData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentCreatePageFromIncidentData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentCreatePageAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentPageType type; + + public IncidentCreatePageFromIncidentData() {} + + @JsonCreator + public IncidentCreatePageFromIncidentData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentCreatePageAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentPageType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentCreatePageFromIncidentData attributes(IncidentCreatePageAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating a page from an incident. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentCreatePageAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentCreatePageAttributes attributes) { + this.attributes = attributes; + } + + public IncidentCreatePageFromIncidentData type(IncidentPageType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident page type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentPageType getType() { + return type; + } + + public void setType(IncidentPageType 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 IncidentCreatePageFromIncidentData + */ + @JsonAnySetter + public IncidentCreatePageFromIncidentData 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 IncidentCreatePageFromIncidentData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentCreatePageFromIncidentData incidentCreatePageFromIncidentData = + (IncidentCreatePageFromIncidentData) o; + return Objects.equals(this.attributes, incidentCreatePageFromIncidentData.attributes) + && Objects.equals(this.type, incidentCreatePageFromIncidentData.type) + && Objects.equals( + this.additionalProperties, incidentCreatePageFromIncidentData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentCreatePageFromIncidentData {\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/IncidentCreatePageFromIncidentRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageFromIncidentRequest.java new file mode 100644 index 00000000000..fcc4bd81ee5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageFromIncidentRequest.java @@ -0,0 +1,148 @@ +/* + * 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; + +/** Request to create a page from an incident. */ +@JsonPropertyOrder({IncidentCreatePageFromIncidentRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentCreatePageFromIncidentRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentCreatePageFromIncidentData data; + + public IncidentCreatePageFromIncidentRequest() {} + + @JsonCreator + public IncidentCreatePageFromIncidentRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentCreatePageFromIncidentData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentCreatePageFromIncidentRequest data(IncidentCreatePageFromIncidentData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for creating a page from an incident. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentCreatePageFromIncidentData getData() { + return data; + } + + public void setData(IncidentCreatePageFromIncidentData 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 IncidentCreatePageFromIncidentRequest + */ + @JsonAnySetter + public IncidentCreatePageFromIncidentRequest 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 IncidentCreatePageFromIncidentRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentCreatePageFromIncidentRequest incidentCreatePageFromIncidentRequest = + (IncidentCreatePageFromIncidentRequest) o; + return Objects.equals(this.data, incidentCreatePageFromIncidentRequest.data) + && Objects.equals( + this.additionalProperties, incidentCreatePageFromIncidentRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentCreatePageFromIncidentRequest {\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/IncidentCreatePageResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageResponse.java new file mode 100644 index 00000000000..d7fd0c407af --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageResponse.java @@ -0,0 +1,147 @@ +/* + * 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; + +/** Response from creating a page from an incident. */ +@JsonPropertyOrder({IncidentCreatePageResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentCreatePageResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentCreatePageResponseData data; + + public IncidentCreatePageResponse() {} + + @JsonCreator + public IncidentCreatePageResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentCreatePageResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentCreatePageResponse data(IncidentCreatePageResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data from creating a page. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentCreatePageResponseData getData() { + return data; + } + + public void setData(IncidentCreatePageResponseData 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 IncidentCreatePageResponse + */ + @JsonAnySetter + public IncidentCreatePageResponse 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 IncidentCreatePageResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentCreatePageResponse incidentCreatePageResponse = (IncidentCreatePageResponse) o; + return Objects.equals(this.data, incidentCreatePageResponse.data) + && Objects.equals( + this.additionalProperties, incidentCreatePageResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentCreatePageResponse {\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/IncidentCreatePageResponseData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageResponseData.java new file mode 100644 index 00000000000..3ca844d2d51 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentCreatePageResponseData.java @@ -0,0 +1,180 @@ +/* + * 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; + +/** Data from creating a page. */ +@JsonPropertyOrder({ + IncidentCreatePageResponseData.JSON_PROPERTY_ID, + IncidentCreatePageResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentCreatePageResponseData { + @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 IncidentPageIdType type; + + public IncidentCreatePageResponseData() {} + + @JsonCreator + public IncidentCreatePageResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentPageIdType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentCreatePageResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The UUID of the created page. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public IncidentCreatePageResponseData type(IncidentPageIdType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident page ID type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentPageIdType getType() { + return type; + } + + public void setType(IncidentPageIdType 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 IncidentCreatePageResponseData + */ + @JsonAnySetter + public IncidentCreatePageResponseData 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 IncidentCreatePageResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentCreatePageResponseData incidentCreatePageResponseData = + (IncidentCreatePageResponseData) o; + return Objects.equals(this.id, incidentCreatePageResponseData.id) + && Objects.equals(this.type, incidentCreatePageResponseData.type) + && Objects.equals( + this.additionalProperties, incidentCreatePageResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentCreatePageResponseData {\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/IncidentPageIdType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentPageIdType.java new file mode 100644 index 00000000000..47720c0cfcc --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentPageIdType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 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; + +/** Incident page ID type. */ +@JsonSerialize(using = IncidentPageIdType.IncidentPageIdTypeSerializer.class) +public class IncidentPageIdType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("page_uuid")); + + public static final IncidentPageIdType PAGE_UUID = new IncidentPageIdType("page_uuid"); + + IncidentPageIdType(String value) { + super(value, allowedValues); + } + + public static class IncidentPageIdTypeSerializer extends StdSerializer { + public IncidentPageIdTypeSerializer(Class t) { + super(t); + } + + public IncidentPageIdTypeSerializer() { + this(null); + } + + @Override + public void serialize(IncidentPageIdType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentPageIdType fromValue(String value) { + return new IncidentPageIdType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentPageTarget.java b/src/main/java/com/datadog/api/client/v2/model/IncidentPageTarget.java new file mode 100644 index 00000000000..fb34718a114 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentPageTarget.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; + +/** Target for creating a page from an incident. */ +@JsonPropertyOrder({ + IncidentPageTarget.JSON_PROPERTY_IDENTIFIER, + IncidentPageTarget.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentPageTarget { + @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 IncidentPageTargetType type; + + public IncidentPageTarget() {} + + @JsonCreator + public IncidentPageTarget( + @JsonProperty(required = true, value = JSON_PROPERTY_IDENTIFIER) String identifier, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentPageTargetType type) { + this.identifier = identifier; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentPageTarget identifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * The identifier of the target (team handle, team UUID, or user UUID). + * + * @return identifier + */ + @JsonProperty(JSON_PROPERTY_IDENTIFIER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public IncidentPageTarget type(IncidentPageTargetType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of page target for incident pages. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentPageTargetType getType() { + return type; + } + + public void setType(IncidentPageTargetType 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 IncidentPageTarget + */ + @JsonAnySetter + public IncidentPageTarget 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 IncidentPageTarget object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentPageTarget incidentPageTarget = (IncidentPageTarget) o; + return Objects.equals(this.identifier, incidentPageTarget.identifier) + && Objects.equals(this.type, incidentPageTarget.type) + && Objects.equals(this.additionalProperties, incidentPageTarget.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(identifier, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentPageTarget {\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/IncidentPageTargetType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentPageTargetType.java new file mode 100644 index 00000000000..4b28f51cd44 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentPageTargetType.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** Type of page target for incident pages. */ +@JsonSerialize(using = IncidentPageTargetType.IncidentPageTargetTypeSerializer.class) +public class IncidentPageTargetType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("team_handle", "team_uuid", "user_uuid")); + + public static final IncidentPageTargetType TEAM_HANDLE = + new IncidentPageTargetType("team_handle"); + public static final IncidentPageTargetType TEAM_UUID = new IncidentPageTargetType("team_uuid"); + public static final IncidentPageTargetType USER_UUID = new IncidentPageTargetType("user_uuid"); + + IncidentPageTargetType(String value) { + super(value, allowedValues); + } + + public static class IncidentPageTargetTypeSerializer + extends StdSerializer { + public IncidentPageTargetTypeSerializer(Class t) { + super(t); + } + + public IncidentPageTargetTypeSerializer() { + this(null); + } + + @Override + public void serialize( + IncidentPageTargetType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentPageTargetType fromValue(String value) { + return new IncidentPageTargetType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentPageType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentPageType.java new file mode 100644 index 00000000000..752645f1c60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentPageType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 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; + +/** Incident page type. */ +@JsonSerialize(using = IncidentPageType.IncidentPageTypeSerializer.class) +public class IncidentPageType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("page")); + + public static final IncidentPageType PAGE = new IncidentPageType("page"); + + IncidentPageType(String value) { + super(value, allowedValues); + } + + public static class IncidentPageTypeSerializer extends StdSerializer { + public IncidentPageTypeSerializer(Class t) { + super(t); + } + + public IncidentPageTypeSerializer() { + this(null); + } + + @Override + public void serialize(IncidentPageType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentPageType fromValue(String value) { + return new IncidentPageType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature index 74ae965968f..1b6eb3821ae 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature @@ -21,6 +21,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "Bad Request" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "Not Found" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Create a page from an incident returns "OK" response + Given operation "CreatePageFromIncident" enabled + And new "CreatePageFromIncident" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Page created for incident response", "services": ["web-service", "api-service"], "tags": ["urgent", "production"], "target": {"identifier": "team-handle", "type": "team_handle"}, "title": "Incident Response Page"}, "type": "page"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Create an incident attachment returns "OK" response Given operation "UpdateIncidentAttachments" enabled 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 6fcf52fcedc..985aaa0d7b3 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 @@ -1423,6 +1423,13 @@ "type": "idempotent" } }, + "CreatePageFromIncident": { + "tag": "Incidents", + "undo": { + "parameters": [], + "type": "unsafe" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": {