Skip to content

Commit 51627a6

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit e9b245e of spec repo
1 parent a71b122 commit 51627a6

4 files changed

Lines changed: 272 additions & 63 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 29 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -59622,6 +59622,7 @@ components:
5962259622
oneOf:
5962359623
- $ref: "#/components/schemas/SendSlackMessageAction"
5962459624
- $ref: "#/components/schemas/SendTeamsMessageAction"
59625+
- $ref: "#/components/schemas/TriggerWorkflowAutomationAction"
5962559626
RoutingRuleAttributes:
5962659627
description: Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency.
5962759628
properties:
@@ -79418,6 +79419,28 @@ components:
7941879419
type: string
7941979420
x-enum-varnames:
7942079421
- MONITOR_ALERT_TRIGGER
79422+
TriggerWorkflowAutomationAction:
79423+
description: "Triggers a Workflow Automation."
79424+
properties:
79425+
handle:
79426+
description: "The handle of the Workflow Automation to trigger."
79427+
example: my-workflow-handle
79428+
type: string
79429+
type:
79430+
$ref: "#/components/schemas/TriggerWorkflowAutomationActionType"
79431+
required:
79432+
- type
79433+
- handle
79434+
type: object
79435+
TriggerWorkflowAutomationActionType:
79436+
default: workflow
79437+
description: "Indicates that the action triggers a Workflow Automation."
79438+
enum:
79439+
- workflow
79440+
example: workflow
79441+
type: string
79442+
x-enum-varnames:
79443+
- TRIGGER_WORKFLOW_AUTOMATION
7942179444
UCConfigPair:
7942279445
description: The definition of `UCConfigPair` object.
7942379446
example:
@@ -134695,45 +134718,16 @@ paths:
134695134718
application/json:
134696134719
examples:
134697134720
default:
134698-
summary: CCM cost summary widget
134699134721
value:
134700134722
data:
134701134723
attributes:
134702134724
definition:
134703-
graph_options:
134704-
- type: query_value
134705-
view: total
134706-
- type: query_value
134707-
view: change
134708-
- display_type: bars
134709-
type: timeseries
134710-
- type: cloud_cost_table
134711-
view: summary
134712-
requests:
134713-
- formulas:
134714-
- formula: query1
134715-
queries:
134716-
- data_source: cloud_cost
134717-
name: query1
134718-
query: sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)
134719-
response_format: timeseries
134720-
time:
134721-
type: live
134722-
unit: day
134723-
value: 30
134724-
title: AWS spend by service (last 30 days)
134725-
type: cloud_cost_summary
134726-
tags: ["finops", "aws"]
134725+
title: My Widget
134726+
type: bar_chart
134727134727
type: widgets
134728134728
schema:
134729134729
$ref: "#/components/schemas/CreateOrUpdateWidgetRequest"
134730-
description: |-
134731-
Widget request body. The `definition` object's required fields vary
134732-
by `widget.definition.type`: every type requires `requests`, and
134733-
some types require additional fields (e.g. `cloud_cost_summary`
134734-
requires `graph_options`, `geomap` requires `style` and `view`).
134735-
The example below shows a complete `cloud_cost_summary` payload
134736-
for the `ccm_reports` experience type.
134730+
description: Widget request body.
134737134731
required: true
134738134732
responses:
134739134733
"200":
@@ -134903,42 +134897,16 @@ paths:
134903134897
application/json:
134904134898
examples:
134905134899
default:
134906-
summary: CCM cost summary widget
134907134900
value:
134908134901
data:
134909134902
attributes:
134910134903
definition:
134911-
graph_options:
134912-
- type: query_value
134913-
view: total
134914-
- type: query_value
134915-
view: change
134916-
- display_type: bars
134917-
type: timeseries
134918-
- type: cloud_cost_table
134919-
view: summary
134920-
requests:
134921-
- formulas:
134922-
- formula: query1
134923-
queries:
134924-
- data_source: cloud_cost
134925-
name: query1
134926-
query: sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, daily)
134927-
response_format: timeseries
134928-
time:
134929-
type: live
134930-
unit: day
134931-
value: 30
134932-
title: AWS spend by service (last 30 days)
134933-
type: cloud_cost_summary
134934-
tags: ["finops", "aws"]
134904+
title: My Widget
134905+
type: bar_chart
134935134906
type: widgets
134936134907
schema:
134937134908
$ref: "#/components/schemas/CreateOrUpdateWidgetRequest"
134938-
description: |-
134939-
Widget request body. The `definition` object's required fields vary
134940-
by `widget.definition.type`; see `CreateWidget` above for a complete
134941-
worked payload. Update is a full replacement of the widget definition.
134909+
description: Widget request body.
134942134910
required: true
134943134911
responses:
134944134912
"200":

