Skip to content

Commit 98d06d1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add GET /api/v2/on-call/schedules/schedule_id/responders spec (#1827)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 806a5a0 commit 98d06d1

29 files changed

Lines changed: 2696 additions & 3 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 327 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85666,6 +85666,11 @@ components:
8566685666
description: A short name for the schedule.
8566785667
example: Primary On-Call
8566885668
type: string
85669+
tags:
85670+
description: A list of tags associated with the schedule.
85671+
items:
85672+
type: string
85673+
type: array
8566985674
time_zone:
8567085675
description: The time zone in which this schedule operates.
8567185676
example: America/New_York
@@ -85789,6 +85794,231 @@ components:
8578985794
type: string
8579085795
x-enum-varnames:
8579185796
- MEMBERS
85797+
ScheduleOnCallResponderData:
85798+
description: Represents one position's (previous, current, or next) group of on-call responder shifts. Positions with no matching shift are omitted entirely from the response.
85799+
properties:
85800+
attributes:
85801+
$ref: "#/components/schemas/ScheduleOnCallResponderDataAttributes"
85802+
id:
85803+
description: Unique identifier of this responder group.
85804+
type: string
85805+
relationships:
85806+
$ref: "#/components/schemas/ScheduleOnCallResponderDataRelationships"
85807+
type:
85808+
$ref: "#/components/schemas/ScheduleOnCallResponderDataType"
85809+
required:
85810+
- type
85811+
type: object
85812+
ScheduleOnCallResponderDataAttributes:
85813+
description: Attributes for one position's (previous, current, or next) group of on-call responder shifts.
85814+
properties:
85815+
position:
85816+
$ref: "#/components/schemas/ScheduleTargetPosition"
85817+
type: object
85818+
ScheduleOnCallResponderDataRelationships:
85819+
description: Relationships for a single position's (previous, current, or next) responder group.
85820+
properties:
85821+
shifts:
85822+
$ref: "#/components/schemas/ScheduleOnCallResponderDataRelationshipsShifts"
85823+
type: object
85824+
ScheduleOnCallResponderDataRelationshipsShifts:
85825+
description: Defines the list of shifts satisfying this responder group's position. Multiple shifts occur when a schedule has multiple concurrent on-call responders at that position.
85826+
properties:
85827+
data:
85828+
description: Array of references to the shifts included in the response.
85829+
items:
85830+
$ref: "#/components/schemas/ScheduleOnCallResponderDataRelationshipsShiftsDataItems"
85831+
type: array
85832+
type: object
85833+
ScheduleOnCallResponderDataRelationshipsShiftsDataItems:
85834+
description: Represents a reference to one of the shifts satisfying this responder group's position.
85835+
properties:
85836+
id:
85837+
description: Unique identifier of the shift.
85838+
example: "00000000-0000-0000-0000-000000000000"
85839+
type: string
85840+
type:
85841+
$ref: "#/components/schemas/ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType"
85842+
required:
85843+
- type
85844+
- id
85845+
type: object
85846+
ScheduleOnCallResponderDataRelationshipsShiftsDataItemsType:
85847+
default: shifts
85848+
description: "Indicates that the related resource is of type `shifts`."
85849+
enum:
85850+
- shifts
85851+
example: shifts
85852+
type: string
85853+
x-enum-varnames:
85854+
- SHIFTS
85855+
ScheduleOnCallResponderDataType:
85856+
default: schedule_oncall_responder
85857+
description: Represents the resource type for a single position's (previous, current, or next) group of on-call responder shifts.
85858+
enum:
85859+
- schedule_oncall_responder
85860+
example: schedule_oncall_responder
85861+
type: string
85862+
x-enum-varnames:
85863+
- SCHEDULE_ONCALL_RESPONDER
85864+
ScheduleOnCallResponders:
85865+
description: Root object representing a schedule's on-call responders, grouped by position (previous, current, next), for a given point in time.
85866+
example:
85867+
data:
85868+
attributes:
85869+
scheduled_at: "2024-05-07T02:53:01.000000000Z"
85870+
id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400"
85871+
relationships:
85872+
responders:
85873+
data:
85874+
- id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current"
85875+
type: schedule_oncall_responder
85876+
schedule:
85877+
data:
85878+
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
85879+
type: schedules
85880+
type: schedule_oncall_responders
85881+
included:
85882+
- attributes:
85883+
position: current
85884+
id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current"
85885+
relationships:
85886+
shifts:
85887+
data:
85888+
- id: 00000000-0000-0000-0000-000000000000
85889+
type: shifts
85890+
type: schedule_oncall_responder
85891+
- attributes:
85892+
end: "2024-05-08T02:53:01.000000000Z"
85893+
start: "2024-05-07T02:53:01.000000000Z"
85894+
id: 00000000-0000-0000-0000-000000000000
85895+
relationships:
85896+
user:
85897+
data:
85898+
id: 00000000-aba1-0000-0000-000000000000
85899+
type: users
85900+
type: shifts
85901+
- attributes:
85902+
email: test@test.com
85903+
name: Test User
85904+
status: active
85905+
id: 00000000-aba1-0000-0000-000000000000
85906+
type: users
85907+
properties:
85908+
data:
85909+
$ref: "#/components/schemas/ScheduleOnCallRespondersData"
85910+
included:
85911+
description: Related resources referenced in the responder groups' relationships, such as shifts, schedules, and users.
85912+
items:
85913+
$ref: "#/components/schemas/ScheduleOnCallRespondersIncluded"
85914+
type: array
85915+
type: object
85916+
ScheduleOnCallRespondersData:
85917+
description: The main data object representing a schedule's on-call responders lookup, including relationships and metadata.
85918+
properties:
85919+
attributes:
85920+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataAttributes"
85921+
id:
85922+
description: Unique identifier of this on-call responders lookup.
85923+
type: string
85924+
relationships:
85925+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationships"
85926+
type:
85927+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataType"
85928+
required:
85929+
- type
85930+
type: object
85931+
ScheduleOnCallRespondersDataAttributes:
85932+
description: Attributes for a schedule's on-call responders lookup.
85933+
properties:
85934+
scheduled_at:
85935+
description: The timestamp the responders were resolved at.
85936+
format: date-time
85937+
type: string
85938+
type: object
85939+
ScheduleOnCallRespondersDataRelationships:
85940+
description: Relationships for a schedule's on-call responders lookup, including the schedule and its responder groups.
85941+
properties:
85942+
responders:
85943+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsResponders"
85944+
schedule:
85945+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsSchedule"
85946+
type: object
85947+
ScheduleOnCallRespondersDataRelationshipsResponders:
85948+
description: Defines the list of per-position (previous, current, next) responder groups for the schedule.
85949+
properties:
85950+
data:
85951+
description: Array of references to the responder groups included in the response.
85952+
items:
85953+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsRespondersDataItems"
85954+
type: array
85955+
type: object
85956+
ScheduleOnCallRespondersDataRelationshipsRespondersDataItems:
85957+
description: Represents a reference to one position's (previous, current, or next) responder group.
85958+
properties:
85959+
id:
85960+
description: Unique identifier of the responder group.
85961+
example: ""
85962+
type: string
85963+
type:
85964+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType"
85965+
required:
85966+
- type
85967+
- id
85968+
type: object
85969+
ScheduleOnCallRespondersDataRelationshipsRespondersDataItemsType:
85970+
default: schedule_oncall_responder
85971+
description: Identifies the resource type for a responder group linked to a schedule's on-call responders lookup.
85972+
enum:
85973+
- schedule_oncall_responder
85974+
example: schedule_oncall_responder
85975+
type: string
85976+
x-enum-varnames:
85977+
- SCHEDULE_ONCALL_RESPONDER
85978+
ScheduleOnCallRespondersDataRelationshipsSchedule:
85979+
description: Defines the relationship to the schedule this on-call responders lookup was performed for.
85980+
properties:
85981+
data:
85982+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsScheduleData"
85983+
type: object
85984+
ScheduleOnCallRespondersDataRelationshipsScheduleData:
85985+
description: Represents a reference to the schedule this on-call responders lookup was performed for.
85986+
properties:
85987+
id:
85988+
description: Unique identifier of the schedule.
85989+
example: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d"
85990+
type: string
85991+
type:
85992+
$ref: "#/components/schemas/ScheduleOnCallRespondersDataRelationshipsScheduleDataType"
85993+
required:
85994+
- type
85995+
- id
85996+
type: object
85997+
ScheduleOnCallRespondersDataRelationshipsScheduleDataType:
85998+
default: schedules
85999+
description: Identifies the resource type for the schedule associated with this on-call responders lookup.
86000+
enum:
86001+
- schedules
86002+
example: schedules
86003+
type: string
86004+
x-enum-varnames:
86005+
- SCHEDULES
86006+
ScheduleOnCallRespondersDataType:
86007+
default: schedule_oncall_responders
86008+
description: Represents the resource type for a schedule's grouped on-call responders across the previous, current, and next positions.
86009+
enum:
86010+
- schedule_oncall_responders
86011+
example: schedule_oncall_responders
86012+
type: string
86013+
x-enum-varnames:
86014+
- SCHEDULE_ONCALL_RESPONDERS
86015+
ScheduleOnCallRespondersIncluded:
86016+
description: Represents a union of related resources included in the response, such as responder groups, shifts, schedules, and users.
86017+
oneOf:
86018+
- $ref: "#/components/schemas/ScheduleOnCallResponderData"
86019+
- $ref: "#/components/schemas/ShiftData"
86020+
- $ref: "#/components/schemas/ScheduleData"
86021+
- $ref: "#/components/schemas/User"
8579286022
ScheduleRequestDataAttributesLayersItemsMembersItems:
8579386023
description: |-
8579486024
Defines a single member within a schedule layer, including the reference to the underlying user.
@@ -160912,7 +161142,8 @@ paths:
160912161142
- on_call_write
160913161143
/api/v2/on-call/schedules/{schedule_id}/on-call:
160914161144
get:
160915-
description: "Retrieves the user who is on-call for the specified schedule at a given time."
161145+
deprecated: true
161146+
description: "Retrieves the user who is on-call for the specified schedule at a given time. This endpoint does not support schedules with multiple concurrent on-call responders at a position. Deprecated. Use `Get on-call responders for a schedule` instead."
160916161147
operationId: GetScheduleOnCallUser
160917161148
parameters:
160918161149
- description: "Specifies related resources to include in the response as a comma-separated list. Allowed value: `user`."
@@ -160975,6 +161206,101 @@ paths:
160975161206
operator: AND
160976161207
permissions:
160977161208
- on_call_read
161209+
x-sunset: "2027-02-01"
161210+
/api/v2/on-call/schedules/{schedule_id}/responders:
161211+
get:
161212+
description: "Retrieves the on-call responders for the specified schedule, grouped by position (previous, current, next), at a given time. Supports schedules with multiple concurrent on-call responders at a position, by returning a list of shifts per position."
161213+
operationId: GetScheduleOnCallResponders
161214+
parameters:
161215+
- description: "Comma-separated list of included relationships to be returned. Allowed values: `schedule`, `responders`, `responders.shifts`, `responders.shifts.user`."
161216+
in: query
161217+
name: include
161218+
schema:
161219+
type: string
161220+
- description: The ID of the schedule.
161221+
in: path
161222+
name: schedule_id
161223+
required: true
161224+
schema:
161225+
example: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
161226+
type: string
161227+
- description: "Comma-separated list of positions to retrieve. Allowed values: `previous`, `current`, `next`. Defaults to `current` if omitted."
161228+
in: query
161229+
name: filter[position]
161230+
schema:
161231+
example: previous,current,next
161232+
type: string
161233+
- description: "Retrieves the on-call responders at the given timestamp in RFC3339 format (for example, `2025-05-07T02:53:01Z` or `2025-05-07T02:53:01+00:00`). When using timezone offsets with `+` or `-`, ensure proper URL encoding (`+` should be encoded as `%2B`). Defaults to the current time if omitted."
161234+
in: query
161235+
name: filter[at_ts]
161236+
schema:
161237+
example: "2025-05-07T02:53:01Z"
161238+
type: string
161239+
responses:
161240+
"200":
161241+
content:
161242+
application/json:
161243+
examples:
161244+
default:
161245+
value:
161246+
data:
161247+
attributes:
161248+
scheduled_at: "2024-05-07T02:53:01.000000000Z"
161249+
id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400"
161250+
relationships:
161251+
responders:
161252+
data:
161253+
- id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current"
161254+
type: schedule_oncall_responder
161255+
schedule:
161256+
data:
161257+
id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d
161258+
type: schedules
161259+
type: schedule_oncall_responders
161260+
included:
161261+
- attributes:
161262+
position: current
161263+
id: "3653d3c6-0c75-11ea-ad28-fb5701eabc7d-1715054400-current"
161264+
relationships:
161265+
shifts:
161266+
data:
161267+
- id: 00000000-0000-0000-0000-000000000000
161268+
type: shifts
161269+
type: schedule_oncall_responder
161270+
- attributes:
161271+
end: "2024-05-08T02:53:01.000000000Z"
161272+
start: "2024-05-07T02:53:01.000000000Z"
161273+
id: 00000000-0000-0000-0000-000000000000
161274+
relationships:
161275+
user:
161276+
data:
161277+
id: 00000000-aba1-0000-0000-000000000000
161278+
type: users
161279+
type: shifts
161280+
schema:
161281+
$ref: "#/components/schemas/ScheduleOnCallResponders"
161282+
description: OK
161283+
"400":
161284+
$ref: "#/components/responses/BadRequestResponse"
161285+
"401":
161286+
$ref: "#/components/responses/UnauthorizedResponse"
161287+
"403":
161288+
$ref: "#/components/responses/ForbiddenResponse"
161289+
"404":
161290+
$ref: "#/components/responses/NotFoundResponse"
161291+
"429":
161292+
$ref: "#/components/responses/TooManyRequestsResponse"
161293+
security:
161294+
- apiKeyAuth: []
161295+
appKeyAuth: []
161296+
- AuthZ: []
161297+
summary: Get on-call responders for a schedule
161298+
tags:
161299+
- On-Call
161300+
"x-permission":
161301+
operator: AND
161302+
permissions:
161303+
- on_call_read
160978161304
/api/v2/on-call/teams/{team_id}/on-call:
160979161305
get:
160980161306
description: Get a team's on-call users at a given time
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Get on-call responders for a schedule returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_on_call::GetScheduleOnCallRespondersOptionalParams;
4+
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "schedule" in the system
9+
let schedule_data_id = std::env::var("SCHEDULE_DATA_ID").unwrap();
10+
let configuration = datadog::Configuration::new();
11+
let api = OnCallAPI::with_config(configuration);
12+
let resp = api
13+
.get_schedule_on_call_responders(
14+
schedule_data_id.clone(),
15+
GetScheduleOnCallRespondersOptionalParams::default(),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}

0 commit comments

Comments
 (0)