From 877ad9447a6bc29caf19dc2cd21fe9b6301cd018 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Sun, 30 Aug 2026 21:44:50 +0000 Subject: [PATCH] Regenerate client from commit f5ef2e8 of spec repo --- .generator/schemas/v2/openapi.yaml | 246 +++++++++++++++- api/datadogV2/model_execution_limit.go | 101 +++++++ api/datadogV2/model_incident_condition.go | 102 +++++++ .../model_incident_created_trigger.go | 146 ++++++++++ .../model_incident_created_trigger_wrapper.go | 145 ++++++++++ .../model_incident_impact_created_trigger.go | 184 ++++++++++++ ...incident_impact_created_trigger_wrapper.go | 145 ++++++++++ .../model_incident_impact_updated_trigger.go | 184 ++++++++++++ ...incident_impact_updated_trigger_wrapper.go | 145 ++++++++++ ...del_incident_postmortem_updated_trigger.go | 184 ++++++++++++ ...dent_postmortem_updated_trigger_wrapper.go | 145 ++++++++++ ...odel_incident_responder_created_trigger.go | 184 ++++++++++++ ...ident_responder_created_trigger_wrapper.go | 145 ++++++++++ api/datadogV2/model_incident_saved_trigger.go | 222 +++++++++++++++ .../model_incident_saved_trigger_wrapper.go | 145 ++++++++++ .../model_incident_schedule_trigger.go | 180 ++++++++++++ ...model_incident_schedule_trigger_wrapper.go | 145 ++++++++++ api/datadogV2/model_incident_tag_value.go | 133 +++++++++ api/datadogV2/model_incident_trigger.go | 39 ++- .../model_incident_trigger_wrapper.go | 4 +- api/datadogV2/model_serial_execution.go | 101 +++++++ api/datadogV2/model_slack_reaction_config.go | 133 +++++++++ api/datadogV2/model_slack_trigger.go | 102 +++++++ api/datadogV2/model_slack_trigger_wrapper.go | 25 +- api/datadogV2/model_trigger.go | 264 ++++++++++++++++-- 25 files changed, 3513 insertions(+), 36 deletions(-) create mode 100644 api/datadogV2/model_execution_limit.go create mode 100644 api/datadogV2/model_incident_condition.go create mode 100644 api/datadogV2/model_incident_created_trigger.go create mode 100644 api/datadogV2/model_incident_created_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_impact_created_trigger.go create mode 100644 api/datadogV2/model_incident_impact_created_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_impact_updated_trigger.go create mode 100644 api/datadogV2/model_incident_impact_updated_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_postmortem_updated_trigger.go create mode 100644 api/datadogV2/model_incident_postmortem_updated_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_responder_created_trigger.go create mode 100644 api/datadogV2/model_incident_responder_created_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_saved_trigger.go create mode 100644 api/datadogV2/model_incident_saved_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_schedule_trigger.go create mode 100644 api/datadogV2/model_incident_schedule_trigger_wrapper.go create mode 100644 api/datadogV2/model_incident_tag_value.go create mode 100644 api/datadogV2/model_serial_execution.go create mode 100644 api/datadogV2/model_slack_reaction_config.go create mode 100644 api/datadogV2/model_slack_trigger.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b6a3ce30c87..5fe94fe87a3 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -38188,6 +38188,19 @@ components: example: "One or several indexes are missing or invalid. Results hold data from the other indexes." type: string type: object + ExecutionLimit: + description: "The maximum number of times to execute a workflow for an incident." + properties: + count: + description: "The maximum number of workflow executions." + example: 1 + format: int32 + maximum: 9999 + minimum: 1 + type: integer + required: + - count + type: object ExecutionPolicyActionPattern: description: The set of actions this policy applies to. properties: @@ -47979,6 +47992,15 @@ components: type: string x-enum-varnames: - INCIDENT_ATTACHMENTS + IncidentCondition: + description: "Conditions that determine which incidents trigger the workflow." + properties: + tagValues: + description: "Incident tags and values used to filter matching incidents." + items: + $ref: "#/components/schemas/IncidentTagValue" + type: array + type: object IncidentConfigurationDataAttributesRequest: description: Attributes for creating an incident configuration. properties: @@ -48332,6 +48354,25 @@ components: required: - data type: object + IncidentCreatedTrigger: + description: "Trigger a workflow when an incident is declared." + properties: + incidentType: + description: "The type of incident that triggers the workflow." + type: string + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + type: object + IncidentCreatedTriggerWrapper: + description: "Schema for an incident declared trigger." + properties: + incidentCreatedTrigger: + $ref: "#/components/schemas/IncidentCreatedTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentCreatedTrigger + type: object IncidentFieldAttributes: description: Dynamic fields for which selections can be made, with field names as keys. oneOf: @@ -49011,6 +49052,27 @@ components: required: - data type: object + IncidentImpactCreatedTrigger: + description: "Trigger a workflow when an impact is created for an incident." + properties: + executionLimit: + $ref: "#/components/schemas/ExecutionLimit" + incidentType: + description: "The type of incident that triggers the workflow." + type: string + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + type: object + IncidentImpactCreatedTriggerWrapper: + description: "Schema for an incident impact created trigger." + properties: + incidentImpactCreatedTrigger: + $ref: "#/components/schemas/IncidentImpactCreatedTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentImpactCreatedTrigger + type: object IncidentImpactFieldChoice: description: A choice option for a dropdown or multiselect impact field. properties: @@ -49309,6 +49371,27 @@ components: type: string x-enum-varnames: - INCIDENT_IMPACTS + IncidentImpactUpdatedTrigger: + description: "Trigger a workflow when an impact is updated for an incident." + properties: + executionLimit: + $ref: "#/components/schemas/ExecutionLimit" + incidentType: + description: "The type of incident that triggers the workflow." + type: string + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + type: object + IncidentImpactUpdatedTriggerWrapper: + description: "Schema for an incident impact updated trigger." + properties: + incidentImpactUpdatedTrigger: + $ref: "#/components/schemas/IncidentImpactUpdatedTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentImpactUpdatedTrigger + type: object IncidentImpactsResponse: description: Response with a list of incident impacts. properties: @@ -50530,6 +50613,27 @@ components: type: string x-enum-varnames: - INCIDENT_POSTMORTEMS + IncidentPostmortemUpdatedTrigger: + description: "Trigger a workflow when a postmortem is updated for an incident." + properties: + executionLimit: + $ref: "#/components/schemas/ExecutionLimit" + incidentType: + description: "The type of incident that triggers the workflow." + type: string + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + type: object + IncidentPostmortemUpdatedTriggerWrapper: + description: "Schema for an incident postmortem updated trigger." + properties: + incidentPostmortemUpdatedTrigger: + $ref: "#/components/schemas/IncidentPostmortemUpdatedTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentPostmortemUpdatedTrigger + type: object IncidentRelatedObject: description: Object related to an incident. enum: @@ -50560,6 +50664,27 @@ components: type: string x-enum-varnames: - INCIDENTS + IncidentResponderCreatedTrigger: + description: "Trigger a workflow when a responder is created for an incident." + properties: + executionLimit: + $ref: "#/components/schemas/ExecutionLimit" + incidentType: + description: "The type of incident that triggers the workflow." + type: string + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + type: object + IncidentResponderCreatedTriggerWrapper: + description: "Schema for an incident responder created trigger." + properties: + incidentResponderCreatedTrigger: + $ref: "#/components/schemas/IncidentResponderCreatedTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentResponderCreatedTrigger + type: object IncidentResponderDataAttributesResponse: description: Attributes of an incident responder in a response. properties: @@ -51313,6 +51438,55 @@ components: required: - data type: object + IncidentSavedTrigger: + description: "Trigger a workflow when an incident is declared or updated." + properties: + executionLimit: + $ref: "#/components/schemas/ExecutionLimit" + incidentType: + description: "The type of incident that triggers the workflow." + type: string + serialExecution: + $ref: "#/components/schemas/SerialExecution" + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + type: object + IncidentSavedTriggerWrapper: + description: "Schema for an incident declared or updated trigger." + properties: + incidentSavedTrigger: + $ref: "#/components/schemas/IncidentSavedTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentSavedTrigger + type: object + IncidentScheduleTrigger: + description: "Trigger a workflow on a schedule for an incident." + properties: + incidentType: + description: "The type of incident that triggers the workflow." + type: string + rrule: + description: "The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string." + example: "DTSTART:20241220T151700Z\nRRULE:FREQ=MONTHLY" + minLength: 1 + type: string + tagCondition: + $ref: "#/components/schemas/IncidentCondition" + required: + - rrule + type: object + IncidentScheduleTriggerWrapper: + description: "Schema for an incident schedule trigger." + properties: + incidentScheduleTrigger: + $ref: "#/components/schemas/IncidentScheduleTrigger" + startStepNames: + $ref: "#/components/schemas/StartStepNames" + required: + - incidentScheduleTrigger + type: object IncidentSearchResponse: description: Response with incidents and facets. properties: @@ -51606,6 +51780,24 @@ components: - SEV_3 - SEV_4 - SEV_5 + IncidentTagValue: + description: "An incident tag and its accepted values." + properties: + tag: + description: "The incident tag to match." + example: "" + type: string + values: + description: "The accepted values for the incident tag." + example: + - "" + items: + type: string + type: array + required: + - tag + - values + type: object IncidentTimelineCellCreateAttributes: description: The timeline cell's attributes for a create request. oneOf: @@ -52025,13 +52217,16 @@ components: x-enum-varnames: - INCIDENT_TODOS IncidentTrigger: - description: "Trigger a workflow from an Incident. For automatic triggering a handle must be configured and the workflow must be published." + description: "Trigger a workflow from an incident. For automatic triggering a handle must be configured and the workflow must be published." properties: rateLimit: $ref: "#/components/schemas/TriggerRateLimit" + version: + description: "Version of the incident manual trigger." + type: string type: object IncidentTriggerWrapper: - description: "Schema for an Incident-based trigger." + description: "Schema for an incident-based trigger." properties: incidentTrigger: $ref: "#/components/schemas/IncidentTrigger" @@ -103923,6 +104118,16 @@ components: - REPLACEMENT_STRING - PARTIAL_REPLACEMENT_FROM_BEGINNING - PARTIAL_REPLACEMENT_FROM_END + SerialExecution: + description: "Whether to execute the workflow serially for an incident." + properties: + enabled: + description: "Whether serial execution is enabled." + example: false + type: boolean + required: + - enabled + type: object ServiceAccessToken: description: Datadog access token. properties: @@ -107006,12 +107211,38 @@ components: - channel_name - redirect_url type: object + SlackReactionConfig: + description: "Configuration for a Slack emoji reaction trigger." + properties: + reactionEmoji: + description: "The Slack emoji reaction name." + example: L + minLength: 1 + type: string + teamId: + description: "The Slack workspace ID." + example: L + minLength: 1 + type: string + required: + - teamId + - reactionEmoji + type: object + SlackTrigger: + description: "Trigger a workflow from Slack. The workflow must be published." + properties: + reactionTriggers: + description: "Slack emoji reactions that trigger the workflow." + items: + $ref: "#/components/schemas/SlackReactionConfig" + type: array + uniqueItems: true + type: object SlackTriggerWrapper: description: "Schema for a Slack-based trigger." properties: slackTrigger: - description: "Trigger a workflow from Slack. The workflow must be published." - type: object + $ref: "#/components/schemas/SlackTrigger" startStepNames: $ref: "#/components/schemas/StartStepNames" required: @@ -118899,6 +119130,13 @@ components: - $ref: "#/components/schemas/DashboardTriggerWrapper" - $ref: "#/components/schemas/FormTriggerWrapper" - $ref: "#/components/schemas/GithubWebhookTriggerWrapper" + - $ref: "#/components/schemas/IncidentCreatedTriggerWrapper" + - $ref: "#/components/schemas/IncidentImpactCreatedTriggerWrapper" + - $ref: "#/components/schemas/IncidentImpactUpdatedTriggerWrapper" + - $ref: "#/components/schemas/IncidentPostmortemUpdatedTriggerWrapper" + - $ref: "#/components/schemas/IncidentResponderCreatedTriggerWrapper" + - $ref: "#/components/schemas/IncidentSavedTriggerWrapper" + - $ref: "#/components/schemas/IncidentScheduleTriggerWrapper" - $ref: "#/components/schemas/IncidentTriggerWrapper" - $ref: "#/components/schemas/MonitorTriggerWrapper" - $ref: "#/components/schemas/NotebookTriggerWrapper" diff --git a/api/datadogV2/model_execution_limit.go b/api/datadogV2/model_execution_limit.go new file mode 100644 index 00000000000..fd11ef735f7 --- /dev/null +++ b/api/datadogV2/model_execution_limit.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" +) + +// ExecutionLimit The maximum number of times to execute a workflow for an incident. +type ExecutionLimit struct { + // The maximum number of workflow executions. + Count int32 `json:"count"` + // 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:"-"` +} + +// NewExecutionLimit instantiates a new ExecutionLimit 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 NewExecutionLimit(count int32) *ExecutionLimit { + this := ExecutionLimit{} + this.Count = count + return &this +} + +// NewExecutionLimitWithDefaults instantiates a new ExecutionLimit 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 NewExecutionLimitWithDefaults() *ExecutionLimit { + this := ExecutionLimit{} + return &this +} + +// GetCount returns the Count field value. +func (o *ExecutionLimit) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *ExecutionLimit) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value. +func (o *ExecutionLimit) SetCount(v int32) { + o.Count = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o ExecutionLimit) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["count"] = o.Count + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *ExecutionLimit) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Count *int32 `json:"count"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Count == nil { + return fmt.Errorf("required field count missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"count"}) + } else { + return err + } + o.Count = *all.Count + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_condition.go b/api/datadogV2/model_incident_condition.go new file mode 100644 index 00000000000..5cdbd7c1db7 --- /dev/null +++ b/api/datadogV2/model_incident_condition.go @@ -0,0 +1,102 @@ +// 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" +) + +// IncidentCondition Conditions that determine which incidents trigger the workflow. +type IncidentCondition struct { + // Incident tags and values used to filter matching incidents. + TagValues []IncidentTagValue `json:"tagValues,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:"-"` +} + +// 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() *IncidentCondition { + this := IncidentCondition{} + 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 +} + +// GetTagValues returns the TagValues field value if set, zero value otherwise. +func (o *IncidentCondition) GetTagValues() []IncidentTagValue { + if o == nil || o.TagValues == nil { + var ret []IncidentTagValue + return ret + } + return o.TagValues +} + +// GetTagValuesOk returns a tuple with the TagValues field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentCondition) GetTagValuesOk() (*[]IncidentTagValue, bool) { + if o == nil || o.TagValues == nil { + return nil, false + } + return &o.TagValues, true +} + +// HasTagValues returns a boolean if a field has been set. +func (o *IncidentCondition) HasTagValues() bool { + return o != nil && o.TagValues != nil +} + +// SetTagValues gets a reference to the given []IncidentTagValue and assigns it to the TagValues field. +func (o *IncidentCondition) SetTagValues(v []IncidentTagValue) { + o.TagValues = 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) + } + if o.TagValues != nil { + toSerialize["tagValues"] = o.TagValues + } + + 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 { + TagValues []IncidentTagValue `json:"tagValues,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"tagValues"}) + } else { + return err + } + o.TagValues = all.TagValues + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_created_trigger.go b/api/datadogV2/model_incident_created_trigger.go new file mode 100644 index 00000000000..717a5176e19 --- /dev/null +++ b/api/datadogV2/model_incident_created_trigger.go @@ -0,0 +1,146 @@ +// 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" +) + +// IncidentCreatedTrigger Trigger a workflow when an incident is declared. +type IncidentCreatedTrigger struct { + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // Conditions that determine which incidents trigger the workflow. + 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:"-"` +} + +// NewIncidentCreatedTrigger instantiates a new IncidentCreatedTrigger 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 NewIncidentCreatedTrigger() *IncidentCreatedTrigger { + this := IncidentCreatedTrigger{} + return &this +} + +// NewIncidentCreatedTriggerWithDefaults instantiates a new IncidentCreatedTrigger 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 NewIncidentCreatedTriggerWithDefaults() *IncidentCreatedTrigger { + this := IncidentCreatedTrigger{} + return &this +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentCreatedTrigger) 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 *IncidentCreatedTrigger) 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 *IncidentCreatedTrigger) 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 *IncidentCreatedTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentCreatedTrigger) 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 *IncidentCreatedTrigger) 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 *IncidentCreatedTrigger) 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 *IncidentCreatedTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreatedTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + 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 *IncidentCreatedTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *string `json:"incidentType,omitempty"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentType", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + o.IncidentType = all.IncidentType + 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_created_trigger_wrapper.go b/api/datadogV2/model_incident_created_trigger_wrapper.go new file mode 100644 index 00000000000..d9bf130882e --- /dev/null +++ b/api/datadogV2/model_incident_created_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" +) + +// IncidentCreatedTriggerWrapper Schema for an incident declared trigger. +type IncidentCreatedTriggerWrapper struct { + // Trigger a workflow when an incident is declared. + IncidentCreatedTrigger IncidentCreatedTrigger `json:"incidentCreatedTrigger"` + // Names of existing workflow 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:"-"` +} + +// NewIncidentCreatedTriggerWrapper instantiates a new IncidentCreatedTriggerWrapper 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 NewIncidentCreatedTriggerWrapper(incidentCreatedTrigger IncidentCreatedTrigger) *IncidentCreatedTriggerWrapper { + this := IncidentCreatedTriggerWrapper{} + this.IncidentCreatedTrigger = incidentCreatedTrigger + return &this +} + +// NewIncidentCreatedTriggerWrapperWithDefaults instantiates a new IncidentCreatedTriggerWrapper 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 NewIncidentCreatedTriggerWrapperWithDefaults() *IncidentCreatedTriggerWrapper { + this := IncidentCreatedTriggerWrapper{} + return &this +} + +// GetIncidentCreatedTrigger returns the IncidentCreatedTrigger field value. +func (o *IncidentCreatedTriggerWrapper) GetIncidentCreatedTrigger() IncidentCreatedTrigger { + if o == nil { + var ret IncidentCreatedTrigger + return ret + } + return o.IncidentCreatedTrigger +} + +// GetIncidentCreatedTriggerOk returns a tuple with the IncidentCreatedTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentCreatedTriggerWrapper) GetIncidentCreatedTriggerOk() (*IncidentCreatedTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentCreatedTrigger, true +} + +// SetIncidentCreatedTrigger sets field value. +func (o *IncidentCreatedTriggerWrapper) SetIncidentCreatedTrigger(v IncidentCreatedTrigger) { + o.IncidentCreatedTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentCreatedTriggerWrapper) 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 *IncidentCreatedTriggerWrapper) 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 *IncidentCreatedTriggerWrapper) 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 *IncidentCreatedTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreatedTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentCreatedTrigger"] = o.IncidentCreatedTrigger + 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 *IncidentCreatedTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentCreatedTrigger *IncidentCreatedTrigger `json:"incidentCreatedTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentCreatedTrigger == nil { + return fmt.Errorf("required field incidentCreatedTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentCreatedTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentCreatedTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentCreatedTrigger = *all.IncidentCreatedTrigger + 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_incident_impact_created_trigger.go b/api/datadogV2/model_incident_impact_created_trigger.go new file mode 100644 index 00000000000..064c4a0661e --- /dev/null +++ b/api/datadogV2/model_incident_impact_created_trigger.go @@ -0,0 +1,184 @@ +// 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" +) + +// IncidentImpactCreatedTrigger Trigger a workflow when an impact is created for an incident. +type IncidentImpactCreatedTrigger struct { + // The maximum number of times to execute a workflow for an incident. + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // Conditions that determine which incidents trigger the workflow. + 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:"-"` +} + +// NewIncidentImpactCreatedTrigger instantiates a new IncidentImpactCreatedTrigger 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 NewIncidentImpactCreatedTrigger() *IncidentImpactCreatedTrigger { + this := IncidentImpactCreatedTrigger{} + return &this +} + +// NewIncidentImpactCreatedTriggerWithDefaults instantiates a new IncidentImpactCreatedTrigger 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 NewIncidentImpactCreatedTriggerWithDefaults() *IncidentImpactCreatedTrigger { + this := IncidentImpactCreatedTrigger{} + return &this +} + +// GetExecutionLimit returns the ExecutionLimit field value if set, zero value otherwise. +func (o *IncidentImpactCreatedTrigger) GetExecutionLimit() ExecutionLimit { + if o == nil || o.ExecutionLimit == nil { + var ret ExecutionLimit + return ret + } + return *o.ExecutionLimit +} + +// GetExecutionLimitOk returns a tuple with the ExecutionLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentImpactCreatedTrigger) GetExecutionLimitOk() (*ExecutionLimit, bool) { + if o == nil || o.ExecutionLimit == nil { + return nil, false + } + return o.ExecutionLimit, true +} + +// HasExecutionLimit returns a boolean if a field has been set. +func (o *IncidentImpactCreatedTrigger) HasExecutionLimit() bool { + return o != nil && o.ExecutionLimit != nil +} + +// SetExecutionLimit gets a reference to the given ExecutionLimit and assigns it to the ExecutionLimit field. +func (o *IncidentImpactCreatedTrigger) SetExecutionLimit(v ExecutionLimit) { + o.ExecutionLimit = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentImpactCreatedTrigger) 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 *IncidentImpactCreatedTrigger) 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 *IncidentImpactCreatedTrigger) 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 *IncidentImpactCreatedTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentImpactCreatedTrigger) 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 *IncidentImpactCreatedTrigger) 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 *IncidentImpactCreatedTrigger) 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 *IncidentImpactCreatedTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactCreatedTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecutionLimit != nil { + toSerialize["executionLimit"] = o.ExecutionLimit + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + 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 *IncidentImpactCreatedTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + IncidentType *string `json:"incidentType,omitempty"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"executionLimit", "incidentType", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + if all.ExecutionLimit != nil && all.ExecutionLimit.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ExecutionLimit = all.ExecutionLimit + o.IncidentType = all.IncidentType + 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_impact_created_trigger_wrapper.go b/api/datadogV2/model_incident_impact_created_trigger_wrapper.go new file mode 100644 index 00000000000..0e4b835ea80 --- /dev/null +++ b/api/datadogV2/model_incident_impact_created_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" +) + +// IncidentImpactCreatedTriggerWrapper Schema for an incident impact created trigger. +type IncidentImpactCreatedTriggerWrapper struct { + // Trigger a workflow when an impact is created for an incident. + IncidentImpactCreatedTrigger IncidentImpactCreatedTrigger `json:"incidentImpactCreatedTrigger"` + // Names of existing workflow 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:"-"` +} + +// NewIncidentImpactCreatedTriggerWrapper instantiates a new IncidentImpactCreatedTriggerWrapper 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 NewIncidentImpactCreatedTriggerWrapper(incidentImpactCreatedTrigger IncidentImpactCreatedTrigger) *IncidentImpactCreatedTriggerWrapper { + this := IncidentImpactCreatedTriggerWrapper{} + this.IncidentImpactCreatedTrigger = incidentImpactCreatedTrigger + return &this +} + +// NewIncidentImpactCreatedTriggerWrapperWithDefaults instantiates a new IncidentImpactCreatedTriggerWrapper 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 NewIncidentImpactCreatedTriggerWrapperWithDefaults() *IncidentImpactCreatedTriggerWrapper { + this := IncidentImpactCreatedTriggerWrapper{} + return &this +} + +// GetIncidentImpactCreatedTrigger returns the IncidentImpactCreatedTrigger field value. +func (o *IncidentImpactCreatedTriggerWrapper) GetIncidentImpactCreatedTrigger() IncidentImpactCreatedTrigger { + if o == nil { + var ret IncidentImpactCreatedTrigger + return ret + } + return o.IncidentImpactCreatedTrigger +} + +// GetIncidentImpactCreatedTriggerOk returns a tuple with the IncidentImpactCreatedTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactCreatedTriggerWrapper) GetIncidentImpactCreatedTriggerOk() (*IncidentImpactCreatedTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentImpactCreatedTrigger, true +} + +// SetIncidentImpactCreatedTrigger sets field value. +func (o *IncidentImpactCreatedTriggerWrapper) SetIncidentImpactCreatedTrigger(v IncidentImpactCreatedTrigger) { + o.IncidentImpactCreatedTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentImpactCreatedTriggerWrapper) 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 *IncidentImpactCreatedTriggerWrapper) 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 *IncidentImpactCreatedTriggerWrapper) 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 *IncidentImpactCreatedTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactCreatedTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentImpactCreatedTrigger"] = o.IncidentImpactCreatedTrigger + 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 *IncidentImpactCreatedTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentImpactCreatedTrigger *IncidentImpactCreatedTrigger `json:"incidentImpactCreatedTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentImpactCreatedTrigger == nil { + return fmt.Errorf("required field incidentImpactCreatedTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentImpactCreatedTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentImpactCreatedTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentImpactCreatedTrigger = *all.IncidentImpactCreatedTrigger + 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_incident_impact_updated_trigger.go b/api/datadogV2/model_incident_impact_updated_trigger.go new file mode 100644 index 00000000000..d32a6d80036 --- /dev/null +++ b/api/datadogV2/model_incident_impact_updated_trigger.go @@ -0,0 +1,184 @@ +// 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" +) + +// IncidentImpactUpdatedTrigger Trigger a workflow when an impact is updated for an incident. +type IncidentImpactUpdatedTrigger struct { + // The maximum number of times to execute a workflow for an incident. + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // Conditions that determine which incidents trigger the workflow. + 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:"-"` +} + +// NewIncidentImpactUpdatedTrigger instantiates a new IncidentImpactUpdatedTrigger 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 NewIncidentImpactUpdatedTrigger() *IncidentImpactUpdatedTrigger { + this := IncidentImpactUpdatedTrigger{} + return &this +} + +// NewIncidentImpactUpdatedTriggerWithDefaults instantiates a new IncidentImpactUpdatedTrigger 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 NewIncidentImpactUpdatedTriggerWithDefaults() *IncidentImpactUpdatedTrigger { + this := IncidentImpactUpdatedTrigger{} + return &this +} + +// GetExecutionLimit returns the ExecutionLimit field value if set, zero value otherwise. +func (o *IncidentImpactUpdatedTrigger) GetExecutionLimit() ExecutionLimit { + if o == nil || o.ExecutionLimit == nil { + var ret ExecutionLimit + return ret + } + return *o.ExecutionLimit +} + +// GetExecutionLimitOk returns a tuple with the ExecutionLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentImpactUpdatedTrigger) GetExecutionLimitOk() (*ExecutionLimit, bool) { + if o == nil || o.ExecutionLimit == nil { + return nil, false + } + return o.ExecutionLimit, true +} + +// HasExecutionLimit returns a boolean if a field has been set. +func (o *IncidentImpactUpdatedTrigger) HasExecutionLimit() bool { + return o != nil && o.ExecutionLimit != nil +} + +// SetExecutionLimit gets a reference to the given ExecutionLimit and assigns it to the ExecutionLimit field. +func (o *IncidentImpactUpdatedTrigger) SetExecutionLimit(v ExecutionLimit) { + o.ExecutionLimit = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentImpactUpdatedTrigger) 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 *IncidentImpactUpdatedTrigger) 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 *IncidentImpactUpdatedTrigger) 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 *IncidentImpactUpdatedTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentImpactUpdatedTrigger) 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 *IncidentImpactUpdatedTrigger) 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 *IncidentImpactUpdatedTrigger) 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 *IncidentImpactUpdatedTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactUpdatedTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecutionLimit != nil { + toSerialize["executionLimit"] = o.ExecutionLimit + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + 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 *IncidentImpactUpdatedTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + IncidentType *string `json:"incidentType,omitempty"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"executionLimit", "incidentType", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + if all.ExecutionLimit != nil && all.ExecutionLimit.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ExecutionLimit = all.ExecutionLimit + o.IncidentType = all.IncidentType + 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_impact_updated_trigger_wrapper.go b/api/datadogV2/model_incident_impact_updated_trigger_wrapper.go new file mode 100644 index 00000000000..9c0b526f669 --- /dev/null +++ b/api/datadogV2/model_incident_impact_updated_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" +) + +// IncidentImpactUpdatedTriggerWrapper Schema for an incident impact updated trigger. +type IncidentImpactUpdatedTriggerWrapper struct { + // Trigger a workflow when an impact is updated for an incident. + IncidentImpactUpdatedTrigger IncidentImpactUpdatedTrigger `json:"incidentImpactUpdatedTrigger"` + // Names of existing workflow 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:"-"` +} + +// NewIncidentImpactUpdatedTriggerWrapper instantiates a new IncidentImpactUpdatedTriggerWrapper 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 NewIncidentImpactUpdatedTriggerWrapper(incidentImpactUpdatedTrigger IncidentImpactUpdatedTrigger) *IncidentImpactUpdatedTriggerWrapper { + this := IncidentImpactUpdatedTriggerWrapper{} + this.IncidentImpactUpdatedTrigger = incidentImpactUpdatedTrigger + return &this +} + +// NewIncidentImpactUpdatedTriggerWrapperWithDefaults instantiates a new IncidentImpactUpdatedTriggerWrapper 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 NewIncidentImpactUpdatedTriggerWrapperWithDefaults() *IncidentImpactUpdatedTriggerWrapper { + this := IncidentImpactUpdatedTriggerWrapper{} + return &this +} + +// GetIncidentImpactUpdatedTrigger returns the IncidentImpactUpdatedTrigger field value. +func (o *IncidentImpactUpdatedTriggerWrapper) GetIncidentImpactUpdatedTrigger() IncidentImpactUpdatedTrigger { + if o == nil { + var ret IncidentImpactUpdatedTrigger + return ret + } + return o.IncidentImpactUpdatedTrigger +} + +// GetIncidentImpactUpdatedTriggerOk returns a tuple with the IncidentImpactUpdatedTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactUpdatedTriggerWrapper) GetIncidentImpactUpdatedTriggerOk() (*IncidentImpactUpdatedTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentImpactUpdatedTrigger, true +} + +// SetIncidentImpactUpdatedTrigger sets field value. +func (o *IncidentImpactUpdatedTriggerWrapper) SetIncidentImpactUpdatedTrigger(v IncidentImpactUpdatedTrigger) { + o.IncidentImpactUpdatedTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentImpactUpdatedTriggerWrapper) 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 *IncidentImpactUpdatedTriggerWrapper) 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 *IncidentImpactUpdatedTriggerWrapper) 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 *IncidentImpactUpdatedTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactUpdatedTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentImpactUpdatedTrigger"] = o.IncidentImpactUpdatedTrigger + 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 *IncidentImpactUpdatedTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentImpactUpdatedTrigger *IncidentImpactUpdatedTrigger `json:"incidentImpactUpdatedTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentImpactUpdatedTrigger == nil { + return fmt.Errorf("required field incidentImpactUpdatedTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentImpactUpdatedTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentImpactUpdatedTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentImpactUpdatedTrigger = *all.IncidentImpactUpdatedTrigger + 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_incident_postmortem_updated_trigger.go b/api/datadogV2/model_incident_postmortem_updated_trigger.go new file mode 100644 index 00000000000..49e89285385 --- /dev/null +++ b/api/datadogV2/model_incident_postmortem_updated_trigger.go @@ -0,0 +1,184 @@ +// 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" +) + +// IncidentPostmortemUpdatedTrigger Trigger a workflow when a postmortem is updated for an incident. +type IncidentPostmortemUpdatedTrigger struct { + // The maximum number of times to execute a workflow for an incident. + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // Conditions that determine which incidents trigger the workflow. + 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:"-"` +} + +// NewIncidentPostmortemUpdatedTrigger instantiates a new IncidentPostmortemUpdatedTrigger 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 NewIncidentPostmortemUpdatedTrigger() *IncidentPostmortemUpdatedTrigger { + this := IncidentPostmortemUpdatedTrigger{} + return &this +} + +// NewIncidentPostmortemUpdatedTriggerWithDefaults instantiates a new IncidentPostmortemUpdatedTrigger 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 NewIncidentPostmortemUpdatedTriggerWithDefaults() *IncidentPostmortemUpdatedTrigger { + this := IncidentPostmortemUpdatedTrigger{} + return &this +} + +// GetExecutionLimit returns the ExecutionLimit field value if set, zero value otherwise. +func (o *IncidentPostmortemUpdatedTrigger) GetExecutionLimit() ExecutionLimit { + if o == nil || o.ExecutionLimit == nil { + var ret ExecutionLimit + return ret + } + return *o.ExecutionLimit +} + +// GetExecutionLimitOk returns a tuple with the ExecutionLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentPostmortemUpdatedTrigger) GetExecutionLimitOk() (*ExecutionLimit, bool) { + if o == nil || o.ExecutionLimit == nil { + return nil, false + } + return o.ExecutionLimit, true +} + +// HasExecutionLimit returns a boolean if a field has been set. +func (o *IncidentPostmortemUpdatedTrigger) HasExecutionLimit() bool { + return o != nil && o.ExecutionLimit != nil +} + +// SetExecutionLimit gets a reference to the given ExecutionLimit and assigns it to the ExecutionLimit field. +func (o *IncidentPostmortemUpdatedTrigger) SetExecutionLimit(v ExecutionLimit) { + o.ExecutionLimit = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentPostmortemUpdatedTrigger) 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 *IncidentPostmortemUpdatedTrigger) 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 *IncidentPostmortemUpdatedTrigger) 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 *IncidentPostmortemUpdatedTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentPostmortemUpdatedTrigger) 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 *IncidentPostmortemUpdatedTrigger) 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 *IncidentPostmortemUpdatedTrigger) 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 *IncidentPostmortemUpdatedTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentPostmortemUpdatedTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecutionLimit != nil { + toSerialize["executionLimit"] = o.ExecutionLimit + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + 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 *IncidentPostmortemUpdatedTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + IncidentType *string `json:"incidentType,omitempty"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"executionLimit", "incidentType", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + if all.ExecutionLimit != nil && all.ExecutionLimit.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ExecutionLimit = all.ExecutionLimit + o.IncidentType = all.IncidentType + 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_postmortem_updated_trigger_wrapper.go b/api/datadogV2/model_incident_postmortem_updated_trigger_wrapper.go new file mode 100644 index 00000000000..fdda9283eab --- /dev/null +++ b/api/datadogV2/model_incident_postmortem_updated_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" +) + +// IncidentPostmortemUpdatedTriggerWrapper Schema for an incident postmortem updated trigger. +type IncidentPostmortemUpdatedTriggerWrapper struct { + // Trigger a workflow when a postmortem is updated for an incident. + IncidentPostmortemUpdatedTrigger IncidentPostmortemUpdatedTrigger `json:"incidentPostmortemUpdatedTrigger"` + // Names of existing workflow 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:"-"` +} + +// NewIncidentPostmortemUpdatedTriggerWrapper instantiates a new IncidentPostmortemUpdatedTriggerWrapper 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 NewIncidentPostmortemUpdatedTriggerWrapper(incidentPostmortemUpdatedTrigger IncidentPostmortemUpdatedTrigger) *IncidentPostmortemUpdatedTriggerWrapper { + this := IncidentPostmortemUpdatedTriggerWrapper{} + this.IncidentPostmortemUpdatedTrigger = incidentPostmortemUpdatedTrigger + return &this +} + +// NewIncidentPostmortemUpdatedTriggerWrapperWithDefaults instantiates a new IncidentPostmortemUpdatedTriggerWrapper 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 NewIncidentPostmortemUpdatedTriggerWrapperWithDefaults() *IncidentPostmortemUpdatedTriggerWrapper { + this := IncidentPostmortemUpdatedTriggerWrapper{} + return &this +} + +// GetIncidentPostmortemUpdatedTrigger returns the IncidentPostmortemUpdatedTrigger field value. +func (o *IncidentPostmortemUpdatedTriggerWrapper) GetIncidentPostmortemUpdatedTrigger() IncidentPostmortemUpdatedTrigger { + if o == nil { + var ret IncidentPostmortemUpdatedTrigger + return ret + } + return o.IncidentPostmortemUpdatedTrigger +} + +// GetIncidentPostmortemUpdatedTriggerOk returns a tuple with the IncidentPostmortemUpdatedTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentPostmortemUpdatedTriggerWrapper) GetIncidentPostmortemUpdatedTriggerOk() (*IncidentPostmortemUpdatedTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentPostmortemUpdatedTrigger, true +} + +// SetIncidentPostmortemUpdatedTrigger sets field value. +func (o *IncidentPostmortemUpdatedTriggerWrapper) SetIncidentPostmortemUpdatedTrigger(v IncidentPostmortemUpdatedTrigger) { + o.IncidentPostmortemUpdatedTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentPostmortemUpdatedTriggerWrapper) 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 *IncidentPostmortemUpdatedTriggerWrapper) 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 *IncidentPostmortemUpdatedTriggerWrapper) 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 *IncidentPostmortemUpdatedTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentPostmortemUpdatedTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentPostmortemUpdatedTrigger"] = o.IncidentPostmortemUpdatedTrigger + 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 *IncidentPostmortemUpdatedTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentPostmortemUpdatedTrigger *IncidentPostmortemUpdatedTrigger `json:"incidentPostmortemUpdatedTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentPostmortemUpdatedTrigger == nil { + return fmt.Errorf("required field incidentPostmortemUpdatedTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentPostmortemUpdatedTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentPostmortemUpdatedTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentPostmortemUpdatedTrigger = *all.IncidentPostmortemUpdatedTrigger + 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_incident_responder_created_trigger.go b/api/datadogV2/model_incident_responder_created_trigger.go new file mode 100644 index 00000000000..35f6a6ded2a --- /dev/null +++ b/api/datadogV2/model_incident_responder_created_trigger.go @@ -0,0 +1,184 @@ +// 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" +) + +// IncidentResponderCreatedTrigger Trigger a workflow when a responder is created for an incident. +type IncidentResponderCreatedTrigger struct { + // The maximum number of times to execute a workflow for an incident. + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // Conditions that determine which incidents trigger the workflow. + 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:"-"` +} + +// NewIncidentResponderCreatedTrigger instantiates a new IncidentResponderCreatedTrigger 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 NewIncidentResponderCreatedTrigger() *IncidentResponderCreatedTrigger { + this := IncidentResponderCreatedTrigger{} + return &this +} + +// NewIncidentResponderCreatedTriggerWithDefaults instantiates a new IncidentResponderCreatedTrigger 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 NewIncidentResponderCreatedTriggerWithDefaults() *IncidentResponderCreatedTrigger { + this := IncidentResponderCreatedTrigger{} + return &this +} + +// GetExecutionLimit returns the ExecutionLimit field value if set, zero value otherwise. +func (o *IncidentResponderCreatedTrigger) GetExecutionLimit() ExecutionLimit { + if o == nil || o.ExecutionLimit == nil { + var ret ExecutionLimit + return ret + } + return *o.ExecutionLimit +} + +// GetExecutionLimitOk returns a tuple with the ExecutionLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponderCreatedTrigger) GetExecutionLimitOk() (*ExecutionLimit, bool) { + if o == nil || o.ExecutionLimit == nil { + return nil, false + } + return o.ExecutionLimit, true +} + +// HasExecutionLimit returns a boolean if a field has been set. +func (o *IncidentResponderCreatedTrigger) HasExecutionLimit() bool { + return o != nil && o.ExecutionLimit != nil +} + +// SetExecutionLimit gets a reference to the given ExecutionLimit and assigns it to the ExecutionLimit field. +func (o *IncidentResponderCreatedTrigger) SetExecutionLimit(v ExecutionLimit) { + o.ExecutionLimit = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentResponderCreatedTrigger) 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 *IncidentResponderCreatedTrigger) 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 *IncidentResponderCreatedTrigger) 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 *IncidentResponderCreatedTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentResponderCreatedTrigger) 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 *IncidentResponderCreatedTrigger) 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 *IncidentResponderCreatedTrigger) 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 *IncidentResponderCreatedTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderCreatedTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecutionLimit != nil { + toSerialize["executionLimit"] = o.ExecutionLimit + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + 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 *IncidentResponderCreatedTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + IncidentType *string `json:"incidentType,omitempty"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"executionLimit", "incidentType", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + if all.ExecutionLimit != nil && all.ExecutionLimit.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ExecutionLimit = all.ExecutionLimit + o.IncidentType = all.IncidentType + 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_responder_created_trigger_wrapper.go b/api/datadogV2/model_incident_responder_created_trigger_wrapper.go new file mode 100644 index 00000000000..aa2174fcb08 --- /dev/null +++ b/api/datadogV2/model_incident_responder_created_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" +) + +// IncidentResponderCreatedTriggerWrapper Schema for an incident responder created trigger. +type IncidentResponderCreatedTriggerWrapper struct { + // Trigger a workflow when a responder is created for an incident. + IncidentResponderCreatedTrigger IncidentResponderCreatedTrigger `json:"incidentResponderCreatedTrigger"` + // Names of existing workflow 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:"-"` +} + +// NewIncidentResponderCreatedTriggerWrapper instantiates a new IncidentResponderCreatedTriggerWrapper 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 NewIncidentResponderCreatedTriggerWrapper(incidentResponderCreatedTrigger IncidentResponderCreatedTrigger) *IncidentResponderCreatedTriggerWrapper { + this := IncidentResponderCreatedTriggerWrapper{} + this.IncidentResponderCreatedTrigger = incidentResponderCreatedTrigger + return &this +} + +// NewIncidentResponderCreatedTriggerWrapperWithDefaults instantiates a new IncidentResponderCreatedTriggerWrapper 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 NewIncidentResponderCreatedTriggerWrapperWithDefaults() *IncidentResponderCreatedTriggerWrapper { + this := IncidentResponderCreatedTriggerWrapper{} + return &this +} + +// GetIncidentResponderCreatedTrigger returns the IncidentResponderCreatedTrigger field value. +func (o *IncidentResponderCreatedTriggerWrapper) GetIncidentResponderCreatedTrigger() IncidentResponderCreatedTrigger { + if o == nil { + var ret IncidentResponderCreatedTrigger + return ret + } + return o.IncidentResponderCreatedTrigger +} + +// GetIncidentResponderCreatedTriggerOk returns a tuple with the IncidentResponderCreatedTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentResponderCreatedTriggerWrapper) GetIncidentResponderCreatedTriggerOk() (*IncidentResponderCreatedTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentResponderCreatedTrigger, true +} + +// SetIncidentResponderCreatedTrigger sets field value. +func (o *IncidentResponderCreatedTriggerWrapper) SetIncidentResponderCreatedTrigger(v IncidentResponderCreatedTrigger) { + o.IncidentResponderCreatedTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentResponderCreatedTriggerWrapper) 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 *IncidentResponderCreatedTriggerWrapper) 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 *IncidentResponderCreatedTriggerWrapper) 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 *IncidentResponderCreatedTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderCreatedTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentResponderCreatedTrigger"] = o.IncidentResponderCreatedTrigger + 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 *IncidentResponderCreatedTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentResponderCreatedTrigger *IncidentResponderCreatedTrigger `json:"incidentResponderCreatedTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentResponderCreatedTrigger == nil { + return fmt.Errorf("required field incidentResponderCreatedTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentResponderCreatedTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentResponderCreatedTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentResponderCreatedTrigger = *all.IncidentResponderCreatedTrigger + 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_incident_saved_trigger.go b/api/datadogV2/model_incident_saved_trigger.go new file mode 100644 index 00000000000..6a8a7eb52a9 --- /dev/null +++ b/api/datadogV2/model_incident_saved_trigger.go @@ -0,0 +1,222 @@ +// 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" +) + +// IncidentSavedTrigger Trigger a workflow when an incident is declared or updated. +type IncidentSavedTrigger struct { + // The maximum number of times to execute a workflow for an incident. + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // Whether to execute the workflow serially for an incident. + SerialExecution *SerialExecution `json:"serialExecution,omitempty"` + // Conditions that determine which incidents trigger the workflow. + 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:"-"` +} + +// NewIncidentSavedTrigger instantiates a new IncidentSavedTrigger 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 NewIncidentSavedTrigger() *IncidentSavedTrigger { + this := IncidentSavedTrigger{} + return &this +} + +// NewIncidentSavedTriggerWithDefaults instantiates a new IncidentSavedTrigger 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 NewIncidentSavedTriggerWithDefaults() *IncidentSavedTrigger { + this := IncidentSavedTrigger{} + return &this +} + +// GetExecutionLimit returns the ExecutionLimit field value if set, zero value otherwise. +func (o *IncidentSavedTrigger) GetExecutionLimit() ExecutionLimit { + if o == nil || o.ExecutionLimit == nil { + var ret ExecutionLimit + return ret + } + return *o.ExecutionLimit +} + +// GetExecutionLimitOk returns a tuple with the ExecutionLimit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentSavedTrigger) GetExecutionLimitOk() (*ExecutionLimit, bool) { + if o == nil || o.ExecutionLimit == nil { + return nil, false + } + return o.ExecutionLimit, true +} + +// HasExecutionLimit returns a boolean if a field has been set. +func (o *IncidentSavedTrigger) HasExecutionLimit() bool { + return o != nil && o.ExecutionLimit != nil +} + +// SetExecutionLimit gets a reference to the given ExecutionLimit and assigns it to the ExecutionLimit field. +func (o *IncidentSavedTrigger) SetExecutionLimit(v ExecutionLimit) { + o.ExecutionLimit = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentSavedTrigger) 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 *IncidentSavedTrigger) 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 *IncidentSavedTrigger) 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 *IncidentSavedTrigger) SetIncidentType(v string) { + o.IncidentType = &v +} + +// GetSerialExecution returns the SerialExecution field value if set, zero value otherwise. +func (o *IncidentSavedTrigger) GetSerialExecution() SerialExecution { + if o == nil || o.SerialExecution == nil { + var ret SerialExecution + return ret + } + return *o.SerialExecution +} + +// GetSerialExecutionOk returns a tuple with the SerialExecution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentSavedTrigger) GetSerialExecutionOk() (*SerialExecution, bool) { + if o == nil || o.SerialExecution == nil { + return nil, false + } + return o.SerialExecution, true +} + +// HasSerialExecution returns a boolean if a field has been set. +func (o *IncidentSavedTrigger) HasSerialExecution() bool { + return o != nil && o.SerialExecution != nil +} + +// SetSerialExecution gets a reference to the given SerialExecution and assigns it to the SerialExecution field. +func (o *IncidentSavedTrigger) SetSerialExecution(v SerialExecution) { + o.SerialExecution = &v +} + +// GetTagCondition returns the TagCondition field value if set, zero value otherwise. +func (o *IncidentSavedTrigger) 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 *IncidentSavedTrigger) 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 *IncidentSavedTrigger) 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 *IncidentSavedTrigger) SetTagCondition(v IncidentCondition) { + o.TagCondition = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentSavedTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecutionLimit != nil { + toSerialize["executionLimit"] = o.ExecutionLimit + } + if o.IncidentType != nil { + toSerialize["incidentType"] = o.IncidentType + } + if o.SerialExecution != nil { + toSerialize["serialExecution"] = o.SerialExecution + } + 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 *IncidentSavedTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecutionLimit *ExecutionLimit `json:"executionLimit,omitempty"` + IncidentType *string `json:"incidentType,omitempty"` + SerialExecution *SerialExecution `json:"serialExecution,omitempty"` + TagCondition *IncidentCondition `json:"tagCondition,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"executionLimit", "incidentType", "serialExecution", "tagCondition"}) + } else { + return err + } + + hasInvalidField := false + if all.ExecutionLimit != nil && all.ExecutionLimit.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ExecutionLimit = all.ExecutionLimit + o.IncidentType = all.IncidentType + if all.SerialExecution != nil && all.SerialExecution.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SerialExecution = all.SerialExecution + 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_saved_trigger_wrapper.go b/api/datadogV2/model_incident_saved_trigger_wrapper.go new file mode 100644 index 00000000000..4d5a58a1892 --- /dev/null +++ b/api/datadogV2/model_incident_saved_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" +) + +// IncidentSavedTriggerWrapper Schema for an incident declared or updated trigger. +type IncidentSavedTriggerWrapper struct { + // Trigger a workflow when an incident is declared or updated. + IncidentSavedTrigger IncidentSavedTrigger `json:"incidentSavedTrigger"` + // Names of existing workflow 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:"-"` +} + +// NewIncidentSavedTriggerWrapper instantiates a new IncidentSavedTriggerWrapper 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 NewIncidentSavedTriggerWrapper(incidentSavedTrigger IncidentSavedTrigger) *IncidentSavedTriggerWrapper { + this := IncidentSavedTriggerWrapper{} + this.IncidentSavedTrigger = incidentSavedTrigger + return &this +} + +// NewIncidentSavedTriggerWrapperWithDefaults instantiates a new IncidentSavedTriggerWrapper 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 NewIncidentSavedTriggerWrapperWithDefaults() *IncidentSavedTriggerWrapper { + this := IncidentSavedTriggerWrapper{} + return &this +} + +// GetIncidentSavedTrigger returns the IncidentSavedTrigger field value. +func (o *IncidentSavedTriggerWrapper) GetIncidentSavedTrigger() IncidentSavedTrigger { + if o == nil { + var ret IncidentSavedTrigger + return ret + } + return o.IncidentSavedTrigger +} + +// GetIncidentSavedTriggerOk returns a tuple with the IncidentSavedTrigger field value +// and a boolean to check if the value has been set. +func (o *IncidentSavedTriggerWrapper) GetIncidentSavedTriggerOk() (*IncidentSavedTrigger, bool) { + if o == nil { + return nil, false + } + return &o.IncidentSavedTrigger, true +} + +// SetIncidentSavedTrigger sets field value. +func (o *IncidentSavedTriggerWrapper) SetIncidentSavedTrigger(v IncidentSavedTrigger) { + o.IncidentSavedTrigger = v +} + +// GetStartStepNames returns the StartStepNames field value if set, zero value otherwise. +func (o *IncidentSavedTriggerWrapper) 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 *IncidentSavedTriggerWrapper) 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 *IncidentSavedTriggerWrapper) 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 *IncidentSavedTriggerWrapper) SetStartStepNames(v []string) { + o.StartStepNames = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentSavedTriggerWrapper) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incidentSavedTrigger"] = o.IncidentSavedTrigger + 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 *IncidentSavedTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentSavedTrigger *IncidentSavedTrigger `json:"incidentSavedTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentSavedTrigger == nil { + return fmt.Errorf("required field incidentSavedTrigger missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incidentSavedTrigger", "startStepNames"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentSavedTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentSavedTrigger = *all.IncidentSavedTrigger + 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_incident_schedule_trigger.go b/api/datadogV2/model_incident_schedule_trigger.go new file mode 100644 index 00000000000..f9cb5488cfe --- /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 on a schedule for an incident. +type IncidentScheduleTrigger struct { + // The type of incident that triggers the workflow. + IncidentType *string `json:"incidentType,omitempty"` + // The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + Rrule string `json:"rrule"` + // Conditions that determine which incidents trigger the workflow. + 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.UnmarshalUseNumber(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..28b34b49d27 --- /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 trigger. +type IncidentScheduleTriggerWrapper struct { + // Trigger a workflow on a schedule for an incident. + IncidentScheduleTrigger IncidentScheduleTrigger `json:"incidentScheduleTrigger"` + // Names of existing workflow 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.UnmarshalUseNumber(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_incident_tag_value.go b/api/datadogV2/model_incident_tag_value.go new file mode 100644 index 00000000000..52fcfa082be --- /dev/null +++ b/api/datadogV2/model_incident_tag_value.go @@ -0,0 +1,133 @@ +// 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" +) + +// IncidentTagValue An incident tag and its accepted values. +type IncidentTagValue struct { + // The incident tag to match. + Tag string `json:"tag"` + // The accepted values for the incident tag. + Values []string `json:"values"` + // 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:"-"` +} + +// NewIncidentTagValue instantiates a new IncidentTagValue 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 NewIncidentTagValue(tag string, values []string) *IncidentTagValue { + this := IncidentTagValue{} + this.Tag = tag + this.Values = values + return &this +} + +// NewIncidentTagValueWithDefaults instantiates a new IncidentTagValue 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 NewIncidentTagValueWithDefaults() *IncidentTagValue { + this := IncidentTagValue{} + return &this +} + +// GetTag returns the Tag field value. +func (o *IncidentTagValue) GetTag() string { + if o == nil { + var ret string + return ret + } + return o.Tag +} + +// GetTagOk returns a tuple with the Tag field value +// and a boolean to check if the value has been set. +func (o *IncidentTagValue) GetTagOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tag, true +} + +// SetTag sets field value. +func (o *IncidentTagValue) SetTag(v string) { + o.Tag = v +} + +// GetValues returns the Values field value. +func (o *IncidentTagValue) GetValues() []string { + if o == nil { + var ret []string + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value +// and a boolean to check if the value has been set. +func (o *IncidentTagValue) GetValuesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Values, true +} + +// SetValues sets field value. +func (o *IncidentTagValue) SetValues(v []string) { + o.Values = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTagValue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["tag"] = o.Tag + toSerialize["values"] = o.Values + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTagValue) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Tag *string `json:"tag"` + Values *[]string `json:"values"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Tag == nil { + return fmt.Errorf("required field tag missing") + } + if all.Values == nil { + return fmt.Errorf("required field values missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"tag", "values"}) + } else { + return err + } + o.Tag = *all.Tag + o.Values = *all.Values + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_trigger.go b/api/datadogV2/model_incident_trigger.go index 7f604b29c07..9269da2fd75 100644 --- a/api/datadogV2/model_incident_trigger.go +++ b/api/datadogV2/model_incident_trigger.go @@ -8,10 +8,12 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// IncidentTrigger Trigger a workflow from an Incident. For automatic triggering a handle must be configured and the workflow must be published. +// IncidentTrigger Trigger a workflow from an incident. For automatic triggering a handle must be configured and the workflow must be published. type IncidentTrigger struct { // Defines a rate limit for a trigger. RateLimit *TriggerRateLimit `json:"rateLimit,omitempty"` + // Version of the incident manual trigger. + Version *string `json:"version,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:"-"` @@ -62,6 +64,34 @@ func (o *IncidentTrigger) SetRateLimit(v TriggerRateLimit) { o.RateLimit = &v } +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *IncidentTrigger) GetVersion() string { + if o == nil || o.Version == nil { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTrigger) GetVersionOk() (*string, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *IncidentTrigger) HasVersion() bool { + return o != nil && o.Version != nil +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *IncidentTrigger) SetVersion(v string) { + o.Version = &v +} + // MarshalJSON serializes the struct using spec logic. func (o IncidentTrigger) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -71,6 +101,9 @@ func (o IncidentTrigger) MarshalJSON() ([]byte, error) { if o.RateLimit != nil { toSerialize["rateLimit"] = o.RateLimit } + if o.Version != nil { + toSerialize["version"] = o.Version + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -82,13 +115,14 @@ func (o IncidentTrigger) MarshalJSON() ([]byte, error) { func (o *IncidentTrigger) UnmarshalJSON(bytes []byte) (err error) { all := struct { RateLimit *TriggerRateLimit `json:"rateLimit,omitempty"` + Version *string `json:"version,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"rateLimit"}) + datadog.DeleteKeys(additionalProperties, &[]string{"rateLimit", "version"}) } else { return err } @@ -98,6 +132,7 @@ func (o *IncidentTrigger) UnmarshalJSON(bytes []byte) (err error) { hasInvalidField = true } o.RateLimit = all.RateLimit + o.Version = all.Version if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_incident_trigger_wrapper.go b/api/datadogV2/model_incident_trigger_wrapper.go index 217ee39c0c4..d769165fe51 100644 --- a/api/datadogV2/model_incident_trigger_wrapper.go +++ b/api/datadogV2/model_incident_trigger_wrapper.go @@ -10,9 +10,9 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// IncidentTriggerWrapper Schema for an Incident-based trigger. +// IncidentTriggerWrapper Schema for an incident-based trigger. type IncidentTriggerWrapper struct { - // Trigger a workflow from an Incident. For automatic triggering a handle must be configured and the workflow must be published. + // Trigger a workflow from an incident. For automatic triggering a handle must be configured and the workflow must be published. IncidentTrigger IncidentTrigger `json:"incidentTrigger"` // Names of existing workflow steps that run first after a trigger fires. StartStepNames []string `json:"startStepNames,omitempty"` diff --git a/api/datadogV2/model_serial_execution.go b/api/datadogV2/model_serial_execution.go new file mode 100644 index 00000000000..309b9cb0c8d --- /dev/null +++ b/api/datadogV2/model_serial_execution.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" +) + +// SerialExecution Whether to execute the workflow serially for an incident. +type SerialExecution struct { + // Whether serial execution is enabled. + Enabled bool `json:"enabled"` + // 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:"-"` +} + +// NewSerialExecution instantiates a new SerialExecution 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 NewSerialExecution(enabled bool) *SerialExecution { + this := SerialExecution{} + this.Enabled = enabled + return &this +} + +// NewSerialExecutionWithDefaults instantiates a new SerialExecution 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 NewSerialExecutionWithDefaults() *SerialExecution { + this := SerialExecution{} + return &this +} + +// GetEnabled returns the Enabled field value. +func (o *SerialExecution) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *SerialExecution) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value. +func (o *SerialExecution) SetEnabled(v bool) { + o.Enabled = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SerialExecution) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["enabled"] = o.Enabled + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SerialExecution) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Enabled *bool `json:"enabled"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Enabled == nil { + return fmt.Errorf("required field enabled missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"enabled"}) + } else { + return err + } + o.Enabled = *all.Enabled + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_slack_reaction_config.go b/api/datadogV2/model_slack_reaction_config.go new file mode 100644 index 00000000000..edf2f0ce855 --- /dev/null +++ b/api/datadogV2/model_slack_reaction_config.go @@ -0,0 +1,133 @@ +// 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" +) + +// SlackReactionConfig Configuration for a Slack emoji reaction trigger. +type SlackReactionConfig struct { + // The Slack emoji reaction name. + ReactionEmoji string `json:"reactionEmoji"` + // The Slack workspace ID. + TeamId string `json:"teamId"` + // 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:"-"` +} + +// NewSlackReactionConfig instantiates a new SlackReactionConfig 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 NewSlackReactionConfig(reactionEmoji string, teamId string) *SlackReactionConfig { + this := SlackReactionConfig{} + this.ReactionEmoji = reactionEmoji + this.TeamId = teamId + return &this +} + +// NewSlackReactionConfigWithDefaults instantiates a new SlackReactionConfig 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 NewSlackReactionConfigWithDefaults() *SlackReactionConfig { + this := SlackReactionConfig{} + return &this +} + +// GetReactionEmoji returns the ReactionEmoji field value. +func (o *SlackReactionConfig) GetReactionEmoji() string { + if o == nil { + var ret string + return ret + } + return o.ReactionEmoji +} + +// GetReactionEmojiOk returns a tuple with the ReactionEmoji field value +// and a boolean to check if the value has been set. +func (o *SlackReactionConfig) GetReactionEmojiOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ReactionEmoji, true +} + +// SetReactionEmoji sets field value. +func (o *SlackReactionConfig) SetReactionEmoji(v string) { + o.ReactionEmoji = v +} + +// GetTeamId returns the TeamId field value. +func (o *SlackReactionConfig) GetTeamId() string { + if o == nil { + var ret string + return ret + } + return o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value +// and a boolean to check if the value has been set. +func (o *SlackReactionConfig) GetTeamIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TeamId, true +} + +// SetTeamId sets field value. +func (o *SlackReactionConfig) SetTeamId(v string) { + o.TeamId = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SlackReactionConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["reactionEmoji"] = o.ReactionEmoji + toSerialize["teamId"] = o.TeamId + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SlackReactionConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ReactionEmoji *string `json:"reactionEmoji"` + TeamId *string `json:"teamId"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ReactionEmoji == nil { + return fmt.Errorf("required field reactionEmoji missing") + } + if all.TeamId == nil { + return fmt.Errorf("required field teamId missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"reactionEmoji", "teamId"}) + } else { + return err + } + o.ReactionEmoji = *all.ReactionEmoji + o.TeamId = *all.TeamId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_slack_trigger.go b/api/datadogV2/model_slack_trigger.go new file mode 100644 index 00000000000..1577b6674a9 --- /dev/null +++ b/api/datadogV2/model_slack_trigger.go @@ -0,0 +1,102 @@ +// 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" +) + +// SlackTrigger Trigger a workflow from Slack. The workflow must be published. +type SlackTrigger struct { + // Slack emoji reactions that trigger the workflow. + ReactionTriggers []SlackReactionConfig `json:"reactionTriggers,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:"-"` +} + +// NewSlackTrigger instantiates a new SlackTrigger 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 NewSlackTrigger() *SlackTrigger { + this := SlackTrigger{} + return &this +} + +// NewSlackTriggerWithDefaults instantiates a new SlackTrigger 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 NewSlackTriggerWithDefaults() *SlackTrigger { + this := SlackTrigger{} + return &this +} + +// GetReactionTriggers returns the ReactionTriggers field value if set, zero value otherwise. +func (o *SlackTrigger) GetReactionTriggers() []SlackReactionConfig { + if o == nil || o.ReactionTriggers == nil { + var ret []SlackReactionConfig + return ret + } + return o.ReactionTriggers +} + +// GetReactionTriggersOk returns a tuple with the ReactionTriggers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SlackTrigger) GetReactionTriggersOk() (*[]SlackReactionConfig, bool) { + if o == nil || o.ReactionTriggers == nil { + return nil, false + } + return &o.ReactionTriggers, true +} + +// HasReactionTriggers returns a boolean if a field has been set. +func (o *SlackTrigger) HasReactionTriggers() bool { + return o != nil && o.ReactionTriggers != nil +} + +// SetReactionTriggers gets a reference to the given []SlackReactionConfig and assigns it to the ReactionTriggers field. +func (o *SlackTrigger) SetReactionTriggers(v []SlackReactionConfig) { + o.ReactionTriggers = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SlackTrigger) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ReactionTriggers != nil { + toSerialize["reactionTriggers"] = o.ReactionTriggers + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SlackTrigger) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ReactionTriggers []SlackReactionConfig `json:"reactionTriggers,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"reactionTriggers"}) + } else { + return err + } + o.ReactionTriggers = all.ReactionTriggers + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_slack_trigger_wrapper.go b/api/datadogV2/model_slack_trigger_wrapper.go index 6d6dec12095..90ada65ea08 100644 --- a/api/datadogV2/model_slack_trigger_wrapper.go +++ b/api/datadogV2/model_slack_trigger_wrapper.go @@ -13,7 +13,7 @@ import ( // SlackTriggerWrapper Schema for a Slack-based trigger. type SlackTriggerWrapper struct { // Trigger a workflow from Slack. The workflow must be published. - SlackTrigger interface{} `json:"slackTrigger"` + SlackTrigger SlackTrigger `json:"slackTrigger"` // Names of existing workflow 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 @@ -25,7 +25,7 @@ type SlackTriggerWrapper 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 NewSlackTriggerWrapper(slackTrigger interface{}) *SlackTriggerWrapper { +func NewSlackTriggerWrapper(slackTrigger SlackTrigger) *SlackTriggerWrapper { this := SlackTriggerWrapper{} this.SlackTrigger = slackTrigger return &this @@ -40,9 +40,9 @@ func NewSlackTriggerWrapperWithDefaults() *SlackTriggerWrapper { } // GetSlackTrigger returns the SlackTrigger field value. -func (o *SlackTriggerWrapper) GetSlackTrigger() interface{} { +func (o *SlackTriggerWrapper) GetSlackTrigger() SlackTrigger { if o == nil { - var ret interface{} + var ret SlackTrigger return ret } return o.SlackTrigger @@ -50,7 +50,7 @@ func (o *SlackTriggerWrapper) GetSlackTrigger() interface{} { // GetSlackTriggerOk returns a tuple with the SlackTrigger field value // and a boolean to check if the value has been set. -func (o *SlackTriggerWrapper) GetSlackTriggerOk() (*interface{}, bool) { +func (o *SlackTriggerWrapper) GetSlackTriggerOk() (*SlackTrigger, bool) { if o == nil { return nil, false } @@ -58,7 +58,7 @@ func (o *SlackTriggerWrapper) GetSlackTriggerOk() (*interface{}, bool) { } // SetSlackTrigger sets field value. -func (o *SlackTriggerWrapper) SetSlackTrigger(v interface{}) { +func (o *SlackTriggerWrapper) SetSlackTrigger(v SlackTrigger) { o.SlackTrigger = v } @@ -110,8 +110,8 @@ func (o SlackTriggerWrapper) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *SlackTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { all := struct { - SlackTrigger *interface{} `json:"slackTrigger"` - StartStepNames []string `json:"startStepNames,omitempty"` + SlackTrigger *SlackTrigger `json:"slackTrigger"` + StartStepNames []string `json:"startStepNames,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -125,6 +125,11 @@ func (o *SlackTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { } else { return err } + + hasInvalidField := false + if all.SlackTrigger.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } o.SlackTrigger = *all.SlackTrigger o.StartStepNames = all.StartStepNames @@ -132,5 +137,9 @@ func (o *SlackTriggerWrapper) UnmarshalJSON(bytes []byte) (err error) { 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 f96d084957a..b88a582380a 100644 --- a/api/datadogV2/model_trigger.go +++ b/api/datadogV2/model_trigger.go @@ -10,26 +10,33 @@ import ( // Trigger - One of the triggers that can start the execution of a workflow. type Trigger struct { - AgentTriggerWrapper *AgentTriggerWrapper - APITriggerWrapper *APITriggerWrapper - AppTriggerWrapper *AppTriggerWrapper - CaseTriggerWrapper *CaseTriggerWrapper - ChangeEventTriggerWrapper *ChangeEventTriggerWrapper - DatabaseMonitoringTriggerWrapper *DatabaseMonitoringTriggerWrapper - DatastoreTriggerWrapper *DatastoreTriggerWrapper - DashboardTriggerWrapper *DashboardTriggerWrapper - FormTriggerWrapper *FormTriggerWrapper - GithubWebhookTriggerWrapper *GithubWebhookTriggerWrapper - IncidentTriggerWrapper *IncidentTriggerWrapper - MonitorTriggerWrapper *MonitorTriggerWrapper - NotebookTriggerWrapper *NotebookTriggerWrapper - OnCallTriggerWrapper *OnCallTriggerWrapper - ScheduleTriggerWrapper *ScheduleTriggerWrapper - SecurityTriggerWrapper *SecurityTriggerWrapper - SelfServiceTriggerWrapper *SelfServiceTriggerWrapper - SlackTriggerWrapper *SlackTriggerWrapper - SoftwareCatalogTriggerWrapper *SoftwareCatalogTriggerWrapper - WorkflowTriggerWrapper *WorkflowTriggerWrapper + AgentTriggerWrapper *AgentTriggerWrapper + APITriggerWrapper *APITriggerWrapper + AppTriggerWrapper *AppTriggerWrapper + CaseTriggerWrapper *CaseTriggerWrapper + ChangeEventTriggerWrapper *ChangeEventTriggerWrapper + DatabaseMonitoringTriggerWrapper *DatabaseMonitoringTriggerWrapper + DatastoreTriggerWrapper *DatastoreTriggerWrapper + DashboardTriggerWrapper *DashboardTriggerWrapper + FormTriggerWrapper *FormTriggerWrapper + GithubWebhookTriggerWrapper *GithubWebhookTriggerWrapper + IncidentCreatedTriggerWrapper *IncidentCreatedTriggerWrapper + IncidentImpactCreatedTriggerWrapper *IncidentImpactCreatedTriggerWrapper + IncidentImpactUpdatedTriggerWrapper *IncidentImpactUpdatedTriggerWrapper + IncidentPostmortemUpdatedTriggerWrapper *IncidentPostmortemUpdatedTriggerWrapper + IncidentResponderCreatedTriggerWrapper *IncidentResponderCreatedTriggerWrapper + IncidentSavedTriggerWrapper *IncidentSavedTriggerWrapper + IncidentScheduleTriggerWrapper *IncidentScheduleTriggerWrapper + IncidentTriggerWrapper *IncidentTriggerWrapper + MonitorTriggerWrapper *MonitorTriggerWrapper + NotebookTriggerWrapper *NotebookTriggerWrapper + OnCallTriggerWrapper *OnCallTriggerWrapper + ScheduleTriggerWrapper *ScheduleTriggerWrapper + SecurityTriggerWrapper *SecurityTriggerWrapper + SelfServiceTriggerWrapper *SelfServiceTriggerWrapper + SlackTriggerWrapper *SlackTriggerWrapper + SoftwareCatalogTriggerWrapper *SoftwareCatalogTriggerWrapper + WorkflowTriggerWrapper *WorkflowTriggerWrapper // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject interface{} @@ -85,6 +92,41 @@ func GithubWebhookTriggerWrapperAsTrigger(v *GithubWebhookTriggerWrapper) Trigge return Trigger{GithubWebhookTriggerWrapper: v} } +// IncidentCreatedTriggerWrapperAsTrigger is a convenience function that returns IncidentCreatedTriggerWrapper wrapped in Trigger. +func IncidentCreatedTriggerWrapperAsTrigger(v *IncidentCreatedTriggerWrapper) Trigger { + return Trigger{IncidentCreatedTriggerWrapper: v} +} + +// IncidentImpactCreatedTriggerWrapperAsTrigger is a convenience function that returns IncidentImpactCreatedTriggerWrapper wrapped in Trigger. +func IncidentImpactCreatedTriggerWrapperAsTrigger(v *IncidentImpactCreatedTriggerWrapper) Trigger { + return Trigger{IncidentImpactCreatedTriggerWrapper: v} +} + +// IncidentImpactUpdatedTriggerWrapperAsTrigger is a convenience function that returns IncidentImpactUpdatedTriggerWrapper wrapped in Trigger. +func IncidentImpactUpdatedTriggerWrapperAsTrigger(v *IncidentImpactUpdatedTriggerWrapper) Trigger { + return Trigger{IncidentImpactUpdatedTriggerWrapper: v} +} + +// IncidentPostmortemUpdatedTriggerWrapperAsTrigger is a convenience function that returns IncidentPostmortemUpdatedTriggerWrapper wrapped in Trigger. +func IncidentPostmortemUpdatedTriggerWrapperAsTrigger(v *IncidentPostmortemUpdatedTriggerWrapper) Trigger { + return Trigger{IncidentPostmortemUpdatedTriggerWrapper: v} +} + +// IncidentResponderCreatedTriggerWrapperAsTrigger is a convenience function that returns IncidentResponderCreatedTriggerWrapper wrapped in Trigger. +func IncidentResponderCreatedTriggerWrapperAsTrigger(v *IncidentResponderCreatedTriggerWrapper) Trigger { + return Trigger{IncidentResponderCreatedTriggerWrapper: v} +} + +// IncidentSavedTriggerWrapperAsTrigger is a convenience function that returns IncidentSavedTriggerWrapper wrapped in Trigger. +func IncidentSavedTriggerWrapperAsTrigger(v *IncidentSavedTriggerWrapper) Trigger { + return Trigger{IncidentSavedTriggerWrapper: v} +} + +// IncidentScheduleTriggerWrapperAsTrigger is a convenience function that returns IncidentScheduleTriggerWrapper wrapped in Trigger. +func IncidentScheduleTriggerWrapperAsTrigger(v *IncidentScheduleTriggerWrapper) Trigger { + return Trigger{IncidentScheduleTriggerWrapper: v} +} + // IncidentTriggerWrapperAsTrigger is a convenience function that returns IncidentTriggerWrapper wrapped in Trigger. func IncidentTriggerWrapperAsTrigger(v *IncidentTriggerWrapper) Trigger { return Trigger{IncidentTriggerWrapper: v} @@ -309,6 +351,125 @@ func (obj *Trigger) UnmarshalJSON(data []byte) error { obj.GithubWebhookTriggerWrapper = nil } + // try to unmarshal data into IncidentCreatedTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentCreatedTriggerWrapper) + if err == nil { + if obj.IncidentCreatedTriggerWrapper != nil && obj.IncidentCreatedTriggerWrapper.UnparsedObject == nil { + jsonIncidentCreatedTriggerWrapper, _ := datadog.Marshal(obj.IncidentCreatedTriggerWrapper) + if string(jsonIncidentCreatedTriggerWrapper) == "{}" { // empty struct + obj.IncidentCreatedTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentCreatedTriggerWrapper = nil + } + } else { + obj.IncidentCreatedTriggerWrapper = nil + } + + // try to unmarshal data into IncidentImpactCreatedTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentImpactCreatedTriggerWrapper) + if err == nil { + if obj.IncidentImpactCreatedTriggerWrapper != nil && obj.IncidentImpactCreatedTriggerWrapper.UnparsedObject == nil { + jsonIncidentImpactCreatedTriggerWrapper, _ := datadog.Marshal(obj.IncidentImpactCreatedTriggerWrapper) + if string(jsonIncidentImpactCreatedTriggerWrapper) == "{}" { // empty struct + obj.IncidentImpactCreatedTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentImpactCreatedTriggerWrapper = nil + } + } else { + obj.IncidentImpactCreatedTriggerWrapper = nil + } + + // try to unmarshal data into IncidentImpactUpdatedTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentImpactUpdatedTriggerWrapper) + if err == nil { + if obj.IncidentImpactUpdatedTriggerWrapper != nil && obj.IncidentImpactUpdatedTriggerWrapper.UnparsedObject == nil { + jsonIncidentImpactUpdatedTriggerWrapper, _ := datadog.Marshal(obj.IncidentImpactUpdatedTriggerWrapper) + if string(jsonIncidentImpactUpdatedTriggerWrapper) == "{}" { // empty struct + obj.IncidentImpactUpdatedTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentImpactUpdatedTriggerWrapper = nil + } + } else { + obj.IncidentImpactUpdatedTriggerWrapper = nil + } + + // try to unmarshal data into IncidentPostmortemUpdatedTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentPostmortemUpdatedTriggerWrapper) + if err == nil { + if obj.IncidentPostmortemUpdatedTriggerWrapper != nil && obj.IncidentPostmortemUpdatedTriggerWrapper.UnparsedObject == nil { + jsonIncidentPostmortemUpdatedTriggerWrapper, _ := datadog.Marshal(obj.IncidentPostmortemUpdatedTriggerWrapper) + if string(jsonIncidentPostmortemUpdatedTriggerWrapper) == "{}" { // empty struct + obj.IncidentPostmortemUpdatedTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentPostmortemUpdatedTriggerWrapper = nil + } + } else { + obj.IncidentPostmortemUpdatedTriggerWrapper = nil + } + + // try to unmarshal data into IncidentResponderCreatedTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentResponderCreatedTriggerWrapper) + if err == nil { + if obj.IncidentResponderCreatedTriggerWrapper != nil && obj.IncidentResponderCreatedTriggerWrapper.UnparsedObject == nil { + jsonIncidentResponderCreatedTriggerWrapper, _ := datadog.Marshal(obj.IncidentResponderCreatedTriggerWrapper) + if string(jsonIncidentResponderCreatedTriggerWrapper) == "{}" { // empty struct + obj.IncidentResponderCreatedTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentResponderCreatedTriggerWrapper = nil + } + } else { + obj.IncidentResponderCreatedTriggerWrapper = nil + } + + // try to unmarshal data into IncidentSavedTriggerWrapper + err = datadog.Unmarshal(data, &obj.IncidentSavedTriggerWrapper) + if err == nil { + if obj.IncidentSavedTriggerWrapper != nil && obj.IncidentSavedTriggerWrapper.UnparsedObject == nil { + jsonIncidentSavedTriggerWrapper, _ := datadog.Marshal(obj.IncidentSavedTriggerWrapper) + if string(jsonIncidentSavedTriggerWrapper) == "{}" { // empty struct + obj.IncidentSavedTriggerWrapper = nil + } else { + match++ + } + } else { + obj.IncidentSavedTriggerWrapper = nil + } + } else { + obj.IncidentSavedTriggerWrapper = 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 IncidentTriggerWrapper err = datadog.Unmarshal(data, &obj.IncidentTriggerWrapper) if err == nil { @@ -491,6 +652,13 @@ func (obj *Trigger) UnmarshalJSON(data []byte) error { obj.DashboardTriggerWrapper = nil obj.FormTriggerWrapper = nil obj.GithubWebhookTriggerWrapper = nil + obj.IncidentCreatedTriggerWrapper = nil + obj.IncidentImpactCreatedTriggerWrapper = nil + obj.IncidentImpactUpdatedTriggerWrapper = nil + obj.IncidentPostmortemUpdatedTriggerWrapper = nil + obj.IncidentResponderCreatedTriggerWrapper = nil + obj.IncidentSavedTriggerWrapper = nil + obj.IncidentScheduleTriggerWrapper = nil obj.IncidentTriggerWrapper = nil obj.MonitorTriggerWrapper = nil obj.NotebookTriggerWrapper = nil @@ -548,6 +716,34 @@ func (obj Trigger) MarshalJSON() ([]byte, error) { return datadog.Marshal(&obj.GithubWebhookTriggerWrapper) } + if obj.IncidentCreatedTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentCreatedTriggerWrapper) + } + + if obj.IncidentImpactCreatedTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentImpactCreatedTriggerWrapper) + } + + if obj.IncidentImpactUpdatedTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentImpactUpdatedTriggerWrapper) + } + + if obj.IncidentPostmortemUpdatedTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentPostmortemUpdatedTriggerWrapper) + } + + if obj.IncidentResponderCreatedTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentResponderCreatedTriggerWrapper) + } + + if obj.IncidentSavedTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentSavedTriggerWrapper) + } + + if obj.IncidentScheduleTriggerWrapper != nil { + return datadog.Marshal(&obj.IncidentScheduleTriggerWrapper) + } + if obj.IncidentTriggerWrapper != nil { return datadog.Marshal(&obj.IncidentTriggerWrapper) } @@ -636,6 +832,34 @@ func (obj *Trigger) GetActualInstance() interface{} { return obj.GithubWebhookTriggerWrapper } + if obj.IncidentCreatedTriggerWrapper != nil { + return obj.IncidentCreatedTriggerWrapper + } + + if obj.IncidentImpactCreatedTriggerWrapper != nil { + return obj.IncidentImpactCreatedTriggerWrapper + } + + if obj.IncidentImpactUpdatedTriggerWrapper != nil { + return obj.IncidentImpactUpdatedTriggerWrapper + } + + if obj.IncidentPostmortemUpdatedTriggerWrapper != nil { + return obj.IncidentPostmortemUpdatedTriggerWrapper + } + + if obj.IncidentResponderCreatedTriggerWrapper != nil { + return obj.IncidentResponderCreatedTriggerWrapper + } + + if obj.IncidentSavedTriggerWrapper != nil { + return obj.IncidentSavedTriggerWrapper + } + + if obj.IncidentScheduleTriggerWrapper != nil { + return obj.IncidentScheduleTriggerWrapper + } + if obj.IncidentTriggerWrapper != nil { return obj.IncidentTriggerWrapper }