Skip to content

Commit 23ecfb2

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Set required properties for schedules in OnCall API (#610)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 3f4491f commit 23ecfb2

18 files changed

+201
-414
lines changed

.apigentools-info

+4-4
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-04-16 20:33:07.120749",
8-
"spec_repo_commit": "9708d631"
7+
"regenerated": "2025-04-17 13:26:14.663007",
8+
"spec_repo_commit": "12ab5180"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-04-16 20:33:07.136788",
13-
"spec_repo_commit": "9708d631"
12+
"regenerated": "2025-04-17 13:26:14.680427",
13+
"spec_repo_commit": "12ab5180"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -18206,6 +18206,8 @@ components:
1820618206
$ref: '#/components/schemas/LayerRelationships'
1820718207
type:
1820818208
$ref: '#/components/schemas/LayerType'
18209+
required:
18210+
- type
1820918211
type: object
1821018212
LayerAttributes:
1821118213
description: Describes key properties of a Layer, including rotation details,
@@ -18339,12 +18341,16 @@ components:
1833918341
type: string
1834018342
type:
1834118343
$ref: '#/components/schemas/LayerRelationshipsMembersDataItemsType'
18344+
required:
18345+
- type
18346+
- id
1834218347
type: object
1834318348
LayerRelationshipsMembersDataItemsType:
1834418349
default: members
1834518350
description: Members resource type.
1834618351
enum:
1834718352
- members
18353+
example: members
1834818354
type: string
1834918355
x-enum-varnames:
1835018356
- MEMBERS
@@ -18353,6 +18359,7 @@ components:
1835318359
description: Layers resource type.
1835418360
enum:
1835518361
- layers
18362+
example: layers
1835618363
type: string
1835718364
x-enum-varnames:
1835818365
- LAYERS
@@ -28179,15 +28186,20 @@ components:
2817928186
properties:
2818028187
id:
2818128188
description: A unique identifier for the team.
28189+
example: ''
2818228190
type: string
2818328191
type:
2818428192
$ref: '#/components/schemas/ScheduleCreateRequestDataRelationshipsTeamsDataItemsType'
28193+
required:
28194+
- type
28195+
- id
2818528196
type: object
2818628197
ScheduleCreateRequestDataRelationshipsTeamsDataItemsType:
2818728198
default: teams
2818828199
description: Teams resource type.
2818928200
enum:
2819028201
- teams
28202+
example: teams
2819128203
type: string
2819228204
x-enum-varnames:
2819328205
- TEAMS
@@ -28214,6 +28226,8 @@ components:
2821428226
$ref: '#/components/schemas/ScheduleDataRelationships'
2821528227
type:
2821628228
$ref: '#/components/schemas/ScheduleDataType'
28229+
required:
28230+
- type
2821728231
type: object
2821828232
ScheduleDataAttributes:
2821928233
description: Provides core properties of a schedule object, such as its name,
@@ -28269,6 +28283,9 @@ components:
2826928283
type: string
2827028284
type:
2827128285
$ref: '#/components/schemas/ScheduleDataRelationshipsLayersDataItemsType'
28286+
required:
28287+
- type
28288+
- id
2827228289
type: object
2827328290
ScheduleDataRelationshipsLayersDataItemsType:
2827428291
default: layers
@@ -28298,6 +28315,9 @@ components:
2829828315
type: string
2829928316
type:
2830028317
$ref: '#/components/schemas/ScheduleDataRelationshipsTeamsDataItemsType'
28318+
required:
28319+
- type
28320+
- id
2830128321
type: object
2830228322
ScheduleDataRelationshipsTeamsDataItemsType:
2830328323
default: teams
@@ -28313,6 +28333,7 @@ components:
2831328333
description: Schedules resource type.
2831428334
enum:
2831528335
- schedules
28336+
example: schedules
2831628337
type: string
2831728338
x-enum-varnames:
2831828339
- SCHEDULES
@@ -28327,6 +28348,8 @@ components:
2832728348
$ref: '#/components/schemas/ScheduleMemberRelationships'
2832828349
type:
2832928350
$ref: '#/components/schemas/ScheduleMemberType'
28351+
required:
28352+
- type
2833028353
type: object
2833128354
ScheduleMemberRelationships:
2833228355
description: Defines relationships for a schedule member, primarily referencing
@@ -28340,6 +28363,8 @@ components:
2834028363
properties:
2834128364
data:
2834228365
$ref: '#/components/schemas/ScheduleMemberRelationshipsUserData'
28366+
required:
28367+
- data
2834328368
type: object
2834428369
ScheduleMemberRelationshipsUserData:
2834528370
description: Points to the user data associated with this schedule member, including
@@ -28351,12 +28376,16 @@ components:
2835128376
type: string
2835228377
type:
2835328378
$ref: '#/components/schemas/ScheduleMemberRelationshipsUserDataType'
28379+
required:
28380+
- type
28381+
- id
2835428382
type: object
2835528383
ScheduleMemberRelationshipsUserDataType:
2835628384
default: users
2835728385
description: Users resource type.
2835828386
enum:
2835928387
- users
28388+
example: users
2836028389
type: string
2836128390
x-enum-varnames:
2836228391
- USERS
@@ -28365,6 +28394,7 @@ components:
2836528394
description: Schedule Members resource type.
2836628395
enum:
2836728396
- members
28397+
example: members
2836828398
type: string
2836928399
x-enum-varnames:
2837028400
- MEMBERS
@@ -28542,6 +28572,12 @@ components:
2854228572
example: '2025-02-01T00:00:00Z'
2854328573
format: date-time
2854428574
type: string
28575+
required:
28576+
- effective_date
28577+
- interval
28578+
- members
28579+
- name
28580+
- rotation_start
2854528581
type: object
2854628582
ScheduleUpdateRequestDataAttributesLayersItemsInterval:
2854728583
description: 'Specifies how the rotation repeats: number of days, plus optional
@@ -28662,12 +28698,16 @@ components:
2866228698
type: string
2866328699
type:
2866428700
$ref: '#/components/schemas/ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType'
28701+
required:
28702+
- type
28703+
- id
2866528704
type: object
2866628705
ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType:
2866728706
default: teams
2866828707
description: Teams resource type.
2866928708
enum:
2867028709
- teams
28710+
example: teams
2867128711
type: string
2867228712
x-enum-varnames:
2867328713
- TEAMS
@@ -28691,6 +28731,8 @@ components:
2869128731
type: string
2869228732
type:
2869328733
$ref: '#/components/schemas/ScheduleUserType'
28734+
required:
28735+
- type
2869428736
type: object
2869528737
ScheduleUserAttributes:
2869628738
description: Provides basic user information for a schedule, including a name
@@ -28710,6 +28752,7 @@ components:
2871028752
description: Users resource type.
2871128753
enum:
2871228754
- users
28755+
example: users
2871328756
type: string
2871428757
x-enum-varnames:
2871528758
- USERS
@@ -34401,6 +34444,8 @@ components:
3440134444
$ref: '#/components/schemas/TeamReferenceRelationships'
3440234445
type:
3440334446
$ref: '#/components/schemas/TeamReferenceType'
34447+
required:
34448+
- type
3440434449
type: object
3440534450
TeamReferenceAttributes:
3440634451
description: Encapsulates the basic attributes of a Team reference, such as
@@ -34446,12 +34491,16 @@ components:
3444634491
type: string
3444734492
type:
3444834493
$ref: '#/components/schemas/TeamReferenceRelationshipsOncallUsersDataItemsType'
34494+
required:
34495+
- type
34496+
- id
3444934497
type: object
3445034498
TeamReferenceRelationshipsOncallUsersDataItemsType:
3445134499
default: users
3445234500
description: Users resource type.
3445334501
enum:
3445434502
- users
34503+
example: users
3445534504
type: string
3445634505
x-enum-varnames:
3445734506
- USERS
@@ -34460,6 +34509,7 @@ components:
3446034509
description: Teams resource type.
3446134510
enum:
3446234511
- teams
34512+
example: teams
3446334513
type: string
3446434514
x-enum-varnames:
3446534515
- TEAMS

examples/v2_on-call_CreateOnCallSchedule.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ async fn main() {
8080
ScheduleCreateRequestDataRelationshipsTeams
8181
::new().data(
8282
vec![
83-
ScheduleCreateRequestDataRelationshipsTeamsDataItems::new()
84-
.id(dd_team_data_id.clone())
85-
.type_(ScheduleCreateRequestDataRelationshipsTeamsDataItemsType::TEAMS)
83+
ScheduleCreateRequestDataRelationshipsTeamsDataItems::new(
84+
dd_team_data_id.clone(),
85+
ScheduleCreateRequestDataRelationshipsTeamsDataItemsType::TEAMS,
86+
)
8687
],
8788
),
8889
),

examples/v2_on-call_UpdateOnCallSchedule.rs

+21-25
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,29 @@ async fn main() {
3636
ScheduleUpdateRequestData::new(
3737
ScheduleUpdateRequestDataAttributes::new(
3838
vec![
39-
ScheduleUpdateRequestDataAttributesLayersItems::new()
40-
.effective_date(
41-
DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
42-
.expect("Failed to parse datetime")
43-
.with_timezone(&Utc),
44-
)
39+
ScheduleUpdateRequestDataAttributesLayersItems::new(
40+
DateTime::parse_from_rfc3339("2021-11-01T11:11:11+00:00")
41+
.expect("Failed to parse datetime")
42+
.with_timezone(&Utc),
43+
ScheduleUpdateRequestDataAttributesLayersItemsInterval::new().seconds(300),
44+
vec![
45+
ScheduleUpdateRequestDataAttributesLayersItemsMembersItems
46+
::new().user(
47+
ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser
48+
::new().id(user_data_id.clone()),
49+
)
50+
],
51+
"Layer 1".to_string(),
52+
DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
53+
.expect("Failed to parse datetime")
54+
.with_timezone(&Utc),
55+
)
4556
.end_date(
4657
DateTime::parse_from_rfc3339("2021-11-21T11:11:11+00:00")
4758
.expect("Failed to parse datetime")
4859
.with_timezone(&Utc),
4960
)
5061
.id(schedule_data_relationships_layers_data_0_id.clone())
51-
.interval(ScheduleUpdateRequestDataAttributesLayersItemsInterval::new().seconds(300))
52-
.members(
53-
vec![
54-
ScheduleUpdateRequestDataAttributesLayersItemsMembersItems
55-
::new().user(
56-
ScheduleUpdateRequestDataAttributesLayersItemsMembersItemsUser
57-
::new().id(user_data_id.clone()),
58-
)
59-
],
60-
)
61-
.name("Layer 1".to_string())
6262
.restrictions(
6363
vec![
6464
ScheduleUpdateRequestDataAttributesLayersItemsRestrictionsItems::new()
@@ -74,11 +74,6 @@ async fn main() {
7474
.start_time("09:00:00".to_string())
7575
],
7676
)
77-
.rotation_start(
78-
DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00")
79-
.expect("Failed to parse datetime")
80-
.with_timezone(&Utc),
81-
)
8277
],
8378
"Example-On-Call".to_string(),
8479
"America/New_York".to_string(),
@@ -91,9 +86,10 @@ async fn main() {
9186
ScheduleUpdateRequestDataRelationshipsTeams
9287
::new().data(
9388
vec![
94-
ScheduleUpdateRequestDataRelationshipsTeamsDataItems::new()
95-
.id(dd_team_data_id.clone())
96-
.type_(ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType::TEAMS)
89+
ScheduleUpdateRequestDataRelationshipsTeamsDataItems::new(
90+
dd_team_data_id.clone(),
91+
ScheduleUpdateRequestDataRelationshipsTeamsDataItemsType::TEAMS,
92+
)
9793
],
9894
),
9995
),

src/datadogV2/model/model_layer.rs

+4-17
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct Layer {
2222
pub relationships: Option<crate::datadogV2::model::LayerRelationships>,
2323
/// Layers resource type.
2424
#[serde(rename = "type")]
25-
pub type_: Option<crate::datadogV2::model::LayerType>,
25+
pub type_: crate::datadogV2::model::LayerType,
2626
#[serde(flatten)]
2727
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
2828
#[serde(skip)]
@@ -31,12 +31,12 @@ pub struct Layer {
3131
}
3232

3333
impl Layer {
34-
pub fn new() -> Layer {
34+
pub fn new(type_: crate::datadogV2::model::LayerType) -> Layer {
3535
Layer {
3636
attributes: None,
3737
id: None,
3838
relationships: None,
39-
type_: None,
39+
type_,
4040
additional_properties: std::collections::BTreeMap::new(),
4141
_unparsed: false,
4242
}
@@ -57,11 +57,6 @@ impl Layer {
5757
self
5858
}
5959

60-
pub fn type_(mut self, value: crate::datadogV2::model::LayerType) -> Self {
61-
self.type_ = Some(value);
62-
self
63-
}
64-
6560
pub fn additional_properties(
6661
mut self,
6762
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -71,12 +66,6 @@ impl Layer {
7166
}
7267
}
7368

74-
impl Default for Layer {
75-
fn default() -> Self {
76-
Self::new()
77-
}
78-
}
79-
8069
impl<'de> Deserialize<'de> for Layer {
8170
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
8271
where
@@ -126,9 +115,6 @@ impl<'de> Deserialize<'de> for Layer {
126115
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
127116
}
128117
"type" => {
129-
if v.is_null() {
130-
continue;
131-
}
132118
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
133119
if let Some(ref _type_) = type_ {
134120
match _type_ {
@@ -146,6 +132,7 @@ impl<'de> Deserialize<'de> for Layer {
146132
}
147133
}
148134
}
135+
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
149136

150137
let content = Layer {
151138
attributes,

0 commit comments

Comments
 (0)