Skip to content

Commit 980f72f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add GetScheduleOnCallUser specs (#2556)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 3ed77f2 commit 980f72f

19 files changed

+826
-4
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-12 09:40:13.024429",
8-
"spec_repo_commit": "c4d0aeef"
7+
"regenerated": "2025-05-13 01:19:26.571134",
8+
"spec_repo_commit": "dc3b522f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-12 09:40:13.041082",
13-
"spec_repo_commit": "c4d0aeef"
12+
"regenerated": "2025-05-13 01:19:26.586009",
13+
"spec_repo_commit": "dc3b522f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36060,6 +36060,115 @@ components:
3606036060
description: Link to the Incident created on ServiceNow
3606136061
type: string
3606236062
type: object
36063+
Shift:
36064+
description: The definition of `Shift` object.
36065+
example:
36066+
data:
36067+
attributes:
36068+
end: '2025-05-07T03:53:01.206662873Z'
36069+
start: '2025-05-07T02:53:01.206662814Z'
36070+
id: 00000000-0000-0000-0000-000000000000
36071+
relationships:
36072+
user:
36073+
data:
36074+
id: 00000000-aba1-0000-0000-000000000000
36075+
type: users
36076+
type: shifts
36077+
included:
36078+
- attributes:
36079+
36080+
name: User 1
36081+
status: ''
36082+
id: 00000000-aba1-0000-0000-000000000000
36083+
type: users
36084+
properties:
36085+
data:
36086+
$ref: '#/components/schemas/ShiftData'
36087+
nullable: true
36088+
included:
36089+
description: The `Shift` `included`.
36090+
items:
36091+
$ref: '#/components/schemas/ShiftIncluded'
36092+
type: array
36093+
type: object
36094+
ShiftData:
36095+
description: The definition of `ShiftData` object.
36096+
properties:
36097+
attributes:
36098+
$ref: '#/components/schemas/ShiftDataAttributes'
36099+
id:
36100+
description: The `ShiftData` `id`.
36101+
type: string
36102+
relationships:
36103+
$ref: '#/components/schemas/ShiftDataRelationships'
36104+
type:
36105+
$ref: '#/components/schemas/ShiftDataType'
36106+
required:
36107+
- type
36108+
type: object
36109+
ShiftDataAttributes:
36110+
description: The definition of `ShiftDataAttributes` object.
36111+
properties:
36112+
end:
36113+
description: The end time of the shift.
36114+
format: date-time
36115+
type: string
36116+
start:
36117+
description: The start time of the shift.
36118+
format: date-time
36119+
type: string
36120+
type: object
36121+
ShiftDataRelationships:
36122+
description: The definition of `ShiftDataRelationships` object.
36123+
properties:
36124+
user:
36125+
$ref: '#/components/schemas/ShiftDataRelationshipsUser'
36126+
type: object
36127+
ShiftDataRelationshipsUser:
36128+
description: Defines the relationship between a shift and the user who is working
36129+
that shift.
36130+
properties:
36131+
data:
36132+
$ref: '#/components/schemas/ShiftDataRelationshipsUserData'
36133+
required:
36134+
- data
36135+
type: object
36136+
ShiftDataRelationshipsUserData:
36137+
description: Represents a reference to the user assigned to this shift, containing
36138+
the user's ID and resource type.
36139+
properties:
36140+
id:
36141+
description: Specifies the unique identifier of the user.
36142+
example: 00000000-0000-0000-0000-000000000000
36143+
type: string
36144+
type:
36145+
$ref: '#/components/schemas/ShiftDataRelationshipsUserDataType'
36146+
required:
36147+
- type
36148+
- id
36149+
type: object
36150+
ShiftDataRelationshipsUserDataType:
36151+
default: users
36152+
description: Indicates that the related resource is of type 'users'.
36153+
enum:
36154+
- users
36155+
example: users
36156+
type: string
36157+
x-enum-varnames:
36158+
- USERS
36159+
ShiftDataType:
36160+
default: shifts
36161+
description: Indicates that the resource is of type 'shifts'.
36162+
enum:
36163+
- shifts
36164+
example: shifts
36165+
type: string
36166+
x-enum-varnames:
36167+
- SHIFTS
36168+
ShiftIncluded:
36169+
description: The definition of `ShiftIncluded` object.
36170+
oneOf:
36171+
- $ref: '#/components/schemas/ScheduleUser'
3606336172
SingleAggregatedConnectionResponseArray:
3606436173
description: List of aggregated connections.
3606536174
example:
@@ -51922,6 +52031,56 @@ paths:
5192252031
operator: AND
5192352032
permissions:
5192452033
- on_call_write
52034+
/api/v2/on-call/schedules/{schedule_id}/on-call:
52035+
get:
52036+
description: Retrieves the user who is on-call for the specified schedule at
52037+
a given time.
52038+
operationId: GetScheduleOnCallUser
52039+
parameters:
52040+
- description: 'Specifies related resources to include in the response as a
52041+
comma-separated list. Allowed value: `user`.'
52042+
in: query
52043+
name: include
52044+
schema:
52045+
type: string
52046+
- description: The ID of the schedule.
52047+
in: path
52048+
name: schedule_id
52049+
required: true
52050+
schema:
52051+
example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
52052+
type: string
52053+
- description: Retrieves the on-call user at the given timestamp (ISO-8601).
52054+
Defaults to the current time if omitted."
52055+
in: query
52056+
name: filter[at_ts]
52057+
schema:
52058+
example: '2025-05-07T02:53:01Z'
52059+
type: string
52060+
responses:
52061+
'200':
52062+
content:
52063+
application/json:
52064+
schema:
52065+
$ref: '#/components/schemas/Shift'
52066+
description: OK
52067+
'400':
52068+
$ref: '#/components/responses/BadRequestResponse'
52069+
'401':
52070+
$ref: '#/components/responses/UnauthorizedResponse'
52071+
'403':
52072+
$ref: '#/components/responses/ForbiddenResponse'
52073+
'404':
52074+
$ref: '#/components/responses/NotFoundResponse'
52075+
'429':
52076+
$ref: '#/components/responses/TooManyRequestsResponse'
52077+
security:
52078+
- apiKeyAuth: []
52079+
appKeyAuth: []
52080+
- AuthZ: []
52081+
summary: Get the schedule of an on-call user
52082+
tags:
52083+
- On-Call
5192552084
/api/v2/on-call/teams/{team_id}/routing-rules:
5192652085
get:
5192752086
description: Get a team's on-call routing rules

docs/datadog_api_client.v2.model.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15593,6 +15593,69 @@ datadog\_api\_client.v2.model.service\_now\_ticket\_result module
1559315593
:members:
1559415594
:show-inheritance:
1559515595

15596+
datadog\_api\_client.v2.model.shift module
15597+
------------------------------------------
15598+
15599+
.. automodule:: datadog_api_client.v2.model.shift
15600+
:members:
15601+
:show-inheritance:
15602+
15603+
datadog\_api\_client.v2.model.shift\_data module
15604+
------------------------------------------------
15605+
15606+
.. automodule:: datadog_api_client.v2.model.shift_data
15607+
:members:
15608+
:show-inheritance:
15609+
15610+
datadog\_api\_client.v2.model.shift\_data\_attributes module
15611+
------------------------------------------------------------
15612+
15613+
.. automodule:: datadog_api_client.v2.model.shift_data_attributes
15614+
:members:
15615+
:show-inheritance:
15616+
15617+
datadog\_api\_client.v2.model.shift\_data\_relationships module
15618+
---------------------------------------------------------------
15619+
15620+
.. automodule:: datadog_api_client.v2.model.shift_data_relationships
15621+
:members:
15622+
:show-inheritance:
15623+
15624+
datadog\_api\_client.v2.model.shift\_data\_relationships\_user module
15625+
---------------------------------------------------------------------
15626+
15627+
.. automodule:: datadog_api_client.v2.model.shift_data_relationships_user
15628+
:members:
15629+
:show-inheritance:
15630+
15631+
datadog\_api\_client.v2.model.shift\_data\_relationships\_user\_data module
15632+
---------------------------------------------------------------------------
15633+
15634+
.. automodule:: datadog_api_client.v2.model.shift_data_relationships_user_data
15635+
:members:
15636+
:show-inheritance:
15637+
15638+
datadog\_api\_client.v2.model.shift\_data\_relationships\_user\_data\_type module
15639+
---------------------------------------------------------------------------------
15640+
15641+
.. automodule:: datadog_api_client.v2.model.shift_data_relationships_user_data_type
15642+
:members:
15643+
:show-inheritance:
15644+
15645+
datadog\_api\_client.v2.model.shift\_data\_type module
15646+
------------------------------------------------------
15647+
15648+
.. automodule:: datadog_api_client.v2.model.shift_data_type
15649+
:members:
15650+
:show-inheritance:
15651+
15652+
datadog\_api\_client.v2.model.shift\_included module
15653+
----------------------------------------------------
15654+
15655+
.. automodule:: datadog_api_client.v2.model.shift_included
15656+
:members:
15657+
:show-inheritance:
15658+
1559615659
datadog\_api\_client.v2.model.single\_aggregated\_connection\_response\_array module
1559715660
------------------------------------------------------------------------------------
1559815661

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Get the schedule of an on-call user returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.on_call_api import OnCallApi
8+
9+
# there is a valid "schedule" in the system
10+
SCHEDULE_DATA_ID = environ["SCHEDULE_DATA_ID"]
11+
12+
configuration = Configuration()
13+
with ApiClient(configuration) as api_client:
14+
api_instance = OnCallApi(api_client)
15+
response = api_instance.get_schedule_on_call_user(
16+
schedule_id=SCHEDULE_DATA_ID,
17+
)
18+
19+
print(response)

src/datadog_api_client/v2/api/on_call_api.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from datadog_api_client.v2.model.schedule import Schedule
1818
from datadog_api_client.v2.model.schedule_create_request import ScheduleCreateRequest
1919
from datadog_api_client.v2.model.schedule_update_request import ScheduleUpdateRequest
20+
from datadog_api_client.v2.model.shift import Shift
2021
from datadog_api_client.v2.model.team_routing_rules import TeamRoutingRules
2122
from datadog_api_client.v2.model.team_routing_rules_request import TeamRoutingRulesRequest
2223

@@ -212,6 +213,39 @@ def __init__(self, api_client=None):
212213
api_client=api_client,
213214
)
214215

