Skip to content

Commit f4faebe

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ddcc2f9 of spec repo
1 parent 06993f6 commit f4faebe

5 files changed

Lines changed: 199 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 23 additions & 0 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:
@@ -79361,6 +79362,28 @@ components:
7936179362
type: string
7936279363
x-enum-varnames:
7936379364
- MONITOR_ALERT_TRIGGER
79365+
TriggerWorkflowAutomationAction:
79366+
description: "Triggers a Workflow Automation."
79367+
properties:
79368+
handle:
79369+
description: "The handle of the Workflow Automation to trigger."
79370+
example: my-workflow-handle
79371+
type: string
79372+
type:
79373+
$ref: "#/components/schemas/TriggerWorkflowAutomationActionType"
79374+
required:
79375+
- type
79376+
- handle
79377+
type: object
79378+
TriggerWorkflowAutomationActionType:
79379+
default: workflow
79380+
description: "Indicates that the action triggers a Workflow Automation."
79381+
enum:
79382+
- workflow
79383+
example: workflow
79384+
type: string
79385+
x-enum-varnames:
79386+
- TRIGGER_WORKFLOW_AUTOMATION
7936479387
UCConfigPair:
7936579388
description: The definition of `UCConfigPair` object.
7936679389
example:

src/datadogV2/model/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6210,6 +6210,10 @@ pub mod model_send_teams_message_action;
62106210
pub use self::model_send_teams_message_action::SendTeamsMessageAction;
62116211
pub mod model_send_teams_message_action_type;
62126212
pub use self::model_send_teams_message_action_type::SendTeamsMessageActionType;
6213+
pub mod model_trigger_workflow_automation_action;
6214+
pub use self::model_trigger_workflow_automation_action::TriggerWorkflowAutomationAction;
6215+
pub mod model_trigger_workflow_automation_action_type;
6216+
pub use self::model_trigger_workflow_automation_action_type::TriggerWorkflowAutomationActionType;
62136217
pub mod model_routing_rule_action;
62146218
pub use self::model_routing_rule_action::RoutingRuleAction;
62156219
pub mod model_time_restrictions;

src/datadogV2/model/model_routing_rule_action.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use serde::{Deserialize, Deserializer, Serialize};
1010
pub enum RoutingRuleAction {
1111
SendSlackMessageAction(Box<crate::datadogV2::model::SendSlackMessageAction>),
1212
SendTeamsMessageAction(Box<crate::datadogV2::model::SendTeamsMessageAction>),
13+
TriggerWorkflowAutomationAction(Box<crate::datadogV2::model::TriggerWorkflowAutomationAction>),
1314
UnparsedObject(crate::datadog::UnparsedObject),
1415
}
1516

@@ -33,6 +34,14 @@ impl<'de> Deserialize<'de> for RoutingRuleAction {
3334
return Ok(RoutingRuleAction::SendTeamsMessageAction(_v));
3435
}
3536
}
37+
if let Ok(_v) = serde_json::from_value::<
38+
Box<crate::datadogV2::model::TriggerWorkflowAutomationAction>,
39+
>(value.clone())
40+
{
41+
if !_v._unparsed {
42+
return Ok(RoutingRuleAction::TriggerWorkflowAutomationAction(_v));
43+
}
44+
}
3645

