Skip to content

Commit 1d689df

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
add include parameter to On-Call team rules test (#675)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 4511809 commit 1d689df

13 files changed

+288
-134
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-05-27 10:37:41.623695",
8-
"spec_repo_commit": "c75940cb"
7+
"regenerated": "2025-05-27 15:21:03.071425",
8+
"spec_repo_commit": "97968943"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-27 10:37:41.639599",
13-
"spec_repo_commit": "c75940cb"
12+
"regenerated": "2025-05-27 15:21:03.087333",
13+
"spec_repo_commit": "97968943"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30384,8 +30384,8 @@ components:
3038430384
description: Defines an action that is executed when a routing rule matches
3038530385
certain criteria.
3038630386
oneOf:
30387-
- $ref: '#/components/schemas/SlackAction'
30388-
- $ref: '#/components/schemas/TeamsAction'
30387+
- $ref: '#/components/schemas/SendSlackMessageAction'
30388+
- $ref: '#/components/schemas/SendTeamsMessageAction'
3038930389
RoutingRuleAttributes:
3039030390
description: Defines the configurable attributes of a routing rule, such as
3039130391
actions, query, time restriction, and urgency.
@@ -30401,6 +30401,7 @@ components:
3040130401
type: string
3040230402
time_restriction:
3040330403
$ref: '#/components/schemas/TimeRestrictions'
30404+
nullable: true
3040430405
urgency:
3040530406
$ref: '#/components/schemas/Urgency'
3040630407
type: object
@@ -30416,8 +30417,7 @@ components:
3041630417
properties:
3041730418
data:
3041830419
$ref: '#/components/schemas/RoutingRuleRelationshipsPolicyData'
30419-
required:
30420-
- data
30420+
nullable: true
3042130421
type: object
3042230422
RoutingRuleRelationshipsPolicyData:
3042330423
description: Represents the policy data reference, containing the policy's ID
@@ -34489,6 +34489,65 @@ components:
3448934489
required:
3449034490
- selfServiceTrigger
3449134491
type: object
34492+
SendSlackMessageAction:
34493+
description: Sends a message to a Slack channel.
34494+
properties:
34495+
channel:
34496+
description: The channel ID.
34497+
example: CHANNEL
34498+
type: string
34499+
type:
34500+
$ref: '#/components/schemas/SendSlackMessageActionType'
34501+
workspace:
34502+
description: The workspace ID.
34503+
example: WORKSPACE
34504+
type: string
34505+
required:
34506+
- type
34507+
- channel
34508+
- workspace
34509+
type: object
34510+
SendSlackMessageActionType:
34511+
default: send_slack_message
34512+
description: Indicates that the action is a send Slack message action.
34513+
enum:
34514+
- send_slack_message
34515+
example: send_slack_message
34516+
type: string
34517+
x-enum-varnames:
34518+
- SEND_SLACK_MESSAGE
34519+
SendTeamsMessageAction:
34520+
description: Sends a message to a Microsoft Teams channel.
34521+
properties:
34522+
channel:
34523+
description: The channel ID.
34524+
example: CHANNEL
34525+
type: string
34526+
team:
34527+
description: The team ID.
34528+
example: TEAM
34529+
type: string
34530+
tenant:
34531+
description: The tenant ID.
34532+
example: TENANT
34533+
type: string
34534+
type:
34535+
$ref: '#/components/schemas/SendTeamsMessageActionType'
34536+
required:
34537+
- type
34538+
- channel
34539+
- tenant
34540+
- team
34541+
type: object
34542+
SendTeamsMessageActionType:
34543+
default: send_teams_message
34544+
description: Indicates that the action is a send Microsoft Teams message action.
34545+
enum:
34546+
- send_teams_message
34547+
example: send_teams_message
34548+
type: string
34549+
x-enum-varnames:
34550+
- SEND_TEAMS_MESSAGE
3449234551
SensitiveDataScannerConfigRequest:
3449334552
description: Group reorder request.
3449434553
properties:
@@ -36396,26 +36455,6 @@ components:
3639636455
type: string
3639736456
x-enum-varnames:
3639836457
- AGGREGATED_CONNECTION
36399-
SlackAction:
36400-
description: Sends a message to a Slack channel.
36401-
properties:
36402-
channel:
36403-
description: The channel ID.
36404-
example: CHANNEL
36405-
type: string
36406-
type:
36407-
description: Must be set to "send_slack_message".
36408-
example: send_slack_message
36409-
type: string
36410-
workspace:
36411-
description: The workspace ID.
36412-
example: WORKSPACE
36413-
type: string
36414-
required:
36415-
- type
36416-
- channel
36417-
- workspace
36418-
type: object
3641936458
SlackIntegrationMetadata:
3642036459
description: Incident integration metadata for the Slack integration.
3642136460
properties:
@@ -38330,31 +38369,6 @@ components:
3833038369
required:
3833138370
- data
3833238371
type: object
38333-
TeamsAction:
38334-
description: Sends a message to a Microsoft Teams channel.
38335-
properties:
38336-
channel:
38337-
description: The channel ID.
38338-
example: CHANNEL
38339-
type: string
38340-
team:
38341-
description: The team ID.
38342-
example: TEAM
38343-
type: string
38344-
tenant:
38345-
description: The tenant ID.
38346-
example: TENANT
38347-
type: string
38348-
type:
38349-
description: Must be set to "send_teams_message".
38350-
example: send_teams_message
38351-
type: string
38352-
required:
38353-
- type
38354-
- channel
38355-
- tenant
38356-
- team
38357-
type: object
3835838372
TeamsField:
3835938373
description: Supported teams field.
3836038374
enum:

examples/v2_on-call_SetOnCallTeamRoutingRules.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use datadog_api_client::datadog;
33
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
44
use datadog_api_client::datadogV2::api_on_call::SetOnCallTeamRoutingRulesOptionalParams;
55
use datadog_api_client::datadogV2::model::RoutingRuleAction;
6-
use datadog_api_client::datadogV2::model::SlackAction;
6+
use datadog_api_client::datadogV2::model::SendSlackMessageAction;
7+
use datadog_api_client::datadogV2::model::SendSlackMessageActionType;
78
use datadog_api_client::datadogV2::model::TeamRoutingRulesRequest;
89
use datadog_api_client::datadogV2::model::TeamRoutingRulesRequestData;
910
use datadog_api_client::datadogV2::model::TeamRoutingRulesRequestDataAttributes;
@@ -27,11 +28,11 @@ async fn main() {
2728
TeamRoutingRulesRequestRule::new()
2829
.actions(
2930
vec![
30-
RoutingRuleAction::SlackAction(
31+
RoutingRuleAction::SendSlackMessageAction(
3132
Box::new(
32-
SlackAction::new(
33+
SendSlackMessageAction::new(
3334
"channel".to_string(),
34-
"send_slack_message".to_string(),
35+
SendSlackMessageActionType::SEND_SLACK_MESSAGE,
3536
"workspace".to_string(),
3637
),
3738
),
@@ -55,8 +56,7 @@ async fn main() {
5556
],
5657
"Europe/Paris".to_string(),
5758
),
58-
)
59-
.urgency(Urgency::HIGH),
59+
),
6060
TeamRoutingRulesRequestRule::new()
6161
.policy_id(escalation_policy_data_id.clone())
6262
.query("".to_string())
@@ -70,7 +70,7 @@ async fn main() {
7070
.set_on_call_team_routing_rules(
7171
dd_team_data_id.clone(),
7272
body,
73-
SetOnCallTeamRoutingRulesOptionalParams::default(),
73+
SetOnCallTeamRoutingRulesOptionalParams::default().include("rules".to_string()),
7474
)
7575
.await;
7676
if let Ok(value) = resp {

src/datadogV2/model/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,10 +2836,14 @@ pub mod model_routing_rule;
28362836
pub use self::model_routing_rule::RoutingRule;
28372837
pub mod model_routing_rule_attributes;
28382838
pub use self::model_routing_rule_attributes::RoutingRuleAttributes;
2839-
pub mod model_slack_action;
2840-
pub use self::model_slack_action::SlackAction;
2841-
pub mod model_teams_action;
2842-
pub use self::model_teams_action::TeamsAction;
2839+
pub mod model_send_slack_message_action;
2840+
pub use self::model_send_slack_message_action::SendSlackMessageAction;
2841+
pub mod model_send_slack_message_action_type;
2842+
pub use self::model_send_slack_message_action_type::SendSlackMessageActionType;
2843+
pub mod model_send_teams_message_action;
2844+
pub use self::model_send_teams_message_action::SendTeamsMessageAction;
2845+
pub mod model_send_teams_message_action_type;
2846+
pub use self::model_send_teams_message_action_type::SendTeamsMessageActionType;
28432847
pub mod model_routing_rule_action;
28442848
pub use self::model_routing_rule_action::RoutingRuleAction;
28452849
pub mod model_time_restrictions;

src/datadogV2/model/model_routing_rule_action.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use serde::{Deserialize, Deserializer, Serialize};
88
#[derive(Clone, Debug, PartialEq, Serialize)]
99
#[serde(untagged)]
1010
pub enum RoutingRuleAction {
11-
SlackAction(Box<crate::datadogV2::model::SlackAction>),
12-
TeamsAction(Box<crate::datadogV2::model::TeamsAction>),
11+
SendSlackMessageAction(Box<crate::datadogV2::model::SendSlackMessageAction>),
12+
SendTeamsMessageAction(Box<crate::datadogV2::model::SendTeamsMessageAction>),
1313
UnparsedObject(crate::datadog::UnparsedObject),
1414
}
1515

@@ -19,18 +19,18 @@ impl<'de> Deserialize<'de> for RoutingRuleAction {
1919
D: Deserializer<'de>,
2020
{
2121
let value: serde_json::Value = Deserialize::deserialize(deserializer)?;
22-
if let Ok(_v) =
23-
serde_json::from_value::<Box<crate::datadogV2::model::SlackAction>>(value.clone())
24-
{
22+
if let Ok(_v) = serde_json::from_value::<Box<crate::datadogV2::model::SendSlackMessageAction>>(
23+
value.clone(),
24+
) {
2525
if !_v._unparsed {
26-
return Ok(RoutingRuleAction::SlackAction(_v));
26+
return Ok(RoutingRuleAction::SendSlackMessageAction(_v));
2727
}
2828
}
29-
if let Ok(_v) =
30-
serde_json::from_value::<Box<crate::datadogV2::model::TeamsAction>>(value.clone())
31-
{
29+
if let Ok(_v) = serde_json::from_value::<Box<crate::datadogV2::model::SendTeamsMessageAction>>(
30+
value.clone(),
31+
) {
3232
if !_v._unparsed {
33-
return Ok(RoutingRuleAction::TeamsAction(_v));
33+
return Ok(RoutingRuleAction::SendTeamsMessageAction(_v));
3434
}
3535
}
3636

src/datadogV2/model/model_routing_rule_relationships_policy.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::fmt::{self, Formatter};
1313
pub struct RoutingRuleRelationshipsPolicy {
1414
/// Represents the policy data reference, containing the policy's ID and resource type.
1515
#[serde(rename = "data")]
16-
pub data: crate::datadogV2::model::RoutingRuleRelationshipsPolicyData,
16+
pub data: Option<crate::datadogV2::model::RoutingRuleRelationshipsPolicyData>,
1717
#[serde(flatten)]
1818
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
1919
#[serde(skip)]
@@ -22,16 +22,22 @@ pub struct RoutingRuleRelationshipsPolicy {
2222
}
2323

2424
impl RoutingRuleRelationshipsPolicy {
25-
pub fn new(
26-
data: crate::datadogV2::model::RoutingRuleRelationshipsPolicyData,
27-
) -> RoutingRuleRelationshipsPolicy {
25+
pub fn new() -> RoutingRuleRelationshipsPolicy {
2826
RoutingRuleRelationshipsPolicy {
29-
data,
27+
data: None,
3028
additional_properties: std::collections::BTreeMap::new(),
3129
_unparsed: false,
3230
}
3331
}
3432

33+
pub fn data(
34+
mut self,
35+
value: crate::datadogV2::model::RoutingRuleRelationshipsPolicyData,
36+
) -> Self {
37+
self.data = Some(value);
38+
self
39+
}
40+
3541
pub fn additional_properties(
3642
mut self,
3743
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -41,6 +47,12 @@ impl RoutingRuleRelationshipsPolicy {
4147
}
4248
}
4349

50+
impl Default for RoutingRuleRelationshipsPolicy {
51+
fn default() -> Self {
52+
Self::new()
53+
}
54+
}
55+
4456
impl<'de> Deserialize<'de> for RoutingRuleRelationshipsPolicy {
4557
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
4658
where
@@ -69,6 +81,9 @@ impl<'de> Deserialize<'de> for RoutingRuleRelationshipsPolicy {
6981
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
7082
match k.as_str() {
7183
"data" => {
84+
if v.is_null() {
85+
continue;
86+
}
7287
data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
7388
}
7489
&_ => {
@@ -78,7 +93,6 @@ impl<'de> Deserialize<'de> for RoutingRuleRelationshipsPolicy {
7893
}
7994
}
8095
}
81-
let data = data.ok_or_else(|| M::Error::missing_field("data"))?;
8296

8397
let content = RoutingRuleRelationshipsPolicy {
8498
data,

0 commit comments

Comments
 (0)