Skip to content

Commit e278cb4

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 6925b82 of spec repo
1 parent 8296564 commit e278cb4

9 files changed

Lines changed: 495 additions & 7 deletions

File tree

‎.generator/schemas/v2/openapi.yaml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109771,6 +109771,7 @@ components:
109771109771
example:
109772109772
data:
109773109773
attributes:
109774+
max_responders: 1
109774109775
name: On-Call Schedule
109775109776
time_zone: America/New_York
109776109777
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
@@ -109852,6 +109853,7 @@ components:
109852109853
start_day: monday
109853109854
start_time: "09:00:00"
109854109855
rotation_start: "2025-02-01T00:00:00Z"
109856+
max_responders: 1
109855109857
name: On-Call Schedule
109856109858
time_zone: America/New_York
109857109859
relationships:
@@ -109887,6 +109889,16 @@ components:
109887109889
items:
109888109890
$ref: "#/components/schemas/ScheduleCreateRequestDataAttributesLayersItems"
109889109891
type: array
109892+
max_responders:
109893+
description: |-
109894+
Maximum number of users that can be on call simultaneously. Set this attribute to create an additive schedule.
109895+
Omit it to create a non-additive (merge) schedule with one responder on call at a time.
109896+
The value must be between 1 and the number of layers, up to a maximum of 10.
109897+
example: 1
109898+
format: int64
109899+
maximum: 10
109900+
minimum: 1
109901+
type: integer
109890109902
name:
109891109903
description: A human-readable name for the new schedule.
109892109904
example: Team A On-Call
@@ -109980,6 +109992,16 @@ components:
109980109992
ScheduleDataAttributes:
109981109993
description: Provides core properties of a schedule object such as its name and time zone.
109982109994
properties:
109995+
max_responders:
109996+
description: |-
109997+
Maximum number of users that can be on call simultaneously for an additive schedule.
109998+
The value is between 1 and the number of layers, up to a maximum of 10.
109999+
Omitted for non-additive (merge) schedules, which have one responder on call at a time.
110000+
example: 1
110001+
format: int64
110002+
maximum: 10
110003+
minimum: 1
110004+
type: integer
109983110005
name:
109984110006
description: A short name for the schedule.
109985110007
example: Primary On-Call
@@ -110462,6 +110484,7 @@ components:
110462110484
start_day: monday
110463110485
start_time: "09:00:00"
110464110486
rotation_start: "2025-02-01T00:00:00Z"
110487+
max_responders: 1
110465110488
name: On-Call Schedule Updated
110466110489
time_zone: America/New_York
110467110490
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
@@ -110504,6 +110527,18 @@ components:
110504110527
items:
110505110528
$ref: "#/components/schemas/ScheduleUpdateRequestDataAttributesLayersItems"
110506110529
type: array
110530+
max_responders:
110531+
description: |-
110532+
Maximum number of users that can be on call simultaneously. Set this attribute for an additive schedule.
110533+
Omit it for a non-additive (merge) schedule with one responder on call at a time.
110534+
The value must be between 1 and the number of layers, up to a maximum of 10.
110535+
Changing between additive and non-additive (merge) schedules is not supported
110536+
and returns a `400 Bad Request` response.
110537+
example: 1
110538+
format: int64
110539+
maximum: 10
110540+
minimum: 1
110541+
type: integer
110507110542
name:
110508110543
description: A short name for the schedule.
110509110544
example: Primary On-Call
@@ -110633,6 +110668,7 @@ components:
110633110668
example:
110634110669
data:
110635110670
- attributes:
110671+
max_responders: 1
110636110672
name: Primary On-Call
110637110673
tags: []
110638110674
time_zone: America/New_York
@@ -205327,6 +205363,7 @@ paths:
205327205363
value:
205328205364
data:
205329205365
- attributes:
205366+
max_responders: 1
205330205367
name: Primary On-Call
205331205368
tags: []
205332205369
time_zone: America/New_York
@@ -205405,6 +205442,7 @@ paths:
205405205442
start_day: monday
205406205443
start_time: 09:00:00
205407205444
rotation_start: "2025-02-01T00:00:00Z"
205445+
max_responders: 1
205408205446
name: On-Call Schedule
205409205447
time_zone: America/New_York
205410205448
relationships:
@@ -205425,6 +205463,7 @@ paths:
205425205463
value:
205426205464
data:
205427205465
attributes:
205466+
max_responders: 1
205428205467
name: On-Call Schedule
205429205468
time_zone: America/New_York
205430205469
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
@@ -205519,6 +205558,7 @@ paths:
205519205558
value:
205520205559
data:
205521205560
attributes:
205561+
max_responders: 1
205522205562
name: On-Call Schedule
205523205563
time_zone: America/New_York
205524205564
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
@@ -205593,6 +205633,7 @@ paths:
205593205633
start_day: monday
205594205634
start_time: 09:00:00
205595205635
rotation_start: "2025-02-01T00:00:00Z"
205636+
max_responders: 1
205596205637
name: On-Call Schedule Updated
205597205638
time_zone: America/New_York
205598205639
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
@@ -205614,6 +205655,7 @@ paths:
205614205655
value:
205615205656
data:
205616205657
attributes:
205658+
max_responders: 1
205617205659
name: On-Call Schedule
205618205660
time_zone: America/New_York
205619205661
id: 00000000-0000-0000-0000-000000000001
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
"""
2+
Create additive On-Call schedule returns "Created" response
3+
"""
4+
5+
from datetime import datetime
6+
from dateutil.relativedelta import relativedelta
7+
from os import environ
8+
from datadog_api_client import ApiClient, Configuration
9+
from datadog_api_client.v2.api.on_call_api import OnCallApi
10+
from datadog_api_client.v2.model.data_relationships_teams import DataRelationshipsTeams
11+
from datadog_api_client.v2.model.data_relationships_teams_data_items import DataRelationshipsTeamsDataItems
12+
from datadog_api_client.v2.model.data_relationships_teams_data_items_type import DataRelationshipsTeamsDataItemsType
13+
from datadog_api_client.v2.model.layer_attributes_interval import LayerAttributesInterval
14+
from datadog_api_client.v2.model.schedule_create_request import ScheduleCreateRequest
15+
from datadog_api_client.v2.model.schedule_create_request_data import ScheduleCreateRequestData
16+
from datadog_api_client.v2.model.schedule_create_request_data_attributes import ScheduleCreateRequestDataAttributes
17+
from datadog_api_client.v2.model.schedule_create_request_data_attributes_layers_items import (
18+
ScheduleCreateRequestDataAttributesLayersItems,
19+
)
20+
from datadog_api_client.v2.model.schedule_create_request_data_relationships import (
21+
ScheduleCreateRequestDataRelationships,
22+
)
23+
from datadog_api_client.v2.model.schedule_create_request_data_type import ScheduleCreateRequestDataType
24+
from datadog_api_client.v2.model.schedule_request_data_attributes_layers_items_members_items import (
25+
ScheduleRequestDataAttributesLayersItemsMembersItems,
26+
)
27+
from datadog_api_client.v2.model.schedule_request_data_attributes_layers_items_members_items_user import (
28+
ScheduleRequestDataAttributesLayersItemsMembersItemsUser,
29+
)
30+
from datadog_api_client.v2.model.time_restriction import TimeRestriction
31+
from datadog_api_client.v2.model.weekday import Weekday
32+
33+
# there is a valid "user" in the system
34+
USER_DATA_ID = environ["USER_DATA_ID"]
35+
36+
# there is a valid "dd_team" in the system
37+
DD_TEAM_DATA_ID = environ["DD_TEAM_DATA_ID"]
38+
39+
body = ScheduleCreateRequest(
40+
data=ScheduleCreateRequestData(
41+
attributes=ScheduleCreateRequestDataAttributes(
42+
max_responders=1,
43+
layers=[
44+
ScheduleCreateRequestDataAttributesLayersItems(
45+
effective_date=(datetime.now() + relativedelta(days=-10)),
46+
end_date=(datetime.now() + relativedelta(days=10)),
47+
interval=LayerAttributesInterval(
48+
days=1,
49+
),
50+
members=[
51+
ScheduleRequestDataAttributesLayersItemsMembersItems(
52+
user=ScheduleRequestDataAttributesLayersItemsMembersItemsUser(
53+
id=USER_DATA_ID,
54+
),
55+
),
56+
],
57+
name="Layer 1",
58+
restrictions=[
59+
TimeRestriction(
60+
end_day=Weekday.FRIDAY,
61+
end_time="17:00:00",
62+
start_day=Weekday.MONDAY,
63+
start_time="09:00:00",
64+
),
65+
],
66+
rotation_start=(datetime.now() + relativedelta(days=-5)),
67+
),
68+
],
69+
name="Example-On-Call",
70+
time_zone="America/New_York",
71+
),
72+
relationships=ScheduleCreateRequestDataRelationships(
73+
teams=DataRelationshipsTeams(
74+
data=[
75+
DataRelationshipsTeamsDataItems(
76+
id=DD_TEAM_DATA_ID,
77+
type=DataRelationshipsTeamsDataItemsType.TEAMS,
78+
),
79+
],
80+
),
81+
),
82+
type=ScheduleCreateRequestDataType.SCHEDULES,
83+
),
84+
)
85+
86+
configuration = Configuration()
87+
configuration.access_token = environ["DD_BEARER_TOKEN"]
88+
with ApiClient(configuration) as api_client:
89+
api_instance = OnCallApi(api_client)
90+
response = api_instance.create_on_call_schedule(body=body)
91+
92+
print(response)