3746
return Ok(RoutingRuleAction::UnparsedObject(
3847
crate::datadog::UnparsedObject { value },
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// Triggers a Workflow Automation.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct TriggerWorkflowAutomationAction {
14+
/// The handle of the Workflow Automation to trigger.
15+
#[serde(rename = "handle")]
16+
pub handle: String,
17+
/// Indicates that the action triggers a Workflow Automation.
18+
#[serde(rename = "type")]
19+
pub type_: crate::datadogV2::model::TriggerWorkflowAutomationActionType,
20+
#[serde(flatten)]
21+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
22+
#[serde(skip)]
23+
#[serde(default)]
24+
pub(crate) _unparsed: bool,
25+
}
26+
27+
impl TriggerWorkflowAutomationAction {
28+
pub fn new(
29+
handle: String,
30+
type_: crate::datadogV2::model::TriggerWorkflowAutomationActionType,
31+
) -> TriggerWorkflowAutomationAction {
32+
TriggerWorkflowAutomationAction {
33+
handle,
34+
type_,
35+
additional_properties: std::collections::BTreeMap::new(),
36+
_unparsed: false,
37+
}
38+
}
39+
40+
pub fn additional_properties(
41+
mut self,
42+
value: std::collections::BTreeMap<String, serde_json::Value>,
43+
) -> Self {
44+
self.additional_properties = value;
45+
self
46+
}
47+
}
48+
49+
impl<'de> Deserialize<'de> for TriggerWorkflowAutomationAction {
50+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
51+
where
52+
D: Deserializer<'de>,
53+
{
54+
struct TriggerWorkflowAutomationActionVisitor;
55+
impl<'a> Visitor<'a> for TriggerWorkflowAutomationActionVisitor {
56+
type Value = TriggerWorkflowAutomationAction;
57+
58+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
59+
f.write_str("a mapping")
60+
}
61+
62+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
63+
where
64+
M: MapAccess<'a>,
65+
{
66+
let mut handle: Option<String> = None;
67+
let mut type_: Option<
68+
crate::datadogV2::model::TriggerWorkflowAutomationActionType,
69+
> = None;
70+
let mut additional_properties: std::collections::BTreeMap<
71+
String,
72+
serde_json::Value,
73+
> = std::collections::BTreeMap::new();
74+
let mut _unparsed = false;
75+
76+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
77+
match k.as_str() {
78+
"handle" => {
79+
handle = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
80+
}
81+
"type" => {
82+
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
83+
if let Some(ref _type_) = type_ {
84+
match _type_ {
85+
crate::datadogV2::model::TriggerWorkflowAutomationActionType::UnparsedObject(_type_) => {
86+
_unparsed = true;
87+
},
88+
_ => {}
89+
}
90+
}
91+
}
92+
&_ => {
93+
if let Ok(value) = serde_json::from_value(v.clone()) {
94+
additional_properties.insert(k, value);
95+
}
96+
}
97+
}
98+
}
99+
let handle = handle.ok_or_else(|| M::Error::missing_field("handle"))?;
100+
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
101+
102+
let content = TriggerWorkflowAutomationAction {
103+
handle,
104+
type_,
105+
additional_properties,
106+
_unparsed,
107+
};
108+
109+
Ok(content)
110+
}
111+
}
112+
113+
deserializer.deserialize_any(TriggerWorkflowAutomationActionVisitor)
114+
}
115+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
6+
7+
#[non_exhaustive]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
9+
pub enum TriggerWorkflowAutomationActionType {
10+
TRIGGER_WORKFLOW_AUTOMATION,
11+
UnparsedObject(crate::datadog::UnparsedObject),
12+
}
13+
14+
impl ToString for TriggerWorkflowAutomationActionType {
15+
fn to_string(&self) -> String {
16+
match self {
17+
Self::TRIGGER_WORKFLOW_AUTOMATION => String::from("workflow"),
18+
Self::UnparsedObject(v) => v.value.to_string(),
19+
}
20+
}
21+
}
22+
23+
impl Serialize for TriggerWorkflowAutomationActionType {
24+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
25+
where
26+
S: Serializer,
27+
{
28+
match self {
29+
Self::UnparsedObject(v) => v.serialize(serializer),
30+
_ => serializer.serialize_str(self.to_string().as_str()),
31+
}
32+
}
33+
}
34+
35+
impl<'de> Deserialize<'de> for TriggerWorkflowAutomationActionType {
36+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
37+
where
38+
D: Deserializer<'de>,
39+
{
40+
let s: String = String::deserialize(deserializer)?;
41+
Ok(match s.as_str() {
42+
"workflow" => Self::TRIGGER_WORKFLOW_AUTOMATION,
43+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
44+
value: serde_json::Value::String(s.into()),
45+
}),
46+
})
47+
}
48+
}

0 commit comments

Comments
 (0)