From cca753920c030ac22dc2613444b6a56ba1bcb7b1 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 19 Feb 2026 16:13:58 +0000 Subject: [PATCH] Regenerate client from commit 0d5ba16 of spec repo --- .generator/schemas/v2/openapi.yaml | 40 ++++ api/datadogV2/model_incident_condition.go | 101 ++++++++++ .../model_incident_schedule_trigger.go | 180 ++++++++++++++++++ ...model_incident_schedule_trigger_wrapper.go | 145 ++++++++++++++ api/datadogV2/model_trigger.go | 32 ++++ 5 files changed, 498 insertions(+) create mode 100644 api/datadogV2/model_incident_condition.go create mode 100644 api/datadogV2/model_incident_schedule_trigger.go create mode 100644 api/datadogV2/model_incident_schedule_trigger_wrapper.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a484bec1a76..b380cb71468 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -28684,6 +28684,19 @@ components: type: string x-enum-varnames: - INCIDENT_ATTACHMENTS + IncidentCondition: + description: A condition evaluated against incident tags. + properties: + tags: + description: Tags that must match for the condition to pass. + example: + - '' + items: + type: string + type: array + required: + - tags + type: object IncidentCreateAttributes: description: The incident's attributes for a create request. properties: @@ -30203,6 +30216,32 @@ components: user_defined_fields: $ref: '#/components/schemas/RelationshipToIncidentUserDefinedFields' type: object + IncidentScheduleTrigger: + description: Trigger a workflow from an Incident Schedule. The workflow must + be published. + properties: + incidentType: + description: Incident type filter for the schedule. + type: string + rrule: + description: Recurrence rule expression for scheduling. + example: '' + type: string + tagCondition: + $ref: '#/components/schemas/IncidentCondition' + required: + - rrule + type: object + IncidentScheduleTriggerWrapper: + description: Schema for an Incident Schedule-based trigger. + properties: + incidentScheduleTrigger: + $ref: '#/components/schemas/IncidentScheduleTrigger' + startStepNames: + $ref: '#/components/schemas/StartStepNames' + required: + - incidentScheduleTrigger + type: object IncidentSearchResponse: description: Response with incidents and facets. properties: @@ -65465,6 +65504,7 @@ components: - $ref: '#/components/schemas/DashboardTriggerWrapper' - $ref: '#/components/schemas/GithubWebhookTriggerWrapper' - $ref: '#/components/schemas/IncidentTriggerWrapper' + - $ref: '#/components/schemas/IncidentScheduleTriggerWrapper' - $ref: '#/components/schemas/MonitorTriggerWrapper' - $ref: '#/components/schemas/NotebookTriggerWrapper' - $ref: '#/components/schemas/OnCallTriggerWrapper' diff --git a/api/datadogV2/model_incident_condition.go b/api/datadogV2/model_incident_condition.go new file mode 100644 index 00000000000..83cedd30261 --- /dev/null +++ b/api/datadogV2/model_incident_condition.go @@ -0,0 +1,101 @@ +// 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" +) + +// IncidentCondition A condition evaluated against incident tags. +type IncidentCondition struct { + // Tags that must match for the condition to pass. + Tags []string `json:"tags"` + // 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:"-"` +} + +// NewIncidentCondition instantiates a new IncidentCondition 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 NewIncidentCondition(tags []string) *IncidentCondition { + this := IncidentCondition{} + this.Tags = tags + return &this +} + +// NewIncidentConditionWithDefaults instantiates a new IncidentCondition 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 NewIncidentConditionWithDefaults() *IncidentCondition { + this := IncidentCondition{} + return &this +} + +// GetTags returns the Tags field value. +func (o *IncidentCondition) GetTags() []string { + if o == nil { + var ret []string + return ret + } + return o.Tags +} + +// GetTagsOk returns a tuple with the Tags field value +// and a boolean to check if the value has been set. +func (o *IncidentCondition) GetTagsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Tags, true +} + +// SetTags sets field value. +func (o *IncidentCondition) SetTags(v []string) { + o.Tags = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["tags"] = o.Tags + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCondition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Tags *[]string `json:"tags"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Tags == nil { + return fmt.Errorf("required field tags missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"tags"}) + } else { + return err + } + o.Tags = *all.Tags + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_schedule_trigger.go b/api/datadogV2/model_incident_schedule_trigger.go new file mode 100644 index 00000000000..e0500eda325 --- /dev/null +++ b/api/datadogV2/model_incident_schedule_trigger.go @@ -0,0 +1,180 @@ +// 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" +) + +// IncidentScheduleTrigger Trigger a workflow from an Incident Schedule. The workflow must be published. +type IncidentScheduleTrigger struct { + // Incident type filter for the schedule. + IncidentType *string `json:"incidentType,omitempty"` + // Recurrence rule expression for scheduling. + Rrule string `json:"rrule"` + // A condition evaluated against incident tags. + TagCondition *IncidentCondition `json:"tagCondition,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:"-"` +} + +// NewIncidentScheduleTrigger instantiates a new IncidentScheduleTrigger 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 NewIncidentScheduleTrigger(rrule string) *IncidentScheduleTrigger { + this := IncidentScheduleTrigger{} + this.Rrule = rrule + return &this +} + +// NewIncidentScheduleTriggerWithDefaults instantiates a new IncidentScheduleTrigger 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 NewIncidentScheduleTriggerWithDefaults() *IncidentScheduleTrigger { + this := IncidentScheduleTrigger{} + return &this +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentScheduleTrigger) GetIncidentType() string { + if o == nil || o.IncidentType == nil { + var ret string + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentScheduleTrigger) GetIncidentTypeOk() (*string, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IncidentScheduleTrigger) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given string and assigns it to the IncidentType field. +func (o *IncidentScheduleTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetRrule returns the Rrule field value. +func (o *IncidentScheduleTrigger) GetRrule() string { + if o == nil { + var ret string + return ret + } + return o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value +// and a boolean to check if the value has been set. +func (o *IncidentScheduleTrigger) GetRruleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Rrule, true +} + +// SetRrule sets field value. +func (o *IncidentScheduleTrigger) SetRrule(v string) { + o.Rrule = v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentScheduleTrigger) GetTagCondition() IncidentCondition { + if o == nil || o.TagCondition == nil { + var ret IncidentCondition + return ret + } + return *o.TagCondition +} + +// GetTagConditionOk returns a tuple with the TagCondition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentScheduleTrigger) GetTagConditionOk() (*IncidentCondition, bool) { + if o == nil || o.TagCondition == nil { + return nil, false + } + return o.TagCondition, true +} + +// HasTagCondition returns a boolean if a field has been set. +func (o *IncidentScheduleTrigger) HasTagCondition() bool { + return o != nil && o.TagCondition != nil +} + +// SetTagCondition gets a reference to the given IncidentCondition and assigns it to the TagCondition field. +func (o *IncidentScheduleTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentScheduleTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + toSerialize["rrule"] = o.Rrule + if o.TagCondition != nil { + toSerialize["tagCondition"] = o.TagCondition + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentScheduleTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *string `json:"incidentType,omitempty"` + Rrule *string `json:"rrule"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Rrule == nil { + return fmt.Errorf("required field rrule missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentType", "rrule", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + o.IncidentType = all.IncidentType + o.Rrule = *all.Rrule + if all.TagCondition != nil && all.TagCondition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.TagCondition = all.TagCondition + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_schedule_trigger_wrapper.go b/api/datadogV2/model_incident_schedule_trigger_wrapper.go new file mode 100644 index 00000000000..12cc90b0366 --- /dev/null +++ b/api/datadogV2/model_incident_schedule_trigger_wrapper.go @@ -0,0 +1,145 @@ +// 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" +) + +// IncidentScheduleTriggerWrapper Schema for an Incident Schedule-based trigger. +type IncidentScheduleTriggerWrapper struct { + // Trigger a workflow from an Incident Schedule. The workflow must be published. + IncidentScheduleTrigger IncidentScheduleTrigger `json:"incidentScheduleTrigger"` + // A list of steps that run first after a trigger fires. + StartStepNames []string `json:"startStepNames,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:"-"` +} + +// NewIncidentScheduleTriggerWrapper instantiates a new IncidentScheduleTriggerWrapper 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 NewIncidentScheduleTriggerWrapper(incidentScheduleTrigger IncidentScheduleTrigger) *IncidentScheduleTriggerWrapper { + this := IncidentScheduleTriggerWrapper{} + this.IncidentScheduleTrigger = incidentScheduleTrigger + return &this +} + +// NewIncidentScheduleTriggerWrapperWithDefaults instantiates a new IncidentScheduleTriggerWrapper 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 NewIncidentScheduleTriggerWrapperWithDefaults() *IncidentScheduleTriggerWrapper { + this := IncidentScheduleTriggerWrapper{} + return &this +} + +// GetIncidentScheduleTrigger returns the IncidentScheduleTrigger field value. +func (o *IncidentScheduleTriggerWrapper) GetIncidentScheduleTrigger() IncidentScheduleTrigger { + if o == nil { + var ret IncidentScheduleTrigger + return ret + } + return o.IncidentScheduleTrigger +} + +// GetIncidentScheduleTriggerOk returns a tuple with the IncidentScheduleTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentScheduleTriggerWrapper) GetIncidentScheduleTriggerOk() (*IncidentScheduleTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentScheduleTrigger, true +} + +// SetIncidentScheduleTrigger sets field value. +func (o *IncidentScheduleTriggerWrapper) SetIncidentScheduleTrigger(v IncidentScheduleTrigger) { + o.IncidentScheduleTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentScheduleTriggerWrapper) GetStartStepNames() []string { + if o == nil || o.StartStepNames == nil { + var ret []string + return ret + } + return o.StartStepNames +} + +// GetStartStepNamesOk returns a tuple with the StartStepNames field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentScheduleTriggerWrapper) GetStartStepNamesOk() (*[]string, bool) { + if o == nil || o.StartStepNames == nil { + return nil, false + } + return &o.StartStepNames, true +} + +// HasStartStepNames returns a boolean if a field has been set. +func (o *IncidentScheduleTriggerWrapper) HasStartStepNames() bool { + return o != nil && o.StartStepNames != nil +} + +// SetStartStepNames gets a reference to the given []string and assigns it to the StartStepNames field. +func (o *IncidentScheduleTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentScheduleTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentScheduleTrigger"] = o.IncidentScheduleTrigger + if o.StartStepNames != nil { + toSerialize["startStepNames"] = o.StartStepNames + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentScheduleTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentScheduleTrigger *IncidentScheduleTrigger `json:"incidentScheduleTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentScheduleTrigger == nil { + return fmt.Errorf("required field incidentScheduleTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentScheduleTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentScheduleTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentScheduleTrigger = *all.IncidentScheduleTrigger + o.StartStepNames = all.StartStepNames + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_trigger.go b/api/datadogV2/model_trigger.go index 7663da4a95a..61ff2200dc6 100644 --- a/api/datadogV2/model_trigger.go +++ b/api/datadogV2/model_trigger.go @@ -19,6 +19,7 @@ type Trigger struct { DashboardTriggerWrapper *DashboardTriggerWrapper GithubWebhookTriggerWrapper *GithubWebhookTriggerWrapper IncidentTriggerWrapper *IncidentTriggerWrapper + IncidentScheduleTriggerWrapper *IncidentScheduleTriggerWrapper MonitorTriggerWrapper *MonitorTriggerWrapper NotebookTriggerWrapper *NotebookTriggerWrapper OnCallTriggerWrapper *OnCallTriggerWrapper @@ -78,6 +79,11 @@ func IncidentTriggerWrapperAsTrigger(v *IncidentTriggerWrapper) Trigger { return Trigger{IncidentTriggerWrapper: v} } +// IncidentScheduleTriggerWrapperAsTrigger is a convenience function that returns IncidentScheduleTriggerWrapper wrapped in Trigger. +func IncidentScheduleTriggerWrapperAsTrigger(v *IncidentScheduleTriggerWrapper) Trigger { + return Trigger{IncidentScheduleTriggerWrapper: v} +} + // MonitorTriggerWrapperAsTrigger is a convenience function that returns MonitorTriggerWrapper wrapped in Trigger. func MonitorTriggerWrapperAsTrigger(v *MonitorTriggerWrapper) Trigger { return Trigger{MonitorTriggerWrapper: v} @@ -280,6 +286,23 @@ func (obj *Trigger) UnmarshalJSON(data []byte) error { obj.IncidentTriggerWrapper = nil } + // try to unmarshal data into IncidentScheduleTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentScheduleTriggerWrapper) + if err == nil { + if obj.IncidentScheduleTriggerWrapper != nil && obj.IncidentScheduleTriggerWrapper.UnparsedObject == nil { + jsonIncidentScheduleTriggerWrapper, _ := datadog.Marshal(obj.IncidentScheduleTriggerWrapper) + if string(jsonIncidentScheduleTriggerWrapper) == "{}" { // empty struct + obj.IncidentScheduleTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentScheduleTriggerWrapper = nil + } + } else { + obj.IncidentScheduleTriggerWrapper = nil + } + // try to unmarshal data into MonitorTriggerWrapper err = datadog.Unmarshal(data, &obj.MonitorTriggerWrapper) if err == nil { @@ -444,6 +467,7 @@ func (obj *Trigger) UnmarshalJSON(data []byte) error { obj.DashboardTriggerWrapper = nil obj.GithubWebhookTriggerWrapper = nil obj.IncidentTriggerWrapper = nil + obj.IncidentScheduleTriggerWrapper = nil obj.MonitorTriggerWrapper = nil obj.NotebookTriggerWrapper = nil obj.OnCallTriggerWrapper = nil @@ -496,6 +520,10 @@ func (obj Trigger) MarshalJSON() ([]byte, error) { return datadog.Marshal(&obj.IncidentTriggerWrapper) } + if obj.IncidentScheduleTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentScheduleTriggerWrapper) + } + if obj.MonitorTriggerWrapper != nil { return datadog.Marshal(&obj.MonitorTriggerWrapper) } @@ -576,6 +604,10 @@ func (obj *Trigger) GetActualInstance() interface{} { return obj.IncidentTriggerWrapper } + if obj.IncidentScheduleTriggerWrapper != nil { + return obj.IncidentScheduleTriggerWrapper + } + if obj.MonitorTriggerWrapper != nil { return obj.MonitorTriggerWrapper }