diff --git a/.apigentools-info b/.apigentools-info index 605d560a1e80..aa87a47b8a01 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:41.078711", - "spec_repo_commit": "5e49afe1" + "regenerated": "2025-06-18 14:53:51.027723", + "spec_repo_commit": "5f7cad1f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-18 13:32:41.095227", - "spec_repo_commit": "5e49afe1" + "regenerated": "2025-06-18 14:53:51.047793", + "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 c24700d9c643..cdbca1909d4f 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/cassettes/features/v2/events/Post-an-event-returns-Bad-request-response.frozen b/cassettes/features/v2/events/Post-an-event-returns-Bad-request-response.frozen new file mode 100644 index 000000000000..a1cd4e8e4aca --- /dev/null +++ b/cassettes/features/v2/events/Post-an-event-returns-Bad-request-response.frozen @@ -0,0 +1 @@ +2025-06-10T15:38:58.529Z \ No newline at end of file diff --git a/cassettes/features/v2/events/Post-an-event-returns-Bad-request-response.yml b/cassettes/features/v2/events/Post-an-event-returns-Bad-request-response.yml new file mode 100644 index 000000000000..b5aac5f8d286 --- /dev/null +++ b/cassettes/features/v2/events/Post-an-event-returns-Bad-request-response.yml @@ -0,0 +1,27 @@ +http_interactions: +- recorded_at: Tue, 10 Jun 2025 15:38:58 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://event-management-intake.datadoghq.com/api/v2/events + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/events/Post-an-event-returns-OK-response.frozen b/cassettes/features/v2/events/Post-an-event-returns-OK-response.frozen new file mode 100644 index 000000000000..42309286e25d --- /dev/null +++ b/cassettes/features/v2/events/Post-an-event-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-06-10T15:38:58.954Z \ No newline at end of file diff --git a/cassettes/features/v2/events/Post-an-event-returns-OK-response.yml b/cassettes/features/v2/events/Post-an-event-returns-OK-response.yml new file mode 100644 index 000000000000..eb908711b841 --- /dev/null +++ b/cassettes/features/v2/events/Post-an-event-returns-OK-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Tue, 10 Jun 2025 15:38:58 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://event-management-intake.datadoghq.com/api/v2/events + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 202 + message: Accepted +recorded_with: VCR 6.0.0 diff --git a/examples/v2/events/CreateEvent.rb b/examples/v2/events/CreateEvent.rb index f75e444a5edd..4352e1601e4d 100644 --- a/examples/v2/events/CreateEvent.rb +++ b/examples/v2/events/CreateEvent.rb @@ -6,9 +6,10 @@ 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", + name: "example@datadog.com", type: DatadogAPIClient::V2::ChangeEventCustomAttributesAuthorType::USER, }), change_metadata: { @@ -32,9 +33,10 @@ }, }), category: DatadogAPIClient::V2::EventCategory::CHANGE, + integration_id: DatadogAPIClient::V2::EventPayloadIntegrationId::CUSTOM_EVENTS, message: "payment_processed feature flag has been enabled", tags: [ - "env:test", + "env:api_client_test", ], title: "payment_processed feature flag updated", }), diff --git a/features/v2/events.feature b/features/v2/events.feature index a8c1307ac683..0a69d195201a 100644 --- a/features/v2/events.feature +++ b/features/v2/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/features/v2/undo.json b/features/v2/undo.json index e81cb7b7ce12..3cc857a7365b 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -934,7 +934,7 @@ "CreateEvent": { "tag": "Events", "undo": { - "type": "unsafe" + "type": "safe" } }, "SearchEvents": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 897a2a2b7aeb..2ee8ff8284c0 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -535,6 +535,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 17abaf136dd9..9d92499e7b81 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -957,6 +957,11 @@ def overrides "v2.active_billing_dimensions_type" => "ActiveBillingDimensionsType", "v2.add_member_team_request" => "AddMemberTeamRequest", "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", @@ -1775,8 +1780,10 @@ 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_payload_integration_id" => "EventPayloadIntegrationId", "v2.event_priority" => "EventPriority", "v2.event_response" => "EventResponse", "v2.event_response_attributes" => "EventResponseAttributes", diff --git a/lib/datadog_api_client/v2/api/events_api.rb b/lib/datadog_api_client/v2/api/events_api.rb index ac18b1bb3007..8fe2ab77bb24 100644 --- a/lib/datadog_api_client/v2/api/events_api.rb +++ b/lib/datadog_api_client/v2/api/events_api.rb @@ -33,13 +33,17 @@ def create_event(body, opts = {}) # Post an event. # - # 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](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. + # ❌ For use cases involving other event categories, use the V1 endpoint or reach out to [support](https://www.datadoghq.com/support/). # - # @param body [EventCreateRequestPayload] Event request object + # ❌ 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 [EventCreateRequestPayload] Event creation request payload. # @param opts [Hash] the optional parameters # @return [Array<(EventCreateResponsePayload, Integer, Hash)>] EventCreateResponsePayload data, response status code and response headers def create_event_with_http_info(body, opts = {}) 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..f32682773540 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes.rb @@ -0,0 +1,145 @@ +=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 + # Alert event attributes. + class AlertEventCustomAttributes + include BaseGenericModel + + # Free form JSON object for arbitrary data. Supports up to 100 properties per object and a maximum nesting depth of 10 levels. + attr_accessor :custom + + # The links related to the event. Maximum of 20 links allowed. + attr_reader :links + + # The priority of the alert. + attr_accessor :priority + + # The status of the alert. + attr_reader :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' => :'Hash', + :'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 + return false if @status.nil? + 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 + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + 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..3e320a021c56 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items.rb @@ -0,0 +1,152 @@ +=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 display text of the link. Limited to 300 characters. + attr_reader :title + + # The URL of the link. Limited to 2048 characters. + attr_reader :url + + # 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 + + # 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::AlertEventCustomAttributesLinksItems`. 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?(:'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 !@title.nil? && @title.to_s.length < 1 + return false if @url.nil? + return false if @url.to_s.length > 2048 + return false if @url.to_s.length < 1 + 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 + if !title.nil? && title.to_s.length < 1 + fail ArgumentError, 'invalid value for "title", the character length must be great than or equal to 1.' + 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 + if url.to_s.length < 1 + fail ArgumentError, 'invalid value for "url", the character length must be great than or equal to 1.' + end + @url = url + 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 + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, title, url].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..e6f75a46ae95 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_links_items_category.rb @@ -0,0 +1,28 @@ +=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 + DOCUMENTATION = "documentation".freeze + DASHBOARD = "dashboard".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..a37b2088ca65 --- /dev/null +++ b/lib/datadog_api_client/v2/models/alert_event_custom_attributes_status.rb @@ -0,0 +1,28 @@ +=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 + + WARN = "warn".freeze + ERROR = "error".freeze + OK = "ok".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_event_custom_attributes.rb b/lib/datadog_api_client/v2/models/change_event_custom_attributes.rb index 6bc335d4158f..86a667e823b1 100644 --- a/lib/datadog_api_client/v2/models/change_event_custom_attributes.rb +++ b/lib/datadog_api_client/v2/models/change_event_custom_attributes.rb @@ -17,31 +17,29 @@ require 'time' module DatadogAPIClient::V2 - # Object representing custom change event attributes. + # Change event attributes. class ChangeEventCustomAttributes include BaseGenericModel - # 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`. attr_accessor :author - # 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. attr_accessor :change_metadata - # Object representing a uniquely identified resource. + # A uniquely identified resource. attr_reader :changed_resource # 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. - attr_accessor :impacted_resources + # the change event at the correct location. Only resources of type `service` are supported. Maximum of 100 impacted resources allowed. + attr_reader :impacted_resources - # Free form object to track new value of the changed resource. + # Free form JSON object representing the new state of the changed resource. attr_accessor :new_value - # Free form object to track previous value of the changed resource. + # Free form JSON object representing the previous state of the changed resource. attr_accessor :prev_value - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -76,14 +74,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeEventCustomAttributes` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ChangeEventCustomAttributes`. 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?(:'author') @@ -118,6 +114,7 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @changed_resource.nil? + return false if !@impacted_resources.nil? && @impacted_resources.length > 100 true end @@ -131,24 +128,14 @@ def changed_resource=(changed_resource) @changed_resource = changed_resource end - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash + # Custom attribute writer method with validation + # @param impacted_resources [Object] Object to be assigned # @!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 + def impacted_resources=(impacted_resources) + if !impacted_resources.nil? && impacted_resources.length > 100 + fail ArgumentError, 'invalid value for "impacted_resources", number of items must be less than or equal to 100.' end - hash + @impacted_resources = impacted_resources end # Checks equality by comparing each attribute. @@ -162,15 +149,14 @@ def ==(o) changed_resource == o.changed_resource && impacted_resources == o.impacted_resources && new_value == o.new_value && - prev_value == o.prev_value && - additional_properties == o.additional_properties + prev_value == o.prev_value end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [author, change_metadata, changed_resource, impacted_resources, new_value, prev_value, additional_properties].hash + [author, change_metadata, changed_resource, impacted_resources, new_value, prev_value].hash end end end diff --git a/lib/datadog_api_client/v2/models/change_event_custom_attributes_author.rb b/lib/datadog_api_client/v2/models/change_event_custom_attributes_author.rb index d9c8154da849..7b444b0fa624 100644 --- a/lib/datadog_api_client/v2/models/change_event_custom_attributes_author.rb +++ b/lib/datadog_api_client/v2/models/change_event_custom_attributes_author.rb @@ -17,18 +17,16 @@ require 'time' module DatadogAPIClient::V2 - # 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`. class ChangeEventCustomAttributesAuthor include BaseGenericModel - # Author's name. Limited to 128 characters. + # The name of the user or system that made the change. Limited to 128 characters. attr_reader :name # Author's type. attr_reader :type - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -55,14 +53,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeEventCustomAttributesAuthor` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ChangeEventCustomAttributesAuthor`. 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?(:'name') @@ -80,6 +76,7 @@ def initialize(attributes = {}) def valid? return false if @name.nil? return false if @name.to_s.length > 128 + return false if @name.to_s.length < 1 return false if @type.nil? true end @@ -94,6 +91,9 @@ def name=(name) if name.to_s.length > 128 fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 128.' end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end @name = name end @@ -107,26 +107,6 @@ def type=(type) @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 - 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 @@ -134,15 +114,14 @@ def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && - type == o.type && - additional_properties == o.additional_properties + type == o.type end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [name, type, additional_properties].hash + [name, type].hash end end end diff --git a/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource.rb b/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource.rb index 384721a01b47..e9291fea283d 100644 --- a/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource.rb +++ b/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource.rb @@ -17,18 +17,16 @@ require 'time' module DatadogAPIClient::V2 - # Object representing a uniquely identified resource. + # A uniquely identified resource. class ChangeEventCustomAttributesChangedResource include BaseGenericModel - # Resource's name. + # The name of the resource that was changed. Limited to 128 characters. attr_reader :name - # Resource's type. + # The type of the resource that was changed. attr_reader :type - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -55,14 +53,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeEventCustomAttributesChangedResource` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ChangeEventCustomAttributesChangedResource`. 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?(:'name') @@ -79,6 +75,8 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @name.nil? + return false if @name.to_s.length > 128 + return false if @name.to_s.length < 1 return false if @type.nil? true end @@ -90,6 +88,12 @@ def name=(name) if name.nil? fail ArgumentError, 'invalid value for "name", name cannot be nil.' end + if name.to_s.length > 128 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 128.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end @name = name end @@ -103,26 +107,6 @@ def type=(type) @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 - 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 @@ -130,15 +114,14 @@ def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && - type == o.type && - additional_properties == o.additional_properties + type == o.type end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [name, type, additional_properties].hash + [name, type].hash end end end diff --git a/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource_type.rb b/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource_type.rb index cee8a151f7cf..5cb52ea0b509 100644 --- a/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource_type.rb +++ b/lib/datadog_api_client/v2/models/change_event_custom_attributes_changed_resource_type.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V2 - # Resource's type. + # The type of the resource that was changed. class ChangeEventCustomAttributesChangedResourceType include BaseEnumModel diff --git a/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items.rb b/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items.rb index 3669858ed4d3..e405a775d2a2 100644 --- a/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items.rb +++ b/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items.rb @@ -17,18 +17,16 @@ require 'time' module DatadogAPIClient::V2 - # Object representing a uniquely identified resource. Only the resource type `service` is supported. + # Object representing a uniquely identified resource. class ChangeEventCustomAttributesImpactedResourcesItems include BaseGenericModel - # Resource's name. + # The name of the impacted resource. Limited to 128 characters. attr_reader :name - # Resource's type. + # The type of the impacted resource. attr_reader :type - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -55,14 +53,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeEventCustomAttributesImpactedResourcesItems` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::ChangeEventCustomAttributesImpactedResourcesItems`. 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?(:'name') @@ -79,6 +75,8 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @name.nil? + return false if @name.to_s.length > 128 + return false if @name.to_s.length < 1 return false if @type.nil? true end @@ -90,6 +88,12 @@ def name=(name) if name.nil? fail ArgumentError, 'invalid value for "name", name cannot be nil.' end + if name.to_s.length > 128 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 128.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end @name = name end @@ -103,26 +107,6 @@ def type=(type) @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 - 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 @@ -130,15 +114,14 @@ def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && - type == o.type && - additional_properties == o.additional_properties + type == o.type end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [name, type, additional_properties].hash + [name, type].hash end end end diff --git a/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items_type.rb b/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items_type.rb index 930c49b28db4..15ab76b6ac8b 100644 --- a/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items_type.rb +++ b/lib/datadog_api_client/v2/models/change_event_custom_attributes_impacted_resources_items_type.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V2 - # Resource's type. + # The type of the impacted resource. class ChangeEventCustomAttributesImpactedResourcesItemsType include BaseEnumModel diff --git a/lib/datadog_api_client/v2/models/event_category.rb b/lib/datadog_api_client/v2/models/event_category.rb index 43b97b08f8d5..5507522ad701 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 identifying the type of event. 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..48d1a7b2cada 100644 --- a/lib/datadog_api_client/v2/models/event_create_request.rb +++ b/lib/datadog_api_client/v2/models/event_create_request.rb @@ -17,15 +17,15 @@ require 'time' module DatadogAPIClient::V2 - # Object representing an event creation request. + # An event object. 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..83aa7de44bce 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 @@ -21,8 +21,8 @@ module DatadogAPIClient::V2 class EventCreateRequestPayload include BaseGenericModel - # Object representing an event creation request. - attr_accessor :data + # An event object. + 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..6ade48396563 100644 --- a/lib/datadog_api_client/v2/models/event_create_response.rb +++ b/lib/datadog_api_client/v2/models/event_create_response.rb @@ -17,14 +17,14 @@ require 'time' module DatadogAPIClient::V2 - # Object containing an event response. + # Event object. class EventCreateResponse include BaseGenericModel - # JSON object containing all events attributes and their associated values. + # Event attributes. attr_accessor :attributes - # Event type + # Entity type. attr_accessor :type attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/event_create_response_attributes.rb b/lib/datadog_api_client/v2/models/event_create_response_attributes.rb index efc9fb5dce30..e1068646e527 100644 --- a/lib/datadog_api_client/v2/models/event_create_response_attributes.rb +++ b/lib/datadog_api_client/v2/models/event_create_response_attributes.rb @@ -17,11 +17,11 @@ require 'time' module DatadogAPIClient::V2 - # JSON object containing all events attributes and their associated values. + # Event attributes. class EventCreateResponseAttributes include BaseGenericModel - # JSON object of attributes from your events. + # JSON object for category-specific attributes. attr_accessor :attributes attr_accessor :additional_properties diff --git a/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes.rb b/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes.rb index b5fd02a8f122..215f82388746 100644 --- a/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes.rb +++ b/lib/datadog_api_client/v2/models/event_create_response_attributes_attributes.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V2 - # JSON object of attributes from your events. + # JSON object for category-specific attributes. class EventCreateResponseAttributesAttributes include BaseGenericModel 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..9380f6c14eb4 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,16 +21,20 @@ module DatadogAPIClient::V2 class EventCreateResponseAttributesAttributesEvt include BaseGenericModel - # Event id + # Event identifier. This field is deprecated and will be removed in a future version. Use the `uid` field instead. attr_accessor :id + # A unique identifier for the event. You can use this identifier to query or reference the event. + attr_accessor :uid + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { - :'id' => :'id' + :'id' => :'id', + :'uid' => :'uid' } end @@ -38,7 +42,8 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'id' => :'String' + :'id' => :'String', + :'uid' => :'String' } end @@ -63,6 +68,10 @@ def initialize(attributes = {}) if attributes.key?(:'id') self.id = attributes[:'id'] end + + if attributes.key?(:'uid') + self.uid = attributes[:'uid'] + 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 && id == o.id && + uid == o.uid && additional_properties == o.additional_properties end @@ -99,7 +109,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [id, additional_properties].hash + [id, 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..81eade4ad80d 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 @@ -17,20 +17,24 @@ require 'time' module DatadogAPIClient::V2 - # Response containing information about created event. + # Event creation response. class EventCreateResponsePayload include BaseGenericModel - # Object containing an event response. + # Event object. attr_accessor :data + # Links to the event. + 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..646b359a7b3c --- /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 to the event. + class EventCreateResponsePayloadLinks + include BaseGenericModel + + # The URL of the event. This link is only functional when using the default 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..569a5f18d2ef 100644 --- a/lib/datadog_api_client/v2/models/event_payload.rb +++ b/lib/datadog_api_client/v2/models/event_payload.rb @@ -21,32 +21,33 @@ module DatadogAPIClient::V2 class EventPayload include BaseGenericModel - # An arbitrary string to use for aggregation when correlating events. Limited to 100 characters. + # 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. attr_reader :aggregation_key - # JSON object for custom attributes. Schema are different per each event category. + # JSON object for category-specific attributes. Schema is different per 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 identifying the type of event. attr_reader :category - # The body of the event. Limited to 4000 characters. + # Integration ID sourced from integration manifests. + attr_accessor :integration_id + + # Free formed text associated with the event. It's suggested to use `data.attributes.attributes.custom` for well-structured attributes. Limited to 4000 characters. attr_reader :message - # A list of tags to apply to the event. + # A list of tags associated with the event. Maximum of 100 tags allowed. # 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"`. # Defaults to the timestamp of receipt. Limited to values no older than 18 hours. attr_accessor :timestamp - # The event title. Limited to 500 characters. + # The title of the event. Limited to 500 characters. attr_reader :title - attr_accessor :additional_properties - # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -54,6 +55,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 +70,7 @@ def self.openapi_types :'aggregation_key' => :'String', :'attributes' => :'EventPayloadAttributes', :'category' => :'EventCategory', + :'integration_id' => :'EventPayloadIntegrationId', :'message' => :'String', :'tags' => :'Array', :'timestamp' => :'String', @@ -83,14 +86,12 @@ def initialize(attributes = {}) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::EventPayload` 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 + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::EventPayload`. 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?(:'aggregation_key') @@ -105,6 +106,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 @@ -129,11 +134,16 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if !@aggregation_key.nil? && @aggregation_key.to_s.length > 100 + return false if !@aggregation_key.nil? && @aggregation_key.to_s.length < 1 return false if @attributes.nil? return false if @category.nil? return false if !@message.nil? && @message.to_s.length > 4000 + return false if !@message.nil? && @message.to_s.length < 1 + 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 + return false if @title.to_s.length < 1 true end @@ -144,6 +154,9 @@ def aggregation_key=(aggregation_key) if !aggregation_key.nil? && aggregation_key.to_s.length > 100 fail ArgumentError, 'invalid value for "aggregation_key", the character length must be smaller than or equal to 100.' end + if !aggregation_key.nil? && aggregation_key.to_s.length < 1 + fail ArgumentError, 'invalid value for "aggregation_key", the character length must be great than or equal to 1.' + end @aggregation_key = aggregation_key end @@ -174,9 +187,25 @@ def message=(message) if !message.nil? && message.to_s.length > 4000 fail ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 4000.' end + if !message.nil? && message.to_s.length < 1 + fail ArgumentError, 'invalid value for "message", the character length must be great than or equal to 1.' + end @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 @@ -187,27 +216,10 @@ def title=(title) if title.to_s.length > 500 fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 500.' end - @title = title - 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 + if title.to_s.length < 1 + fail ArgumentError, 'invalid value for "title", the character length must be great than or equal to 1.' end - hash + @title = title end # Checks equality by comparing each attribute. @@ -219,18 +231,18 @@ 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 && - title == o.title && - additional_properties == o.additional_properties + title == o.title end # Calculates hash code according to all attributes. # @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].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..780910a69ea9 100644 --- a/lib/datadog_api_client/v2/models/event_payload_attributes.rb +++ b/lib/datadog_api_client/v2/models/event_payload_attributes.rb @@ -17,7 +17,7 @@ require 'time' module DatadogAPIClient::V2 - # JSON object for custom attributes. Schema are different per each event category. + # JSON object for category-specific attributes. Schema is different per event category. module EventPayloadAttributes class << self include BaseOneOfModel @@ -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 diff --git a/lib/datadog_api_client/v2/models/event_payload_integration_id.rb b/lib/datadog_api_client/v2/models/event_payload_integration_id.rb new file mode 100644 index 000000000000..99874ab6e1d5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/event_payload_integration_id.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 + # Integration ID sourced from integration manifests. + class EventPayloadIntegrationId + include BaseEnumModel + + CUSTOM_EVENTS = "custom-events".freeze + end +end