From 37ed5da7c456ef0d08ef4617cf541be3d655a009 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 6 May 2025 22:58:15 +0000 Subject: [PATCH] Regenerate client from commit d4c49fcb of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 166 ++++++++++++++++- examples/v2/events/CreateEvent.rb | 2 + features/v2/events.feature | 4 +- lib/datadog_api_client/configuration.rb | 52 ++++++ lib/datadog_api_client/inflector.rb | 6 + lib/datadog_api_client/v2/api/events_api.rb | 2 +- .../models/alert_event_custom_attributes.rb | 134 ++++++++++++++ ...ert_event_custom_attributes_links_items.rb | 169 ++++++++++++++++++ ..._custom_attributes_links_items_category.rb | 26 +++ .../alert_event_custom_attributes_priority.rb | 30 ++++ .../alert_event_custom_attributes_status.rb | 29 +++ .../v2/models/event_category.rb | 3 +- .../v2/models/event_create_request.rb | 33 +++- .../v2/models/event_create_request_payload.rb | 20 ++- .../v2/models/event_create_response.rb | 12 +- ...eate_response_attributes_attributes_evt.rb | 16 +- .../models/event_create_response_payload.rb | 16 +- .../event_create_response_payload_links.rb | 105 +++++++++++ .../v2/models/event_payload.rb | 31 +++- .../v2/models/event_payload_attributes.rb | 3 +- 21 files changed, 834 insertions(+), 33 deletions(-) create mode 100644 lib/datadog_api_client/v2/models/alert_event_custom_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items.rb create mode 100644 lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items_category.rb create mode 100644 lib/datadog_api_client/v2/models/alert_event_custom_attributes_priority.rb create mode 100644 lib/datadog_api_client/v2/models/alert_event_custom_attributes_status.rb create mode 100644 lib/datadog_api_client/v2/models/event_create_response_payload_links.rb diff --git a/.apigentools-info b/.apigentools-info index b70174810f07..21309647c799 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-06 15:05:59.808713", - "spec_repo_commit": "d0ee626b" + "regenerated": "2025-05-06 22:57:40.975915", + "spec_repo_commit": "d4c49fcb" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-06 15:05:59.824618", - "spec_repo_commit": "d0ee626b" + "regenerated": "2025-05-06 22:57:40.993440", + "spec_repo_commit": "d4c49fcb" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 37a8f69d15c8..1ff980b4025e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2138,6 +2138,89 @@ components: - id - base_severity type: object + AlertEventCustomAttributes: + additionalProperties: false + description: Object representing custom alert event attributes. + properties: + custom: + $ref: '#/components/schemas/AlertEventCustomAttributesCustom' + links: + $ref: '#/components/schemas/AlertEventCustomAttributesLinks' + priority: + $ref: '#/components/schemas/AlertEventCustomAttributesPriority' + status: + $ref: '#/components/schemas/AlertEventCustomAttributesStatus' + type: object + AlertEventCustomAttributesCustom: + additionalProperties: {} + description: Custom attributes support up to 100 properties and a maximum nesting + depth of 10 levels. + example: {} + type: object + AlertEventCustomAttributesLinks: + description: The links related to the event. + items: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItems' + maxItems: 20 + minItems: 1 + type: array + AlertEventCustomAttributesLinksItems: + description: A link. + properties: + category: + $ref: '#/components/schemas/AlertEventCustomAttributesLinksItemsCategory' + title: + description: The title of the link. + example: Runbook Link + maxLength: 300 + type: string + url: + description: The URL of the link. + example: https://app.datadoghq.com/runbook + maxLength: 2048 + type: string + required: + - url + - category + type: object + AlertEventCustomAttributesLinksItemsCategory: + description: The category of the link. + enum: + - runbook + example: runbook + type: string + x-enum-varnames: + - RUNBOOK + AlertEventCustomAttributesPriority: + description: The priority of the alert. + enum: + - '1' + - '2' + - '3' + - '4' + - '5' + example: '1' + type: string + x-enum-varnames: + - PRIORITY_ONE + - PRIORITY_TWO + - PRIORITY_THREE + - PRIORITY_FOUR + - PRIORITY_FIVE + AlertEventCustomAttributesStatus: + description: The status of the alert. + enum: + - info + - warn + - error + - ok + example: warn + type: string + x-enum-varnames: + - INFO + - WARN + - ERROR + - OK Annotation: description: A list of annotations used in the workflow. These are like sticky notes for your workflow! @@ -13905,15 +13988,16 @@ 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 to identify the type of event. For example, `change` + or `alert`. enum: - change + - alert example: change type: string x-enum-varnames: - CHANGE + - ALERT EventCreateRequest: description: Object representing an event creation request. properties: @@ -13921,12 +14005,17 @@ components: $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. @@ -13941,6 +14030,12 @@ components: properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributes' + id: + description: A numerical ID compatible with the V1 endpoint. This field + is not populated in response from the V2 endpoint. To retrieve this ID, + refer to the event attributes in the Event Explorer. + example: _ + type: string type: description: Event type example: event @@ -13962,8 +14057,10 @@ components: EventCreateResponseAttributesAttributesEvt: description: JSON object of event system attributes. properties: - id: - description: Event id + uid: + description: A unique identifier for the event. You can use this ID to query + or reference the event in the V2 endpoint. + example: ABCDEFGHIJKLMNOPQRSTUVWX type: string type: object EventCreateResponsePayload: @@ -13971,6 +14068,17 @@ components: properties: data: $ref: '#/components/schemas/EventCreateResponse' + links: + $ref: '#/components/schemas/EventCreateResponsePayloadLinks' + type: object + EventCreateResponsePayloadLinks: + description: Links attributes. + properties: + self: + description: The URL of the event. This link is only functional when using + the `app` subdomain. + example: https://app.datadoghq.com/event/event?id=123 + type: string type: object EventPayload: description: Event attributes. @@ -13978,12 +14086,19 @@ components: aggregation_key: description: An arbitrary string to use for aggregation when correlating events. Limited to 100 characters. + example: aggregation_key_123 maxLength: 100 type: string attributes: $ref: '#/components/schemas/EventPayloadAttributes' category: $ref: '#/components/schemas/EventCategory' + integration_id: + description: Integration IDs sourced from manifests. Examples include custom-events, + containerd, docker, elasticsearch, helm, mongodb, mysql, and nagios. See + the full list of available IDs [here](https://docs.datadoghq.com/service_management/events/ingest/integration_ids). + example: custom-events + type: string message: description: The body of the event. Limited to 4000 characters. example: payment_processed feature flag has been enabled @@ -13997,7 +14112,10 @@ components: - env:test items: description: A tag. + maxLength: 200 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) @@ -14023,6 +14141,7 @@ components: event category. oneOf: - $ref: '#/components/schemas/ChangeEventCustomAttributes' + - $ref: '#/components/schemas/AlertEventCustomAttributes' EventPriority: description: The priority of the event's monitor. For example, `normal` or `low`. enum: @@ -45640,7 +45759,8 @@ paths: - 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) + 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." operationId: CreateEvent @@ -45652,6 +45772,7 @@ paths: value: data: attributes: + aggregation_key: aggregation_key_123 attributes: author: name: datadog@datadog.com @@ -45680,6 +45801,7 @@ paths: rule: datacenter: devcycle.us1.prod category: change + integration_id: custom-events message: payment_processed feature flag has been enabled tags: - env:test @@ -45713,6 +45835,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.rb b/examples/v2/events/CreateEvent.rb index f75e444a5edd..e6dd243f2d07 100644 --- a/examples/v2/events/CreateEvent.rb +++ b/examples/v2/events/CreateEvent.rb @@ -6,6 +6,7 @@ body = DatadogAPIClient::V2::EventCreateRequestPayload.new({ data: DatadogAPIClient::V2::EventCreateRequest.new({ attributes: DatadogAPIClient::V2::EventPayload.new({ + aggregation_key: "aggregation_key_123", attributes: DatadogAPIClient::V2::ChangeEventCustomAttributes.new({ author: DatadogAPIClient::V2::ChangeEventCustomAttributesAuthor.new({ name: "datadog@datadog.com", @@ -32,6 +33,7 @@ }, }), category: DatadogAPIClient::V2::EventCategory::CHANGE, + integration_id: "custom-events", message: "payment_processed feature flag has been enabled", tags: [ "env:test", diff --git a/features/v2/events.feature b/features/v2/events.feature index a8c1307ac683..71a689b2cb68 100644 --- a/features/v2/events.feature +++ b/features/v2/events.feature @@ -53,14 +53,14 @@ Feature: Events @generated @skip @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": "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", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env: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 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": "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", "integration_id": "custom-events", "message": "payment_processed feature flag has been enabled", "tags": ["env:test"], "title": "payment_processed feature flag updated"}, "type": "event"}} When the request is sent Then the response status is 200 OK diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index a9c1e720df0c..1af7e54404f3 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -534,6 +534,58 @@ def operation_server_settings } } ], + "v2.create_event": [ + { + url: "https://{subdomain}.{site}", + description: "No description provided", + variables: { + site: { + description: "The regional site for customers.", + default_value: "datadoghq.com", + enum_values: [ + "datadoghq.com", + "us3.datadoghq.com", + "us5.datadoghq.com", + "ap1.datadoghq.com", + "datadoghq.eu", + "ddog-gov.com" + ] + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "event-management-intake", + } + } + }, + { + url: "{protocol}://{name}", + description: "No description provided", + variables: { + name: { + description: "Full site DNS name.", + default_value: "event-management-intake.datadoghq.com", + }, + protocol: { + description: "The protocol for accessing the API.", + default_value: "https", + } + } + }, + { + url: "https://{subdomain}.{site}", + description: "No description provided", + variables: { + site: { + description: "Any Datadog deployment.", + default_value: "datadoghq.com", + }, + subdomain: { + description: "The subdomain where the API is deployed.", + default_value: "event-management-intake", + } + } + } + ], "v2.submit_log": [ { url: "https://{subdomain}.{site}", diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b31ae532c475..072f07e81d80 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -954,6 +954,11 @@ def overrides "v2.active_billing_dimensions_response" => "ActiveBillingDimensionsResponse", "v2.active_billing_dimensions_type" => "ActiveBillingDimensionsType", "v2.advisory" => "Advisory", + "v2.alert_event_custom_attributes" => "AlertEventCustomAttributes", + "v2.alert_event_custom_attributes_links_items" => "AlertEventCustomAttributesLinksItems", + "v2.alert_event_custom_attributes_links_items_category" => "AlertEventCustomAttributesLinksItemsCategory", + "v2.alert_event_custom_attributes_priority" => "AlertEventCustomAttributesPriority", + "v2.alert_event_custom_attributes_status" => "AlertEventCustomAttributesStatus", "v2.annotation" => "Annotation", "v2.annotation_display" => "AnnotationDisplay", "v2.annotation_display_bounds" => "AnnotationDisplayBounds", @@ -1738,6 +1743,7 @@ def overrides "v2.event_create_response_attributes_attributes" => "EventCreateResponseAttributesAttributes", "v2.event_create_response_attributes_attributes_evt" => "EventCreateResponseAttributesAttributesEvt", "v2.event_create_response_payload" => "EventCreateResponsePayload", + "v2.event_create_response_payload_links" => "EventCreateResponsePayloadLinks", "v2.event_payload" => "EventPayload", "v2.event_payload_attributes" => "EventPayloadAttributes", "v2.event_priority" => "EventPriority", diff --git a/lib/datadog_api_client/v2/api/events_api.rb b/lib/datadog_api_client/v2/api/events_api.rb index ac18b1bb3007..b5a082f3495e 100644 --- a/lib/datadog_api_client/v2/api/events_api.rb +++ b/lib/datadog_api_client/v2/api/events_api.rb @@ -35,7 +35,7 @@ def create_event(body, opts = {}) # # This endpoint allows you to post events. # - # ✅ **Only events with the `change` category** are in General Availability. See [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details. + # ✅ **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. # # ❌ For use cases involving other event categories, please use the V1 endpoint. # diff --git a/lib/datadog_api_client/v2/models/alert_event_custom_attributes.rb b/lib/datadog_api_client/v2/models/alert_event_custom_attributes.rb new file mode 100644 index 000000000000..f618a782ee76 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes.rb @@ -0,0 +1,134 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object representing custom alert event attributes. + class AlertEventCustomAttributes + include BaseGenericModel + + # Custom attributes support up to 100 properties and a maximum nesting depth of 10 levels. + attr_accessor :custom + + # The links related to the event. + attr_reader :links + + # The priority of the alert. + attr_accessor :priority + + # The status of the alert. + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'custom' => :'custom', + :'links' => :'links', + :'priority' => :'priority', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'custom' => :'AlertEventCustomAttributesCustom', + :'links' => :'Array', + :'priority' => :'AlertEventCustomAttributesPriority', + :'status' => :'AlertEventCustomAttributesStatus' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AlertEventCustomAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::AlertEventCustomAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'custom') + self.custom = attributes[:'custom'] + end + + if attributes.key?(:'links') + if (value = attributes[:'links']).is_a?(Array) + self.links = value + end + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@links.nil? && @links.length > 20 + return false if !@links.nil? && @links.length < 1 + true + end + + # Custom attribute writer method with validation + # @param links [Object] Object to be assigned + # @!visibility private + def links=(links) + if !links.nil? && links.length > 20 + fail ArgumentError, 'invalid value for "links", number of items must be less than or equal to 20.' + end + if !links.nil? && links.length < 1 + fail ArgumentError, 'invalid value for "links", number of items must be greater than or equal to 1.' + end + @links = links + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + custom == o.custom && + links == o.links && + priority == o.priority && + status == o.status + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [custom, links, priority, status].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items.rb b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items.rb new file mode 100644 index 000000000000..920f496b7a24 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items.rb @@ -0,0 +1,169 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A link. + class AlertEventCustomAttributesLinksItems + include BaseGenericModel + + # The category of the link. + attr_reader :category + + # The title of the link. + attr_reader :title + + # The URL of the link. + attr_reader :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'title' => :'title', + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'AlertEventCustomAttributesLinksItemsCategory', + :'title' => :'String', + :'url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AlertEventCustomAttributesLinksItems` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @category.nil? + return false if !@title.nil? && @title.to_s.length > 300 + return false if @url.nil? + return false if @url.to_s.length > 2048 + true + end + + # Custom attribute writer method with validation + # @param category [Object] Object to be assigned + # @!visibility private + def category=(category) + if category.nil? + fail ArgumentError, 'invalid value for "category", category cannot be nil.' + end + @category = category + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if !title.nil? && title.to_s.length > 300 + fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 300.' + end + @title = title + end + + # Custom attribute writer method with validation + # @param url [Object] Object to be assigned + # @!visibility private + def url=(url) + if url.nil? + fail ArgumentError, 'invalid value for "url", url cannot be nil.' + end + if url.to_s.length > 2048 + fail ArgumentError, 'invalid value for "url", the character length must be smaller than or equal to 2048.' + end + @url = url + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + title == o.title && + url == o.url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, title, url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items_category.rb b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items_category.rb new file mode 100644 index 000000000000..6463073cb19f --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items_category.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The category of the link. + class AlertEventCustomAttributesLinksItemsCategory + include BaseEnumModel + + RUNBOOK = "runbook".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/alert_event_custom_attributes_priority.rb b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_priority.rb new file mode 100644 index 000000000000..8ac8a2655c7b --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_priority.rb @@ -0,0 +1,30 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The priority of the alert. + class AlertEventCustomAttributesPriority + include BaseEnumModel + + PRIORITY_ONE = "1".freeze + PRIORITY_TWO = "2".freeze + PRIORITY_THREE = "3".freeze + PRIORITY_FOUR = "4".freeze + PRIORITY_FIVE = "5".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/alert_event_custom_attributes_status.rb b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_status.rb new file mode 100644 index 000000000000..24f582952b33 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_status.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The status of the alert. + class AlertEventCustomAttributesStatus + include BaseEnumModel + + INFO = "info".freeze + WARN = "warn".freeze + ERROR = "error".freeze + OK = "ok".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/event_category.rb b/lib/datadog_api_client/v2/models/event_category.rb index 43b97b08f8d5..4fcdcd1e828e 100644 --- a/lib/datadog_api_client/v2/models/event_category.rb +++ b/lib/datadog_api_client/v2/models/event_category.rb @@ -17,10 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # 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 to identify the type of event. For example, `change` or `alert`. class EventCategory include BaseEnumModel CHANGE = "change".freeze + ALERT = "alert".freeze end end diff --git a/lib/datadog_api_client/v2/models/event_create_request.rb b/lib/datadog_api_client/v2/models/event_create_request.rb index 1823053bff32..045f18e73104 100644 --- a/lib/datadog_api_client/v2/models/event_create_request.rb +++ b/lib/datadog_api_client/v2/models/event_create_request.rb @@ -22,10 +22,10 @@ class EventCreateRequest include BaseGenericModel # Event attributes. - attr_accessor :attributes + attr_reader :attributes # Entity type. - attr_accessor :type + attr_reader :type attr_accessor :additional_properties @@ -74,6 +74,35 @@ def initialize(attributes = {}) end end + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/event_create_request_payload.rb b/lib/datadog_api_client/v2/models/event_create_request_payload.rb index a1c32d9f9c47..d40a8ca8ed53 100644 --- a/lib/datadog_api_client/v2/models/event_create_request_payload.rb +++ b/lib/datadog_api_client/v2/models/event_create_request_payload.rb @@ -22,7 +22,7 @@ class EventCreateRequestPayload include BaseGenericModel # Object representing an event creation request. - attr_accessor :data + attr_reader :data attr_accessor :additional_properties @@ -65,6 +65,24 @@ def initialize(attributes = {}) end end + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private diff --git a/lib/datadog_api_client/v2/models/event_create_response.rb b/lib/datadog_api_client/v2/models/event_create_response.rb index 1244ccfa18a4..e03fb6415da3 100644 --- a/lib/datadog_api_client/v2/models/event_create_response.rb +++ b/lib/datadog_api_client/v2/models/event_create_response.rb @@ -24,6 +24,9 @@ class EventCreateResponse # JSON object containing all events attributes and their associated values. attr_accessor :attributes + # A numerical ID compatible with the V1 endpoint. This field is not populated in response from the V2 endpoint. To retrieve this ID, refer to the event attributes in the Event Explorer. + attr_accessor :id + # Event type attr_accessor :type @@ -34,6 +37,7 @@ class EventCreateResponse def self.attribute_map { :'attributes' => :'attributes', + :'id' => :'id', :'type' => :'type' } end @@ -43,6 +47,7 @@ def self.attribute_map def self.openapi_types { :'attributes' => :'EventCreateResponseAttributes', + :'id' => :'String', :'type' => :'String' } end @@ -69,6 +74,10 @@ def initialize(attributes = {}) self.attributes = attributes[:'attributes'] end + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + if attributes.key?(:'type') self.type = attributes[:'type'] end @@ -101,6 +110,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && attributes == o.attributes && + id == o.id && type == o.type && additional_properties == o.additional_properties end @@ -109,7 +119,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [attributes, type, additional_properties].hash + [attributes, id, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes_evt.rb b/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes_evt.rb index f8553cc96a28..f9be4ddb0386 100644 --- a/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes_evt.rb +++ b/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes_evt.rb @@ -21,8 +21,8 @@ module DatadogAPIClient::V2 class EventCreateResponseAttributesAttributesEvt include BaseGenericModel - # Event id - attr_accessor :id + # A unique identifier for the event. You can use this ID to query or reference the event in the V2 endpoint. + attr_accessor :uid attr_accessor :additional_properties @@ -30,7 +30,7 @@ class EventCreateResponseAttributesAttributesEvt # @!visibility private def self.attribute_map { - :'id' => :'id' + :'uid' => :'uid' } end @@ -38,7 +38,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'id' => :'String' + :'uid' => :'String' } end @@ -60,8 +60,8 @@ def initialize(attributes = {}) end } - if attributes.key?(:'id') - self.id = attributes[:'id'] + if attributes.key?(:'uid') + self.uid = attributes[:'uid'] end end @@ -91,7 +91,7 @@ def to_hash def ==(o) return true if self.equal?(o) self.class == o.class && - id == o.id && + uid == o.uid && additional_properties == o.additional_properties end @@ -99,7 +99,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, additional_properties].hash + [uid, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/event_create_response_payload.rb b/lib/datadog_api_client/v2/models/event_create_response_payload.rb index 7d94d3a66d2d..e70ac6a5917c 100644 --- a/lib/datadog_api_client/v2/models/event_create_response_payload.rb +++ b/lib/datadog_api_client/v2/models/event_create_response_payload.rb @@ -24,13 +24,17 @@ class EventCreateResponsePayload # Object containing an event response. attr_accessor :data + # Links attributes. + attr_accessor :links + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { - :'data' => :'data' + :'data' => :'data', + :'links' => :'links' } end @@ -38,7 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'data' => :'EventCreateResponse' + :'data' => :'EventCreateResponse', + :'links' => :'EventCreateResponsePayloadLinks' } end @@ -63,6 +68,10 @@ def initialize(attributes = {}) if attributes.key?(:'data') self.data = attributes[:'data'] end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end end # Returns the object in the form of hash, with additionalProperties support. @@ -92,6 +101,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && data == o.data && + links == o.links && additional_properties == o.additional_properties end @@ -99,7 +109,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [data, additional_properties].hash + [data, links, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/event_create_response_payload_links.rb b/lib/datadog_api_client/v2/models/event_create_response_payload_links.rb new file mode 100644 index 000000000000..83ab089ea389 --- /dev/null +++ b/lib/datadog_api_client/v2/models/event_create_response_payload_links.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Links attributes. + class EventCreateResponsePayloadLinks + include BaseGenericModel + + # The URL of the event. This link is only functional when using the `app` subdomain. + attr_accessor :_self + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_self' => :'self' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_self' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EventCreateResponsePayloadLinks` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'_self') + self._self = attributes[:'_self'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _self == o._self && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_self, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/event_payload.rb b/lib/datadog_api_client/v2/models/event_payload.rb index ef97fc05b0a8..6f8a0c03ac1e 100644 --- a/lib/datadog_api_client/v2/models/event_payload.rb +++ b/lib/datadog_api_client/v2/models/event_payload.rb @@ -27,15 +27,18 @@ class EventPayload # JSON object for custom attributes. Schema are different per each event category. attr_reader :attributes - # 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 to identify the type of event. For example, `change` or `alert`. attr_reader :category + # Integration IDs sourced from manifests. Examples include custom-events, containerd, docker, elasticsearch, helm, mongodb, mysql, and nagios. See the full list of available IDs [here](https://docs.datadoghq.com/service_management/events/ingest/integration_ids). + attr_accessor :integration_id + # The body of the event. Limited to 4000 characters. attr_reader :message # A list of tags to apply to the event. # Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/). - attr_accessor :tags + attr_reader :tags # Timestamp when the event occurred. Must follow [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. # For example `"2017-01-15T01:30:15.010000Z"`. @@ -54,6 +57,7 @@ def self.attribute_map :'aggregation_key' => :'aggregation_key', :'attributes' => :'attributes', :'category' => :'category', + :'integration_id' => :'integration_id', :'message' => :'message', :'tags' => :'tags', :'timestamp' => :'timestamp', @@ -68,6 +72,7 @@ def self.openapi_types :'aggregation_key' => :'String', :'attributes' => :'EventPayloadAttributes', :'category' => :'EventCategory', + :'integration_id' => :'String', :'message' => :'String', :'tags' => :'Array', :'timestamp' => :'String', @@ -105,6 +110,10 @@ def initialize(attributes = {}) self.category = attributes[:'category'] end + if attributes.key?(:'integration_id') + self.integration_id = attributes[:'integration_id'] + end + if attributes.key?(:'message') self.message = attributes[:'message'] end @@ -132,6 +141,8 @@ def valid? return false if @attributes.nil? return false if @category.nil? return false if !@message.nil? && @message.to_s.length > 4000 + return false if !@tags.nil? && @tags.length > 100 + return false if !@tags.nil? && @tags.length < 1 return false if @title.nil? return false if @title.to_s.length > 500 true @@ -177,6 +188,19 @@ def message=(message) @message = message end + # Custom attribute writer method with validation + # @param tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if !tags.nil? && tags.length > 100 + fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 100.' + end + if !tags.nil? && tags.length < 1 + fail ArgumentError, 'invalid value for "tags", number of items must be greater than or equal to 1.' + end + @tags = tags + end + # Custom attribute writer method with validation # @param title [Object] Object to be assigned # @!visibility private @@ -219,6 +243,7 @@ def ==(o) aggregation_key == o.aggregation_key && attributes == o.attributes && category == o.category && + integration_id == o.integration_id && message == o.message && tags == o.tags && timestamp == o.timestamp && @@ -230,7 +255,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [aggregation_key, attributes, category, message, tags, timestamp, title, additional_properties].hash + [aggregation_key, attributes, category, integration_id, message, tags, timestamp, title, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/event_payload_attributes.rb b/lib/datadog_api_client/v2/models/event_payload_attributes.rb index 0d0225479a8a..442e8cd400da 100644 --- a/lib/datadog_api_client/v2/models/event_payload_attributes.rb +++ b/lib/datadog_api_client/v2/models/event_payload_attributes.rb @@ -26,7 +26,8 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'ChangeEventCustomAttributes' + :'ChangeEventCustomAttributes', + :'AlertEventCustomAttributes' ] end # Builds the object