diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bdfd07431..4b5678d0bc 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -74529,9 +74529,13 @@ paths: - apiKeyAuth: [] appKeyAuth: [] - AuthZ: [] - summary: Get the schedule on-call user + summary: Get scheduled on-call user tags: - On-Call + x-permission: + operator: AND + permissions: + - on_call_read /api/v2/on-call/teams/{team_id}/on-call: get: description: Get a team's on-call users at a given time @@ -74574,6 +74578,10 @@ paths: summary: Get team on-call users tags: - On-Call + x-permission: + operator: AND + permissions: + - on_call_read /api/v2/on-call/teams/{team_id}/routing-rules: get: description: Get a team's On-Call routing rules diff --git a/examples/v2/on-call/GetScheduleOnCallUser.py b/examples/v2/on-call/GetScheduleOnCallUser.py index 4c4d0722ed..28b03dec6a 100644 --- a/examples/v2/on-call/GetScheduleOnCallUser.py +++ b/examples/v2/on-call/GetScheduleOnCallUser.py @@ -1,5 +1,5 @@ """ -Get the schedule on-call user returns "OK" response +Get scheduled on-call user returns "OK" response """ from os import environ diff --git a/src/datadog_api_client/v2/api/on_call_api.py b/src/datadog_api_client/v2/api/on_call_api.py index 34755ee80e..cdebda07c1 100644 --- a/src/datadog_api_client/v2/api/on_call_api.py +++ b/src/datadog_api_client/v2/api/on_call_api.py @@ -527,7 +527,7 @@ def get_schedule_on_call_user( include: Union[str, UnsetType] = unset, filter_at_ts: Union[str, UnsetType] = unset, ) -> Shift: - """Get the schedule on-call user. + """Get scheduled on-call user. Retrieves the user who is on-call for the specified schedule at a given time. diff --git a/tests/v2/cassettes/test_scenarios/test_get_scheduled_oncall_user_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_scheduled_oncall_user_returns_ok_response.frozen new file mode 100644 index 0000000000..be12eaae28 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_scheduled_oncall_user_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-12-04T08:50:18.341Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_scheduled_oncall_user_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_scheduled_oncall_user_returns_ok_response.yaml new file mode 100644 index 0000000000..dfba7b11a1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_scheduled_oncall_user_returns_ok_response.yaml @@ -0,0 +1,87 @@ +interactions: +- request: + body: '{"data":{"attributes":{"email":"Test-Get_scheduled_on_call_user_returns_OK_response-1764838218@datadoghq.com","title":"user + title"},"type":"users"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/users + response: + body: + string: '{"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 + 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"}}}}} + + ' + headers: + content-type: + - application/json + status: + code: 201 + message: Created +- request: + body: '{"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"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/on-call/schedules + response: + body: + string: '{"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"}]}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 201 + message: Created +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/on-call/schedules/7f4eb086-4141-4f2a-ae4a-c0a06816672b/on-call + response: + body: + string: '{"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"}}}}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/on-call/schedules/7f4eb086-4141-4f2a-ae4a-c0a06816672b + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/users/42e2447f-d0ee-11f0-b246-f6a778e5e220 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_the_schedule_oncall_user_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_the_schedule_oncall_user_returns_ok_response.frozen deleted file mode 100644 index baa8f4a589..0000000000 --- a/tests/v2/cassettes/test_scenarios/test_get_the_schedule_oncall_user_returns_ok_response.frozen +++ /dev/null @@ -1 +0,0 @@ -2025-11-27T14:11:47.631Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_the_schedule_oncall_user_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_the_schedule_oncall_user_returns_ok_response.yaml deleted file mode 100644 index c9baa23df8..0000000000 --- a/tests/v2/cassettes/test_scenarios/test_get_the_schedule_oncall_user_returns_ok_response.yaml +++ /dev/null @@ -1,87 +0,0 @@ -interactions: -- request: - body: '{"data":{"attributes":{"email":"Test-Get_the_schedule_on_call_user_returns_OK_response-1764252707@datadoghq.com","title":"user - title"},"type":"users"}}' - headers: - accept: - - application/json - content-type: - - application/json - method: POST - uri: https://api.datadoghq.com/api/v2/users - response: - body: - string: '{"data":{"type":"users","id":"030e767a-cb9b-11f0-8fcd-5ac0b02adf59","attributes":{"name":null,"handle":"test-get_the_schedule_on_call_user_returns_ok_response-1764252707@datadoghq.com","created_at":"2025-11-27T14:11:48.013486+00:00","modified_at":"2025-11-27T14:11:48.013486+00:00","email":"test-get_the_schedule_on_call_user_returns_ok_response-1764252707@datadoghq.com","icon":"https://secure.gravatar.com/avatar/a9e8940d153698e24c0b29024875d46f?s=48&d=retro","title":"user - 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"}}}}} - - ' - headers: - content-type: - - application/json - status: - code: 201 - message: Created -- request: - body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-11-17T14:11:47.631Z","end_date":"2025-12-07T14:11:47.631Z","interval":{"days":1},"members":[{"user":{"id":"030e767a-cb9b-11f0-8fcd-5ac0b02adf59"}}],"name":"Layer - 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-11-22T14:11:47.631Z"}],"name":"Test-Get_the_schedule_on_call_user_returns_OK_response-1764252707","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}' - headers: - accept: - - application/json - content-type: - - application/json - method: POST - uri: https://api.datadoghq.com/api/v2/on-call/schedules - response: - body: - string: '{"data":{"id":"93a33505-71dc-4be4-a55d-95eb23b6b400","type":"schedules","attributes":{"name":"Test-Get_the_schedule_on_call_user_returns_OK_response-1764252707","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"c9addf6a-059c-4b07-aced-a2c287fd969f","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' - headers: - content-type: - - application/vnd.api+json - status: - code: 201 - message: Created -- request: - body: null - headers: - accept: - - application/json - method: GET - uri: https://api.datadoghq.com/api/v2/on-call/schedules/93a33505-71dc-4be4-a55d-95eb23b6b400/on-call - response: - body: - string: '{"data":{"id":"030e767a-cb9b-11f0-8fcd-5ac0b02adf59-2025-11-27T09:11:48-05:00-2025-11-28T09:11:47-05:00","type":"shifts","attributes":{"end":"2025-11-28T09:11:47-05:00","start":"2025-11-27T09:11:48.47496-05:00"},"relationships":{"user":{"data":{"id":"030e767a-cb9b-11f0-8fcd-5ac0b02adf59","type":"users"}}}}}' - headers: - content-type: - - application/vnd.api+json - status: - code: 200 - message: OK -- request: - body: null - headers: - accept: - - '*/*' - method: DELETE - uri: https://api.datadoghq.com/api/v2/on-call/schedules/93a33505-71dc-4be4-a55d-95eb23b6b400 - response: - body: - string: '' - headers: {} - status: - code: 204 - message: No Content -- request: - body: null - headers: - accept: - - '*/*' - method: DELETE - uri: https://api.datadoghq.com/api/v2/users/030e767a-cb9b-11f0-8fcd-5ac0b02adf59 - response: - body: - string: '' - headers: {} - status: - code: 204 - message: No Content -version: 1 diff --git a/tests/v2/features/on-call.feature b/tests/v2/features/on-call.feature index 7bcd1d00e1..c52e4291fc 100644 --- a/tests/v2/features/on-call.feature +++ b/tests/v2/features/on-call.feature @@ -127,52 +127,52 @@ Feature: On-Call Then the response status is 200 OK @generated @skip @team:DataDog/on-call - Scenario: Get team on-call users returns "Bad Request" response - Given new "GetTeamOnCallUsers" request - And request contains "team_id" parameter from "REPLACE.ME" + Scenario: Get scheduled on-call user returns "Bad Request" response + Given new "GetScheduleOnCallUser" request + And request contains "schedule_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/on-call - Scenario: Get team on-call users returns "Not Found" response - Given new "GetTeamOnCallUsers" request - And request contains "team_id" parameter from "REPLACE.ME" + Scenario: Get scheduled on-call user returns "Not Found" response + Given new "GetScheduleOnCallUser" request + And request contains "schedule_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found @team:DataDog/on-call - Scenario: Get team on-call users returns "OK" response - Given new "GetTeamOnCallUsers" request + Scenario: Get scheduled on-call user returns "OK" response + Given new "GetScheduleOnCallUser" request And there is a valid "user" in the system - And there is a valid "dd_team" in the system And there is a valid "schedule" in the system - And there is a valid "escalation_policy" in the system - And there are valid "routing_rules" in the system - And request contains "team_id" parameter from "routing_rules.data.id" - And request contains "include" parameter with value "responders,escalations.responders" + And request contains "schedule_id" parameter from "schedule.data.id" When the request is sent Then the response status is 200 OK @generated @skip @team:DataDog/on-call - Scenario: Get the schedule on-call user returns "Bad Request" response - Given new "GetScheduleOnCallUser" request - And request contains "schedule_id" parameter from "REPLACE.ME" + Scenario: Get team on-call users returns "Bad Request" response + Given new "GetTeamOnCallUsers" request + And request contains "team_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/on-call - Scenario: Get the schedule on-call user returns "Not Found" response - Given new "GetScheduleOnCallUser" request - And request contains "schedule_id" parameter from "REPLACE.ME" + Scenario: Get team on-call users returns "Not Found" response + Given new "GetTeamOnCallUsers" request + And request contains "team_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found @team:DataDog/on-call - Scenario: Get the schedule on-call user returns "OK" response - Given new "GetScheduleOnCallUser" request + Scenario: Get team on-call users returns "OK" response + Given new "GetTeamOnCallUsers" request And there is a valid "user" in the system + And there is a valid "dd_team" in the system And there is a valid "schedule" in the system - And request contains "schedule_id" parameter from "schedule.data.id" + And there is a valid "escalation_policy" in the system + And there are valid "routing_rules" in the system + And request contains "team_id" parameter from "routing_rules.data.id" + And request contains "include" parameter with value "responders,escalations.responders" When the request is sent Then the response status is 200 OK