api/datadogV2/model_routing_rule_action.go

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import (
1010

1111
// RoutingRuleAction - Defines an action that is executed when a routing rule matches certain criteria.
1212
type RoutingRuleAction struct {
13-
SendSlackMessageAction *SendSlackMessageAction
14-
SendTeamsMessageAction *SendTeamsMessageAction
13+
SendSlackMessageAction *SendSlackMessageAction
14+
SendTeamsMessageAction *SendTeamsMessageAction
15+
TriggerWorkflowAutomationAction *TriggerWorkflowAutomationAction
1516

1617
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1718
UnparsedObject interface{}
@@ -27,6 +28,11 @@ func SendTeamsMessageActionAsRoutingRuleAction(v *SendTeamsMessageAction) Routin
2728
return RoutingRuleAction{SendTeamsMessageAction: v}
2829
}
2930

31+
// TriggerWorkflowAutomationActionAsRoutingRuleAction is a convenience function that returns TriggerWorkflowAutomationAction wrapped in RoutingRuleAction.
32+
func TriggerWorkflowAutomationActionAsRoutingRuleAction(v *TriggerWorkflowAutomationAction) RoutingRuleAction {
33+
return RoutingRuleAction{TriggerWorkflowAutomationAction: v}
34+
}
35+
3036
// UnmarshalJSON turns data into one of the pointers in the struct.
3137
func (obj *RoutingRuleAction) UnmarshalJSON(data []byte) error {
3238
var err error
@@ -65,10 +71,28 @@ func (obj *RoutingRuleAction) UnmarshalJSON(data []byte) error {
6571
obj.SendTeamsMessageAction = nil
6672
}
6773

74+
// try to unmarshal data into TriggerWorkflowAutomationAction
75+
err = datadog.Unmarshal(data, &obj.TriggerWorkflowAutomationAction)
76+
if err == nil {
77+
if obj.TriggerWorkflowAutomationAction != nil && obj.TriggerWorkflowAutomationAction.UnparsedObject == nil {
78+
jsonTriggerWorkflowAutomationAction, _ := datadog.Marshal(obj.TriggerWorkflowAutomationAction)
79+
if string(jsonTriggerWorkflowAutomationAction) == "{}" { // empty struct
80+
obj.TriggerWorkflowAutomationAction = nil
81+
} else {
82+
match++
83+
}
84+
} else {
85+
obj.TriggerWorkflowAutomationAction = nil
86+
}
87+
} else {
88+
obj.TriggerWorkflowAutomationAction = nil
89+
}
90+
6891
if match != 1 { // more than 1 match
6992
// reset to nil
7093
obj.SendSlackMessageAction = nil
7194
obj.SendTeamsMessageAction = nil
95+
obj.TriggerWorkflowAutomationAction = nil
7296
return datadog.Unmarshal(data, &obj.UnparsedObject)
7397
}
7498
return nil // exactly one match
@@ -84,6 +108,10 @@ func (obj RoutingRuleAction) MarshalJSON() ([]byte, error) {
84108
return datadog.Marshal(&obj.SendTeamsMessageAction)
85109
}
86110

111+
if obj.TriggerWorkflowAutomationAction != nil {
112+
return datadog.Marshal(&obj.TriggerWorkflowAutomationAction)
113+
}
114+
87115
if obj.UnparsedObject != nil {
88116
return datadog.Marshal(obj.UnparsedObject)
89117
}
@@ -100,6 +128,10 @@ func (obj *RoutingRuleAction) GetActualInstance() interface{} {
100128
return obj.SendTeamsMessageAction
101129
}
102130

131+
if obj.TriggerWorkflowAutomationAction != nil {
132+
return obj.TriggerWorkflowAutomationAction
133+
}
134+
103135
// all schemas are nil
104136
return nil
105137
}
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// TriggerWorkflowAutomationAction Triggers a Workflow Automation.
14+
type TriggerWorkflowAutomationAction struct {
15+
// The handle of the Workflow Automation to trigger.
16+
Handle string `json:"handle"`
17+
// Indicates that the action triggers a Workflow Automation.
18+
Type TriggerWorkflowAutomationActionType `json:"type"`
19+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
20+
UnparsedObject map[string]interface{} `json:"-"`
21+
AdditionalProperties map[string]interface{} `json:"-"`
22+
}
23+
24+
// NewTriggerWorkflowAutomationAction instantiates a new TriggerWorkflowAutomationAction object.
25+
// This constructor will assign default values to properties that have it defined,
26+
// and makes sure properties required by API are set, but the set of arguments
27+
// will change when the set of required properties is changed.
28+
func NewTriggerWorkflowAutomationAction(handle string, typeVar TriggerWorkflowAutomationActionType) *TriggerWorkflowAutomationAction {
29+
this := TriggerWorkflowAutomationAction{}
30+
this.Handle = handle
31+
this.Type = typeVar
32+
return &this
33+
}
34+
35+
// NewTriggerWorkflowAutomationActionWithDefaults instantiates a new TriggerWorkflowAutomationAction object.
36+
// This constructor will only assign default values to properties that have it defined,
37+
// but it doesn't guarantee that properties required by API are set.
38+
func NewTriggerWorkflowAutomationActionWithDefaults() *TriggerWorkflowAutomationAction {
39+
this := TriggerWorkflowAutomationAction{}
40+
var typeVar TriggerWorkflowAutomationActionType = TRIGGERWORKFLOWAUTOMATIONACTIONTYPE_TRIGGER_WORKFLOW_AUTOMATION
41+
this.Type = typeVar
42+
return &this
43+
}
44+
45+
// GetHandle returns the Handle field value.
46+
func (o *TriggerWorkflowAutomationAction) GetHandle() string {
47+
if o == nil {
48+
var ret string
49+
return ret
50+
}
51+
return o.Handle
52+
}
53+
54+
// GetHandleOk returns a tuple with the Handle field value
55+
// and a boolean to check if the value has been set.
56+
func (o *TriggerWorkflowAutomationAction) GetHandleOk() (*string, bool) {
57+
if o == nil {
58+
return nil, false
59+
}
60+
return &o.Handle, true
61+
}
62+
63+
// SetHandle sets field value.
64+
func (o *TriggerWorkflowAutomationAction) SetHandle(v string) {
65+
o.Handle = v
66+
}
67+
68+
// GetType returns the Type field value.
69+
func (o *TriggerWorkflowAutomationAction) GetType() TriggerWorkflowAutomationActionType {
70+
if o == nil {
71+
var ret TriggerWorkflowAutomationActionType
72+
return ret
73+
}
74+
return o.Type
75+
}
76+
77+
// GetTypeOk returns a tuple with the Type field value
78+
// and a boolean to check if the value has been set.
79+
func (o *TriggerWorkflowAutomationAction) GetTypeOk() (*TriggerWorkflowAutomationActionType, bool) {
80+
if o == nil {
81+
return nil, false
82+
}
83+
return &o.Type, true
84+
}
85+
86+
// SetType sets field value.
87+
func (o *TriggerWorkflowAutomationAction) SetType(v TriggerWorkflowAutomationActionType) {
88+
o.Type = v
89+
}
90+
91+
// MarshalJSON serializes the struct using spec logic.
92+
func (o TriggerWorkflowAutomationAction) MarshalJSON() ([]byte, error) {
93+
toSerialize := map[string]interface{}{}
94+
if o.UnparsedObject != nil {
95+
return datadog.Marshal(o.UnparsedObject)
96+
}
97+
toSerialize["handle"] = o.Handle
98+
toSerialize["type"] = o.Type
99+
100+
for key, value := range o.AdditionalProperties {
101+
toSerialize[key] = value
102+
}
103+
return datadog.Marshal(toSerialize)
104+
}
105+
106+
// UnmarshalJSON deserializes the given payload.
107+
func (o *TriggerWorkflowAutomationAction) UnmarshalJSON(bytes []byte) (err error) {
108+
all := struct {
109+
Handle *string `json:"handle"`
110+
Type *TriggerWorkflowAutomationActionType `json:"type"`
111+
}{}
112+
if err = datadog.Unmarshal(bytes, &all); err != nil {
113+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
114+
}
115+
if all.Handle == nil {
116+
return fmt.Errorf("required field handle missing")
117+
}
118+
if all.Type == nil {
119+
return fmt.Errorf("required field type missing")
120+
}
121+
additionalProperties := make(map[string]interface{})
122+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
123+
datadog.DeleteKeys(additionalProperties, &[]string{"handle", "type"})
124+
} else {
125+
return err
126+
}
127+
128+
hasInvalidField := false
129+
o.Handle = *all.Handle
130+
if !all.Type.IsValid() {
131+
hasInvalidField = true
132+
} else {
133+
o.Type = *all.Type
134+
}
135+
136+
if len(additionalProperties) > 0 {
137+
o.AdditionalProperties = additionalProperties
138+
}
139+
140+
if hasInvalidField {
141+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
142+
}
143+
144+
return nil
145+
}

0 commit comments

Comments
 (0)