216+
self._get_schedule_on_call_user_endpoint = _Endpoint(
217+
settings={
218+
"response_type": (Shift,),
219+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
220+
"endpoint_path": "/api/v2/on-call/schedules/{schedule_id}/on-call",
221+
"operation_id": "get_schedule_on_call_user",
222+
"http_method": "GET",
223+
"version": "v2",
224+
},
225+
params_map={
226+
"include": {
227+
"openapi_types": (str,),
228+
"attribute": "include",
229+
"location": "query",
230+
},
231+
"schedule_id": {
232+
"required": True,
233+
"openapi_types": (str,),
234+
"attribute": "schedule_id",
235+
"location": "path",
236+
},
237+
"filter_at_ts": {
238+
"openapi_types": (str,),
239+
"attribute": "filter[at_ts]",
240+
"location": "query",
241+
},
242+
},
243+
headers_map={
244+
"accept": ["application/json"],
245+
},
246+
api_client=api_client,
247+
)
248+
215249
self._set_on_call_team_routing_rules_endpoint = _Endpoint(
216250
settings={
217251
"response_type": (TeamRoutingRules,),
@@ -457,6 +491,36 @@ def get_on_call_team_routing_rules(
457491

458492
return self._get_on_call_team_routing_rules_endpoint.call_with_http_info(**kwargs)
459493

494+
def get_schedule_on_call_user(
495+
self,
496+
schedule_id: str,
497+
*,
498+
include: Union[str, UnsetType] = unset,
499+
filter_at_ts: Union[str, UnsetType] = unset,
500+
) -> Shift:
501+
"""Get the schedule of an on-call user.
502+
503+
Retrieves the user who is on-call for the specified schedule at a given time.
504+
505+
:param schedule_id: The ID of the schedule.
506+
:type schedule_id: str
507+
:param include: Specifies related resources to include in the response as a comma-separated list. Allowed value: ``user``.
508+
:type include: str, optional
509+
:param filter_at_ts: Retrieves the on-call user at the given timestamp (ISO-8601). Defaults to the current time if omitted."
510+
:type filter_at_ts: str, optional
511+
:rtype: Shift
512+
"""
513+
kwargs: Dict[str, Any] = {}
514+
if include is not unset:
515+
kwargs["include"] = include
516+
517+
kwargs["schedule_id"] = schedule_id
518+
519+
if filter_at_ts is not unset:
520+
kwargs["filter_at_ts"] = filter_at_ts
521+
522+
return self._get_schedule_on_call_user_endpoint.call_with_http_info(**kwargs)
523+
460524
def set_on_call_team_routing_rules(
461525
self,
462526
team_id: str,

0 commit comments

Comments
 (0)