diff --git a/.generated-info b/.generated-info index 19c26bde7ba..28d4b64f85a 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "0becaa3", - "generated": "2025-07-17 13:14:16.680" + "spec_repo_commit": "214381f", + "generated": "2025-07-17 15:38:05.086" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index affbc2622b2..5709841fc5c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2291,6 +2291,88 @@ components: - id - base_severity type: object + AlertEventAttributes: + description: Alert event attributes. + properties: + aggregation_key: + $ref: '#/components/schemas/V2EventAggregationKey' + custom: + description: JSON object of custom attributes. + example: {} + type: object + evt: + $ref: '#/components/schemas/EventSystemAttributes' + links: + description: The links related to the event. + example: + - category: runbook + title: Runbook Link + url: https://app.datadoghq.com/runbook + items: + $ref: '#/components/schemas/AlertEventAttributesLinksItem' + type: array + priority: + $ref: '#/components/schemas/AlertEventAttributesPriority' + service: + $ref: '#/components/schemas/V2EventService' + status: + $ref: '#/components/schemas/AlertEventAttributesStatus' + timestamp: + $ref: '#/components/schemas/V2EventTimestamp' + title: + $ref: '#/components/schemas/V2EventTitle' + type: object + AlertEventAttributesLinksItem: + description: A link. + properties: + category: + $ref: '#/components/schemas/AlertEventAttributesLinksItemCategory' + title: + description: The display text of the link. + type: string + url: + description: The URL of the link. + type: string + type: object + AlertEventAttributesLinksItemCategory: + description: The category of the link. + enum: + - runbook + - documentation + - dashboard + type: string + x-enum-varnames: + - RUNBOOK + - DOCUMENTATION + - DASHBOARD + AlertEventAttributesPriority: + description: The priority of the alert. + enum: + - '1' + - '2' + - '3' + - '4' + - '5' + example: '5' + type: string + x-enum-varnames: + - PRIORITY_ONE + - PRIORITY_TWO + - PRIORITY_THREE + - PRIORITY_FOUR + - PRIORITY_FIVE + AlertEventAttributesStatus: + description: The status of the alert. + enum: + - warn + - error + - ok + example: error + type: string + x-enum-varnames: + - WARN + - ERROR + - OK AlertEventCustomAttributes: additionalProperties: false description: Alert event attributes. @@ -7102,6 +7184,116 @@ components: format: int64 type: integer type: object + ChangeEventAttributes: + description: Change event attributes. + properties: + aggregation_key: + $ref: '#/components/schemas/V2EventAggregationKey' + author: + $ref: '#/components/schemas/ChangeEventAttributesAuthor' + change_metadata: + description: JSON object of change metadata. + example: + dd: + team: datadog_team + user_email: datadog@datadog.com + user_id: datadog_user_id + user_name: datadog_username + type: object + changed_resource: + $ref: '#/components/schemas/ChangeEventAttributesChangedResource' + evt: + $ref: '#/components/schemas/EventSystemAttributes' + impacted_resources: + description: A list of resources impacted by this change. + example: + - name: service-name + type: service + items: + $ref: '#/components/schemas/ChangeEventAttributesImpactedResourcesItem' + type: array + new_value: + description: The new state of the changed resource. + example: + enabled: true + percentage: 50% + rule: + datacenter: devcycle.us1.prod + type: object + prev_value: + description: The previous state of the changed resource. + example: + enabled: true + percentage: 10% + rule: + datacenter: devcycle.us1.prod + type: object + service: + $ref: '#/components/schemas/V2EventService' + timestamp: + $ref: '#/components/schemas/V2EventTimestamp' + title: + $ref: '#/components/schemas/V2EventTitle' + type: object + ChangeEventAttributesAuthor: + description: The entity that made the change. + properties: + name: + description: The name of the user or system that made the change. + example: example@datadog.com + type: string + type: + $ref: '#/components/schemas/ChangeEventAttributesAuthorType' + type: object + ChangeEventAttributesAuthorType: + description: The type of the author. + enum: + - user + - system + - api + - automation + example: user + type: string + x-enum-varnames: + - USER + - SYSTEM + - API + - AUTOMATION + ChangeEventAttributesChangedResource: + description: A uniquely identified resource. + properties: + name: + description: The name of the changed resource. + type: string + type: + $ref: '#/components/schemas/ChangeEventAttributesChangedResourceType' + type: object + ChangeEventAttributesChangedResourceType: + description: The type of the changed resource. + enum: + - feature_flag + - configuration + example: feature_flag + type: string + x-enum-varnames: + - FEATURE_FLAG + - CONFIGURATION + ChangeEventAttributesImpactedResourcesItem: + description: A uniquely identified resource. + properties: + name: + description: The name of the impacted resource. + type: string + type: + $ref: '#/components/schemas/ChangeEventAttributesImpactedResourcesItemType' + type: object + ChangeEventAttributesImpactedResourcesItemType: + description: The type of the impacted resource. + enum: + - service + type: string + x-enum-varnames: + - SERVICE ChangeEventCustomAttributes: additionalProperties: false description: Change event attributes. @@ -15189,6 +15381,44 @@ components: - USER_UPDATE - RECOMMENDATION - SNAPSHOT + EventSystemAttributes: + description: JSON object of event system attributes. + properties: + category: + $ref: '#/components/schemas/EventSystemAttributesCategory' + id: + description: Event identifier. This field is deprecated and will be removed + in a future version. Use the `uid` field instead. + type: string + integration_id: + $ref: '#/components/schemas/EventSystemAttributesIntegrationId' + source_id: + description: The source type ID of the event. + format: int64 + type: integer + uid: + description: A unique identifier for the event. You can use this identifier + to query or reference the event. + type: string + type: object + EventSystemAttributesCategory: + description: Event category identifying the type of event. + enum: + - change + - alert + example: change + type: string + x-enum-varnames: + - CHANGE + - ALERT + EventSystemAttributesIntegrationId: + description: Integration ID sourced from integration manifests. + enum: + - custom-events + example: custom-events + type: string + x-enum-varnames: + - CUSTOM_EVENTS EventType: default: event description: Type of the event. @@ -41557,6 +41787,70 @@ components: type: string x-enum-varnames: - USERS + V2Event: + description: An event object. + properties: + attributes: + $ref: '#/components/schemas/V2EventAttributes' + id: + description: The event's ID. + example: '' + type: string + type: + description: Entity type. + example: event + type: string + type: object + V2EventAggregationKey: + description: Aggregation key of the event. + example: aggregation-key + type: string + V2EventAttributes: + description: Event attributes. + properties: + attributes: + $ref: '#/components/schemas/V2EventAttributesAttributes' + message: + description: Free-form text associated with the event. + example: The event message + type: string + tags: + description: A list of tags associated with the event. + example: + - env:api_client_test + items: + description: A tag. + type: string + type: array + timestamp: + description: Timestamp when the event occurred. + example: '2017-01-15T01:30:15.010000Z' + type: string + type: object + V2EventAttributesAttributes: + description: JSON object for category-specific attributes. + oneOf: + - $ref: '#/components/schemas/ChangeEventAttributes' + - $ref: '#/components/schemas/AlertEventAttributes' + V2EventResponse: + description: Get an event response. + properties: + data: + $ref: '#/components/schemas/V2Event' + type: object + V2EventService: + description: Service that triggered the event. + example: service-name + type: string + V2EventTimestamp: + description: POSIX timestamp of the event. + example: 175019386627 + format: int64 + type: integer + V2EventTitle: + description: The title of the event. + example: The event title + type: string ValidationError: description: Represents a single validation error, including a human-readable title and metadata. @@ -48828,6 +49122,46 @@ paths: operator: OR permissions: - events_read + /api/v2/events/{event_id}: + get: + description: Get the details of an event by `event_id`. + operationId: GetEvent + parameters: + - description: The UID of the event. + in: path + name: event_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/V2EventResponse' + 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: + - events_read + summary: Get an event + tags: + - Events + x-permission: + operator: OR + permissions: + - events_read /api/v2/incidents: get: description: Get all incidents for the user's organization. diff --git a/examples/v2/events/GetEvent.java b/examples/v2/events/GetEvent.java new file mode 100644 index 00000000000..3ac0dd3a018 --- /dev/null +++ b/examples/v2/events/GetEvent.java @@ -0,0 +1,24 @@ +// Get an event returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.EventsApi; +import com.datadog.api.client.v2.model.V2EventResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + EventsApi apiInstance = new EventsApi(defaultClient); + + try { + V2EventResponse result = apiInstance.getEvent("AZeF-nTCAABzkAgGXzYPtgAA"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling EventsApi#getEvent"); + 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/v2/api/EventsApi.java b/src/main/java/com/datadog/api/client/v2/api/EventsApi.java index 0a18dac2140..f886d4135c7 100644 --- a/src/main/java/com/datadog/api/client/v2/api/EventsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/EventsApi.java @@ -12,6 +12,7 @@ import com.datadog.api.client.v2.model.EventsListResponse; import com.datadog.api.client.v2.model.EventsRequestPage; import com.datadog.api.client.v2.model.EventsSort; +import com.datadog.api.client.v2.model.V2EventResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -197,6 +198,139 @@ public CompletableFuture> createEventWit new GenericType() {}); } + /** + * Get an event. + * + *

