diff --git a/.apigentools-info b/.apigentools-info index 804af3c5b95..321f84085dc 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-18 13:32:40.416319", - "spec_repo_commit": "5e49afe1" + "regenerated": "2025-06-18 14:53:53.143868", + "spec_repo_commit": "5f7cad1f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-18 13:32:40.432526", - "spec_repo_commit": "5e49afe1" + "regenerated": "2025-06-18 14:53:53.159803", + "spec_repo_commit": "5f7cad1f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index c24700d9c64..cdbca1909d4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2227,6 +2227,97 @@ components: - id - base_severity type: object + AlertEventCustomAttributes: + additionalProperties: false + description: Alert event attributes. + properties: + custom: + $ref: '#/components/schemas/AlertEventCustomAttributesCustom' + links: + $ref: '#/components/schemas/AlertEventCustomAttributesLinks' + priority: + $ref: '#/components/schemas/AlertEventCustomAttributesPriority' + status: + $ref: '#/components/schemas/AlertEventCustomAttributesStatus' + required: + - status + type: object + AlertEventCustomAttributesCustom: + additionalProperties: {} + description: Free form JSON object for arbitrary data. Supports up to 100 properties + per object and a maximum nesting depth of 10 levels. + example: {} + type: object + AlertEventCustomAttributesLinks: + description: The links related to the event. Maximum of 20 links allowed. + items: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItems' + maxItems: 20 + minItems: 1 + type: array + AlertEventCustomAttributesLinksItems: + additionalProperties: false + description: A link. + properties: + category: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItemsCategory' + title: + description: The display text of the link. Limited to 300 characters. + example: Runbook Link + maxLength: 300 + minLength: 1 + type: string + url: + description: The URL of the link. Limited to 2048 characters. + example: https://app.datadoghq.com/runbook + maxLength: 2048 + minLength: 1 + type: string + required: + - url + - category + type: object + AlertEventCustomAttributesLinksItemsCategory: + description: The category of the link. + enum: + - runbook + - documentation + - dashboard + example: runbook + type: string + x-enum-varnames: + - RUNBOOK + - DOCUMENTATION + - DASHBOARD + AlertEventCustomAttributesPriority: + default: '5' + 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 + AlertEventCustomAttributesStatus: + description: The status of the alert. + enum: + - warn + - error + - ok + example: warn + type: string + x-enum-varnames: + - WARN + - ERROR + - OK Annotation: description: A list of annotations used in the workflow. These are like sticky notes for your workflow! @@ -6919,14 +7010,16 @@ components: type: integer type: object ChangeEventCustomAttributes: - description: Object representing custom change event attributes. + additionalProperties: false + description: Change event attributes. properties: author: $ref: '#/components/schemas/ChangeEventCustomAttributesAuthor' change_metadata: additionalProperties: {} - description: Free form object with information related to the `change` event. - Can be arbitrarily nested and contain any valid JSON. + description: Free form JSON object with information related to the `change` + event. Supports up to 100 properties per object and a maximum nesting + depth of 10 levels. example: dd: team: datadog_team @@ -6941,17 +7034,19 @@ components: description: 'A list of resources impacted by this change. It is recommended to provide an impacted resource to display - the change event at the right location. Only resources of type `service` - are supported.' + the change event at the correct location. Only resources of type `service` + are supported. Maximum of 100 impacted resources allowed.' example: - name: payments_api type: service items: $ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItems' + maxItems: 100 type: array new_value: additionalProperties: {} - description: Free form object to track new value of the changed resource. + description: Free form JSON object representing the new state of the changed + resource. example: enabled: true percentage: 50% @@ -6960,7 +7055,8 @@ components: type: object prev_value: additionalProperties: {} - description: Free form object to track previous value of the changed resource. + description: Free form JSON object representing the previous state of the + changed resource. example: enabled: true percentage: 10% @@ -6971,13 +7067,16 @@ components: - changed_resource type: object ChangeEventCustomAttributesAuthor: - description: Object representing the entity which made the change. Optional - field but if provided should include `type` and `name`. + additionalProperties: false + description: The entity that made the change. Optional, if provided it must + include `type` and `name`. properties: name: - description: Author's name. Limited to 128 characters. - example: datadog@datadog.com + description: The name of the user or system that made the change. Limited + to 128 characters. + example: example@datadog.com maxLength: 128 + minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesAuthorType' @@ -6996,11 +7095,14 @@ components: - USER - SYSTEM ChangeEventCustomAttributesChangedResource: - description: Object representing a uniquely identified resource. + additionalProperties: false + description: A uniquely identified resource. properties: name: - description: Resource's name. + description: The name of the resource that was changed. Limited to 128 characters. example: fallback_payments_test + maxLength: 128 + minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesChangedResourceType' @@ -7009,7 +7111,7 @@ components: - name type: object ChangeEventCustomAttributesChangedResourceType: - description: Resource's type. + description: The type of the resource that was changed. enum: - feature_flag - configuration @@ -7019,12 +7121,14 @@ components: - FEATURE_FLAG - CONFIGURATION ChangeEventCustomAttributesImpactedResourcesItems: - description: Object representing a uniquely identified resource. Only the resource - type `service` is supported. + additionalProperties: false + description: Object representing a uniquely identified resource. properties: name: - description: Resource's name. + description: The name of the impacted resource. Limited to 128 characters. example: payments_api + maxLength: 128 + minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItemsType' @@ -7033,7 +7137,7 @@ components: - name type: object ChangeEventCustomAttributesImpactedResourcesItemsType: - description: Resource's type. + description: The type of the impacted resource. enum: - service example: service @@ -14587,28 +14691,33 @@ components: type: string type: object EventCategory: - description: Event category to identify the type of event. Only the value `change` - is supported. Support for other categories are coming. please reach out to - datadog support if you're interested. + description: Event category identifying the type of event. enum: - change + - alert example: change type: string x-enum-varnames: - CHANGE + - ALERT EventCreateRequest: - description: Object representing an event creation request. + description: An event object. properties: attributes: $ref: '#/components/schemas/EventPayload' type: $ref: '#/components/schemas/EventCreateRequestType' + required: + - type + - attributes type: object EventCreateRequestPayload: description: Payload for creating an event. properties: data: $ref: '#/components/schemas/EventCreateRequest' + required: + - data type: object EventCreateRequestType: description: Entity type. @@ -14619,24 +14728,23 @@ components: x-enum-varnames: - EVENT EventCreateResponse: - description: Object containing an event response. + description: Event object. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributes' type: - description: Event type + description: Entity type. example: event type: string type: object EventCreateResponseAttributes: - description: JSON object containing all events attributes and their associated - values. + description: Event attributes. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributesAttributes' type: object EventCreateResponseAttributesAttributes: - description: JSON object of attributes from your events. + description: JSON object for category-specific attributes. properties: evt: $ref: '#/components/schemas/EventCreateResponseAttributesAttributesEvt' @@ -14645,41 +14753,71 @@ components: description: JSON object of event system attributes. properties: id: - description: Event id + deprecated: true + description: Event identifier. This field is deprecated and will be removed + in a future version. Use the `uid` field instead. + type: string + uid: + description: A unique identifier for the event. You can use this identifier + to query or reference the event. type: string type: object EventCreateResponsePayload: - description: Response containing information about created event. + description: Event creation response. properties: data: $ref: '#/components/schemas/EventCreateResponse' + links: + $ref: '#/components/schemas/EventCreateResponsePayloadLinks' + type: object + EventCreateResponsePayloadLinks: + description: Links to the event. + properties: + self: + description: The URL of the event. This link is only functional when using + the default subdomain. + type: string type: object EventPayload: + additionalProperties: false description: Event attributes. properties: aggregation_key: - description: An arbitrary string to use for aggregation when correlating - events. Limited to 100 characters. + description: A string used for aggregation when [correlating](https://docs.datadoghq.com/service_management/events/correlation/) + events. If you specify a key, events are deduplicated to alerts based + on this key. Limited to 100 characters. + example: aggregation_key_123 maxLength: 100 + minLength: 1 type: string attributes: $ref: '#/components/schemas/EventPayloadAttributes' category: $ref: '#/components/schemas/EventCategory' + integration_id: + $ref: '#/components/schemas/EventPayloadIntegrationId' message: - description: The body of the event. Limited to 4000 characters. + description: Free formed text associated with the event. It's suggested + to use `data.attributes.attributes.custom` for well-structured attributes. + Limited to 4000 characters. example: payment_processed feature flag has been enabled maxLength: 4000 + minLength: 1 type: string tags: - description: 'A list of tags to apply to the event. + description: 'A list of tags associated with the event. Maximum of 100 tags + allowed. Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/).' example: - - env:test + - env:api_client_test items: description: A tag. + maxLength: 200 + minLength: 1 type: string + maxItems: 100 + minItems: 1 type: array timestamp: description: 'Timestamp when the event occurred. Must follow [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) @@ -14691,9 +14829,10 @@ components: 18 hours.' type: string title: - description: The event title. Limited to 500 characters. + description: The title of the event. Limited to 500 characters. example: payment_processed feature flag updated maxLength: 500 + minLength: 1 type: string required: - title @@ -14701,10 +14840,19 @@ components: - attributes type: object EventPayloadAttributes: - description: JSON object for custom attributes. Schema are different per each - event category. + description: JSON object for category-specific attributes. Schema is different + per event category. oneOf: - $ref: '#/components/schemas/ChangeEventCustomAttributes' + - $ref: '#/components/schemas/AlertEventCustomAttributes' + EventPayloadIntegrationId: + description: Integration ID sourced from integration manifests. + enum: + - custom-events + example: custom-events + type: string + x-enum-varnames: + - CUSTOM_EVENTS EventPriority: description: The priority of the event's monitor. For example, `normal` or `low`. enum: @@ -47063,10 +47211,15 @@ paths: permissions: - events_read post: - description: "This endpoint allows you to post events.\n\n\u2705 **Only events - with the `change` category** are in General Availability. See [Change Tracking](https://docs.datadoghq.com/change_tracking) + description: "This endpoint allows you to publish events.\n\n\u2705 **Only events + with the `change` or `alert` category** are in General Availability. For change + events, see [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details.\n\n\u274C For use cases involving other event categories, - please use the V1 endpoint." + use the V1 endpoint or reach out to [support](https://www.datadoghq.com/support/).\n\n\u274C + Notifications are not yet supported for events sent to this endpoint. Use + the V1 endpoint for notification functionality.\n\n\u274C This endpoint is + not available for the Government (US1-FED) site. Contact your account representative + for more information." operationId: CreateEvent requestBody: content: @@ -47076,9 +47229,10 @@ paths: value: data: attributes: + aggregation_key: aggregation_key_123 attributes: author: - name: datadog@datadog.com + name: example@datadog.com type: user change_metadata: dd: @@ -47104,17 +47258,19 @@ paths: rule: datacenter: devcycle.us1.prod category: change + integration_id: custom-events message: payment_processed feature flag has been enabled tags: - - env:test + - env:api_client_test + timestamp: '2020-01-01T01:30:15.010000Z' title: payment_processed feature flag updated type: event schema: $ref: '#/components/schemas/EventCreateRequestPayload' - description: Event request object + description: Event creation request payload. required: true responses: - '200': + '202': content: application/json: schema: @@ -47137,6 +47293,38 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] + servers: + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: The regional site for customers. + enum: + - datadoghq.com + - us3.datadoghq.com + - us5.datadoghq.com + - ap1.datadoghq.com + - datadoghq.eu + - ddog-gov.com + subdomain: + default: event-management-intake + description: The subdomain where the API is deployed. + - url: '{protocol}://{name}' + variables: + name: + default: event-management-intake.datadoghq.com + description: Full site DNS name. + protocol: + default: https + description: The protocol for accessing the API. + - url: https://{subdomain}.{site} + variables: + site: + default: datadoghq.com + description: Any Datadog deployment. + subdomain: + default: event-management-intake + description: The subdomain where the API is deployed. summary: Post an event tags: - Events diff --git a/examples/v2/events/CreateEvent.java b/examples/v2/events/CreateEvent.java index 5e754aac948..60b74fa4973 100644 --- a/examples/v2/events/CreateEvent.java +++ b/examples/v2/events/CreateEvent.java @@ -17,6 +17,7 @@ import com.datadog.api.client.v2.model.EventCreateResponsePayload; import com.datadog.api.client.v2.model.EventPayload; import com.datadog.api.client.v2.model.EventPayloadAttributes; +import com.datadog.api.client.v2.model.EventPayloadIntegrationId; import java.util.Collections; import java.util.Map; @@ -31,12 +32,13 @@ public static void main(String[] args) { new EventCreateRequest() .attributes( new EventPayload() + .aggregationKey("aggregation_key_123") .attributes( new EventPayloadAttributes( new ChangeEventCustomAttributes() .author( new ChangeEventCustomAttributesAuthor() - .name("datadog@datadog.com") + .name("example@datadog.com") .type(ChangeEventCustomAttributesAuthorType.USER)) .changeMetadata( Map.ofEntries( @@ -76,8 +78,9 @@ public static void main(String[] args) { "rule", "{'datacenter': 'devcycle.us1.prod'}"))))) .category(EventCategory.CHANGE) + .integrationId(EventPayloadIntegrationId.CUSTOM_EVENTS) .message("payment_processed feature flag has been enabled") - .tags(Collections.singletonList("env:test")) + .tags(Collections.singletonList("env:api_client_test")) .title("payment_processed feature flag updated")) .type(EventCreateRequestType.EVENT)); diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index cfb737701fd..d03574cfd14 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -277,6 +277,74 @@ public class ApiClient { new HashSet())); } })))); + put( + "v2.EventsApi.createEvent", + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "The regional site for customers.", + "datadoghq.com", + new HashSet( + Arrays.asList( + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "ap1.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com")))); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "event-management-intake", + new HashSet())); + } + }), + new ServerConfiguration( + "{protocol}://{name}", + "No description provided", + new HashMap() { + { + put( + "name", + new ServerVariable( + "Full site DNS name.", + "event-management-intake.datadoghq.com", + new HashSet())); + put( + "protocol", + new ServerVariable( + "The protocol for accessing the API.", + "https", + new HashSet())); + } + }), + new ServerConfiguration( + "https://{subdomain}.{site}", + "No description provided", + new HashMap() { + { + put( + "site", + new ServerVariable( + "Any Datadog deployment.", + "datadoghq.com", + new HashSet())); + put( + "subdomain", + new ServerVariable( + "The subdomain where the API is deployed.", + "event-management-intake", + new HashSet())); + } + })))); put( "v2.LogsApi.submitLog", new ArrayList( 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 fc4ab775609..9df000ac014 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 @@ -57,7 +57,7 @@ public void setApiClient(ApiClient apiClient) { * *