‎src/datadog_api_client/v2/model/schedule_create_request_data_attributes.py‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import List, TYPE_CHECKING
6+
from typing import List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
unset,
12+
UnsetType,
1113
)
1214

1315

@@ -18,6 +20,13 @@
1820

1921

2022
class ScheduleCreateRequestDataAttributes(ModelNormal):
23+
validations = {
24+
"max_responders": {
25+
"inclusive_maximum": 10,
26+
"inclusive_minimum": 1,
27+
},
28+
}
29+
2130
@cached_property
2231
def openapi_types(_):
2332
from datadog_api_client.v2.model.schedule_create_request_data_attributes_layers_items import (
@@ -26,31 +35,45 @@ def openapi_types(_):
2635

2736
return {
2837
"layers": ([ScheduleCreateRequestDataAttributesLayersItems],),
38+
"max_responders": (int,),
2939
"name": (str,),
3040
"time_zone": (str,),
3141
}
3242

3343
attribute_map = {
3444
"layers": "layers",
45+
"max_responders": "max_responders",
3546
"name": "name",
3647
"time_zone": "time_zone",
3748
}
3849

3950
def __init__(
40-
self_, layers: List[ScheduleCreateRequestDataAttributesLayersItems], name: str, time_zone: str, **kwargs
51+
self_,
52+
layers: List[ScheduleCreateRequestDataAttributesLayersItems],
53+
name: str,
54+
time_zone: str,
55+
max_responders: Union[int, UnsetType] = unset,
56+
**kwargs,
4157
):
4258
"""
4359
Describes the main attributes for creating a new schedule, including name, layers, and time zone.
4460
4561
:param layers: The layers of On-Call coverage that define rotation intervals and restrictions.
4662
:type layers: [ScheduleCreateRequestDataAttributesLayersItems]
4763
64+
:param max_responders: Maximum number of users that can be on call simultaneously. Set this attribute to create an additive schedule.
65+
Omit it to create a non-additive (merge) schedule with one responder on call at a time.
66+
The value must be between 1 and the number of layers, up to a maximum of 10.
67+
:type max_responders: int, optional
68+
4869
:param name: A human-readable name for the new schedule.
4970
:type name: str
5071
5172
:param time_zone: The time zone in which the schedule is defined.
5273
:type time_zone: str
5374
"""
75+
if max_responders is not unset:
76+
kwargs["max_responders"] = max_responders
5477
super().__init__(kwargs)
5578

5679
self_.layers = layers

‎src/datadog_api_client/v2/model/schedule_data_attributes.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,32 @@
1414

1515

1616
class ScheduleDataAttributes(ModelNormal):
17+
validations = {
18+
"max_responders": {
19+
"inclusive_maximum": 10,
20+
"inclusive_minimum": 1,
21+
},
22+
}
23+
1724
@cached_property
1825
def openapi_types(_):
1926
return {
27+
"max_responders": (int,),
2028
"name": (str,),
2129
"tags": ([str],),
2230
"time_zone": (str,),
2331
}
2432

2533
attribute_map = {
34+
"max_responders": "max_responders",
2635
"name": "name",
2736
"tags": "tags",
2837
"time_zone": "time_zone",
2938
}
3039

3140
def __init__(
3241
self_,
42+
max_responders: Union[int, UnsetType] = unset,
3343
name: Union[str, UnsetType] = unset,
3444
tags: Union[List[str], UnsetType] = unset,
3545
time_zone: Union[str, UnsetType] = unset,
@@ -38,6 +48,11 @@ def __init__(
3848
"""
3949
Provides core properties of a schedule object such as its name and time zone.
4050
51+
:param max_responders: Maximum number of users that can be on call simultaneously for an additive schedule.
52+
The value is between 1 and the number of layers, up to a maximum of 10.
53+
Omitted for non-additive (merge) schedules, which have one responder on call at a time.
54+
:type max_responders: int, optional
55+
4156
:param name: A short name for the schedule.
4257
:type name: str, optional
4358
@@ -47,6 +62,8 @@ def __init__(
4762
:param time_zone: The time zone in which this schedule operates.
4863
:type time_zone: str, optional
4964
"""
65+
if max_responders is not unset:
66+
kwargs["max_responders"] = max_responders
5067
if name is not unset:
5168
kwargs["name"] = name
5269
if tags is not unset:

0 commit comments

Comments
 (0)