Skip to content

Commit 6fac1ef

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add permission requirements to on-call endpoints (DataDog#3499)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 2aab7b0 commit 6fac1ef

8 files changed

Lines changed: 126 additions & 118 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75178,9 +75178,13 @@ paths:
7517875178
- apiKeyAuth: []
7517975179
appKeyAuth: []
7518075180
- AuthZ: []
75181-
summary: Get the schedule on-call user
75181+
summary: Get scheduled on-call user
7518275182
tags:
7518375183
- On-Call
75184+
x-permission:
75185+
operator: AND
75186+
permissions:
75187+
- on_call_read
7518475188
/api/v2/on-call/teams/{team_id}/on-call:
7518575189
get:
7518675190
description: Get a team's on-call users at a given time
@@ -75223,6 +75227,10 @@ paths:
7522375227
summary: Get team on-call users
7522475228
tags:
7522575229
- On-Call
75230+
x-permission:
75231+
operator: AND
75232+
permissions:
75233+
- on_call_read
7522675234
/api/v2/on-call/teams/{team_id}/routing-rules:
7522775235
get:
7522875236
description: Get a team's On-Call routing rules

api/datadogV2/api_on_call.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ func (r *GetScheduleOnCallUserOptionalParameters) WithFilterAtTs(filterAtTs stri
709709
return r
710710
}
711711

712-
// GetScheduleOnCallUser Get the schedule on-call user.
712+
// GetScheduleOnCallUser Get scheduled on-call user.
713713
// Retrieves the user who is on-call for the specified schedule at a given time.
714714
func (a *OnCallApi) GetScheduleOnCallUser(ctx _context.Context, scheduleId string, o ...GetScheduleOnCallUserOptionalParameters) (Shift, *_nethttp.Response, error) {
715715
var (

examples/v2/on-call/GetScheduleOnCallUser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Get the schedule on-call user returns "OK" response
1+
// Get scheduled on-call user returns "OK" response
22

33
package main
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-12-04T08:50:18.341Z
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
interactions:
2+
- request:
3+
body: |
4+
{"data":{"attributes":{"email":"Test-Get_scheduled_on_call_user_returns_OK_response-1764838218@datadoghq.com","title":"user title"},"type":"users"}}
5+
form: {}
6+
headers:
7+
Accept:
8+
- application/json
9+
Content-Type:
10+
- application/json
11+
id: 0
12+
method: POST
13+
url: https://api.datadoghq.com/api/v2/users
14+
response:
15+
body: '{"data":{"type":"users","id":"42e2447f-d0ee-11f0-b246-f6a778e5e220","attributes":{"name":null,"handle":"test-get_scheduled_on_call_user_returns_ok_response-1764838218@datadoghq.com","created_at":"2025-12-04T08:50:19.140471+00:00","modified_at":"2025-12-04T08:50:19.140471+00:00","email":"test-get_scheduled_on_call_user_returns_ok_response-1764838218@datadoghq.com","icon":"https://secure.gravatar.com/avatar/6a6c3614a2758d626d4fcde0e9727205?s=48&d=retro","title":"user
16+
title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}
17+
18+
'
19+
code: 201
20+
duration: 0ms
21+
headers:
22+
Content-Type:
23+
- application/json
24+
status: 201 Created
25+
- request:
26+
body: |
27+
{"data":{"attributes":{"layers":[{"effective_date":"2025-11-24T08:50:18.341Z","end_date":"2025-12-14T08:50:18.341Z","interval":{"days":1},"members":[{"user":{"id":"42e2447f-d0ee-11f0-b246-f6a778e5e220"}}],"name":"Layer 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-11-29T08:50:18.341Z"}],"name":"Test-Get_scheduled_on_call_user_returns_OK_response-1764838218","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}
28+
form: {}
29+
headers:
30+
Accept:
31+
- application/json
32+
Content-Type:
33+
- application/json
34+
id: 1
35+
method: POST
36+
url: https://api.datadoghq.com/api/v2/on-call/schedules
37+
response:
38+
body: '{"data":{"id":"7f4eb086-4141-4f2a-ae4a-c0a06816672b","type":"schedules","attributes":{"name":"Test-Get_scheduled_on_call_user_returns_OK_response-1764838218","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"ad5985ec-b9e0-4dc7-aff9-a7bb75fc334f","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}'
39+
code: 201
40+
duration: 0ms
41+
headers:
42+
Content-Type:
43+
- application/vnd.api+json
44+
status: 201 Created
45+
- request:
46+
body: ''
47+
form: {}
48+
headers:
49+
Accept:
50+
- application/json
51+
id: 2
52+
method: GET
53+
url: https://api.datadoghq.com/api/v2/on-call/schedules/7f4eb086-4141-4f2a-ae4a-c0a06816672b/on-call
54+
response:
55+
body: '{"data":{"id":"42e2447f-d0ee-11f0-b246-f6a778e5e220-2025-12-04T03:50:19-05:00-2025-12-05T03:50:18-05:00","type":"shifts","attributes":{"end":"2025-12-05T03:50:18-05:00","start":"2025-12-04T03:50:19.261184-05:00"},"relationships":{"user":{"data":{"id":"42e2447f-d0ee-11f0-b246-f6a778e5e220","type":"users"}}}}}'
56+
code: 200
57+
duration: 0ms
58+
headers:
59+
Content-Type:
60+
- application/vnd.api+json
61+
status: 200 OK
62+
- request:
63+
body: ''
64+
form: {}
65+
headers:
66+
Accept:
67+
- '*/*'
68+
id: 3
69+
method: DELETE
70+
url: https://api.datadoghq.com/api/v2/on-call/schedules/7f4eb086-4141-4f2a-ae4a-c0a06816672b
71+
response:
72+
body: ''
73+
code: 204
74+
duration: 0ms
75+
headers: {}
76+
status: 204 No Content
77+
- request:
78+
body: ''
79+
form: {}
80+
headers:
81+
Accept:
82+
- '*/*'
83+
id: 4
84+
method: DELETE
85+
url: https://api.datadoghq.com/api/v2/users/42e2447f-d0ee-11f0-b246-f6a778e5e220
86+
response:
87+
body: ''
88+
code: 204
89+
duration: 0ms
90+
headers: {}
91+
status: 204 No Content
92+
version: 2

tests/scenarios/cassettes/TestScenarios/v2/Feature_On-Call/Scenario_Get_the_schedule_on-call_user_returns_OK_response.freeze

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/scenarios/cassettes/TestScenarios/v2/Feature_On-Call/Scenario_Get_the_schedule_on-call_user_returns_OK_response.yaml

Lines changed: 0 additions & 92 deletions
This file was deleted.

tests/scenarios/features/v2/on-call.feature

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,52 +127,52 @@ Feature: On-Call
127127
Then the response status is 200 OK
128128

129129
@generated @skip @team:DataDog/on-call
130-
Scenario: Get team on-call users returns "Bad Request" response
131-
Given new "GetTeamOnCallUsers" request
132-
And request contains "team_id" parameter from "REPLACE.ME"
130+
Scenario: Get scheduled on-call user returns "Bad Request" response
131+
Given new "GetScheduleOnCallUser" request
132+
And request contains "schedule_id" parameter from "REPLACE.ME"
133133
When the request is sent
134134
Then the response status is 400 Bad Request
135135

136136
@generated @skip @team:DataDog/on-call
137-
Scenario: Get team on-call users returns "Not Found" response
138-
Given new "GetTeamOnCallUsers" request
139-
And request contains "team_id" parameter from "REPLACE.ME"
137+
Scenario: Get scheduled on-call user returns "Not Found" response
138+
Given new "GetScheduleOnCallUser" request
139+
And request contains "schedule_id" parameter from "REPLACE.ME"
140140
When the request is sent
141141
Then the response status is 404 Not Found
142142

143143
@team:DataDog/on-call
144-
Scenario: Get team on-call users returns "OK" response
145-
Given new "GetTeamOnCallUsers" request
144+
Scenario: Get scheduled on-call user returns "OK" response
145+
Given new "GetScheduleOnCallUser" request
146146
And there is a valid "user" in the system
147-
And there is a valid "dd_team" in the system
148147
And there is a valid "schedule" in the system
149-
And there is a valid "escalation_policy" in the system
150-
And there are valid "routing_rules" in the system
151-
And request contains "team_id" parameter from "routing_rules.data.id"
152-
And request contains "include" parameter with value "responders,escalations.responders"
148+
And request contains "schedule_id" parameter from "schedule.data.id"
153149
When the request is sent
154150
Then the response status is 200 OK
155151

156152
@generated @skip @team:DataDog/on-call
157-
Scenario: Get the schedule on-call user returns "Bad Request" response
158-
Given new "GetScheduleOnCallUser" request
159-
And request contains "schedule_id" parameter from "REPLACE.ME"
153+
Scenario: Get team on-call users returns "Bad Request" response
154+
Given new "GetTeamOnCallUsers" request
155+
And request contains "team_id" parameter from "REPLACE.ME"
160156
When the request is sent
161157
Then the response status is 400 Bad Request
162158

163159
@generated @skip @team:DataDog/on-call
164-
Scenario: Get the schedule on-call user returns "Not Found" response
165-
Given new "GetScheduleOnCallUser" request
166-
And request contains "schedule_id" parameter from "REPLACE.ME"
160+
Scenario: Get team on-call users returns "Not Found" response
161+
Given new "GetTeamOnCallUsers" request
162+
And request contains "team_id" parameter from "REPLACE.ME"
167163
When the request is sent
168164
Then the response status is 404 Not Found
169165

170166
@team:DataDog/on-call
171-
Scenario: Get the schedule on-call user returns "OK" response
172-
Given new "GetScheduleOnCallUser" request
167+
Scenario: Get team on-call users returns "OK" response
168+
Given new "GetTeamOnCallUsers" request
173169
And there is a valid "user" in the system
170+
And there is a valid "dd_team" in the system
174171
And there is a valid "schedule" in the system
175-
And request contains "schedule_id" parameter from "schedule.data.id"
172+
And there is a valid "escalation_policy" in the system
173+
And there are valid "routing_rules" in the system
174+
And request contains "team_id" parameter from "routing_rules.data.id"
175+
And request contains "include" parameter with value "responders,escalations.responders"
176176
When the request is sent
177177
Then the response status is 200 OK
178178

0 commit comments

Comments
 (0)