Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53833,6 +53833,10 @@ components:
OnCallTrigger:
description: "Trigger a workflow from an On-Call Page or On-Call Handover. For automatic triggering a handle must be configured and the workflow must be published."
properties:
handle:
description: "The handle used to reference this trigger from On-Call. Required for automatic triggering."
example: ""
type: string
rateLimit:
$ref: "#/components/schemas/TriggerRateLimit"
type: object
Expand Down
37 changes: 36 additions & 1 deletion api/datadogV2/model_on_call_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (

// OnCallTrigger Trigger a workflow from an On-Call Page or On-Call Handover. For automatic triggering a handle must be configured and the workflow must be published.
type OnCallTrigger struct {
// The handle used to reference this trigger from On-Call. Required for automatic triggering.
Handle *string `json:"handle,omitempty"`
// Defines a rate limit for a trigger.
RateLimit *TriggerRateLimit `json:"rateLimit,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand All @@ -34,6 +36,34 @@ func NewOnCallTriggerWithDefaults() *OnCallTrigger {
return &this
}

// GetHandle returns the Handle field value if set, zero value otherwise.
func (o *OnCallTrigger) GetHandle() string {
if o == nil || o.Handle == nil {
var ret string
return ret
}
return *o.Handle
}

// GetHandleOk returns a tuple with the Handle field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OnCallTrigger) GetHandleOk() (*string, bool) {
if o == nil || o.Handle == nil {
return nil, false
}
return o.Handle, true
}

// HasHandle returns a boolean if a field has been set.
func (o *OnCallTrigger) HasHandle() bool {
return o != nil && o.Handle != nil
}

// SetHandle gets a reference to the given string and assigns it to the Handle field.
func (o *OnCallTrigger) SetHandle(v string) {
o.Handle = &v
}

// GetRateLimit returns the RateLimit field value if set, zero value otherwise.
func (o *OnCallTrigger) GetRateLimit() TriggerRateLimit {
if o == nil || o.RateLimit == nil {
Expand Down Expand Up @@ -68,6 +98,9 @@ func (o OnCallTrigger) MarshalJSON() ([]byte, error) {
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.Handle != nil {
toSerialize["handle"] = o.Handle
}
if o.RateLimit != nil {
toSerialize["rateLimit"] = o.RateLimit
}
Expand All @@ -81,19 +114,21 @@ func (o OnCallTrigger) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *OnCallTrigger) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Handle *string `json:"handle,omitempty"`
RateLimit *TriggerRateLimit `json:"rateLimit,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"rateLimit"})
datadog.DeleteKeys(additionalProperties, &[]string{"handle", "rateLimit"})
} else {
return err
}

hasInvalidField := false
o.Handle = all.Handle
if all.RateLimit != nil && all.RateLimit.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
Expand Down
Loading