See {@link #getEventWithHttpInfo}. + * + * @param eventId The UID of the event. (required) + * @return V2EventResponse + * @throws ApiException if fails to make API call + */ + public V2EventResponse getEvent(String eventId) throws ApiException { + return getEventWithHttpInfo(eventId).getData(); + } + + /** + * Get an event. + * + *

See {@link #getEventWithHttpInfoAsync}. + * + * @param eventId The UID of the event. (required) + * @return CompletableFuture<V2EventResponse> + */ + public CompletableFuture getEventAsync(String eventId) { + return getEventWithHttpInfoAsync(eventId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get the details of an event by event_id. + * + * @param eventId The UID of the event. (required) + * @return ApiResponse<V2EventResponse> + * @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 getEventWithHttpInfo(String eventId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'eventId' is set + if (eventId == null) { + throw new ApiException(400, "Missing the required parameter 'eventId' when calling getEvent"); + } + // create path and map variables + String localVarPath = + "/api/v2/events/{event_id}" + .replaceAll("\\{" + "event_id" + "\\}", apiClient.escapeString(eventId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.EventsApi.getEvent", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an event. + * + *

See {@link #getEventWithHttpInfo}. + * + * @param eventId The UID of the event. (required) + * @return CompletableFuture<ApiResponse<V2EventResponse>> + */ + public CompletableFuture> getEventWithHttpInfoAsync(String eventId) { + Object localVarPostBody = null; + + // verify the required parameter 'eventId' is set + if (eventId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'eventId' when calling getEvent")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/events/{event_id}" + .replaceAll("\\{" + "event_id" + "\\}", apiClient.escapeString(eventId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.EventsApi.getEvent", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to listEvents. */ public static class ListEventsOptionalParameters { private String filterQuery; diff --git a/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributes.java new file mode 100644 index 00000000000..ba3680e7524 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributes.java @@ -0,0 +1,386 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Alert event attributes. */ +@JsonPropertyOrder({ + AlertEventAttributes.JSON_PROPERTY_AGGREGATION_KEY, + AlertEventAttributes.JSON_PROPERTY_CUSTOM, + AlertEventAttributes.JSON_PROPERTY_EVT, + AlertEventAttributes.JSON_PROPERTY_LINKS, + AlertEventAttributes.JSON_PROPERTY_PRIORITY, + AlertEventAttributes.JSON_PROPERTY_SERVICE, + AlertEventAttributes.JSON_PROPERTY_STATUS, + AlertEventAttributes.JSON_PROPERTY_TIMESTAMP, + AlertEventAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AlertEventAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AGGREGATION_KEY = "aggregation_key"; + private String aggregationKey; + + public static final String JSON_PROPERTY_CUSTOM = "custom"; + private Object custom; + + public static final String JSON_PROPERTY_EVT = "evt"; + private EventSystemAttributes evt; + + public static final String JSON_PROPERTY_LINKS = "links"; + private List links = null; + + public static final String JSON_PROPERTY_PRIORITY = "priority"; + private AlertEventAttributesPriority priority; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_STATUS = "status"; + private AlertEventAttributesStatus status; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private Long timestamp; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public AlertEventAttributes aggregationKey(String aggregationKey) { + this.aggregationKey = aggregationKey; + return this; + } + + /** + * Aggregation key of the event. + * + * @return aggregationKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AGGREGATION_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAggregationKey() { + return aggregationKey; + } + + public void setAggregationKey(String aggregationKey) { + this.aggregationKey = aggregationKey; + } + + public AlertEventAttributes custom(Object custom) { + this.custom = custom; + return this; + } + + /** + * JSON object of custom attributes. + * + * @return custom + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getCustom() { + return custom; + } + + public void setCustom(Object custom) { + this.custom = custom; + } + + public AlertEventAttributes evt(EventSystemAttributes evt) { + this.evt = evt; + this.unparsed |= evt.unparsed; + return this; + } + + /** + * JSON object of event system attributes. + * + * @return evt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EventSystemAttributes getEvt() { + return evt; + } + + public void setEvt(EventSystemAttributes evt) { + this.evt = evt; + } + + public AlertEventAttributes links(List links) { + this.links = links; + for (AlertEventAttributesLinksItem item : links) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AlertEventAttributes addLinksItem(AlertEventAttributesLinksItem linksItem) { + if (this.links == null) { + this.links = new ArrayList<>(); + } + this.links.add(linksItem); + this.unparsed |= linksItem.unparsed; + return this; + } + + /** + * The links related to the event. + * + * @return links + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getLinks() { + return links; + } + + public void setLinks(List links) { + this.links = links; + } + + public AlertEventAttributes priority(AlertEventAttributesPriority priority) { + this.priority = priority; + this.unparsed |= !priority.isValid(); + return this; + } + + /** + * The priority of the alert. + * + * @return priority + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PRIORITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AlertEventAttributesPriority getPriority() { + return priority; + } + + public void setPriority(AlertEventAttributesPriority priority) { + if (!priority.isValid()) { + this.unparsed = true; + } + this.priority = priority; + } + + public AlertEventAttributes service(String service) { + this.service = service; + return this; + } + + /** + * Service that triggered the event. + * + * @return service + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public AlertEventAttributes status(AlertEventAttributesStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The status of the alert. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AlertEventAttributesStatus getStatus() { + return status; + } + + public void setStatus(AlertEventAttributesStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public AlertEventAttributes timestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * POSIX timestamp of the event. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(Long timestamp) { + this.timestamp = timestamp; + } + + public AlertEventAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the event. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + 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 AlertEventAttributes + */ + @JsonAnySetter + public AlertEventAttributes 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 AlertEventAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlertEventAttributes alertEventAttributes = (AlertEventAttributes) o; + return Objects.equals(this.aggregationKey, alertEventAttributes.aggregationKey) + && Objects.equals(this.custom, alertEventAttributes.custom) + && Objects.equals(this.evt, alertEventAttributes.evt) + && Objects.equals(this.links, alertEventAttributes.links) + && Objects.equals(this.priority, alertEventAttributes.priority) + && Objects.equals(this.service, alertEventAttributes.service) + && Objects.equals(this.status, alertEventAttributes.status) + && Objects.equals(this.timestamp, alertEventAttributes.timestamp) + && Objects.equals(this.title, alertEventAttributes.title) + && Objects.equals(this.additionalProperties, alertEventAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + aggregationKey, + custom, + evt, + links, + priority, + service, + status, + timestamp, + title, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlertEventAttributes {\n"); + sb.append(" aggregationKey: ").append(toIndentedString(aggregationKey)).append("\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" evt: ").append(toIndentedString(evt)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).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/AlertEventAttributesLinksItem.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesLinksItem.java new file mode 100644 index 00000000000..f66d54f8452 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesLinksItem.java @@ -0,0 +1,196 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A link. */ +@JsonPropertyOrder({ + AlertEventAttributesLinksItem.JSON_PROPERTY_CATEGORY, + AlertEventAttributesLinksItem.JSON_PROPERTY_TITLE, + AlertEventAttributesLinksItem.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AlertEventAttributesLinksItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private AlertEventAttributesLinksItemCategory category; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public AlertEventAttributesLinksItem category(AlertEventAttributesLinksItemCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * The category of the link. + * + * @return category + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AlertEventAttributesLinksItemCategory getCategory() { + return category; + } + + public void setCategory(AlertEventAttributesLinksItemCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public AlertEventAttributesLinksItem title(String title) { + this.title = title; + return this; + } + + /** + * The display text of the link. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public AlertEventAttributesLinksItem url(String url) { + this.url = url; + return this; + } + + /** + * The URL of the link. + * + * @return url + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * 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 AlertEventAttributesLinksItem + */ + @JsonAnySetter + public AlertEventAttributesLinksItem 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 AlertEventAttributesLinksItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlertEventAttributesLinksItem alertEventAttributesLinksItem = (AlertEventAttributesLinksItem) o; + return Objects.equals(this.category, alertEventAttributesLinksItem.category) + && Objects.equals(this.title, alertEventAttributesLinksItem.title) + && Objects.equals(this.url, alertEventAttributesLinksItem.url) + && Objects.equals( + this.additionalProperties, alertEventAttributesLinksItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(category, title, url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlertEventAttributesLinksItem {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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/AlertEventAttributesLinksItemCategory.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesLinksItemCategory.java new file mode 100644 index 00000000000..e696b4f0bee --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesLinksItemCategory.java @@ -0,0 +1,66 @@ +/* + * 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 category of the link. */ +@JsonSerialize( + using = + AlertEventAttributesLinksItemCategory.AlertEventAttributesLinksItemCategorySerializer.class) +public class AlertEventAttributesLinksItemCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("runbook", "documentation", "dashboard")); + + public static final AlertEventAttributesLinksItemCategory RUNBOOK = + new AlertEventAttributesLinksItemCategory("runbook"); + public static final AlertEventAttributesLinksItemCategory DOCUMENTATION = + new AlertEventAttributesLinksItemCategory("documentation"); + public static final AlertEventAttributesLinksItemCategory DASHBOARD = + new AlertEventAttributesLinksItemCategory("dashboard"); + + AlertEventAttributesLinksItemCategory(String value) { + super(value, allowedValues); + } + + public static class AlertEventAttributesLinksItemCategorySerializer + extends StdSerializer { + public AlertEventAttributesLinksItemCategorySerializer( + Class t) { + super(t); + } + + public AlertEventAttributesLinksItemCategorySerializer() { + this(null); + } + + @Override + public void serialize( + AlertEventAttributesLinksItemCategory value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AlertEventAttributesLinksItemCategory fromValue(String value) { + return new AlertEventAttributesLinksItemCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesPriority.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesPriority.java new file mode 100644 index 00000000000..b6021bcc420 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesPriority.java @@ -0,0 +1,65 @@ +/* + * 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 priority of the alert. */ +@JsonSerialize(using = AlertEventAttributesPriority.AlertEventAttributesPrioritySerializer.class) +public class AlertEventAttributesPriority extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("1", "2", "3", "4", "5")); + + public static final AlertEventAttributesPriority PRIORITY_ONE = + new AlertEventAttributesPriority("1"); + public static final AlertEventAttributesPriority PRIORITY_TWO = + new AlertEventAttributesPriority("2"); + public static final AlertEventAttributesPriority PRIORITY_THREE = + new AlertEventAttributesPriority("3"); + public static final AlertEventAttributesPriority PRIORITY_FOUR = + new AlertEventAttributesPriority("4"); + public static final AlertEventAttributesPriority PRIORITY_FIVE = + new AlertEventAttributesPriority("5"); + + AlertEventAttributesPriority(String value) { + super(value, allowedValues); + } + + public static class AlertEventAttributesPrioritySerializer + extends StdSerializer { + public AlertEventAttributesPrioritySerializer(Class t) { + super(t); + } + + public AlertEventAttributesPrioritySerializer() { + this(null); + } + + @Override + public void serialize( + AlertEventAttributesPriority value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AlertEventAttributesPriority fromValue(String value) { + return new AlertEventAttributesPriority(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesStatus.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesStatus.java new file mode 100644 index 00000000000..db4ceba94a0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventAttributesStatus.java @@ -0,0 +1,58 @@ +/* + * 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 status of the alert. */ +@JsonSerialize(using = AlertEventAttributesStatus.AlertEventAttributesStatusSerializer.class) +public class AlertEventAttributesStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("warn", "error", "ok")); + + public static final AlertEventAttributesStatus WARN = new AlertEventAttributesStatus("warn"); + public static final AlertEventAttributesStatus ERROR = new AlertEventAttributesStatus("error"); + public static final AlertEventAttributesStatus OK = new AlertEventAttributesStatus("ok"); + + AlertEventAttributesStatus(String value) { + super(value, allowedValues); + } + + public static class AlertEventAttributesStatusSerializer + extends StdSerializer { + public AlertEventAttributesStatusSerializer(Class t) { + super(t); + } + + public AlertEventAttributesStatusSerializer() { + this(null); + } + + @Override + public void serialize( + AlertEventAttributesStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AlertEventAttributesStatus fromValue(String value) { + return new AlertEventAttributesStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributes.java new file mode 100644 index 00000000000..50e8467426d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributes.java @@ -0,0 +1,440 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Change event attributes. */ +@JsonPropertyOrder({ + ChangeEventAttributes.JSON_PROPERTY_AGGREGATION_KEY, + ChangeEventAttributes.JSON_PROPERTY_AUTHOR, + ChangeEventAttributes.JSON_PROPERTY_CHANGE_METADATA, + ChangeEventAttributes.JSON_PROPERTY_CHANGED_RESOURCE, + ChangeEventAttributes.JSON_PROPERTY_EVT, + ChangeEventAttributes.JSON_PROPERTY_IMPACTED_RESOURCES, + ChangeEventAttributes.JSON_PROPERTY_NEW_VALUE, + ChangeEventAttributes.JSON_PROPERTY_PREV_VALUE, + ChangeEventAttributes.JSON_PROPERTY_SERVICE, + ChangeEventAttributes.JSON_PROPERTY_TIMESTAMP, + ChangeEventAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ChangeEventAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AGGREGATION_KEY = "aggregation_key"; + private String aggregationKey; + + public static final String JSON_PROPERTY_AUTHOR = "author"; + private ChangeEventAttributesAuthor author; + + public static final String JSON_PROPERTY_CHANGE_METADATA = "change_metadata"; + private Object changeMetadata; + + public static final String JSON_PROPERTY_CHANGED_RESOURCE = "changed_resource"; + private ChangeEventAttributesChangedResource changedResource; + + public static final String JSON_PROPERTY_EVT = "evt"; + private EventSystemAttributes evt; + + public static final String JSON_PROPERTY_IMPACTED_RESOURCES = "impacted_resources"; + private List impactedResources = null; + + public static final String JSON_PROPERTY_NEW_VALUE = "new_value"; + private Object newValue; + + public static final String JSON_PROPERTY_PREV_VALUE = "prev_value"; + private Object prevValue; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private Long timestamp; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public ChangeEventAttributes aggregationKey(String aggregationKey) { + this.aggregationKey = aggregationKey; + return this; + } + + /** + * Aggregation key of the event. + * + * @return aggregationKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AGGREGATION_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAggregationKey() { + return aggregationKey; + } + + public void setAggregationKey(String aggregationKey) { + this.aggregationKey = aggregationKey; + } + + public ChangeEventAttributes author(ChangeEventAttributesAuthor author) { + this.author = author; + this.unparsed |= author.unparsed; + return this; + } + + /** + * The entity that made the change. + * + * @return author + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AUTHOR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChangeEventAttributesAuthor getAuthor() { + return author; + } + + public void setAuthor(ChangeEventAttributesAuthor author) { + this.author = author; + } + + public ChangeEventAttributes changeMetadata(Object changeMetadata) { + this.changeMetadata = changeMetadata; + return this; + } + + /** + * JSON object of change metadata. + * + * @return changeMetadata + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANGE_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getChangeMetadata() { + return changeMetadata; + } + + public void setChangeMetadata(Object changeMetadata) { + this.changeMetadata = changeMetadata; + } + + public ChangeEventAttributes changedResource( + ChangeEventAttributesChangedResource changedResource) { + this.changedResource = changedResource; + this.unparsed |= changedResource.unparsed; + return this; + } + + /** + * A uniquely identified resource. + * + * @return changedResource + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANGED_RESOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChangeEventAttributesChangedResource getChangedResource() { + return changedResource; + } + + public void setChangedResource(ChangeEventAttributesChangedResource changedResource) { + this.changedResource = changedResource; + } + + public ChangeEventAttributes evt(EventSystemAttributes evt) { + this.evt = evt; + this.unparsed |= evt.unparsed; + return this; + } + + /** + * JSON object of event system attributes. + * + * @return evt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EVT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EventSystemAttributes getEvt() { + return evt; + } + + public void setEvt(EventSystemAttributes evt) { + this.evt = evt; + } + + public ChangeEventAttributes impactedResources( + List impactedResources) { + this.impactedResources = impactedResources; + for (ChangeEventAttributesImpactedResourcesItem item : impactedResources) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ChangeEventAttributes addImpactedResourcesItem( + ChangeEventAttributesImpactedResourcesItem impactedResourcesItem) { + if (this.impactedResources == null) { + this.impactedResources = new ArrayList<>(); + } + this.impactedResources.add(impactedResourcesItem); + this.unparsed |= impactedResourcesItem.unparsed; + return this; + } + + /** + * A list of resources impacted by this change. + * + * @return impactedResources + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IMPACTED_RESOURCES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getImpactedResources() { + return impactedResources; + } + + public void setImpactedResources( + List impactedResources) { + this.impactedResources = impactedResources; + } + + public ChangeEventAttributes newValue(Object newValue) { + this.newValue = newValue; + return this; + } + + /** + * The new state of the changed resource. + * + * @return newValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEW_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getNewValue() { + return newValue; + } + + public void setNewValue(Object newValue) { + this.newValue = newValue; + } + + public ChangeEventAttributes prevValue(Object prevValue) { + this.prevValue = prevValue; + return this; + } + + /** + * The previous state of the changed resource. + * + * @return prevValue + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PREV_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getPrevValue() { + return prevValue; + } + + public void setPrevValue(Object prevValue) { + this.prevValue = prevValue; + } + + public ChangeEventAttributes service(String service) { + this.service = service; + return this; + } + + /** + * Service that triggered the event. + * + * @return service + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public ChangeEventAttributes timestamp(Long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * POSIX timestamp of the event. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(Long timestamp) { + this.timestamp = timestamp; + } + + public ChangeEventAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the event. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + 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 ChangeEventAttributes + */ + @JsonAnySetter + public ChangeEventAttributes 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 ChangeEventAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangeEventAttributes changeEventAttributes = (ChangeEventAttributes) o; + return Objects.equals(this.aggregationKey, changeEventAttributes.aggregationKey) + && Objects.equals(this.author, changeEventAttributes.author) + && Objects.equals(this.changeMetadata, changeEventAttributes.changeMetadata) + && Objects.equals(this.changedResource, changeEventAttributes.changedResource) + && Objects.equals(this.evt, changeEventAttributes.evt) + && Objects.equals(this.impactedResources, changeEventAttributes.impactedResources) + && Objects.equals(this.newValue, changeEventAttributes.newValue) + && Objects.equals(this.prevValue, changeEventAttributes.prevValue) + && Objects.equals(this.service, changeEventAttributes.service) + && Objects.equals(this.timestamp, changeEventAttributes.timestamp) + && Objects.equals(this.title, changeEventAttributes.title) + && Objects.equals(this.additionalProperties, changeEventAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + aggregationKey, + author, + changeMetadata, + changedResource, + evt, + impactedResources, + newValue, + prevValue, + service, + timestamp, + title, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangeEventAttributes {\n"); + sb.append(" aggregationKey: ").append(toIndentedString(aggregationKey)).append("\n"); + sb.append(" author: ").append(toIndentedString(author)).append("\n"); + sb.append(" changeMetadata: ").append(toIndentedString(changeMetadata)).append("\n"); + sb.append(" changedResource: ").append(toIndentedString(changedResource)).append("\n"); + sb.append(" evt: ").append(toIndentedString(evt)).append("\n"); + sb.append(" impactedResources: ").append(toIndentedString(impactedResources)).append("\n"); + sb.append(" newValue: ").append(toIndentedString(newValue)).append("\n"); + sb.append(" prevValue: ").append(toIndentedString(prevValue)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).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/ChangeEventAttributesAuthor.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesAuthor.java new file mode 100644 index 00000000000..a81488ae6bb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesAuthor.java @@ -0,0 +1,169 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The entity that made the change. */ +@JsonPropertyOrder({ + ChangeEventAttributesAuthor.JSON_PROPERTY_NAME, + ChangeEventAttributesAuthor.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ChangeEventAttributesAuthor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ChangeEventAttributesAuthorType type; + + public ChangeEventAttributesAuthor name(String name) { + this.name = name; + return this; + } + + /** + * The name of the user or system that made the change. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ChangeEventAttributesAuthor type(ChangeEventAttributesAuthorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the author. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChangeEventAttributesAuthorType getType() { + return type; + } + + public void setType(ChangeEventAttributesAuthorType 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 ChangeEventAttributesAuthor + */ + @JsonAnySetter + public ChangeEventAttributesAuthor 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 ChangeEventAttributesAuthor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangeEventAttributesAuthor changeEventAttributesAuthor = (ChangeEventAttributesAuthor) o; + return Objects.equals(this.name, changeEventAttributesAuthor.name) + && Objects.equals(this.type, changeEventAttributesAuthor.type) + && Objects.equals( + this.additionalProperties, changeEventAttributesAuthor.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangeEventAttributesAuthor {\n"); + sb.append(" name: ").append(toIndentedString(name)).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/ChangeEventAttributesAuthorType.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesAuthorType.java new file mode 100644 index 00000000000..0ce38a88a0c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesAuthorType.java @@ -0,0 +1,64 @@ +/* + * 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 the author. */ +@JsonSerialize( + using = ChangeEventAttributesAuthorType.ChangeEventAttributesAuthorTypeSerializer.class) +public class ChangeEventAttributesAuthorType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("user", "system", "api", "automation")); + + public static final ChangeEventAttributesAuthorType USER = + new ChangeEventAttributesAuthorType("user"); + public static final ChangeEventAttributesAuthorType SYSTEM = + new ChangeEventAttributesAuthorType("system"); + public static final ChangeEventAttributesAuthorType API = + new ChangeEventAttributesAuthorType("api"); + public static final ChangeEventAttributesAuthorType AUTOMATION = + new ChangeEventAttributesAuthorType("automation"); + + ChangeEventAttributesAuthorType(String value) { + super(value, allowedValues); + } + + public static class ChangeEventAttributesAuthorTypeSerializer + extends StdSerializer { + public ChangeEventAttributesAuthorTypeSerializer(Class t) { + super(t); + } + + public ChangeEventAttributesAuthorTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ChangeEventAttributesAuthorType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ChangeEventAttributesAuthorType fromValue(String value) { + return new ChangeEventAttributesAuthorType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesChangedResource.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesChangedResource.java new file mode 100644 index 00000000000..c486e401760 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesChangedResource.java @@ -0,0 +1,170 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A uniquely identified resource. */ +@JsonPropertyOrder({ + ChangeEventAttributesChangedResource.JSON_PROPERTY_NAME, + ChangeEventAttributesChangedResource.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ChangeEventAttributesChangedResource { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ChangeEventAttributesChangedResourceType type; + + public ChangeEventAttributesChangedResource name(String name) { + this.name = name; + return this; + } + + /** + * The name of the changed resource. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ChangeEventAttributesChangedResource type(ChangeEventAttributesChangedResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the changed resource. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChangeEventAttributesChangedResourceType getType() { + return type; + } + + public void setType(ChangeEventAttributesChangedResourceType 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 ChangeEventAttributesChangedResource + */ + @JsonAnySetter + public ChangeEventAttributesChangedResource 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 ChangeEventAttributesChangedResource object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangeEventAttributesChangedResource changeEventAttributesChangedResource = + (ChangeEventAttributesChangedResource) o; + return Objects.equals(this.name, changeEventAttributesChangedResource.name) + && Objects.equals(this.type, changeEventAttributesChangedResource.type) + && Objects.equals( + this.additionalProperties, changeEventAttributesChangedResource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangeEventAttributesChangedResource {\n"); + sb.append(" name: ").append(toIndentedString(name)).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/ChangeEventAttributesChangedResourceType.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesChangedResourceType.java new file mode 100644 index 00000000000..5822d451a9b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesChangedResourceType.java @@ -0,0 +1,65 @@ +/* + * 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 the changed resource. */ +@JsonSerialize( + using = + ChangeEventAttributesChangedResourceType.ChangeEventAttributesChangedResourceTypeSerializer + .class) +public class ChangeEventAttributesChangedResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("feature_flag", "configuration")); + + public static final ChangeEventAttributesChangedResourceType FEATURE_FLAG = + new ChangeEventAttributesChangedResourceType("feature_flag"); + public static final ChangeEventAttributesChangedResourceType CONFIGURATION = + new ChangeEventAttributesChangedResourceType("configuration"); + + ChangeEventAttributesChangedResourceType(String value) { + super(value, allowedValues); + } + + public static class ChangeEventAttributesChangedResourceTypeSerializer + extends StdSerializer { + public ChangeEventAttributesChangedResourceTypeSerializer( + Class t) { + super(t); + } + + public ChangeEventAttributesChangedResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ChangeEventAttributesChangedResourceType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ChangeEventAttributesChangedResourceType fromValue(String value) { + return new ChangeEventAttributesChangedResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesImpactedResourcesItem.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesImpactedResourcesItem.java new file mode 100644 index 00000000000..47cea2de64a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesImpactedResourcesItem.java @@ -0,0 +1,173 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A uniquely identified resource. */ +@JsonPropertyOrder({ + ChangeEventAttributesImpactedResourcesItem.JSON_PROPERTY_NAME, + ChangeEventAttributesImpactedResourcesItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ChangeEventAttributesImpactedResourcesItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ChangeEventAttributesImpactedResourcesItemType type; + + public ChangeEventAttributesImpactedResourcesItem name(String name) { + this.name = name; + return this; + } + + /** + * The name of the impacted resource. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ChangeEventAttributesImpactedResourcesItem type( + ChangeEventAttributesImpactedResourcesItemType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of the impacted resource. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ChangeEventAttributesImpactedResourcesItemType getType() { + return type; + } + + public void setType(ChangeEventAttributesImpactedResourcesItemType 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 ChangeEventAttributesImpactedResourcesItem + */ + @JsonAnySetter + public ChangeEventAttributesImpactedResourcesItem 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 ChangeEventAttributesImpactedResourcesItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangeEventAttributesImpactedResourcesItem changeEventAttributesImpactedResourcesItem = + (ChangeEventAttributesImpactedResourcesItem) o; + return Objects.equals(this.name, changeEventAttributesImpactedResourcesItem.name) + && Objects.equals(this.type, changeEventAttributesImpactedResourcesItem.type) + && Objects.equals( + this.additionalProperties, + changeEventAttributesImpactedResourcesItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangeEventAttributesImpactedResourcesItem {\n"); + sb.append(" name: ").append(toIndentedString(name)).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/ChangeEventAttributesImpactedResourcesItemType.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesImpactedResourcesItemType.java new file mode 100644 index 00000000000..e9d963eba38 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventAttributesImpactedResourcesItemType.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 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 the impacted resource. */ +@JsonSerialize( + using = + ChangeEventAttributesImpactedResourcesItemType + .ChangeEventAttributesImpactedResourcesItemTypeSerializer.class) +public class ChangeEventAttributesImpactedResourcesItemType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("service")); + + public static final ChangeEventAttributesImpactedResourcesItemType SERVICE = + new ChangeEventAttributesImpactedResourcesItemType("service"); + + ChangeEventAttributesImpactedResourcesItemType(String value) { + super(value, allowedValues); + } + + public static class ChangeEventAttributesImpactedResourcesItemTypeSerializer + extends StdSerializer { + public ChangeEventAttributesImpactedResourcesItemTypeSerializer( + Class t) { + super(t); + } + + public ChangeEventAttributesImpactedResourcesItemTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ChangeEventAttributesImpactedResourcesItemType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ChangeEventAttributesImpactedResourcesItemType fromValue(String value) { + return new ChangeEventAttributesImpactedResourcesItemType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributes.java b/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributes.java new file mode 100644 index 00000000000..3acbcb3187b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributes.java @@ -0,0 +1,254 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** JSON object of event system attributes. */ +@JsonPropertyOrder({ + EventSystemAttributes.JSON_PROPERTY_CATEGORY, + EventSystemAttributes.JSON_PROPERTY_ID, + EventSystemAttributes.JSON_PROPERTY_INTEGRATION_ID, + EventSystemAttributes.JSON_PROPERTY_SOURCE_ID, + EventSystemAttributes.JSON_PROPERTY_UID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EventSystemAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private EventSystemAttributesCategory category; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_INTEGRATION_ID = "integration_id"; + private EventSystemAttributesIntegrationId integrationId; + + public static final String JSON_PROPERTY_SOURCE_ID = "source_id"; + private Long sourceId; + + public static final String JSON_PROPERTY_UID = "uid"; + private String uid; + + public EventSystemAttributes category(EventSystemAttributesCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * Event category identifying the type of event. + * + * @return category + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EventSystemAttributesCategory getCategory() { + return category; + } + + public void setCategory(EventSystemAttributesCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public EventSystemAttributes id(String id) { + this.id = id; + return this; + } + + /** + * Event identifier. This field is deprecated and will be removed in a future version. Use the + * uid field instead. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public EventSystemAttributes integrationId(EventSystemAttributesIntegrationId integrationId) { + this.integrationId = integrationId; + this.unparsed |= !integrationId.isValid(); + return this; + } + + /** + * Integration ID sourced from integration manifests. + * + * @return integrationId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INTEGRATION_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EventSystemAttributesIntegrationId getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(EventSystemAttributesIntegrationId integrationId) { + if (!integrationId.isValid()) { + this.unparsed = true; + } + this.integrationId = integrationId; + } + + public EventSystemAttributes sourceId(Long sourceId) { + this.sourceId = sourceId; + return this; + } + + /** + * The source type ID of the event. + * + * @return sourceId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOURCE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getSourceId() { + return sourceId; + } + + public void setSourceId(Long sourceId) { + this.sourceId = sourceId; + } + + public EventSystemAttributes uid(String uid) { + this.uid = uid; + return this; + } + + /** + * A unique identifier for the event. You can use this identifier to query or reference the event. + * + * @return uid + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + /** + * 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 EventSystemAttributes + */ + @JsonAnySetter + public EventSystemAttributes 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 EventSystemAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventSystemAttributes eventSystemAttributes = (EventSystemAttributes) o; + return Objects.equals(this.category, eventSystemAttributes.category) + && Objects.equals(this.id, eventSystemAttributes.id) + && Objects.equals(this.integrationId, eventSystemAttributes.integrationId) + && Objects.equals(this.sourceId, eventSystemAttributes.sourceId) + && Objects.equals(this.uid, eventSystemAttributes.uid) + && Objects.equals(this.additionalProperties, eventSystemAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(category, id, integrationId, sourceId, uid, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventSystemAttributes {\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" sourceId: ").append(toIndentedString(sourceId)).append("\n"); + sb.append(" uid: ").append(toIndentedString(uid)).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/EventSystemAttributesCategory.java b/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributesCategory.java new file mode 100644 index 00000000000..fbf8f566261 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributesCategory.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; + +/** Event category identifying the type of event. */ +@JsonSerialize(using = EventSystemAttributesCategory.EventSystemAttributesCategorySerializer.class) +public class EventSystemAttributesCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("change", "alert")); + + public static final EventSystemAttributesCategory CHANGE = + new EventSystemAttributesCategory("change"); + public static final EventSystemAttributesCategory ALERT = + new EventSystemAttributesCategory("alert"); + + EventSystemAttributesCategory(String value) { + super(value, allowedValues); + } + + public static class EventSystemAttributesCategorySerializer + extends StdSerializer { + public EventSystemAttributesCategorySerializer(Class t) { + super(t); + } + + public EventSystemAttributesCategorySerializer() { + this(null); + } + + @Override + public void serialize( + EventSystemAttributesCategory value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EventSystemAttributesCategory fromValue(String value) { + return new EventSystemAttributesCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributesIntegrationId.java b/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributesIntegrationId.java new file mode 100644 index 00000000000..db5f69ac9f7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EventSystemAttributesIntegrationId.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; + +/** Integration ID sourced from integration manifests. */ +@JsonSerialize( + using = EventSystemAttributesIntegrationId.EventSystemAttributesIntegrationIdSerializer.class) +public class EventSystemAttributesIntegrationId extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom-events")); + + public static final EventSystemAttributesIntegrationId CUSTOM_EVENTS = + new EventSystemAttributesIntegrationId("custom-events"); + + EventSystemAttributesIntegrationId(String value) { + super(value, allowedValues); + } + + public static class EventSystemAttributesIntegrationIdSerializer + extends StdSerializer { + public EventSystemAttributesIntegrationIdSerializer( + Class t) { + super(t); + } + + public EventSystemAttributesIntegrationIdSerializer() { + this(null); + } + + @Override + public void serialize( + EventSystemAttributesIntegrationId value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EventSystemAttributesIntegrationId fromValue(String value) { + return new EventSystemAttributesIntegrationId(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/V2Event.java b/src/main/java/com/datadog/api/client/v2/model/V2Event.java new file mode 100644 index 00000000000..09ff5a4ec97 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/V2Event.java @@ -0,0 +1,192 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An event object. */ +@JsonPropertyOrder({ + V2Event.JSON_PROPERTY_ATTRIBUTES, + V2Event.JSON_PROPERTY_ID, + V2Event.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class V2Event { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private V2EventAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public V2Event attributes(V2EventAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Event attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public V2EventAttributes getAttributes() { + return attributes; + } + + public void setAttributes(V2EventAttributes attributes) { + this.attributes = attributes; + } + + public V2Event id(String id) { + this.id = id; + return this; + } + + /** + * The event's ID. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public V2Event type(String type) { + this.type = type; + return this; + } + + /** + * Entity type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return V2Event + */ + @JsonAnySetter + public V2Event 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 V2Event object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + V2Event v2Event = (V2Event) o; + return Objects.equals(this.attributes, v2Event.attributes) + && Objects.equals(this.id, v2Event.id) + && Objects.equals(this.type, v2Event.type) + && Objects.equals(this.additionalProperties, v2Event.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2Event {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\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/V2EventAttributes.java b/src/main/java/com/datadog/api/client/v2/model/V2EventAttributes.java new file mode 100644 index 00000000000..978bc59987c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/V2EventAttributes.java @@ -0,0 +1,229 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Event attributes. */ +@JsonPropertyOrder({ + V2EventAttributes.JSON_PROPERTY_ATTRIBUTES, + V2EventAttributes.JSON_PROPERTY_MESSAGE, + V2EventAttributes.JSON_PROPERTY_TAGS, + V2EventAttributes.JSON_PROPERTY_TIMESTAMP +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class V2EventAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private V2EventAttributesAttributes attributes; + + public static final String JSON_PROPERTY_MESSAGE = "message"; + private String message; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public static final String JSON_PROPERTY_TIMESTAMP = "timestamp"; + private String timestamp; + + public V2EventAttributes attributes(V2EventAttributesAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * JSON object for category-specific attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public V2EventAttributesAttributes getAttributes() { + return attributes; + } + + public void setAttributes(V2EventAttributesAttributes attributes) { + this.attributes = attributes; + } + + public V2EventAttributes message(String message) { + this.message = message; + return this; + } + + /** + * Free-form text associated with the event. + * + * @return message + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public V2EventAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public V2EventAttributes addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * A list of tags associated with the event. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public V2EventAttributes timestamp(String timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Timestamp when the event occurred. + * + * @return timestamp + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMESTAMP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + /** + * 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 V2EventAttributes + */ + @JsonAnySetter + public V2EventAttributes 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 V2EventAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + V2EventAttributes v2EventAttributes = (V2EventAttributes) o; + return Objects.equals(this.attributes, v2EventAttributes.attributes) + && Objects.equals(this.message, v2EventAttributes.message) + && Objects.equals(this.tags, v2EventAttributes.tags) + && Objects.equals(this.timestamp, v2EventAttributes.timestamp) + && Objects.equals(this.additionalProperties, v2EventAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, message, tags, timestamp, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2EventAttributes {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).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/V2EventAttributesAttributes.java b/src/main/java/com/datadog/api/client/v2/model/V2EventAttributesAttributes.java new file mode 100644 index 00000000000..041bb15ddf5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/V2EventAttributesAttributes.java @@ -0,0 +1,283 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = V2EventAttributesAttributes.V2EventAttributesAttributesDeserializer.class) +@JsonSerialize(using = V2EventAttributesAttributes.V2EventAttributesAttributesSerializer.class) +public class V2EventAttributesAttributes extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(V2EventAttributesAttributes.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class V2EventAttributesAttributesSerializer + extends StdSerializer { + public V2EventAttributesAttributesSerializer(Class t) { + super(t); + } + + public V2EventAttributesAttributesSerializer() { + this(null); + } + + @Override + public void serialize( + V2EventAttributesAttributes value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class V2EventAttributesAttributesDeserializer + extends StdDeserializer { + public V2EventAttributesAttributesDeserializer() { + this(V2EventAttributesAttributes.class); + } + + public V2EventAttributesAttributesDeserializer(Class vc) { + super(vc); + } + + @Override + public V2EventAttributesAttributes deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ChangeEventAttributes + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ChangeEventAttributes.class.equals(Integer.class) + || ChangeEventAttributes.class.equals(Long.class) + || ChangeEventAttributes.class.equals(Float.class) + || ChangeEventAttributes.class.equals(Double.class) + || ChangeEventAttributes.class.equals(Boolean.class) + || ChangeEventAttributes.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ChangeEventAttributes.class.equals(Integer.class) + || ChangeEventAttributes.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ChangeEventAttributes.class.equals(Float.class) + || ChangeEventAttributes.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ChangeEventAttributes.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ChangeEventAttributes.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ChangeEventAttributes.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ChangeEventAttributes) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ChangeEventAttributes'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ChangeEventAttributes'", e); + } + + // deserialize AlertEventAttributes + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AlertEventAttributes.class.equals(Integer.class) + || AlertEventAttributes.class.equals(Long.class) + || AlertEventAttributes.class.equals(Float.class) + || AlertEventAttributes.class.equals(Double.class) + || AlertEventAttributes.class.equals(Boolean.class) + || AlertEventAttributes.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AlertEventAttributes.class.equals(Integer.class) + || AlertEventAttributes.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AlertEventAttributes.class.equals(Float.class) + || AlertEventAttributes.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AlertEventAttributes.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AlertEventAttributes.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AlertEventAttributes.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((AlertEventAttributes) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AlertEventAttributes'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AlertEventAttributes'", e); + } + + V2EventAttributesAttributes ret = new V2EventAttributesAttributes(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public V2EventAttributesAttributes getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "V2EventAttributesAttributes cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public V2EventAttributesAttributes() { + super("oneOf", Boolean.FALSE); + } + + public V2EventAttributesAttributes(ChangeEventAttributes o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public V2EventAttributesAttributes(AlertEventAttributes o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ChangeEventAttributes", new GenericType() {}); + schemas.put("AlertEventAttributes", new GenericType() {}); + JSON.registerDescendants( + V2EventAttributesAttributes.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return V2EventAttributesAttributes.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ChangeEventAttributes, AlertEventAttributes + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ChangeEventAttributes.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(AlertEventAttributes.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be ChangeEventAttributes, AlertEventAttributes"); + } + + /** + * Get the actual instance, which can be the following: ChangeEventAttributes, + * AlertEventAttributes + * + * @return The actual instance (ChangeEventAttributes, AlertEventAttributes) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ChangeEventAttributes`. If the actual instance is not + * `ChangeEventAttributes`, the ClassCastException will be thrown. + * + * @return The actual instance of `ChangeEventAttributes` + * @throws ClassCastException if the instance is not `ChangeEventAttributes` + */ + public ChangeEventAttributes getChangeEventAttributes() throws ClassCastException { + return (ChangeEventAttributes) super.getActualInstance(); + } + + /** + * Get the actual instance of `AlertEventAttributes`. If the actual instance is not + * `AlertEventAttributes`, the ClassCastException will be thrown. + * + * @return The actual instance of `AlertEventAttributes` + * @throws ClassCastException if the instance is not `AlertEventAttributes` + */ + public AlertEventAttributes getAlertEventAttributes() throws ClassCastException { + return (AlertEventAttributes) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/V2EventResponse.java b/src/main/java/com/datadog/api/client/v2/model/V2EventResponse.java new file mode 100644 index 00000000000..75b31f82a17 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/V2EventResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Get an event response. */ +@JsonPropertyOrder({V2EventResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class V2EventResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private V2Event data; + + public V2EventResponse data(V2Event data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * An event object. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public V2Event getData() { + return data; + } + + public void setData(V2Event 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 V2EventResponse + */ + @JsonAnySetter + public V2EventResponse 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 V2EventResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + V2EventResponse v2EventResponse = (V2EventResponse) o; + return Objects.equals(this.data, v2EventResponse.data) + && Objects.equals(this.additionalProperties, v2EventResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2EventResponse {\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/test/resources/com/datadog/api/client/v2/api/events.feature b/src/test/resources/com/datadog/api/client/v2/api/events.feature index 0a69d195201..61d824ce108 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/events.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/events.feature @@ -50,6 +50,27 @@ Feature: Events Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/event-management + Scenario: Get an event returns "Bad Request" response + Given new "GetEvent" request + And request contains "event_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/event-management + Scenario: Get an event returns "Not Found" response + Given new "GetEvent" request + And request contains "event_id" parameter with value "AAAAAAAAAAAAAAAAAAAAAAAA" + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/event-management + Scenario: Get an event returns "OK" response + Given new "GetEvent" request + And request contains "event_id" parameter with value "AZeF-nTCAABzkAgGXzYPtgAA" + When the request is sent + Then the response status is 200 OK + @team:DataDog/event-management Scenario: Post an event returns "Bad request" response Given new "CreateEvent" 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 df87d8d6c90..abe0c0b370d 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 @@ -1022,6 +1022,12 @@ "type": "safe" } }, + "GetEvent": { + "tag": "Events", + "undo": { + "type": "safe" + } + }, "ListIncidents": { "tag": "Incidents", "undo": {