See {@link #createEventWithHttpInfo}. * - * @param body Event request object (required) + * @param body Event creation request payload. (required) * @return EventCreateResponsePayload * @throws ApiException if fails to make API call */ @@ -71,7 +71,7 @@ public EventCreateResponsePayload createEvent(EventCreateRequestPayload body) * *

See {@link #createEventWithHttpInfoAsync}. * - * @param body Event request object (required) + * @param body Event creation request payload. (required) * @return CompletableFuture<EventCreateResponsePayload> */ public CompletableFuture createEventAsync( @@ -84,22 +84,29 @@ public CompletableFuture createEventAsync( } /** - * This endpoint allows you to post events. + * This endpoint allows you to publish events. * - *

Only events with the change category are in General - * Availability. See Change Tracking for - * more details. + *

Only events with the change or alert category + * are in General Availability. For change events, see Change Tracking for more details. * - *

❌ For use cases involving other event categories, please use the V1 endpoint. + *

❌ For use cases involving other event categories, use the V1 endpoint or reach out to support. * - * @param body Event request object (required) + *

❌ Notifications are not yet supported for events sent to this endpoint. Use the V1 endpoint + * for notification functionality. + * + *

❌ This endpoint is not available for the Government (US1-FED) site. Contact your account + * representative for more information. + * + * @param body Event creation request payload. (required) * @return ApiResponse<EventCreateResponsePayload> * @throws ApiException if fails to make API call * @http.response.details * * * - * + * * * * @@ -143,7 +150,7 @@ public ApiResponse createEventWithHttpInfo( * *

See {@link #createEventWithHttpInfo}. * - * @param body Event request object (required) + * @param body Event creation request payload. (required) * @return CompletableFuture<ApiResponse<EventCreateResponsePayload>> */ public CompletableFuture> createEventWithHttpInfoAsync( diff --git a/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributes.java new file mode 100644 index 00000000000..80c179d5957 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributes.java @@ -0,0 +1,208 @@ +/* + * 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.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Alert event attributes. */ +@JsonPropertyOrder({ + AlertEventCustomAttributes.JSON_PROPERTY_CUSTOM, + AlertEventCustomAttributes.JSON_PROPERTY_LINKS, + AlertEventCustomAttributes.JSON_PROPERTY_PRIORITY, + AlertEventCustomAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AlertEventCustomAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CUSTOM = "custom"; + private Map custom = null; + + public static final String JSON_PROPERTY_LINKS = "links"; + private List links = null; + + public static final String JSON_PROPERTY_PRIORITY = "priority"; + private AlertEventCustomAttributesPriority priority = + AlertEventCustomAttributesPriority.PRIORITY_FIVE; + + public static final String JSON_PROPERTY_STATUS = "status"; + private AlertEventCustomAttributesStatus status; + + public AlertEventCustomAttributes() {} + + @JsonCreator + public AlertEventCustomAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) + AlertEventCustomAttributesStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + } + + public AlertEventCustomAttributes custom(Map custom) { + this.custom = custom; + return this; + } + + public AlertEventCustomAttributes putCustomItem(String key, Object customItem) { + if (this.custom == null) { + this.custom = new HashMap<>(); + } + this.custom.put(key, customItem); + return this; + } + + /** + * Free form JSON object for arbitrary data. Supports up to 100 properties per object and a + * maximum nesting depth of 10 levels. + * + * @return custom + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CUSTOM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getCustom() { + return custom; + } + + public void setCustom(Map custom) { + this.custom = custom; + } + + public AlertEventCustomAttributes links(List links) { + this.links = links; + for (AlertEventCustomAttributesLinksItems item : links) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AlertEventCustomAttributes addLinksItem(AlertEventCustomAttributesLinksItems 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. Maximum of 20 links allowed. + * + * @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 AlertEventCustomAttributes priority(AlertEventCustomAttributesPriority 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 AlertEventCustomAttributesPriority getPriority() { + return priority; + } + + public void setPriority(AlertEventCustomAttributesPriority priority) { + if (!priority.isValid()) { + this.unparsed = true; + } + this.priority = priority; + } + + public AlertEventCustomAttributes status(AlertEventCustomAttributesStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The status of the alert. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AlertEventCustomAttributesStatus getStatus() { + return status; + } + + public void setStatus(AlertEventCustomAttributesStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + /** Return true if this AlertEventCustomAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlertEventCustomAttributes alertEventCustomAttributes = (AlertEventCustomAttributes) o; + return Objects.equals(this.custom, alertEventCustomAttributes.custom) + && Objects.equals(this.links, alertEventCustomAttributes.links) + && Objects.equals(this.priority, alertEventCustomAttributes.priority) + && Objects.equals(this.status, alertEventCustomAttributes.status); + } + + @Override + public int hashCode() { + return Objects.hash(custom, links, priority, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlertEventCustomAttributes {\n"); + sb.append(" custom: ").append(toIndentedString(custom)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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/AlertEventCustomAttributesLinksItems.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesLinksItems.java new file mode 100644 index 00000000000..f4b3b605ad2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesLinksItems.java @@ -0,0 +1,154 @@ +/* + * 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.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** A link. */ +@JsonPropertyOrder({ + AlertEventCustomAttributesLinksItems.JSON_PROPERTY_CATEGORY, + AlertEventCustomAttributesLinksItems.JSON_PROPERTY_TITLE, + AlertEventCustomAttributesLinksItems.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AlertEventCustomAttributesLinksItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CATEGORY = "category"; + private AlertEventCustomAttributesLinksItemsCategory category; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public AlertEventCustomAttributesLinksItems() {} + + @JsonCreator + public AlertEventCustomAttributesLinksItems( + @JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) + AlertEventCustomAttributesLinksItemsCategory category, + @JsonProperty(required = true, value = JSON_PROPERTY_URL) String url) { + this.category = category; + this.unparsed |= !category.isValid(); + this.url = url; + } + + public AlertEventCustomAttributesLinksItems category( + AlertEventCustomAttributesLinksItemsCategory category) { + this.category = category; + this.unparsed |= !category.isValid(); + return this; + } + + /** + * The category of the link. + * + * @return category + */ + @JsonProperty(JSON_PROPERTY_CATEGORY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AlertEventCustomAttributesLinksItemsCategory getCategory() { + return category; + } + + public void setCategory(AlertEventCustomAttributesLinksItemsCategory category) { + if (!category.isValid()) { + this.unparsed = true; + } + this.category = category; + } + + public AlertEventCustomAttributesLinksItems title(String title) { + this.title = title; + return this; + } + + /** + * The display text of the link. Limited to 300 characters. + * + * @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 AlertEventCustomAttributesLinksItems url(String url) { + this.url = url; + return this; + } + + /** + * The URL of the link. Limited to 2048 characters. + * + * @return url + */ + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** Return true if this AlertEventCustomAttributesLinksItems object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AlertEventCustomAttributesLinksItems alertEventCustomAttributesLinksItems = + (AlertEventCustomAttributesLinksItems) o; + return Objects.equals(this.category, alertEventCustomAttributesLinksItems.category) + && Objects.equals(this.title, alertEventCustomAttributesLinksItems.title) + && Objects.equals(this.url, alertEventCustomAttributesLinksItems.url); + } + + @Override + public int hashCode() { + return Objects.hash(category, title, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlertEventCustomAttributesLinksItems {\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('}'); + 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/AlertEventCustomAttributesLinksItemsCategory.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesLinksItemsCategory.java new file mode 100644 index 00000000000..a2adc581ad3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesLinksItemsCategory.java @@ -0,0 +1,67 @@ +/* + * 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 = + AlertEventCustomAttributesLinksItemsCategory + .AlertEventCustomAttributesLinksItemsCategorySerializer.class) +public class AlertEventCustomAttributesLinksItemsCategory extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("runbook", "documentation", "dashboard")); + + public static final AlertEventCustomAttributesLinksItemsCategory RUNBOOK = + new AlertEventCustomAttributesLinksItemsCategory("runbook"); + public static final AlertEventCustomAttributesLinksItemsCategory DOCUMENTATION = + new AlertEventCustomAttributesLinksItemsCategory("documentation"); + public static final AlertEventCustomAttributesLinksItemsCategory DASHBOARD = + new AlertEventCustomAttributesLinksItemsCategory("dashboard"); + + AlertEventCustomAttributesLinksItemsCategory(String value) { + super(value, allowedValues); + } + + public static class AlertEventCustomAttributesLinksItemsCategorySerializer + extends StdSerializer { + public AlertEventCustomAttributesLinksItemsCategorySerializer( + Class t) { + super(t); + } + + public AlertEventCustomAttributesLinksItemsCategorySerializer() { + this(null); + } + + @Override + public void serialize( + AlertEventCustomAttributesLinksItemsCategory value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AlertEventCustomAttributesLinksItemsCategory fromValue(String value) { + return new AlertEventCustomAttributesLinksItemsCategory(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesPriority.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesPriority.java new file mode 100644 index 00000000000..84b42b1ddd6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesPriority.java @@ -0,0 +1,67 @@ +/* + * 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 = AlertEventCustomAttributesPriority.AlertEventCustomAttributesPrioritySerializer.class) +public class AlertEventCustomAttributesPriority extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("1", "2", "3", "4", "5")); + + public static final AlertEventCustomAttributesPriority PRIORITY_ONE = + new AlertEventCustomAttributesPriority("1"); + public static final AlertEventCustomAttributesPriority PRIORITY_TWO = + new AlertEventCustomAttributesPriority("2"); + public static final AlertEventCustomAttributesPriority PRIORITY_THREE = + new AlertEventCustomAttributesPriority("3"); + public static final AlertEventCustomAttributesPriority PRIORITY_FOUR = + new AlertEventCustomAttributesPriority("4"); + public static final AlertEventCustomAttributesPriority PRIORITY_FIVE = + new AlertEventCustomAttributesPriority("5"); + + AlertEventCustomAttributesPriority(String value) { + super(value, allowedValues); + } + + public static class AlertEventCustomAttributesPrioritySerializer + extends StdSerializer { + public AlertEventCustomAttributesPrioritySerializer( + Class t) { + super(t); + } + + public AlertEventCustomAttributesPrioritySerializer() { + this(null); + } + + @Override + public void serialize( + AlertEventCustomAttributesPriority value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AlertEventCustomAttributesPriority fromValue(String value) { + return new AlertEventCustomAttributesPriority(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesStatus.java b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesStatus.java new file mode 100644 index 00000000000..d2cf39cd203 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AlertEventCustomAttributesStatus.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 status of the alert. */ +@JsonSerialize( + using = AlertEventCustomAttributesStatus.AlertEventCustomAttributesStatusSerializer.class) +public class AlertEventCustomAttributesStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("warn", "error", "ok")); + + public static final AlertEventCustomAttributesStatus WARN = + new AlertEventCustomAttributesStatus("warn"); + public static final AlertEventCustomAttributesStatus ERROR = + new AlertEventCustomAttributesStatus("error"); + public static final AlertEventCustomAttributesStatus OK = + new AlertEventCustomAttributesStatus("ok"); + + AlertEventCustomAttributesStatus(String value) { + super(value, allowedValues); + } + + public static class AlertEventCustomAttributesStatusSerializer + extends StdSerializer { + public AlertEventCustomAttributesStatusSerializer(Class t) { + super(t); + } + + public AlertEventCustomAttributesStatusSerializer() { + this(null); + } + + @Override + public void serialize( + AlertEventCustomAttributesStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AlertEventCustomAttributesStatus fromValue(String value) { + return new AlertEventCustomAttributesStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributes.java index 1329f7f7bb6..ad39e62e56a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributes.java @@ -6,8 +6,6 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -19,7 +17,7 @@ import java.util.Map; import java.util.Objects; -/** Object representing custom change event attributes. */ +/** Change event attributes. */ @JsonPropertyOrder({ ChangeEventCustomAttributes.JSON_PROPERTY_AUTHOR, ChangeEventCustomAttributes.JSON_PROPERTY_CHANGE_METADATA, @@ -67,8 +65,8 @@ public ChangeEventCustomAttributes author(ChangeEventCustomAttributesAuthor auth } /** - * Object representing the entity which made the change. Optional field but if provided should - * include type and name. + * The entity that made the change. Optional, if provided it must include type and + * name. * * @return author */ @@ -97,8 +95,8 @@ public ChangeEventCustomAttributes putChangeMetadataItem(String key, Object chan } /** - * Free form object with information related to the change event. Can be arbitrarily - * nested and contain any valid JSON. + * Free form JSON object with information related to the change event. Supports up to + * 100 properties per object and a maximum nesting depth of 10 levels. * * @return changeMetadata */ @@ -121,7 +119,7 @@ public ChangeEventCustomAttributes changedResource( } /** - * Object representing a uniquely identified resource. + * A uniquely identified resource. * * @return changedResource */ @@ -156,8 +154,8 @@ public ChangeEventCustomAttributes addImpactedResourcesItem( /** * A list of resources impacted by this change. It is recommended to provide an impacted resource - * to display the change event at the right location. Only resources of type service - * are supported. + * to display the change event at the correct location. Only resources of type service + * are supported. Maximum of 100 impacted resources allowed. * * @return impactedResources */ @@ -187,7 +185,7 @@ public ChangeEventCustomAttributes putNewValueItem(String key, Object newValueIt } /** - * Free form object to track new value of the changed resource. + * Free form JSON object representing the new state of the changed resource. * * @return newValue */ @@ -216,7 +214,7 @@ public ChangeEventCustomAttributes putPrevValueItem(String key, Object prevValue } /** - * Free form object to track previous value of the changed resource. + * Free form JSON object representing the previous state of the changed resource. * * @return prevValue */ @@ -231,52 +229,6 @@ public void setPrevValue(Map prevValue) { this.prevValue = prevValue; } - /** - * 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 ChangeEventCustomAttributes - */ - @JsonAnySetter - public ChangeEventCustomAttributes 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 ChangeEventCustomAttributes object is equal to o. */ @Override public boolean equals(Object o) { @@ -292,21 +244,13 @@ public boolean equals(Object o) { && Objects.equals(this.changedResource, changeEventCustomAttributes.changedResource) && Objects.equals(this.impactedResources, changeEventCustomAttributes.impactedResources) && Objects.equals(this.newValue, changeEventCustomAttributes.newValue) - && Objects.equals(this.prevValue, changeEventCustomAttributes.prevValue) - && Objects.equals( - this.additionalProperties, changeEventCustomAttributes.additionalProperties); + && Objects.equals(this.prevValue, changeEventCustomAttributes.prevValue); } @Override public int hashCode() { return Objects.hash( - author, - changeMetadata, - changedResource, - impactedResources, - newValue, - prevValue, - additionalProperties); + author, changeMetadata, changedResource, impactedResources, newValue, prevValue); } @Override @@ -319,9 +263,6 @@ public String toString() { 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(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); sb.append('}'); return sb.toString(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesAuthor.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesAuthor.java index f291f1e4dce..98203d486dd 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesAuthor.java +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesAuthor.java @@ -6,20 +6,16 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; /** - * Object representing the entity which made the change. Optional field but if provided should - * include type and name. + * The entity that made the change. Optional, if provided it must include type and + * name. */ @JsonPropertyOrder({ ChangeEventCustomAttributesAuthor.JSON_PROPERTY_NAME, @@ -53,7 +49,7 @@ public ChangeEventCustomAttributesAuthor name(String name) { } /** - * Author's name. Limited to 128 characters. + * The name of the user or system that made the change. Limited to 128 characters. * * @return name */ @@ -91,52 +87,6 @@ public void setType(ChangeEventCustomAttributesAuthorType 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 ChangeEventCustomAttributesAuthor - */ - @JsonAnySetter - public ChangeEventCustomAttributesAuthor 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 ChangeEventCustomAttributesAuthor object is equal to o. */ @Override public boolean equals(Object o) { @@ -149,14 +99,12 @@ public boolean equals(Object o) { ChangeEventCustomAttributesAuthor changeEventCustomAttributesAuthor = (ChangeEventCustomAttributesAuthor) o; return Objects.equals(this.name, changeEventCustomAttributesAuthor.name) - && Objects.equals(this.type, changeEventCustomAttributesAuthor.type) - && Objects.equals( - this.additionalProperties, changeEventCustomAttributesAuthor.additionalProperties); + && Objects.equals(this.type, changeEventCustomAttributesAuthor.type); } @Override public int hashCode() { - return Objects.hash(name, type, additionalProperties); + return Objects.hash(name, type); } @Override @@ -165,9 +113,6 @@ public String toString() { sb.append("class ChangeEventCustomAttributesAuthor {\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(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResource.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResource.java index 6d7947796f0..acfc8b62824 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResource.java +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResource.java @@ -6,18 +6,14 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; -/** Object representing a uniquely identified resource. */ +/** A uniquely identified resource. */ @JsonPropertyOrder({ ChangeEventCustomAttributesChangedResource.JSON_PROPERTY_NAME, ChangeEventCustomAttributesChangedResource.JSON_PROPERTY_TYPE @@ -50,7 +46,7 @@ public ChangeEventCustomAttributesChangedResource name(String name) { } /** - * Resource's name. + * The name of the resource that was changed. Limited to 128 characters. * * @return name */ @@ -72,7 +68,7 @@ public ChangeEventCustomAttributesChangedResource type( } /** - * Resource's type. + * The type of the resource that was changed. * * @return type */ @@ -89,53 +85,6 @@ public void setType(ChangeEventCustomAttributesChangedResourceType 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 ChangeEventCustomAttributesChangedResource - */ - @JsonAnySetter - public ChangeEventCustomAttributesChangedResource 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 ChangeEventCustomAttributesChangedResource object is equal to o. */ @Override public boolean equals(Object o) { @@ -148,15 +97,12 @@ public boolean equals(Object o) { ChangeEventCustomAttributesChangedResource changeEventCustomAttributesChangedResource = (ChangeEventCustomAttributesChangedResource) o; return Objects.equals(this.name, changeEventCustomAttributesChangedResource.name) - && Objects.equals(this.type, changeEventCustomAttributesChangedResource.type) - && Objects.equals( - this.additionalProperties, - changeEventCustomAttributesChangedResource.additionalProperties); + && Objects.equals(this.type, changeEventCustomAttributesChangedResource.type); } @Override public int hashCode() { - return Objects.hash(name, type, additionalProperties); + return Objects.hash(name, type); } @Override @@ -165,9 +111,6 @@ public String toString() { sb.append("class ChangeEventCustomAttributesChangedResource {\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(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResourceType.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResourceType.java index 4ffecebad1b..ffcfd74e219 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResourceType.java +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesChangedResourceType.java @@ -18,7 +18,7 @@ import java.util.HashSet; import java.util.Set; -/** Resource's type. */ +/** The type of the resource that was changed. */ @JsonSerialize( using = ChangeEventCustomAttributesChangedResourceType diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItems.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItems.java index c41ea25c2b2..e7276602c3f 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItems.java +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItems.java @@ -6,21 +6,14 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.HashMap; -import java.util.Map; import java.util.Objects; -/** - * Object representing a uniquely identified resource. Only the resource type service - * is supported. - */ +/** Object representing a uniquely identified resource. */ @JsonPropertyOrder({ ChangeEventCustomAttributesImpactedResourcesItems.JSON_PROPERTY_NAME, ChangeEventCustomAttributesImpactedResourcesItems.JSON_PROPERTY_TYPE @@ -53,7 +46,7 @@ public ChangeEventCustomAttributesImpactedResourcesItems name(String name) { } /** - * Resource's name. + * The name of the impacted resource. Limited to 128 characters. * * @return name */ @@ -75,7 +68,7 @@ public ChangeEventCustomAttributesImpactedResourcesItems type( } /** - * Resource's type. + * The type of the impacted resource. * * @return type */ @@ -92,53 +85,6 @@ public void setType(ChangeEventCustomAttributesImpactedResourcesItemsType 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 ChangeEventCustomAttributesImpactedResourcesItems - */ - @JsonAnySetter - public ChangeEventCustomAttributesImpactedResourcesItems 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 ChangeEventCustomAttributesImpactedResourcesItems object is equal to o. */ @Override public boolean equals(Object o) { @@ -152,15 +98,12 @@ public boolean equals(Object o) { changeEventCustomAttributesImpactedResourcesItems = (ChangeEventCustomAttributesImpactedResourcesItems) o; return Objects.equals(this.name, changeEventCustomAttributesImpactedResourcesItems.name) - && Objects.equals(this.type, changeEventCustomAttributesImpactedResourcesItems.type) - && Objects.equals( - this.additionalProperties, - changeEventCustomAttributesImpactedResourcesItems.additionalProperties); + && Objects.equals(this.type, changeEventCustomAttributesImpactedResourcesItems.type); } @Override public int hashCode() { - return Objects.hash(name, type, additionalProperties); + return Objects.hash(name, type); } @Override @@ -169,9 +112,6 @@ public String toString() { sb.append("class ChangeEventCustomAttributesImpactedResourcesItems {\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(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItemsType.java b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItemsType.java index 27e2f73e067..ba627413793 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItemsType.java +++ b/src/main/java/com/datadog/api/client/v2/model/ChangeEventCustomAttributesImpactedResourcesItemsType.java @@ -18,7 +18,7 @@ import java.util.HashSet; import java.util.Set; -/** Resource's type. */ +/** The type of the impacted resource. */ @JsonSerialize( using = ChangeEventCustomAttributesImpactedResourcesItemsType diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCategory.java b/src/main/java/com/datadog/api/client/v2/model/EventCategory.java index 64944dc99bb..6ad8dd26422 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCategory.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCategory.java @@ -18,17 +18,15 @@ import java.util.HashSet; import java.util.Set; -/** - * Event category to identify the type of event. Only the value change is supported. - * Support for other categories are coming. please reach out to datadog support if you're - * interested. - */ +/** Event category identifying the type of event. */ @JsonSerialize(using = EventCategory.EventCategorySerializer.class) public class EventCategory extends ModelEnum { - private static final Set allowedValues = new HashSet(Arrays.asList("change")); + private static final Set allowedValues = + new HashSet(Arrays.asList("change", "alert")); public static final EventCategory CHANGE = new EventCategory("change"); + public static final EventCategory ALERT = new EventCategory("alert"); EventCategory(String value) { super(value, allowedValues); diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateRequest.java index 9bd04f4b675..fce22b58c79 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateRequest.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateRequest.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -16,7 +17,7 @@ import java.util.Map; import java.util.Objects; -/** Object representing an event creation request. */ +/** An event object. */ @JsonPropertyOrder({ EventCreateRequest.JSON_PROPERTY_ATTRIBUTES, EventCreateRequest.JSON_PROPERTY_TYPE @@ -31,6 +32,18 @@ public class EventCreateRequest { public static final String JSON_PROPERTY_TYPE = "type"; private EventCreateRequestType type; + public EventCreateRequest() {} + + @JsonCreator + public EventCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) EventPayload attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) EventCreateRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + public EventCreateRequest attributes(EventPayload attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; @@ -42,9 +55,8 @@ public EventCreateRequest attributes(EventPayload attributes) { * * @return attributes */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public EventPayload getAttributes() { return attributes; } @@ -64,9 +76,8 @@ public EventCreateRequest type(EventCreateRequestType type) { * * @return type */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public EventCreateRequestType getType() { return type; } diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateRequestPayload.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateRequestPayload.java index d924800054b..545f133e92d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateRequestPayload.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateRequestPayload.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -25,6 +26,15 @@ public class EventCreateRequestPayload { public static final String JSON_PROPERTY_DATA = "data"; private EventCreateRequest data; + public EventCreateRequestPayload() {} + + @JsonCreator + public EventCreateRequestPayload( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) EventCreateRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + public EventCreateRequestPayload data(EventCreateRequest data) { this.data = data; this.unparsed |= data.unparsed; @@ -32,13 +42,12 @@ public EventCreateRequestPayload data(EventCreateRequest data) { } /** - * Object representing an event creation request. + * An event object. * * @return data */ - @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public EventCreateRequest getData() { return data; } diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponse.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponse.java index 7d5146556b3..d2dc8de809a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponse.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponse.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.Objects; -/** Object containing an event response. */ +/** Event object. */ @JsonPropertyOrder({ EventCreateResponse.JSON_PROPERTY_ATTRIBUTES, EventCreateResponse.JSON_PROPERTY_TYPE @@ -38,7 +38,7 @@ public EventCreateResponse attributes(EventCreateResponseAttributes attributes) } /** - * JSON object containing all events attributes and their associated values. + * Event attributes. * * @return attributes */ @@ -59,7 +59,7 @@ public EventCreateResponse type(String type) { } /** - * Event type + * Entity type. * * @return type */ diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributes.java index 7c7069d31cb..230ce4c7d23 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributes.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.Objects; -/** JSON object containing all events attributes and their associated values. */ +/** Event attributes. */ @JsonPropertyOrder({EventCreateResponseAttributes.JSON_PROPERTY_ATTRIBUTES}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -33,7 +33,7 @@ public EventCreateResponseAttributes attributes( } /** - * JSON object of attributes from your events. + * JSON object for category-specific attributes. * * @return attributes */ diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributes.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributes.java index cdbfdf23e14..5717071786f 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributes.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.Objects; -/** JSON object of attributes from your events. */ +/** JSON object for category-specific attributes. */ @JsonPropertyOrder({EventCreateResponseAttributesAttributes.JSON_PROPERTY_EVT}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributesEvt.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributesEvt.java index df56a6c16f9..d7ff5d3ed70 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributesEvt.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponseAttributesAttributesEvt.java @@ -17,7 +17,10 @@ import java.util.Objects; /** JSON object of event system attributes. */ -@JsonPropertyOrder({EventCreateResponseAttributesAttributesEvt.JSON_PROPERTY_ID}) +@JsonPropertyOrder({ + EventCreateResponseAttributesAttributesEvt.JSON_PROPERTY_ID, + EventCreateResponseAttributesAttributesEvt.JSON_PROPERTY_UID +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class EventCreateResponseAttributesAttributesEvt { @@ -25,16 +28,22 @@ public class EventCreateResponseAttributesAttributesEvt { public static final String JSON_PROPERTY_ID = "id"; private String id; + public static final String JSON_PROPERTY_UID = "uid"; + private String uid; + public EventCreateResponseAttributesAttributesEvt id(String id) { this.id = id; return this; } /** - * Event id + * Event identifier. This field is deprecated and will be removed in a future version. Use the + * uid field instead. * * @return id + * @deprecated */ + @Deprecated @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -42,10 +51,32 @@ public String getId() { return id; } + @Deprecated public void setId(String id) { this.id = id; } + public EventCreateResponseAttributesAttributesEvt 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. @@ -105,6 +136,7 @@ public boolean equals(Object o) { EventCreateResponseAttributesAttributesEvt eventCreateResponseAttributesAttributesEvt = (EventCreateResponseAttributesAttributesEvt) o; return Objects.equals(this.id, eventCreateResponseAttributesAttributesEvt.id) + && Objects.equals(this.uid, eventCreateResponseAttributesAttributesEvt.uid) && Objects.equals( this.additionalProperties, eventCreateResponseAttributesAttributesEvt.additionalProperties); @@ -112,7 +144,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, additionalProperties); + return Objects.hash(id, uid, additionalProperties); } @Override @@ -120,6 +152,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class EventCreateResponseAttributesAttributesEvt {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" uid: ").append(toIndentedString(uid)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayload.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayload.java index dfd0c669635..46ee966ebde 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayload.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayload.java @@ -16,8 +16,11 @@ import java.util.Map; import java.util.Objects; -/** Response containing information about created event. */ -@JsonPropertyOrder({EventCreateResponsePayload.JSON_PROPERTY_DATA}) +/** Event creation response. */ +@JsonPropertyOrder({ + EventCreateResponsePayload.JSON_PROPERTY_DATA, + EventCreateResponsePayload.JSON_PROPERTY_LINKS +}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") public class EventCreateResponsePayload { @@ -25,6 +28,9 @@ public class EventCreateResponsePayload { public static final String JSON_PROPERTY_DATA = "data"; private EventCreateResponse data; + public static final String JSON_PROPERTY_LINKS = "links"; + private EventCreateResponsePayloadLinks links; + public EventCreateResponsePayload data(EventCreateResponse data) { this.data = data; this.unparsed |= data.unparsed; @@ -32,7 +38,7 @@ public EventCreateResponsePayload data(EventCreateResponse data) { } /** - * Object containing an event response. + * Event object. * * @return data */ @@ -47,6 +53,28 @@ public void setData(EventCreateResponse data) { this.data = data; } + public EventCreateResponsePayload links(EventCreateResponsePayloadLinks links) { + this.links = links; + this.unparsed |= links.unparsed; + return this; + } + + /** + * Links to the event. + * + * @return links + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LINKS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EventCreateResponsePayloadLinks getLinks() { + return links; + } + + public void setLinks(EventCreateResponsePayloadLinks links) { + this.links = links; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -104,13 +132,14 @@ public boolean equals(Object o) { } EventCreateResponsePayload eventCreateResponsePayload = (EventCreateResponsePayload) o; return Objects.equals(this.data, eventCreateResponsePayload.data) + && Objects.equals(this.links, eventCreateResponsePayload.links) && Objects.equals( this.additionalProperties, eventCreateResponsePayload.additionalProperties); } @Override public int hashCode() { - return Objects.hash(data, additionalProperties); + return Objects.hash(data, links, additionalProperties); } @Override @@ -118,6 +147,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class EventCreateResponsePayload {\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayloadLinks.java b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayloadLinks.java new file mode 100644 index 00000000000..f6db4def622 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EventCreateResponsePayloadLinks.java @@ -0,0 +1,137 @@ +/* + * 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; + +/** Links to the event. */ +@JsonPropertyOrder({EventCreateResponsePayloadLinks.JSON_PROPERTY_SELF}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EventCreateResponsePayloadLinks { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_SELF = "self"; + private String self; + + public EventCreateResponsePayloadLinks self(String self) { + this.self = self; + return this; + } + + /** + * The URL of the event. This link is only functional when using the default subdomain. + * + * @return self + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SELF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSelf() { + return self; + } + + public void setSelf(String self) { + this.self = self; + } + + /** + * 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 EventCreateResponsePayloadLinks + */ + @JsonAnySetter + public EventCreateResponsePayloadLinks 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 EventCreateResponsePayloadLinks object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventCreateResponsePayloadLinks eventCreateResponsePayloadLinks = + (EventCreateResponsePayloadLinks) o; + return Objects.equals(this.self, eventCreateResponsePayloadLinks.self) + && Objects.equals( + this.additionalProperties, eventCreateResponsePayloadLinks.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(self, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventCreateResponsePayloadLinks {\n"); + sb.append(" self: ").append(toIndentedString(self)).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/EventPayload.java b/src/main/java/com/datadog/api/client/v2/model/EventPayload.java index 3c16bacbeef..d4d0409c1af 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventPayload.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventPayload.java @@ -6,17 +6,13 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; /** Event attributes. */ @@ -24,6 +20,7 @@ EventPayload.JSON_PROPERTY_AGGREGATION_KEY, EventPayload.JSON_PROPERTY_ATTRIBUTES, EventPayload.JSON_PROPERTY_CATEGORY, + EventPayload.JSON_PROPERTY_INTEGRATION_ID, EventPayload.JSON_PROPERTY_MESSAGE, EventPayload.JSON_PROPERTY_TAGS, EventPayload.JSON_PROPERTY_TIMESTAMP, @@ -42,6 +39,9 @@ public class EventPayload { public static final String JSON_PROPERTY_CATEGORY = "category"; private EventCategory category; + public static final String JSON_PROPERTY_INTEGRATION_ID = "integration_id"; + private EventPayloadIntegrationId integrationId; + public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; @@ -75,7 +75,10 @@ public EventPayload aggregationKey(String aggregationKey) { } /** - * An arbitrary string to use for aggregation when correlating events. Limited to 100 characters. + * A string used for aggregation when correlating + * events. If you specify a key, events are deduplicated to alerts based on this key. Limited to + * 100 characters. * * @return aggregationKey */ @@ -97,7 +100,7 @@ public EventPayload attributes(EventPayloadAttributes attributes) { } /** - * JSON object for custom attributes. Schema are different per each event category. + * JSON object for category-specific attributes. Schema is different per event category. * * @return attributes */ @@ -118,9 +121,7 @@ public EventPayload category(EventCategory category) { } /** - * Event category to identify the type of event. Only the value change is supported. - * Support for other categories are coming. please reach out to datadog support if you're - * interested. + * Event category identifying the type of event. * * @return category */ @@ -137,13 +138,40 @@ public void setCategory(EventCategory category) { this.category = category; } + public EventPayload integrationId(EventPayloadIntegrationId 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 EventPayloadIntegrationId getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(EventPayloadIntegrationId integrationId) { + if (!integrationId.isValid()) { + this.unparsed = true; + } + this.integrationId = integrationId; + } + public EventPayload message(String message) { this.message = message; return this; } /** - * The body of the event. Limited to 4000 characters. + * Free formed text associated with the event. It's suggested to use + * data.attributes.attributes.custom for well-structured attributes. Limited to 4000 + * characters. * * @return message */ @@ -172,7 +200,7 @@ public EventPayload addTagsItem(String tagsItem) { } /** - * A list of tags to apply to the event. Refer to Tags docs. * * @return tags @@ -218,7 +246,7 @@ public EventPayload title(String title) { } /** - * The event title. Limited to 500 characters. + * The title of the event. Limited to 500 characters. * * @return title */ @@ -232,52 +260,6 @@ 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 EventPayload - */ - @JsonAnySetter - public EventPayload 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 EventPayload object is equal to o. */ @Override public boolean equals(Object o) { @@ -291,24 +273,17 @@ public boolean equals(Object o) { return Objects.equals(this.aggregationKey, eventPayload.aggregationKey) && Objects.equals(this.attributes, eventPayload.attributes) && Objects.equals(this.category, eventPayload.category) + && Objects.equals(this.integrationId, eventPayload.integrationId) && Objects.equals(this.message, eventPayload.message) && Objects.equals(this.tags, eventPayload.tags) && Objects.equals(this.timestamp, eventPayload.timestamp) - && Objects.equals(this.title, eventPayload.title) - && Objects.equals(this.additionalProperties, eventPayload.additionalProperties); + && Objects.equals(this.title, eventPayload.title); } @Override public int hashCode() { return Objects.hash( - aggregationKey, - attributes, - category, - message, - tags, - timestamp, - title, - additionalProperties); + aggregationKey, attributes, category, integrationId, message, tags, timestamp, title); } @Override @@ -318,13 +293,11 @@ public String toString() { sb.append(" aggregationKey: ").append(toIndentedString(aggregationKey)).append("\n"); sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).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(" title: ").append(toIndentedString(title)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); sb.append('}'); return sb.toString(); } diff --git a/src/main/java/com/datadog/api/client/v2/model/EventPayloadAttributes.java b/src/main/java/com/datadog/api/client/v2/model/EventPayloadAttributes.java index 4a9f038ff9d..603ac723ab8 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EventPayloadAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/EventPayloadAttributes.java @@ -125,6 +125,51 @@ public EventPayloadAttributes deserialize(JsonParser jp, DeserializationContext log.log(Level.FINER, "Input data does not match schema 'ChangeEventCustomAttributes'", e); } + // deserialize AlertEventCustomAttributes + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (AlertEventCustomAttributes.class.equals(Integer.class) + || AlertEventCustomAttributes.class.equals(Long.class) + || AlertEventCustomAttributes.class.equals(Float.class) + || AlertEventCustomAttributes.class.equals(Double.class) + || AlertEventCustomAttributes.class.equals(Boolean.class) + || AlertEventCustomAttributes.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((AlertEventCustomAttributes.class.equals(Integer.class) + || AlertEventCustomAttributes.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((AlertEventCustomAttributes.class.equals(Float.class) + || AlertEventCustomAttributes.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (AlertEventCustomAttributes.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (AlertEventCustomAttributes.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(AlertEventCustomAttributes.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 (!((AlertEventCustomAttributes) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'AlertEventCustomAttributes'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AlertEventCustomAttributes'", e); + } + EventPayloadAttributes ret = new EventPayloadAttributes(); if (match == 1) { ret.setActualInstance(deserialized); @@ -159,8 +204,14 @@ public EventPayloadAttributes(ChangeEventCustomAttributes o) { setActualInstance(o); } + public EventPayloadAttributes(AlertEventCustomAttributes o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("ChangeEventCustomAttributes", new GenericType() {}); + schemas.put("AlertEventCustomAttributes", new GenericType() {}); JSON.registerDescendants(EventPayloadAttributes.class, Collections.unmodifiableMap(schemas)); } @@ -171,7 +222,7 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: ChangeEventCustomAttributes + * against the oneOf child schemas: ChangeEventCustomAttributes, AlertEventCustomAttributes * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -182,18 +233,24 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(AlertEventCustomAttributes.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 ChangeEventCustomAttributes"); + throw new RuntimeException( + "Invalid instance type. Must be ChangeEventCustomAttributes, AlertEventCustomAttributes"); } /** - * Get the actual instance, which can be the following: ChangeEventCustomAttributes + * Get the actual instance, which can be the following: ChangeEventCustomAttributes, + * AlertEventCustomAttributes * - * @return The actual instance (ChangeEventCustomAttributes) + * @return The actual instance (ChangeEventCustomAttributes, AlertEventCustomAttributes) */ @Override public Object getActualInstance() { @@ -210,4 +267,15 @@ public Object getActualInstance() { public ChangeEventCustomAttributes getChangeEventCustomAttributes() throws ClassCastException { return (ChangeEventCustomAttributes) super.getActualInstance(); } + + /** + * Get the actual instance of `AlertEventCustomAttributes`. If the actual instance is not + * `AlertEventCustomAttributes`, the ClassCastException will be thrown. + * + * @return The actual instance of `AlertEventCustomAttributes` + * @throws ClassCastException if the instance is not `AlertEventCustomAttributes` + */ + public AlertEventCustomAttributes getAlertEventCustomAttributes() throws ClassCastException { + return (AlertEventCustomAttributes) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/EventPayloadIntegrationId.java b/src/main/java/com/datadog/api/client/v2/model/EventPayloadIntegrationId.java new file mode 100644 index 00000000000..498513a8a1f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EventPayloadIntegrationId.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Integration ID sourced from integration manifests. */ +@JsonSerialize(using = EventPayloadIntegrationId.EventPayloadIntegrationIdSerializer.class) +public class EventPayloadIntegrationId extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("custom-events")); + + public static final EventPayloadIntegrationId CUSTOM_EVENTS = + new EventPayloadIntegrationId("custom-events"); + + EventPayloadIntegrationId(String value) { + super(value, allowedValues); + } + + public static class EventPayloadIntegrationIdSerializer + extends StdSerializer { + public EventPayloadIntegrationIdSerializer(Class t) { + super(t); + } + + public EventPayloadIntegrationIdSerializer() { + this(null); + } + + @Override + public void serialize( + EventPayloadIntegrationId value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EventPayloadIntegrationId fromValue(String value) { + return new EventPayloadIntegrationId(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Post_an_event_returns_Bad_request_response.freeze b/src/test/resources/cassettes/features/v2/Post_an_event_returns_Bad_request_response.freeze new file mode 100644 index 00000000000..a1cd4e8e4ac --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_event_returns_Bad_request_response.freeze @@ -0,0 +1 @@ +2025-06-10T15:38:58.529Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_event_returns_Bad_request_response.json b/src/test/resources/cassettes/features/v2/Post_an_event_returns_Bad_request_response.json new file mode 100644 index 00000000000..acfc4bd4ef0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_event_returns_Bad_request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"aggregation_key\":\"aggregation_key_123\",\"attributes\":{\"author\":{\"name\":\"example@datadog.com\",\"type\":\"user\"},\"change_metadata\":{\"dd\":{\"team\":\"datadog_team\",\"user_email\":\"datadog@datadog.com\",\"user_id\":\"datadog_user_id\",\"user_name\":\"datadog_username\"},\"resource_link\":\"datadog.com/feature/fallback_payments_test\"},\"changed_resource\":{\"name\":\"fallback_payments_test\",\"type\":\"feature_flag\"},\"impacted_resources\":[{\"name\":\"payments_api\",\"type\":\"service\"}],\"new_value\":{\"enabled\":true,\"percentage\":\"50%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}},\"prev_value\":{\"enabled\":true,\"percentage\":\"10%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}}},\"category\":\"invalid\",\"integration_id\":\"custom-events\",\"message\":\"payment_processed feature flag has been enabled\",\"tags\":[\"env:api_client_test\"],\"title\":\"payment_processed feature flag updated\"},\"type\":\"event\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/events", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"JSON validation failed at $.data.attributes.category: value must be one of: [\\\"alert\\\", \\\"change\\\"].\"}]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b35f8f84-50dc-70b8-3d76-61b05817ff7e" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_event_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Post_an_event_returns_OK_response.freeze new file mode 100644 index 00000000000..42309286e25 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_event_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-06-10T15:38:58.954Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Post_an_event_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Post_an_event_returns_OK_response.json new file mode 100644 index 00000000000..3f4701e821a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Post_an_event_returns_OK_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"aggregation_key\":\"aggregation_key_123\",\"attributes\":{\"author\":{\"name\":\"example@datadog.com\",\"type\":\"user\"},\"change_metadata\":{\"dd\":{\"team\":\"datadog_team\",\"user_email\":\"datadog@datadog.com\",\"user_id\":\"datadog_user_id\",\"user_name\":\"datadog_username\"},\"resource_link\":\"datadog.com/feature/fallback_payments_test\"},\"changed_resource\":{\"name\":\"fallback_payments_test\",\"type\":\"feature_flag\"},\"impacted_resources\":[{\"name\":\"payments_api\",\"type\":\"service\"}],\"new_value\":{\"enabled\":true,\"percentage\":\"50%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}},\"prev_value\":{\"enabled\":true,\"percentage\":\"10%\",\"rule\":{\"datacenter\":\"devcycle.us1.prod\"}}},\"category\":\"change\",\"integration_id\":\"custom-events\",\"message\":\"payment_processed feature flag has been enabled\",\"tags\":[\"env:api_client_test\"],\"title\":\"payment_processed feature flag updated\"},\"type\":\"event\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/events", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"attributes\":{\"attributes\":{\"evt\":{\"uid\":\"AZdafqaTAACKG_iMQ82pmAAA\"}}},\"id\":\"_\",\"type\":\"event\"},\"links\":{\"self\":\"https://app.datadoghq.com/event/event?uid=AZdafqaTAACKG_iMQ82pmAAA\"}}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 202, + "reasonPhrase": "Accepted" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "12f2ce8c-e9b9-19c0-6a47-1c2b7d261fb3" + } +] \ No newline at end of file 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 a8c1307ac68..0a69d195201 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,19 +50,21 @@ Feature: Events Then the response status is 200 OK And the response "data" has length 0 - @generated @skip @team:DataDog/event-management + @team:DataDog/event-management Scenario: Post an event returns "Bad request" response Given new "CreateEvent" request - And body with value {"data": {"attributes": {"attributes": {"author": {"name": "datadog@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "change", "message": "payment_processed feature flag has been enabled", "tags": ["env:test"], "title": "payment_processed feature flag updated"}, "type": "event"}} + And body with value {"data": {"attributes": {"aggregation_key": "aggregation_key_123", "attributes": {"author": {"name": "example@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "invalid", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env:api_client_test"], "title": "payment_processed feature flag updated"}, "type": "event"}} When the request is sent Then the response status is 400 Bad request - @generated @skip @team:DataDog/event-management + @skip-validation @team:DataDog/event-management Scenario: Post an event returns "OK" response Given new "CreateEvent" request - And body with value {"data": {"attributes": {"attributes": {"author": {"name": "datadog@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "change", "message": "payment_processed feature flag has been enabled", "tags": ["env:test"], "title": "payment_processed feature flag updated"}, "type": "event"}} + And body with value {"data": {"attributes": {"aggregation_key": "aggregation_key_123", "attributes": {"author": {"name": "example@datadog.com", "type": "user"}, "change_metadata": {"dd": {"team": "datadog_team", "user_email": "datadog@datadog.com", "user_id": "datadog_user_id", "user_name": "datadog_username"}, "resource_link": "datadog.com/feature/fallback_payments_test"}, "changed_resource": {"name": "fallback_payments_test", "type": "feature_flag"}, "impacted_resources": [{"name": "payments_api", "type": "service"}], "new_value": {"enabled": true, "percentage": "50%", "rule": {"datacenter": "devcycle.us1.prod"}}, "prev_value": {"enabled": true, "percentage": "10%", "rule": {"datacenter": "devcycle.us1.prod"}}}, "category": "change", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env:api_client_test"], "title": "payment_processed feature flag updated"}, "type": "event"}} When the request is sent - Then the response status is 200 OK + Then the response status is 202 OK + And the response "data.type" is equal to "event" + And the response "data.attributes.attributes.evt" has field "uid" @team:DataDog/event-management Scenario: Search events returns "Bad Request" response 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 e81cb7b7ce1..3cc857a7365 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 @@ -934,7 +934,7 @@ "CreateEvent": { "tag": "Events", "undo": { - "type": "unsafe" + "type": "safe" } }, "SearchEvents": {

Response details
Status Code Description Response Headers
200 OK -
202 OK -
400 Bad request -
403 Forbidden -
429 Too many requests -