diff --git a/.apigentools-info b/.apigentools-info index 1316bd4583f..1b6f36d5941 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 18:01:44.569120", - "spec_repo_commit": "9a201ac7" + "regenerated": "2025-06-23 19:18:45.955890", + "spec_repo_commit": "779f1def" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 18:01:44.585897", - "spec_repo_commit": "9a201ac7" + "regenerated": "2025-06-23 19:18:45.971799", + "spec_repo_commit": "779f1def" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4c7b28f483c..40efcb6b55c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2227,97 +2227,6 @@ 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! @@ -7010,16 +6919,14 @@ components: type: integer type: object ChangeEventCustomAttributes: - additionalProperties: false - description: Change event attributes. + description: Object representing custom change event attributes. properties: author: $ref: '#/components/schemas/ChangeEventCustomAttributesAuthor' change_metadata: additionalProperties: {} - 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. + description: Free form object with information related to the `change` event. + Can be arbitrarily nested and contain any valid JSON. example: dd: team: datadog_team @@ -7034,19 +6941,17 @@ 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 correct location. Only resources of type `service` - are supported. Maximum of 100 impacted resources allowed.' + the change event at the right location. Only resources of type `service` + are supported.' example: - name: payments_api type: service items: $ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItems' - maxItems: 100 type: array new_value: additionalProperties: {} - description: Free form JSON object representing the new state of the changed - resource. + description: Free form object to track new value of the changed resource. example: enabled: true percentage: 50% @@ -7055,8 +6960,7 @@ components: type: object prev_value: additionalProperties: {} - description: Free form JSON object representing the previous state of the - changed resource. + description: Free form object to track previous value of the changed resource. example: enabled: true percentage: 10% @@ -7067,16 +6971,13 @@ components: - changed_resource type: object ChangeEventCustomAttributesAuthor: - additionalProperties: false - description: The entity that made the change. Optional, if provided it must - include `type` and `name`. + description: Object representing the entity which made the change. Optional + field but if provided should include `type` and `name`. properties: name: - description: The name of the user or system that made the change. Limited - to 128 characters. - example: example@datadog.com + description: Author's name. Limited to 128 characters. + example: datadog@datadog.com maxLength: 128 - minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesAuthorType' @@ -7099,14 +7000,11 @@ components: - API - AUTOMATION ChangeEventCustomAttributesChangedResource: - additionalProperties: false - description: A uniquely identified resource. + description: Object representing a uniquely identified resource. properties: name: - description: The name of the resource that was changed. Limited to 128 characters. + description: Resource's name. example: fallback_payments_test - maxLength: 128 - minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesChangedResourceType' @@ -7115,7 +7013,7 @@ components: - name type: object ChangeEventCustomAttributesChangedResourceType: - description: The type of the resource that was changed. + description: Resource's type. enum: - feature_flag - configuration @@ -7125,14 +7023,12 @@ components: - FEATURE_FLAG - CONFIGURATION ChangeEventCustomAttributesImpactedResourcesItems: - additionalProperties: false - description: Object representing a uniquely identified resource. + description: Object representing a uniquely identified resource. Only the resource + type `service` is supported. properties: name: - description: The name of the impacted resource. Limited to 128 characters. + description: Resource's name. example: payments_api - maxLength: 128 - minLength: 1 type: string type: $ref: '#/components/schemas/ChangeEventCustomAttributesImpactedResourcesItemsType' @@ -7141,7 +7037,7 @@ components: - name type: object ChangeEventCustomAttributesImpactedResourcesItemsType: - description: The type of the impacted resource. + description: Resource's type. enum: - service example: service @@ -14783,33 +14679,28 @@ components: type: string type: object EventCategory: - description: Event category identifying the type of event. + 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. enum: - change - - alert example: change type: string x-enum-varnames: - CHANGE - - ALERT EventCreateRequest: - description: An event object. + description: Object representing an event creation request. 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. @@ -14820,23 +14711,24 @@ components: x-enum-varnames: - EVENT EventCreateResponse: - description: Event object. + description: Object containing an event response. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributes' type: - description: Entity type. + description: Event type example: event type: string type: object EventCreateResponseAttributes: - description: Event attributes. + description: JSON object containing all events attributes and their associated + values. properties: attributes: $ref: '#/components/schemas/EventCreateResponseAttributesAttributes' type: object EventCreateResponseAttributesAttributes: - description: JSON object for category-specific attributes. + description: JSON object of attributes from your events. properties: evt: $ref: '#/components/schemas/EventCreateResponseAttributesAttributesEvt' @@ -14845,71 +14737,41 @@ components: description: JSON object of event system attributes. properties: 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. + description: Event id type: string type: object EventCreateResponsePayload: - description: Event creation response. + description: Response containing information about created event. 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: 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 + description: An arbitrary string to use for aggregation when correlating + events. Limited to 100 characters. maxLength: 100 - minLength: 1 type: string attributes: $ref: '#/components/schemas/EventPayloadAttributes' category: $ref: '#/components/schemas/EventCategory' - integration_id: - $ref: '#/components/schemas/EventPayloadIntegrationId' message: - 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. + description: The body of the event. Limited to 4000 characters. example: payment_processed feature flag has been enabled maxLength: 4000 - minLength: 1 type: string tags: - description: 'A list of tags associated with the event. Maximum of 100 tags - allowed. + description: 'A list of tags to apply to the event. Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/).' example: - - env:api_client_test + - env: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) @@ -14921,10 +14783,9 @@ components: 18 hours.' type: string title: - description: The title of the event. Limited to 500 characters. + description: The event title. Limited to 500 characters. example: payment_processed feature flag updated maxLength: 500 - minLength: 1 type: string required: - title @@ -14932,19 +14793,10 @@ components: - attributes type: object EventPayloadAttributes: - description: JSON object for category-specific attributes. Schema is different - per event category. + description: JSON object for custom attributes. Schema are different per each + 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: @@ -47307,15 +47159,10 @@ paths: permissions: - events_read post: - 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) + 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) for more details.\n\n\u274C For use cases involving other event categories, - 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." + please use the V1 endpoint." operationId: CreateEvent requestBody: content: @@ -47325,10 +47172,9 @@ paths: value: data: attributes: - aggregation_key: aggregation_key_123 attributes: author: - name: example@datadog.com + name: datadog@datadog.com type: user change_metadata: dd: @@ -47354,19 +47200,17 @@ paths: rule: datacenter: devcycle.us1.prod category: change - integration_id: custom-events message: payment_processed feature flag has been enabled tags: - - env:api_client_test - timestamp: '2020-01-01T01:30:15.010000Z' + - env:test title: payment_processed feature flag updated type: event schema: $ref: '#/components/schemas/EventCreateRequestPayload' - description: Event creation request payload. + description: Event request object required: true responses: - '202': + '200': content: application/json: schema: @@ -47389,38 +47233,6 @@ 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/api/datadog/configuration.go b/api/datadog/configuration.go index d4d2c4256fe..82c1ff88bbd 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -269,58 +269,6 @@ func NewConfiguration() *Configuration { }, }, }, - "v2.EventsApi.CreateEvent": { - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "The regional site for customers.", - DefaultValue: "datadoghq.com", - EnumValues: []string{ - "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.", - DefaultValue: "event-management-intake", - }, - }, - }, - { - URL: "{protocol}://{name}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "name": { - Description: "Full site DNS name.", - DefaultValue: "event-management-intake.datadoghq.com", - }, - "protocol": { - Description: "The protocol for accessing the API.", - DefaultValue: "https", - }, - }, - }, - { - URL: "https://{subdomain}.{site}", - Description: "No description provided", - Variables: map[string]ServerVariable{ - "site": { - Description: "Any Datadog deployment.", - DefaultValue: "datadoghq.com", - }, - "subdomain": { - Description: "The subdomain where the API is deployed.", - DefaultValue: "event-management-intake", - }, - }, - }, - }, "v2.LogsApi.SubmitLog": { { URL: "https://{subdomain}.{site}", diff --git a/api/datadogV2/api_events.go b/api/datadogV2/api_events.go index 2b10c68ef7d..c1ea8823326 100644 --- a/api/datadogV2/api_events.go +++ b/api/datadogV2/api_events.go @@ -16,15 +16,11 @@ import ( type EventsApi datadog.Service // CreateEvent Post an event. -// This endpoint allows you to publish events. +// This endpoint allows you to post events. // -// ✅ **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. +// ✅ **Only events with the `change` category** are in General Availability. See [Change Tracking](https://docs.datadoghq.com/change_tracking) for more details. // -// ❌ For use cases involving other event categories, use the V1 endpoint or reach out to [support](https://www.datadoghq.com/support/). -// -// ❌ 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. +// ❌ For use cases involving other event categories, please use the V1 endpoint. func (a *EventsApi) CreateEvent(ctx _context.Context, body EventCreateRequestPayload) (EventCreateResponsePayload, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost diff --git a/api/datadogV2/model_alert_event_custom_attributes.go b/api/datadogV2/model_alert_event_custom_attributes.go deleted file mode 100644 index 7f5a07124c5..00000000000 --- a/api/datadogV2/model_alert_event_custom_attributes.go +++ /dev/null @@ -1,209 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// AlertEventCustomAttributes Alert event attributes. -type AlertEventCustomAttributes struct { - // Free form JSON object for arbitrary data. Supports up to 100 properties per object and a maximum nesting depth of 10 levels. - Custom map[string]interface{} `json:"custom,omitempty"` - // The links related to the event. Maximum of 20 links allowed. - Links []AlertEventCustomAttributesLinksItems `json:"links,omitempty"` - // The priority of the alert. - Priority *AlertEventCustomAttributesPriority `json:"priority,omitempty"` - // The status of the alert. - Status AlertEventCustomAttributesStatus `json:"status"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` -} - -// NewAlertEventCustomAttributes instantiates a new AlertEventCustomAttributes object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewAlertEventCustomAttributes(status AlertEventCustomAttributesStatus) *AlertEventCustomAttributes { - this := AlertEventCustomAttributes{} - var priority AlertEventCustomAttributesPriority = ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_FIVE - this.Priority = &priority - this.Status = status - return &this -} - -// NewAlertEventCustomAttributesWithDefaults instantiates a new AlertEventCustomAttributes object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewAlertEventCustomAttributesWithDefaults() *AlertEventCustomAttributes { - this := AlertEventCustomAttributes{} - var priority AlertEventCustomAttributesPriority = ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_FIVE - this.Priority = &priority - return &this -} - -// GetCustom returns the Custom field value if set, zero value otherwise. -func (o *AlertEventCustomAttributes) GetCustom() map[string]interface{} { - if o == nil || o.Custom == nil { - var ret map[string]interface{} - return ret - } - return o.Custom -} - -// GetCustomOk returns a tuple with the Custom field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributes) GetCustomOk() (*map[string]interface{}, bool) { - if o == nil || o.Custom == nil { - return nil, false - } - return &o.Custom, true -} - -// HasCustom returns a boolean if a field has been set. -func (o *AlertEventCustomAttributes) HasCustom() bool { - return o != nil && o.Custom != nil -} - -// SetCustom gets a reference to the given map[string]interface{} and assigns it to the Custom field. -func (o *AlertEventCustomAttributes) SetCustom(v map[string]interface{}) { - o.Custom = v -} - -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *AlertEventCustomAttributes) GetLinks() []AlertEventCustomAttributesLinksItems { - if o == nil || o.Links == nil { - var ret []AlertEventCustomAttributesLinksItems - return ret - } - return o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributes) GetLinksOk() (*[]AlertEventCustomAttributesLinksItems, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return &o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *AlertEventCustomAttributes) HasLinks() bool { - return o != nil && o.Links != nil -} - -// SetLinks gets a reference to the given []AlertEventCustomAttributesLinksItems and assigns it to the Links field. -func (o *AlertEventCustomAttributes) SetLinks(v []AlertEventCustomAttributesLinksItems) { - o.Links = v -} - -// GetPriority returns the Priority field value if set, zero value otherwise. -func (o *AlertEventCustomAttributes) GetPriority() AlertEventCustomAttributesPriority { - if o == nil || o.Priority == nil { - var ret AlertEventCustomAttributesPriority - return ret - } - return *o.Priority -} - -// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributes) GetPriorityOk() (*AlertEventCustomAttributesPriority, bool) { - if o == nil || o.Priority == nil { - return nil, false - } - return o.Priority, true -} - -// HasPriority returns a boolean if a field has been set. -func (o *AlertEventCustomAttributes) HasPriority() bool { - return o != nil && o.Priority != nil -} - -// SetPriority gets a reference to the given AlertEventCustomAttributesPriority and assigns it to the Priority field. -func (o *AlertEventCustomAttributes) SetPriority(v AlertEventCustomAttributesPriority) { - o.Priority = &v -} - -// GetStatus returns the Status field value. -func (o *AlertEventCustomAttributes) GetStatus() AlertEventCustomAttributesStatus { - if o == nil { - var ret AlertEventCustomAttributesStatus - return ret - } - return o.Status -} - -// GetStatusOk returns a tuple with the Status field value -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributes) GetStatusOk() (*AlertEventCustomAttributesStatus, bool) { - if o == nil { - return nil, false - } - return &o.Status, true -} - -// SetStatus sets field value. -func (o *AlertEventCustomAttributes) SetStatus(v AlertEventCustomAttributesStatus) { - o.Status = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AlertEventCustomAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Custom != nil { - toSerialize["custom"] = o.Custom - } - if o.Links != nil { - toSerialize["links"] = o.Links - } - if o.Priority != nil { - toSerialize["priority"] = o.Priority - } - toSerialize["status"] = o.Status - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AlertEventCustomAttributes) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Custom map[string]interface{} `json:"custom,omitempty"` - Links []AlertEventCustomAttributesLinksItems `json:"links,omitempty"` - Priority *AlertEventCustomAttributesPriority `json:"priority,omitempty"` - Status *AlertEventCustomAttributesStatus `json:"status"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Status == nil { - return fmt.Errorf("required field status missing") - } - - hasInvalidField := false - o.Custom = all.Custom - o.Links = all.Links - if all.Priority != nil && !all.Priority.IsValid() { - hasInvalidField = true - } else { - o.Priority = all.Priority - } - if !all.Status.IsValid() { - hasInvalidField = true - } else { - o.Status = *all.Status - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_alert_event_custom_attributes_links_items.go b/api/datadogV2/model_alert_event_custom_attributes_links_items.go deleted file mode 100644 index a3168981aff..00000000000 --- a/api/datadogV2/model_alert_event_custom_attributes_links_items.go +++ /dev/null @@ -1,163 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// AlertEventCustomAttributesLinksItems A link. -type AlertEventCustomAttributesLinksItems struct { - // The category of the link. - Category AlertEventCustomAttributesLinksItemsCategory `json:"category"` - // The display text of the link. Limited to 300 characters. - Title *string `json:"title,omitempty"` - // The URL of the link. Limited to 2048 characters. - Url string `json:"url"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` -} - -// NewAlertEventCustomAttributesLinksItems instantiates a new AlertEventCustomAttributesLinksItems object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewAlertEventCustomAttributesLinksItems(category AlertEventCustomAttributesLinksItemsCategory, url string) *AlertEventCustomAttributesLinksItems { - this := AlertEventCustomAttributesLinksItems{} - this.Category = category - this.Url = url - return &this -} - -// NewAlertEventCustomAttributesLinksItemsWithDefaults instantiates a new AlertEventCustomAttributesLinksItems object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewAlertEventCustomAttributesLinksItemsWithDefaults() *AlertEventCustomAttributesLinksItems { - this := AlertEventCustomAttributesLinksItems{} - return &this -} - -// GetCategory returns the Category field value. -func (o *AlertEventCustomAttributesLinksItems) GetCategory() AlertEventCustomAttributesLinksItemsCategory { - if o == nil { - var ret AlertEventCustomAttributesLinksItemsCategory - return ret - } - return o.Category -} - -// GetCategoryOk returns a tuple with the Category field value -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributesLinksItems) GetCategoryOk() (*AlertEventCustomAttributesLinksItemsCategory, bool) { - if o == nil { - return nil, false - } - return &o.Category, true -} - -// SetCategory sets field value. -func (o *AlertEventCustomAttributesLinksItems) SetCategory(v AlertEventCustomAttributesLinksItemsCategory) { - o.Category = v -} - -// GetTitle returns the Title field value if set, zero value otherwise. -func (o *AlertEventCustomAttributesLinksItems) GetTitle() string { - if o == nil || o.Title == nil { - var ret string - return ret - } - return *o.Title -} - -// GetTitleOk returns a tuple with the Title field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributesLinksItems) GetTitleOk() (*string, bool) { - if o == nil || o.Title == nil { - return nil, false - } - return o.Title, true -} - -// HasTitle returns a boolean if a field has been set. -func (o *AlertEventCustomAttributesLinksItems) HasTitle() bool { - return o != nil && o.Title != nil -} - -// SetTitle gets a reference to the given string and assigns it to the Title field. -func (o *AlertEventCustomAttributesLinksItems) SetTitle(v string) { - o.Title = &v -} - -// GetUrl returns the Url field value. -func (o *AlertEventCustomAttributesLinksItems) GetUrl() string { - if o == nil { - var ret string - return ret - } - return o.Url -} - -// GetUrlOk returns a tuple with the Url field value -// and a boolean to check if the value has been set. -func (o *AlertEventCustomAttributesLinksItems) GetUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Url, true -} - -// SetUrl sets field value. -func (o *AlertEventCustomAttributesLinksItems) SetUrl(v string) { - o.Url = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o AlertEventCustomAttributesLinksItems) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["category"] = o.Category - if o.Title != nil { - toSerialize["title"] = o.Title - } - toSerialize["url"] = o.Url - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *AlertEventCustomAttributesLinksItems) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Category *AlertEventCustomAttributesLinksItemsCategory `json:"category"` - Title *string `json:"title,omitempty"` - Url *string `json:"url"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Category == nil { - return fmt.Errorf("required field category missing") - } - if all.Url == nil { - return fmt.Errorf("required field url missing") - } - - hasInvalidField := false - if !all.Category.IsValid() { - hasInvalidField = true - } else { - o.Category = *all.Category - } - o.Title = all.Title - o.Url = *all.Url - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_alert_event_custom_attributes_links_items_category.go b/api/datadogV2/model_alert_event_custom_attributes_links_items_category.go deleted file mode 100644 index 7d7198fe5ac..00000000000 --- a/api/datadogV2/model_alert_event_custom_attributes_links_items_category.go +++ /dev/null @@ -1,68 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// AlertEventCustomAttributesLinksItemsCategory The category of the link. -type AlertEventCustomAttributesLinksItemsCategory string - -// List of AlertEventCustomAttributesLinksItemsCategory. -const ( - ALERTEVENTCUSTOMATTRIBUTESLINKSITEMSCATEGORY_RUNBOOK AlertEventCustomAttributesLinksItemsCategory = "runbook" - ALERTEVENTCUSTOMATTRIBUTESLINKSITEMSCATEGORY_DOCUMENTATION AlertEventCustomAttributesLinksItemsCategory = "documentation" - ALERTEVENTCUSTOMATTRIBUTESLINKSITEMSCATEGORY_DASHBOARD AlertEventCustomAttributesLinksItemsCategory = "dashboard" -) - -var allowedAlertEventCustomAttributesLinksItemsCategoryEnumValues = []AlertEventCustomAttributesLinksItemsCategory{ - ALERTEVENTCUSTOMATTRIBUTESLINKSITEMSCATEGORY_RUNBOOK, - ALERTEVENTCUSTOMATTRIBUTESLINKSITEMSCATEGORY_DOCUMENTATION, - ALERTEVENTCUSTOMATTRIBUTESLINKSITEMSCATEGORY_DASHBOARD, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AlertEventCustomAttributesLinksItemsCategory) GetAllowedValues() []AlertEventCustomAttributesLinksItemsCategory { - return allowedAlertEventCustomAttributesLinksItemsCategoryEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AlertEventCustomAttributesLinksItemsCategory) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AlertEventCustomAttributesLinksItemsCategory(value) - return nil -} - -// NewAlertEventCustomAttributesLinksItemsCategoryFromValue returns a pointer to a valid AlertEventCustomAttributesLinksItemsCategory -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAlertEventCustomAttributesLinksItemsCategoryFromValue(v string) (*AlertEventCustomAttributesLinksItemsCategory, error) { - ev := AlertEventCustomAttributesLinksItemsCategory(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AlertEventCustomAttributesLinksItemsCategory: valid values are %v", v, allowedAlertEventCustomAttributesLinksItemsCategoryEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AlertEventCustomAttributesLinksItemsCategory) IsValid() bool { - for _, existing := range allowedAlertEventCustomAttributesLinksItemsCategoryEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AlertEventCustomAttributesLinksItemsCategory value. -func (v AlertEventCustomAttributesLinksItemsCategory) Ptr() *AlertEventCustomAttributesLinksItemsCategory { - return &v -} diff --git a/api/datadogV2/model_alert_event_custom_attributes_priority.go b/api/datadogV2/model_alert_event_custom_attributes_priority.go deleted file mode 100644 index d6fae1aa0cb..00000000000 --- a/api/datadogV2/model_alert_event_custom_attributes_priority.go +++ /dev/null @@ -1,72 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// AlertEventCustomAttributesPriority The priority of the alert. -type AlertEventCustomAttributesPriority string - -// List of AlertEventCustomAttributesPriority. -const ( - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_ONE AlertEventCustomAttributesPriority = "1" - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_TWO AlertEventCustomAttributesPriority = "2" - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_THREE AlertEventCustomAttributesPriority = "3" - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_FOUR AlertEventCustomAttributesPriority = "4" - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_FIVE AlertEventCustomAttributesPriority = "5" -) - -var allowedAlertEventCustomAttributesPriorityEnumValues = []AlertEventCustomAttributesPriority{ - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_ONE, - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_TWO, - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_THREE, - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_FOUR, - ALERTEVENTCUSTOMATTRIBUTESPRIORITY_PRIORITY_FIVE, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AlertEventCustomAttributesPriority) GetAllowedValues() []AlertEventCustomAttributesPriority { - return allowedAlertEventCustomAttributesPriorityEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AlertEventCustomAttributesPriority) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AlertEventCustomAttributesPriority(value) - return nil -} - -// NewAlertEventCustomAttributesPriorityFromValue returns a pointer to a valid AlertEventCustomAttributesPriority -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAlertEventCustomAttributesPriorityFromValue(v string) (*AlertEventCustomAttributesPriority, error) { - ev := AlertEventCustomAttributesPriority(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AlertEventCustomAttributesPriority: valid values are %v", v, allowedAlertEventCustomAttributesPriorityEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AlertEventCustomAttributesPriority) IsValid() bool { - for _, existing := range allowedAlertEventCustomAttributesPriorityEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AlertEventCustomAttributesPriority value. -func (v AlertEventCustomAttributesPriority) Ptr() *AlertEventCustomAttributesPriority { - return &v -} diff --git a/api/datadogV2/model_alert_event_custom_attributes_status.go b/api/datadogV2/model_alert_event_custom_attributes_status.go deleted file mode 100644 index c391a48677f..00000000000 --- a/api/datadogV2/model_alert_event_custom_attributes_status.go +++ /dev/null @@ -1,68 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// AlertEventCustomAttributesStatus The status of the alert. -type AlertEventCustomAttributesStatus string - -// List of AlertEventCustomAttributesStatus. -const ( - ALERTEVENTCUSTOMATTRIBUTESSTATUS_WARN AlertEventCustomAttributesStatus = "warn" - ALERTEVENTCUSTOMATTRIBUTESSTATUS_ERROR AlertEventCustomAttributesStatus = "error" - ALERTEVENTCUSTOMATTRIBUTESSTATUS_OK AlertEventCustomAttributesStatus = "ok" -) - -var allowedAlertEventCustomAttributesStatusEnumValues = []AlertEventCustomAttributesStatus{ - ALERTEVENTCUSTOMATTRIBUTESSTATUS_WARN, - ALERTEVENTCUSTOMATTRIBUTESSTATUS_ERROR, - ALERTEVENTCUSTOMATTRIBUTESSTATUS_OK, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *AlertEventCustomAttributesStatus) GetAllowedValues() []AlertEventCustomAttributesStatus { - return allowedAlertEventCustomAttributesStatusEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *AlertEventCustomAttributesStatus) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = AlertEventCustomAttributesStatus(value) - return nil -} - -// NewAlertEventCustomAttributesStatusFromValue returns a pointer to a valid AlertEventCustomAttributesStatus -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewAlertEventCustomAttributesStatusFromValue(v string) (*AlertEventCustomAttributesStatus, error) { - ev := AlertEventCustomAttributesStatus(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for AlertEventCustomAttributesStatus: valid values are %v", v, allowedAlertEventCustomAttributesStatusEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v AlertEventCustomAttributesStatus) IsValid() bool { - for _, existing := range allowedAlertEventCustomAttributesStatusEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to AlertEventCustomAttributesStatus value. -func (v AlertEventCustomAttributesStatus) Ptr() *AlertEventCustomAttributesStatus { - return &v -} diff --git a/api/datadogV2/model_change_event_custom_attributes.go b/api/datadogV2/model_change_event_custom_attributes.go index 4ccd149bb43..8b79e9668cf 100644 --- a/api/datadogV2/model_change_event_custom_attributes.go +++ b/api/datadogV2/model_change_event_custom_attributes.go @@ -10,23 +10,24 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// ChangeEventCustomAttributes Change event attributes. +// ChangeEventCustomAttributes Object representing custom change event attributes. type ChangeEventCustomAttributes struct { - // The entity that made the change. Optional, if provided it must include `type` and `name`. + // Object representing the entity which made the change. Optional field but if provided should include `type` and `name`. Author *ChangeEventCustomAttributesAuthor `json:"author,omitempty"` - // 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. + // Free form object with information related to the `change` event. Can be arbitrarily nested and contain any valid JSON. ChangeMetadata map[string]interface{} `json:"change_metadata,omitempty"` - // A uniquely identified resource. + // Object representing a uniquely identified resource. ChangedResource ChangeEventCustomAttributesChangedResource `json:"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 correct location. Only resources of type `service` are supported. Maximum of 100 impacted resources allowed. + // the change event at the right location. Only resources of type `service` are supported. ImpactedResources []ChangeEventCustomAttributesImpactedResourcesItems `json:"impacted_resources,omitempty"` - // Free form JSON object representing the new state of the changed resource. + // Free form object to track new value of the changed resource. NewValue map[string]interface{} `json:"new_value,omitempty"` - // Free form JSON object representing the previous state of the changed resource. + // Free form object to track previous value of the changed resource. PrevValue map[string]interface{} `json:"prev_value,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` } // NewChangeEventCustomAttributes instantiates a new ChangeEventCustomAttributes object. @@ -232,6 +233,10 @@ func (o ChangeEventCustomAttributes) MarshalJSON() ([]byte, error) { if o.PrevValue != nil { toSerialize["prev_value"] = o.PrevValue } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } return datadog.Marshal(toSerialize) } @@ -251,6 +256,12 @@ func (o *ChangeEventCustomAttributes) UnmarshalJSON(bytes []byte) (err error) { if all.ChangedResource == nil { return fmt.Errorf("required field changed_resource missing") } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"author", "change_metadata", "changed_resource", "impacted_resources", "new_value", "prev_value"}) + } else { + return err + } hasInvalidField := false if all.Author != nil && all.Author.UnparsedObject != nil && o.UnparsedObject == nil { @@ -266,6 +277,10 @@ func (o *ChangeEventCustomAttributes) UnmarshalJSON(bytes []byte) (err error) { o.NewValue = all.NewValue o.PrevValue = all.PrevValue + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + if hasInvalidField { return datadog.Unmarshal(bytes, &o.UnparsedObject) } diff --git a/api/datadogV2/model_change_event_custom_attributes_author.go b/api/datadogV2/model_change_event_custom_attributes_author.go index c78b4cf5586..d9d235e8b4b 100644 --- a/api/datadogV2/model_change_event_custom_attributes_author.go +++ b/api/datadogV2/model_change_event_custom_attributes_author.go @@ -10,14 +10,15 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// ChangeEventCustomAttributesAuthor The entity that made the change. Optional, if provided it must include `type` and `name`. +// ChangeEventCustomAttributesAuthor Object representing the entity which made the change. Optional field but if provided should include `type` and `name`. type ChangeEventCustomAttributesAuthor struct { - // The name of the user or system that made the change. Limited to 128 characters. + // Author's name. Limited to 128 characters. Name string `json:"name"` // Author's type. Type ChangeEventCustomAttributesAuthorType `json:"type"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` } // NewChangeEventCustomAttributesAuthor instantiates a new ChangeEventCustomAttributesAuthor object. @@ -93,6 +94,10 @@ func (o ChangeEventCustomAttributesAuthor) MarshalJSON() ([]byte, error) { } toSerialize["name"] = o.Name toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } return datadog.Marshal(toSerialize) } @@ -111,6 +116,12 @@ func (o *ChangeEventCustomAttributesAuthor) UnmarshalJSON(bytes []byte) (err err if all.Type == nil { return fmt.Errorf("required field type missing") } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "type"}) + } else { + return err + } hasInvalidField := false o.Name = *all.Name @@ -120,6 +131,10 @@ func (o *ChangeEventCustomAttributesAuthor) UnmarshalJSON(bytes []byte) (err err o.Type = *all.Type } + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + if hasInvalidField { return datadog.Unmarshal(bytes, &o.UnparsedObject) } diff --git a/api/datadogV2/model_change_event_custom_attributes_changed_resource.go b/api/datadogV2/model_change_event_custom_attributes_changed_resource.go index a9333a3b498..ac6873bd2ec 100644 --- a/api/datadogV2/model_change_event_custom_attributes_changed_resource.go +++ b/api/datadogV2/model_change_event_custom_attributes_changed_resource.go @@ -10,14 +10,15 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// ChangeEventCustomAttributesChangedResource A uniquely identified resource. +// ChangeEventCustomAttributesChangedResource Object representing a uniquely identified resource. type ChangeEventCustomAttributesChangedResource struct { - // The name of the resource that was changed. Limited to 128 characters. + // Resource's name. Name string `json:"name"` - // The type of the resource that was changed. + // Resource's type. Type ChangeEventCustomAttributesChangedResourceType `json:"type"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` } // NewChangeEventCustomAttributesChangedResource instantiates a new ChangeEventCustomAttributesChangedResource object. @@ -93,6 +94,10 @@ func (o ChangeEventCustomAttributesChangedResource) MarshalJSON() ([]byte, error } toSerialize["name"] = o.Name toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } return datadog.Marshal(toSerialize) } @@ -111,6 +116,12 @@ func (o *ChangeEventCustomAttributesChangedResource) UnmarshalJSON(bytes []byte) if all.Type == nil { return fmt.Errorf("required field type missing") } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "type"}) + } else { + return err + } hasInvalidField := false o.Name = *all.Name @@ -120,6 +131,10 @@ func (o *ChangeEventCustomAttributesChangedResource) UnmarshalJSON(bytes []byte) o.Type = *all.Type } + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + if hasInvalidField { return datadog.Unmarshal(bytes, &o.UnparsedObject) } diff --git a/api/datadogV2/model_change_event_custom_attributes_changed_resource_type.go b/api/datadogV2/model_change_event_custom_attributes_changed_resource_type.go index 6ab9fa3bf0c..899c1fee4c4 100644 --- a/api/datadogV2/model_change_event_custom_attributes_changed_resource_type.go +++ b/api/datadogV2/model_change_event_custom_attributes_changed_resource_type.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// ChangeEventCustomAttributesChangedResourceType The type of the resource that was changed. +// ChangeEventCustomAttributesChangedResourceType Resource's type. type ChangeEventCustomAttributesChangedResourceType string // List of ChangeEventCustomAttributesChangedResourceType. diff --git a/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items.go b/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items.go index fdbffd6f9f1..6ce74a25468 100644 --- a/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items.go +++ b/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items.go @@ -10,14 +10,15 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// ChangeEventCustomAttributesImpactedResourcesItems Object representing a uniquely identified resource. +// ChangeEventCustomAttributesImpactedResourcesItems Object representing a uniquely identified resource. Only the resource type `service` is supported. type ChangeEventCustomAttributesImpactedResourcesItems struct { - // The name of the impacted resource. Limited to 128 characters. + // Resource's name. Name string `json:"name"` - // The type of the impacted resource. + // Resource's type. Type ChangeEventCustomAttributesImpactedResourcesItemsType `json:"type"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` } // NewChangeEventCustomAttributesImpactedResourcesItems instantiates a new ChangeEventCustomAttributesImpactedResourcesItems object. @@ -93,6 +94,10 @@ func (o ChangeEventCustomAttributesImpactedResourcesItems) MarshalJSON() ([]byte } toSerialize["name"] = o.Name toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } return datadog.Marshal(toSerialize) } @@ -111,6 +116,12 @@ func (o *ChangeEventCustomAttributesImpactedResourcesItems) UnmarshalJSON(bytes if all.Type == nil { return fmt.Errorf("required field type missing") } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "type"}) + } else { + return err + } hasInvalidField := false o.Name = *all.Name @@ -120,6 +131,10 @@ func (o *ChangeEventCustomAttributesImpactedResourcesItems) UnmarshalJSON(bytes o.Type = *all.Type } + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + if hasInvalidField { return datadog.Unmarshal(bytes, &o.UnparsedObject) } diff --git a/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items_type.go b/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items_type.go index 87cf7ea1e78..69dfc09930c 100644 --- a/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items_type.go +++ b/api/datadogV2/model_change_event_custom_attributes_impacted_resources_items_type.go @@ -10,7 +10,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// ChangeEventCustomAttributesImpactedResourcesItemsType The type of the impacted resource. +// ChangeEventCustomAttributesImpactedResourcesItemsType Resource's type. type ChangeEventCustomAttributesImpactedResourcesItemsType string // List of ChangeEventCustomAttributesImpactedResourcesItemsType. diff --git a/api/datadogV2/model_event_category.go b/api/datadogV2/model_event_category.go index ca7cf81fdde..abc1ca9adb5 100644 --- a/api/datadogV2/model_event_category.go +++ b/api/datadogV2/model_event_category.go @@ -10,18 +10,16 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventCategory Event category identifying the type of event. +// EventCategory 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. type EventCategory string // List of EventCategory. const ( EVENTCATEGORY_CHANGE EventCategory = "change" - EVENTCATEGORY_ALERT EventCategory = "alert" ) var allowedEventCategoryEnumValues = []EventCategory{ EVENTCATEGORY_CHANGE, - EVENTCATEGORY_ALERT, } // GetAllowedValues reeturns the list of possible values. diff --git a/api/datadogV2/model_event_create_request.go b/api/datadogV2/model_event_create_request.go index 49e014c8fbd..9504cec7985 100644 --- a/api/datadogV2/model_event_create_request.go +++ b/api/datadogV2/model_event_create_request.go @@ -5,17 +5,15 @@ package datadogV2 import ( - "fmt" - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventCreateRequest An event object. +// EventCreateRequest Object representing an event creation request. type EventCreateRequest struct { // Event attributes. - Attributes EventPayload `json:"attributes"` + Attributes *EventPayload `json:"attributes,omitempty"` // Entity type. - Type EventCreateRequestType `json:"type"` + Type *EventCreateRequestType `json:"type,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -25,10 +23,8 @@ type EventCreateRequest struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewEventCreateRequest(attributes EventPayload, typeVar EventCreateRequestType) *EventCreateRequest { +func NewEventCreateRequest() *EventCreateRequest { this := EventCreateRequest{} - this.Attributes = attributes - this.Type = typeVar return &this } @@ -40,50 +36,60 @@ func NewEventCreateRequestWithDefaults() *EventCreateRequest { return &this } -// GetAttributes returns the Attributes field value. +// GetAttributes returns the Attributes field value if set, zero value otherwise. func (o *EventCreateRequest) GetAttributes() EventPayload { - if o == nil { + if o == nil || o.Attributes == nil { var ret EventPayload return ret } - return o.Attributes + return *o.Attributes } -// GetAttributesOk returns a tuple with the Attributes field value +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *EventCreateRequest) GetAttributesOk() (*EventPayload, bool) { - if o == nil { + if o == nil || o.Attributes == nil { return nil, false } - return &o.Attributes, true + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *EventCreateRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil } -// SetAttributes sets field value. +// SetAttributes gets a reference to the given EventPayload and assigns it to the Attributes field. func (o *EventCreateRequest) SetAttributes(v EventPayload) { - o.Attributes = v + o.Attributes = &v } -// GetType returns the Type field value. +// GetType returns the Type field value if set, zero value otherwise. func (o *EventCreateRequest) GetType() EventCreateRequestType { - if o == nil { + if o == nil || o.Type == nil { var ret EventCreateRequestType return ret } - return o.Type + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *EventCreateRequest) GetTypeOk() (*EventCreateRequestType, bool) { - if o == nil { + if o == nil || o.Type == nil { return nil, false } - return &o.Type, true + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *EventCreateRequest) HasType() bool { + return o != nil && o.Type != nil } -// SetType sets field value. +// SetType gets a reference to the given EventCreateRequestType and assigns it to the Type field. func (o *EventCreateRequest) SetType(v EventCreateRequestType) { - o.Type = v + o.Type = &v } // MarshalJSON serializes the struct using spec logic. @@ -92,8 +98,12 @@ func (o EventCreateRequest) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -104,18 +114,12 @@ func (o EventCreateRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Attributes *EventPayload `json:"attributes"` - Type *EventCreateRequestType `json:"type"` + Attributes *EventPayload `json:"attributes,omitempty"` + Type *EventCreateRequestType `json:"type,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } - if all.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) @@ -124,14 +128,14 @@ func (o *EventCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } hasInvalidField := false - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.Attributes = *all.Attributes - if !all.Type.IsValid() { + o.Attributes = all.Attributes + if all.Type != nil && !all.Type.IsValid() { hasInvalidField = true } else { - o.Type = *all.Type + o.Type = all.Type } if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_event_create_request_payload.go b/api/datadogV2/model_event_create_request_payload.go index 11d5c45ae6a..b1616503c5b 100644 --- a/api/datadogV2/model_event_create_request_payload.go +++ b/api/datadogV2/model_event_create_request_payload.go @@ -5,15 +5,13 @@ package datadogV2 import ( - "fmt" - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) // EventCreateRequestPayload Payload for creating an event. type EventCreateRequestPayload struct { - // An event object. - Data EventCreateRequest `json:"data"` + // Object representing an event creation request. + Data *EventCreateRequest `json:"data,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -23,9 +21,8 @@ type EventCreateRequestPayload struct { // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewEventCreateRequestPayload(data EventCreateRequest) *EventCreateRequestPayload { +func NewEventCreateRequestPayload() *EventCreateRequestPayload { this := EventCreateRequestPayload{} - this.Data = data return &this } @@ -37,27 +34,32 @@ func NewEventCreateRequestPayloadWithDefaults() *EventCreateRequestPayload { return &this } -// GetData returns the Data field value. +// GetData returns the Data field value if set, zero value otherwise. func (o *EventCreateRequestPayload) GetData() EventCreateRequest { - if o == nil { + if o == nil || o.Data == nil { var ret EventCreateRequest return ret } - return o.Data + return *o.Data } -// GetDataOk returns a tuple with the Data field value +// GetDataOk returns a tuple with the Data field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *EventCreateRequestPayload) GetDataOk() (*EventCreateRequest, bool) { - if o == nil { + if o == nil || o.Data == nil { return nil, false } - return &o.Data, true + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *EventCreateRequestPayload) HasData() bool { + return o != nil && o.Data != nil } -// SetData sets field value. +// SetData gets a reference to the given EventCreateRequest and assigns it to the Data field. func (o *EventCreateRequestPayload) SetData(v EventCreateRequest) { - o.Data = v + o.Data = &v } // MarshalJSON serializes the struct using spec logic. @@ -66,7 +68,9 @@ func (o EventCreateRequestPayload) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["data"] = o.Data + if o.Data != nil { + toSerialize["data"] = o.Data + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -77,14 +81,11 @@ func (o EventCreateRequestPayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventCreateRequestPayload) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *EventCreateRequest `json:"data"` + Data *EventCreateRequest `json:"data,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } - if all.Data == nil { - return fmt.Errorf("required field data missing") - } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { datadog.DeleteKeys(additionalProperties, &[]string{"data"}) @@ -93,10 +94,10 @@ func (o *EventCreateRequestPayload) UnmarshalJSON(bytes []byte) (err error) { } hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.Data = *all.Data + o.Data = all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_event_create_response.go b/api/datadogV2/model_event_create_response.go index d9717567cac..52b979dd7ee 100644 --- a/api/datadogV2/model_event_create_response.go +++ b/api/datadogV2/model_event_create_response.go @@ -8,11 +8,11 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventCreateResponse Event object. +// EventCreateResponse Object containing an event response. type EventCreateResponse struct { - // Event attributes. + // JSON object containing all events attributes and their associated values. Attributes *EventCreateResponseAttributes `json:"attributes,omitempty"` - // Entity type. + // Event type Type *string `json:"type,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_event_create_response_attributes.go b/api/datadogV2/model_event_create_response_attributes.go index 7c67627632a..aff9c573dd7 100644 --- a/api/datadogV2/model_event_create_response_attributes.go +++ b/api/datadogV2/model_event_create_response_attributes.go @@ -8,9 +8,9 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventCreateResponseAttributes Event attributes. +// EventCreateResponseAttributes JSON object containing all events attributes and their associated values. type EventCreateResponseAttributes struct { - // JSON object for category-specific attributes. + // JSON object of attributes from your events. Attributes *EventCreateResponseAttributesAttributes `json:"attributes,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_event_create_response_attributes_attributes.go b/api/datadogV2/model_event_create_response_attributes_attributes.go index 8be21a6a066..9665fa59b23 100644 --- a/api/datadogV2/model_event_create_response_attributes_attributes.go +++ b/api/datadogV2/model_event_create_response_attributes_attributes.go @@ -8,7 +8,7 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventCreateResponseAttributesAttributes JSON object for category-specific attributes. +// EventCreateResponseAttributesAttributes JSON object of attributes from your events. type EventCreateResponseAttributesAttributes struct { // JSON object of event system attributes. Evt *EventCreateResponseAttributesAttributesEvt `json:"evt,omitempty"` diff --git a/api/datadogV2/model_event_create_response_attributes_attributes_evt.go b/api/datadogV2/model_event_create_response_attributes_attributes_evt.go index b35d3201d63..45ecd78c4cb 100644 --- a/api/datadogV2/model_event_create_response_attributes_attributes_evt.go +++ b/api/datadogV2/model_event_create_response_attributes_attributes_evt.go @@ -10,11 +10,8 @@ import ( // EventCreateResponseAttributesAttributesEvt JSON object of event system attributes. type EventCreateResponseAttributesAttributesEvt struct { - // Event identifier. This field is deprecated and will be removed in a future version. Use the `uid` field instead. - // Deprecated + // Event id Id *string `json:"id,omitempty"` - // A unique identifier for the event. You can use this identifier to query or reference the event. - Uid *string `json:"uid,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -38,7 +35,6 @@ func NewEventCreateResponseAttributesAttributesEvtWithDefaults() *EventCreateRes } // GetId returns the Id field value if set, zero value otherwise. -// Deprecated func (o *EventCreateResponseAttributesAttributesEvt) GetId() string { if o == nil || o.Id == nil { var ret string @@ -49,7 +45,6 @@ func (o *EventCreateResponseAttributesAttributesEvt) GetId() string { // GetIdOk returns a tuple with the Id field value if set, nil otherwise // and a boolean to check if the value has been set. -// Deprecated func (o *EventCreateResponseAttributesAttributesEvt) GetIdOk() (*string, bool) { if o == nil || o.Id == nil { return nil, false @@ -63,39 +58,10 @@ func (o *EventCreateResponseAttributesAttributesEvt) HasId() bool { } // SetId gets a reference to the given string and assigns it to the Id field. -// Deprecated func (o *EventCreateResponseAttributesAttributesEvt) SetId(v string) { o.Id = &v } -// GetUid returns the Uid field value if set, zero value otherwise. -func (o *EventCreateResponseAttributesAttributesEvt) GetUid() string { - if o == nil || o.Uid == nil { - var ret string - return ret - } - return *o.Uid -} - -// GetUidOk returns a tuple with the Uid field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateResponseAttributesAttributesEvt) GetUidOk() (*string, bool) { - if o == nil || o.Uid == nil { - return nil, false - } - return o.Uid, true -} - -// HasUid returns a boolean if a field has been set. -func (o *EventCreateResponseAttributesAttributesEvt) HasUid() bool { - return o != nil && o.Uid != nil -} - -// SetUid gets a reference to the given string and assigns it to the Uid field. -func (o *EventCreateResponseAttributesAttributesEvt) SetUid(v string) { - o.Uid = &v -} - // MarshalJSON serializes the struct using spec logic. func (o EventCreateResponseAttributesAttributesEvt) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -105,9 +71,6 @@ func (o EventCreateResponseAttributesAttributesEvt) MarshalJSON() ([]byte, error if o.Id != nil { toSerialize["id"] = o.Id } - if o.Uid != nil { - toSerialize["uid"] = o.Uid - } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -118,20 +81,18 @@ func (o EventCreateResponseAttributesAttributesEvt) MarshalJSON() ([]byte, error // UnmarshalJSON deserializes the given payload. func (o *EventCreateResponseAttributesAttributesEvt) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Id *string `json:"id,omitempty"` - Uid *string `json:"uid,omitempty"` + Id *string `json:"id,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"id", "uid"}) + datadog.DeleteKeys(additionalProperties, &[]string{"id"}) } else { return err } o.Id = all.Id - o.Uid = all.Uid if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_event_create_response_payload.go b/api/datadogV2/model_event_create_response_payload.go index 18dd63e0ca8..6f41f2c199a 100644 --- a/api/datadogV2/model_event_create_response_payload.go +++ b/api/datadogV2/model_event_create_response_payload.go @@ -8,12 +8,10 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventCreateResponsePayload Event creation response. +// EventCreateResponsePayload Response containing information about created event. type EventCreateResponsePayload struct { - // Event object. + // Object containing an event response. Data *EventCreateResponse `json:"data,omitempty"` - // Links to the event. - Links *EventCreateResponsePayloadLinks `json:"links,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -64,34 +62,6 @@ func (o *EventCreateResponsePayload) SetData(v EventCreateResponse) { o.Data = &v } -// GetLinks returns the Links field value if set, zero value otherwise. -func (o *EventCreateResponsePayload) GetLinks() EventCreateResponsePayloadLinks { - if o == nil || o.Links == nil { - var ret EventCreateResponsePayloadLinks - return ret - } - return *o.Links -} - -// GetLinksOk returns a tuple with the Links field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateResponsePayload) GetLinksOk() (*EventCreateResponsePayloadLinks, bool) { - if o == nil || o.Links == nil { - return nil, false - } - return o.Links, true -} - -// HasLinks returns a boolean if a field has been set. -func (o *EventCreateResponsePayload) HasLinks() bool { - return o != nil && o.Links != nil -} - -// SetLinks gets a reference to the given EventCreateResponsePayloadLinks and assigns it to the Links field. -func (o *EventCreateResponsePayload) SetLinks(v EventCreateResponsePayloadLinks) { - o.Links = &v -} - // MarshalJSON serializes the struct using spec logic. func (o EventCreateResponsePayload) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -101,9 +71,6 @@ func (o EventCreateResponsePayload) MarshalJSON() ([]byte, error) { if o.Data != nil { toSerialize["data"] = o.Data } - if o.Links != nil { - toSerialize["links"] = o.Links - } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -114,15 +81,14 @@ func (o EventCreateResponsePayload) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *EventCreateResponsePayload) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *EventCreateResponse `json:"data,omitempty"` - Links *EventCreateResponsePayloadLinks `json:"links,omitempty"` + Data *EventCreateResponse `json:"data,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data", "links"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) } else { return err } @@ -132,10 +98,6 @@ func (o *EventCreateResponsePayload) UnmarshalJSON(bytes []byte) (err error) { hasInvalidField = true } o.Data = all.Data - if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Links = all.Links if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_event_create_response_payload_links.go b/api/datadogV2/model_event_create_response_payload_links.go deleted file mode 100644 index ac0a8e4709b..00000000000 --- a/api/datadogV2/model_event_create_response_payload_links.go +++ /dev/null @@ -1,102 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// EventCreateResponsePayloadLinks Links to the event. -type EventCreateResponsePayloadLinks struct { - // The URL of the event. This link is only functional when using the default subdomain. - Self *string `json:"self,omitempty"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewEventCreateResponsePayloadLinks instantiates a new EventCreateResponsePayloadLinks object. -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewEventCreateResponsePayloadLinks() *EventCreateResponsePayloadLinks { - this := EventCreateResponsePayloadLinks{} - return &this -} - -// NewEventCreateResponsePayloadLinksWithDefaults instantiates a new EventCreateResponsePayloadLinks object. -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set. -func NewEventCreateResponsePayloadLinksWithDefaults() *EventCreateResponsePayloadLinks { - this := EventCreateResponsePayloadLinks{} - return &this -} - -// GetSelf returns the Self field value if set, zero value otherwise. -func (o *EventCreateResponsePayloadLinks) GetSelf() string { - if o == nil || o.Self == nil { - var ret string - return ret - } - return *o.Self -} - -// GetSelfOk returns a tuple with the Self field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventCreateResponsePayloadLinks) GetSelfOk() (*string, bool) { - if o == nil || o.Self == nil { - return nil, false - } - return o.Self, true -} - -// HasSelf returns a boolean if a field has been set. -func (o *EventCreateResponsePayloadLinks) HasSelf() bool { - return o != nil && o.Self != nil -} - -// SetSelf gets a reference to the given string and assigns it to the Self field. -func (o *EventCreateResponsePayloadLinks) SetSelf(v string) { - o.Self = &v -} - -// MarshalJSON serializes the struct using spec logic. -func (o EventCreateResponsePayloadLinks) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Self != nil { - toSerialize["self"] = o.Self - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *EventCreateResponsePayloadLinks) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Self *string `json:"self,omitempty"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"self"}) - } else { - return err - } - o.Self = all.Self - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV2/model_event_payload.go b/api/datadogV2/model_event_payload.go index d6634a8c6b3..8d10d414110 100644 --- a/api/datadogV2/model_event_payload.go +++ b/api/datadogV2/model_event_payload.go @@ -12,27 +12,26 @@ import ( // EventPayload Event attributes. type EventPayload struct { - // 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. + // An arbitrary string to use for aggregation when correlating events. Limited to 100 characters. AggregationKey *string `json:"aggregation_key,omitempty"` - // JSON object for category-specific attributes. Schema is different per event category. + // JSON object for custom attributes. Schema are different per each event category. Attributes EventPayloadAttributes `json:"attributes"` - // Event category identifying the type of event. + // 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. Category EventCategory `json:"category"` - // Integration ID sourced from integration manifests. - IntegrationId *EventPayloadIntegrationId `json:"integration_id,omitempty"` - // Free formed text associated with the event. It's suggested to use `data.attributes.attributes.custom` for well-structured attributes. Limited to 4000 characters. + // The body of the event. Limited to 4000 characters. Message *string `json:"message,omitempty"` - // A list of tags associated with the event. Maximum of 100 tags allowed. + // A list of tags to apply to the event. // Refer to [Tags docs](https://docs.datadoghq.com/getting_started/tagging/). Tags []string `json:"tags,omitempty"` // 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. Timestamp *string `json:"timestamp,omitempty"` - // The title of the event. Limited to 500 characters. + // The event title. Limited to 500 characters. Title string `json:"title"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` } // NewEventPayload instantiates a new EventPayload object. @@ -129,34 +128,6 @@ func (o *EventPayload) SetCategory(v EventCategory) { o.Category = v } -// GetIntegrationId returns the IntegrationId field value if set, zero value otherwise. -func (o *EventPayload) GetIntegrationId() EventPayloadIntegrationId { - if o == nil || o.IntegrationId == nil { - var ret EventPayloadIntegrationId - return ret - } - return *o.IntegrationId -} - -// GetIntegrationIdOk returns a tuple with the IntegrationId field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *EventPayload) GetIntegrationIdOk() (*EventPayloadIntegrationId, bool) { - if o == nil || o.IntegrationId == nil { - return nil, false - } - return o.IntegrationId, true -} - -// HasIntegrationId returns a boolean if a field has been set. -func (o *EventPayload) HasIntegrationId() bool { - return o != nil && o.IntegrationId != nil -} - -// SetIntegrationId gets a reference to the given EventPayloadIntegrationId and assigns it to the IntegrationId field. -func (o *EventPayload) SetIntegrationId(v EventPayloadIntegrationId) { - o.IntegrationId = &v -} - // GetMessage returns the Message field value if set, zero value otherwise. func (o *EventPayload) GetMessage() string { if o == nil || o.Message == nil { @@ -275,9 +246,6 @@ func (o EventPayload) MarshalJSON() ([]byte, error) { } toSerialize["attributes"] = o.Attributes toSerialize["category"] = o.Category - if o.IntegrationId != nil { - toSerialize["integration_id"] = o.IntegrationId - } if o.Message != nil { toSerialize["message"] = o.Message } @@ -288,20 +256,23 @@ func (o EventPayload) MarshalJSON() ([]byte, error) { toSerialize["timestamp"] = o.Timestamp } toSerialize["title"] = o.Title + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } return datadog.Marshal(toSerialize) } // UnmarshalJSON deserializes the given payload. func (o *EventPayload) UnmarshalJSON(bytes []byte) (err error) { all := struct { - AggregationKey *string `json:"aggregation_key,omitempty"` - Attributes *EventPayloadAttributes `json:"attributes"` - Category *EventCategory `json:"category"` - IntegrationId *EventPayloadIntegrationId `json:"integration_id,omitempty"` - Message *string `json:"message,omitempty"` - Tags []string `json:"tags,omitempty"` - Timestamp *string `json:"timestamp,omitempty"` - Title *string `json:"title"` + AggregationKey *string `json:"aggregation_key,omitempty"` + Attributes *EventPayloadAttributes `json:"attributes"` + Category *EventCategory `json:"category"` + Message *string `json:"message,omitempty"` + Tags []string `json:"tags,omitempty"` + Timestamp *string `json:"timestamp,omitempty"` + Title *string `json:"title"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -315,6 +286,12 @@ func (o *EventPayload) UnmarshalJSON(bytes []byte) (err error) { if all.Title == nil { return fmt.Errorf("required field title missing") } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"aggregation_key", "attributes", "category", "message", "tags", "timestamp", "title"}) + } else { + return err + } hasInvalidField := false o.AggregationKey = all.AggregationKey @@ -324,16 +301,15 @@ func (o *EventPayload) UnmarshalJSON(bytes []byte) (err error) { } else { o.Category = *all.Category } - if all.IntegrationId != nil && !all.IntegrationId.IsValid() { - hasInvalidField = true - } else { - o.IntegrationId = all.IntegrationId - } o.Message = all.Message o.Tags = all.Tags o.Timestamp = all.Timestamp o.Title = *all.Title + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + if hasInvalidField { return datadog.Unmarshal(bytes, &o.UnparsedObject) } diff --git a/api/datadogV2/model_event_payload_attributes.go b/api/datadogV2/model_event_payload_attributes.go index 203f87eafac..e6b8b0a28e8 100644 --- a/api/datadogV2/model_event_payload_attributes.go +++ b/api/datadogV2/model_event_payload_attributes.go @@ -8,10 +8,9 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// EventPayloadAttributes - JSON object for category-specific attributes. Schema is different per event category. +// EventPayloadAttributes - JSON object for custom attributes. Schema are different per each event category. type EventPayloadAttributes struct { ChangeEventCustomAttributes *ChangeEventCustomAttributes - AlertEventCustomAttributes *AlertEventCustomAttributes // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -22,11 +21,6 @@ func ChangeEventCustomAttributesAsEventPayloadAttributes(v *ChangeEventCustomAtt return EventPayloadAttributes{ChangeEventCustomAttributes: v} } -// AlertEventCustomAttributesAsEventPayloadAttributes is a convenience function that returns AlertEventCustomAttributes wrapped in EventPayloadAttributes. -func AlertEventCustomAttributesAsEventPayloadAttributes(v *AlertEventCustomAttributes) EventPayloadAttributes { - return EventPayloadAttributes{AlertEventCustomAttributes: v} -} - // UnmarshalJSON turns data into one of the pointers in the struct. func (obj *EventPayloadAttributes) UnmarshalJSON(data []byte) error { var err error @@ -48,27 +42,9 @@ func (obj *EventPayloadAttributes) UnmarshalJSON(data []byte) error { obj.ChangeEventCustomAttributes = nil } - // try to unmarshal data into AlertEventCustomAttributes - err = datadog.Unmarshal(data, &obj.AlertEventCustomAttributes) - if err == nil { - if obj.AlertEventCustomAttributes != nil && obj.AlertEventCustomAttributes.UnparsedObject == nil { - jsonAlertEventCustomAttributes, _ := datadog.Marshal(obj.AlertEventCustomAttributes) - if string(jsonAlertEventCustomAttributes) == "{}" { // empty struct - obj.AlertEventCustomAttributes = nil - } else { - match++ - } - } else { - obj.AlertEventCustomAttributes = nil - } - } else { - obj.AlertEventCustomAttributes = nil - } - if match != 1 { // more than 1 match // reset to nil obj.ChangeEventCustomAttributes = nil - obj.AlertEventCustomAttributes = nil return datadog.Unmarshal(data, &obj.UnparsedObject) } return nil // exactly one match @@ -80,10 +56,6 @@ func (obj EventPayloadAttributes) MarshalJSON() ([]byte, error) { return datadog.Marshal(&obj.ChangeEventCustomAttributes) } - if obj.AlertEventCustomAttributes != nil { - return datadog.Marshal(&obj.AlertEventCustomAttributes) - } - if obj.UnparsedObject != nil { return datadog.Marshal(obj.UnparsedObject) } @@ -96,10 +68,6 @@ func (obj *EventPayloadAttributes) GetActualInstance() interface{} { return obj.ChangeEventCustomAttributes } - if obj.AlertEventCustomAttributes != nil { - return obj.AlertEventCustomAttributes - } - // all schemas are nil return nil } diff --git a/api/datadogV2/model_event_payload_integration_id.go b/api/datadogV2/model_event_payload_integration_id.go deleted file mode 100644 index 6479028984b..00000000000 --- a/api/datadogV2/model_event_payload_integration_id.go +++ /dev/null @@ -1,64 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. - -package datadogV2 - -import ( - "fmt" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" -) - -// EventPayloadIntegrationId Integration ID sourced from integration manifests. -type EventPayloadIntegrationId string - -// List of EventPayloadIntegrationId. -const ( - EVENTPAYLOADINTEGRATIONID_CUSTOM_EVENTS EventPayloadIntegrationId = "custom-events" -) - -var allowedEventPayloadIntegrationIdEnumValues = []EventPayloadIntegrationId{ - EVENTPAYLOADINTEGRATIONID_CUSTOM_EVENTS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *EventPayloadIntegrationId) GetAllowedValues() []EventPayloadIntegrationId { - return allowedEventPayloadIntegrationIdEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *EventPayloadIntegrationId) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = EventPayloadIntegrationId(value) - return nil -} - -// NewEventPayloadIntegrationIdFromValue returns a pointer to a valid EventPayloadIntegrationId -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewEventPayloadIntegrationIdFromValue(v string) (*EventPayloadIntegrationId, error) { - ev := EventPayloadIntegrationId(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for EventPayloadIntegrationId: valid values are %v", v, allowedEventPayloadIntegrationIdEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v EventPayloadIntegrationId) IsValid() bool { - for _, existing := range allowedEventPayloadIntegrationIdEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to EventPayloadIntegrationId value. -func (v EventPayloadIntegrationId) Ptr() *EventPayloadIntegrationId { - return &v -} diff --git a/examples/v2/events/CreateEvent.go b/examples/v2/events/CreateEvent.go index 769225715da..75785df172c 100644 --- a/examples/v2/events/CreateEvent.go +++ b/examples/v2/events/CreateEvent.go @@ -14,13 +14,12 @@ import ( func main() { body := datadogV2.EventCreateRequestPayload{ - Data: datadogV2.EventCreateRequest{ - Attributes: datadogV2.EventPayload{ - AggregationKey: datadog.PtrString("aggregation_key_123"), + Data: &datadogV2.EventCreateRequest{ + Attributes: &datadogV2.EventPayload{ Attributes: datadogV2.EventPayloadAttributes{ ChangeEventCustomAttributes: &datadogV2.ChangeEventCustomAttributes{ Author: &datadogV2.ChangeEventCustomAttributesAuthor{ - Name: "example@datadog.com", + Name: "datadog@datadog.com", Type: datadogV2.CHANGEEVENTCUSTOMATTRIBUTESAUTHORTYPE_USER, }, ChangeMetadata: map[string]interface{}{ @@ -48,15 +47,14 @@ func main() { "rule": "{'datacenter': 'devcycle.us1.prod'}", }, }}, - Category: datadogV2.EVENTCATEGORY_CHANGE, - IntegrationId: datadogV2.EVENTPAYLOADINTEGRATIONID_CUSTOM_EVENTS.Ptr(), - Message: datadog.PtrString("payment_processed feature flag has been enabled"), + Category: datadogV2.EVENTCATEGORY_CHANGE, + Message: datadog.PtrString("payment_processed feature flag has been enabled"), Tags: []string{ - "env:api_client_test", + "env:test", }, Title: "payment_processed feature flag updated", }, - Type: datadogV2.EVENTCREATEREQUESTTYPE_EVENT, + Type: datadogV2.EVENTCREATEREQUESTTYPE_EVENT.Ptr(), }, } ctx := datadog.NewDefaultContext(context.Background()) diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_Bad_request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_Bad_request_response.freeze deleted file mode 100644 index a1cd4e8e4ac..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_Bad_request_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2025-06-10T15:38:58.529Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_Bad_request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_Bad_request_response.yaml deleted file mode 100644 index 4cabd4af0a1..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_Bad_request_response.yaml +++ /dev/null @@ -1,23 +0,0 @@ -interactions: -- request: - body: | - {"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"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://event-management-intake.datadoghq.com/api/v2/events - response: - body: '{"errors":[{"status":"400","title":"Bad Request","detail":"JSON validation - failed at $.data.attributes.category: value must be one of: [\"alert\", \"change\"]."}]}' - code: 400 - duration: 0ms - headers: - Content-Type: - - application/json - status: 400 Bad Request -version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_OK_response.freeze deleted file mode 100644 index 42309286e25..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_OK_response.freeze +++ /dev/null @@ -1 +0,0 @@ -2025-06-10T15:38:58.954Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_OK_response.yaml deleted file mode 100644 index b3844e6493d..00000000000 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Events/Scenario_Post_an_event_returns_OK_response.yaml +++ /dev/null @@ -1,22 +0,0 @@ -interactions: -- request: - body: | - {"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"}} - form: {} - headers: - Accept: - - application/json - Content-Type: - - application/json - id: 0 - method: POST - url: https://event-management-intake.datadoghq.com/api/v2/events - response: - body: '{"data":{"attributes":{"attributes":{"evt":{"uid":"AZdafqaTAACKG_iMQ82pmAAA"}}},"id":"_","type":"event"},"links":{"self":"https://app.datadoghq.com/event/event?uid=AZdafqaTAACKG_iMQ82pmAAA"}}' - code: 202 - duration: 0ms - headers: - Content-Type: - - application/json - status: 202 Accepted -version: 2 diff --git a/tests/scenarios/features/v2/events.feature b/tests/scenarios/features/v2/events.feature index 0a69d195201..a8c1307ac68 100644 --- a/tests/scenarios/features/v2/events.feature +++ b/tests/scenarios/features/v2/events.feature @@ -50,21 +50,19 @@ Feature: Events Then the response status is 200 OK And the response "data" has length 0 - @team:DataDog/event-management + @generated @skip @team:DataDog/event-management Scenario: Post an event returns "Bad request" response Given new "CreateEvent" request - 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"}} + 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"}} When the request is sent Then the response status is 400 Bad request - @skip-validation @team:DataDog/event-management + @generated @skip @team:DataDog/event-management Scenario: Post an event returns "OK" response Given new "CreateEvent" request - 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"}} + 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"}} When the request is sent - 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" + Then the response status is 200 OK @team:DataDog/event-management Scenario: Search events returns "Bad Request" response diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 3cc857a7365..e81cb7b7ce1 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -934,7 +934,7 @@ "CreateEvent": { "tag": "Events", "undo": { - "type": "safe" + "type": "unsafe" } }, "SearchEvents": {