Skip to content

Update rotation interval #2678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-07-02 20:43:17.503949",
"spec_repo_commit": "e327e6df"
"regenerated": "2025-07-03 15:40:46.434231",
"spec_repo_commit": "86252ae7"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-07-02 20:43:17.520727",
"spec_repo_commit": "e327e6df"
"regenerated": "2025-07-03 15:40:46.449850",
"spec_repo_commit": "86252ae7"
}
}
}
4 changes: 2 additions & 2 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20008,7 +20008,7 @@ components:
type: object
LayerAttributesInterval:
description: Defines how often the rotation repeats, using a combination of
days and optional seconds.
days and optional seconds. Should be at least 1 hour.
properties:
days:
description: The number of days in each rotation cycle.
Expand Down Expand Up @@ -33143,7 +33143,7 @@ components:
- effective_date: '2025-02-03T05:00:00Z'
end_date: '2025-12-31T00:00:00Z'
interval:
seconds: 300
seconds: 3600
members:
- user:
id: 00000000-aba1-0000-0000-000000000000
Expand Down
2 changes: 1 addition & 1 deletion examples/v2/on-call/UpdateOnCallSchedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
effective_date=(datetime.now() + relativedelta(days=-10)),
end_date=(datetime.now() + relativedelta(days=10)),
interval=LayerAttributesInterval(
seconds=300,
seconds=3600,
),
members=[
ScheduleRequestDataAttributesLayersItemsMembersItems(
Expand Down
2 changes: 1 addition & 1 deletion src/datadog_api_client/v2/model/layer_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
:param end_date: When the layer ceases to be active (ISO 8601).
:type end_date: datetime, optional

:param interval: Defines how often the rotation repeats, using a combination of days and optional seconds.
:param interval: Defines how often the rotation repeats, using a combination of days and optional seconds. Should be at least 1 hour.
:type interval: LayerAttributesInterval, optional

:param name: The name of this layer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def openapi_types(_):

def __init__(self_, days: Union[int, UnsetType] = unset, seconds: Union[int, UnsetType] = unset, **kwargs):
"""
Defines how often the rotation repeats, using a combination of days and optional seconds.
Defines how often the rotation repeats, using a combination of days and optional seconds. Should be at least 1 hour.

:param days: The number of days in each rotation cycle.
:type days: int, optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(
:param end_date: The date/time after which this layer no longer applies (in ISO 8601).
:type end_date: datetime, optional

:param interval: Defines how often the rotation repeats, using a combination of days and optional seconds.
:param interval: Defines how often the rotation repeats, using a combination of days and optional seconds. Should be at least 1 hour.
:type interval: LayerAttributesInterval

:param members: A list of members who participate in this layer's rotation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(
:param id: A unique identifier for the layer being updated.
:type id: str, optional

:param interval: Defines how often the rotation repeats, using a combination of days and optional seconds.
:param interval: Defines how often the rotation repeats, using a combination of days and optional seconds. Should be at least 1 hour.
:type interval: LayerAttributesInterval

:param members: The members assigned to this layer.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-05-29T04:54:24.605Z
2025-07-03T14:30:45.232Z
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interactions:
- request:
body: '{"data":{"attributes":{"email":"Test-Update_On_Call_schedule_returns_OK_response-1748494464@datadoghq.com","title":"user
body: '{"data":{"attributes":{"email":"Test-Update_On_Call_schedule_returns_OK_response-1751553045@datadoghq.com","title":"user
title"},"type":"users"}}'
headers:
accept:
Expand All @@ -11,7 +11,7 @@ interactions:
uri: https://api.datadoghq.com/api/v2/users
response:
body:
string: '{"data":{"type":"users","id":"fe6b1fbd-3c48-11f0-90c9-4ad2f0f8c382","attributes":{"name":null,"handle":"test-update_on_call_schedule_returns_ok_response-1748494464@datadoghq.com","created_at":"2025-05-29T04:54:25.223093+00:00","modified_at":"2025-05-29T04:54:25.223093+00:00","email":"test-update_on_call_schedule_returns_ok_response-1748494464@datadoghq.com","icon":"https://secure.gravatar.com/avatar/6bc23e301121dc7a0a2d1adc71bbbc54?s=48&d=retro","title":"user
string: '{"data":{"type":"users","id":"4ea279a2-581a-11f0-bb4d-bed6e06a25e4","attributes":{"name":null,"handle":"test-update_on_call_schedule_returns_ok_response-1751553045@datadoghq.com","created_at":"2025-07-03T14:30:46.015046+00:00","modified_at":"2025-07-03T14:30:46.015046+00:00","email":"test-update_on_call_schedule_returns_ok_response-1751553045@datadoghq.com","icon":"https://secure.gravatar.com/avatar/8c4a38455f71bb12d82add5157f105a0?s=48&d=retro","title":"user
title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending"},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}}

'
Expand All @@ -22,8 +22,8 @@ interactions:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-05-19T04:54:24.605Z","end_date":"2025-06-08T04:54:24.605Z","interval":{"days":1},"members":[{"user":{"id":"fe6b1fbd-3c48-11f0-90c9-4ad2f0f8c382"}}],"name":"Layer
1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-05-24T04:54:24.605Z"}],"name":"Test-Update_On_Call_schedule_returns_OK_response-1748494464","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}'
body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-06-23T14:30:45.232Z","end_date":"2025-07-13T14:30:45.232Z","interval":{"days":1},"members":[{"user":{"id":"4ea279a2-581a-11f0-bb4d-bed6e06a25e4"}}],"name":"Layer
1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-06-28T14:30:45.232Z"}],"name":"Test-Update_On_Call_schedule_returns_OK_response-1751553045","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}'
headers:
accept:
- application/json
Expand All @@ -33,15 +33,15 @@ interactions:
uri: https://api.datadoghq.com/api/v2/on-call/schedules
response:
body:
string: '{"data":{"id":"f12650c6-beae-40fd-a686-7e57d72216c6","type":"schedules","attributes":{"name":"Test-Update_On_Call_schedule_returns_OK_response-1748494464","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"b9dca7b6-b083-44d3-9971-6c2c796fb352","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}'
string: '{"data":{"id":"3cb80fa4-f506-4b2f-9187-2af6c2253698","type":"schedules","attributes":{"name":"Test-Update_On_Call_schedule_returns_OK_response-1751553045","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"70f75d0e-19d0-46a1-9c1c-19d2de171744","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: '{"data":{"attributes":{"handle":"test-handle-ed2e958dacae5dbc","name":"test-name-ed2e958dacae5dbc"},"type":"team"}}'
body: '{"data":{"attributes":{"handle":"test-handle-001d7ca9284aa632","name":"test-name-001d7ca9284aa632"},"type":"team"}}'
headers:
accept:
- application/json
Expand All @@ -51,7 +51,7 @@ interactions:
uri: https://api.datadoghq.com/api/v2/team
response:
body:
string: '{"data":{"type":"team","id":"522c3ff2-76b4-41db-8cfa-9bb9876145e4","attributes":{"name":"test-name-ed2e958dacae5dbc","handle":"test-handle-ed2e958dacae5dbc","summary":null,"description":null,"avatar":null,"banner":13,"visible_modules":[],"hidden_modules":[],"created_at":"2025-05-29T04:54:26.535052+00:00","modified_at":"2025-05-29T04:54:26.535061+00:00","user_count":0,"link_count":0},"relationships":{"team_links":{"links":{"related":"/api/v2/team/522c3ff2-76b4-41db-8cfa-9bb9876145e4/links"}},"user_team_permissions":{"links":{"related":"/api/v2/team/522c3ff2-76b4-41db-8cfa-9bb9876145e4/permission-settings"}}}}}
string: '{"data":{"type":"team","id":"9ca20f11-ede5-4147-addb-25b7f91ce508","attributes":{"name":"test-name-001d7ca9284aa632","handle":"test-handle-001d7ca9284aa632","summary":null,"description":null,"avatar":null,"banner":13,"visible_modules":[],"hidden_modules":[],"created_at":"2025-07-03T14:30:46.275583+00:00","modified_at":"2025-07-03T14:30:46.275594+00:00","user_count":0,"link_count":0},"relationships":{"team_links":{"links":{"related":"/api/v2/team/9ca20f11-ede5-4147-addb-25b7f91ce508/links"}},"user_team_permissions":{"links":{"related":"/api/v2/team/9ca20f11-ede5-4147-addb-25b7f91ce508/permission-settings"}}}}}

'
headers:
Expand All @@ -61,18 +61,18 @@ interactions:
code: 201
message: Created
- request:
body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-05-19T04:54:24.605Z","end_date":"2025-06-08T04:54:24.605Z","id":"b9dca7b6-b083-44d3-9971-6c2c796fb352","interval":{"seconds":300},"members":[{"user":{"id":"fe6b1fbd-3c48-11f0-90c9-4ad2f0f8c382"}}],"name":"Layer
1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-05-24T04:54:24.605Z"}],"name":"Test-Update_On_Call_schedule_returns_OK_response-1748494464","time_zone":"America/New_York"},"id":"f12650c6-beae-40fd-a686-7e57d72216c6","relationships":{"teams":{"data":[{"id":"522c3ff2-76b4-41db-8cfa-9bb9876145e4","type":"teams"}]}},"type":"schedules"}}'
body: '{"data":{"attributes":{"layers":[{"effective_date":"2025-06-23T14:30:45.232Z","end_date":"2025-07-13T14:30:45.232Z","id":"70f75d0e-19d0-46a1-9c1c-19d2de171744","interval":{"seconds":3600},"members":[{"user":{"id":"4ea279a2-581a-11f0-bb4d-bed6e06a25e4"}}],"name":"Layer
1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-06-28T14:30:45.232Z"}],"name":"Test-Update_On_Call_schedule_returns_OK_response-1751553045","time_zone":"America/New_York"},"id":"3cb80fa4-f506-4b2f-9187-2af6c2253698","relationships":{"teams":{"data":[{"id":"9ca20f11-ede5-4147-addb-25b7f91ce508","type":"teams"}]}},"type":"schedules"}}'
headers:
accept:
- application/json
content-type:
- application/json
method: PUT
uri: https://api.datadoghq.com/api/v2/on-call/schedules/f12650c6-beae-40fd-a686-7e57d72216c6
uri: https://api.datadoghq.com/api/v2/on-call/schedules/3cb80fa4-f506-4b2f-9187-2af6c2253698
response:
body:
string: '{"data":{"id":"f12650c6-beae-40fd-a686-7e57d72216c6","type":"schedules","attributes":{"name":"Test-Update_On_Call_schedule_returns_OK_response-1748494464","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"b9dca7b6-b083-44d3-9971-6c2c796fb352","type":"layers"}]},"teams":{"data":[{"id":"522c3ff2-76b4-41db-8cfa-9bb9876145e4","type":"teams"}]}}}}'
string: '{"data":{"id":"3cb80fa4-f506-4b2f-9187-2af6c2253698","type":"schedules","attributes":{"name":"Test-Update_On_Call_schedule_returns_OK_response-1751553045","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"70f75d0e-19d0-46a1-9c1c-19d2de171744","type":"layers"}]},"teams":{"data":[{"id":"9ca20f11-ede5-4147-addb-25b7f91ce508","type":"teams"}]}}}}'
headers:
content-type:
- application/vnd.api+json
Expand All @@ -85,7 +85,7 @@ interactions:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/team/522c3ff2-76b4-41db-8cfa-9bb9876145e4
uri: https://api.datadoghq.com/api/v2/team/9ca20f11-ede5-4147-addb-25b7f91ce508
response:
body:
string: ''
Expand All @@ -99,7 +99,7 @@ interactions:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/on-call/schedules/f12650c6-beae-40fd-a686-7e57d72216c6
uri: https://api.datadoghq.com/api/v2/on-call/schedules/3cb80fa4-f506-4b2f-9187-2af6c2253698
response:
body:
string: ''
Expand All @@ -113,7 +113,7 @@ interactions:
accept:
- '*/*'
method: DELETE
uri: https://api.datadoghq.com/api/v2/users/fe6b1fbd-3c48-11f0-90c9-4ad2f0f8c382
uri: https://api.datadoghq.com/api/v2/users/4ea279a2-581a-11f0-bb4d-bed6e06a25e4
response:
body:
string: ''
Expand Down
6 changes: 3 additions & 3 deletions tests/v2/features/on-call.feature
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ Feature: On-Call
Scenario: Update On-Call schedule returns "Bad Request" response
Given new "UpdateOnCallSchedule" request
And request contains "schedule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"seconds": 300}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule Updated", "time_zone": "America/New_York"}, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}}
And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"seconds": 3600}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule Updated", "time_zone": "America/New_York"}, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/bugle
Scenario: Update On-Call schedule returns "Not Found" response
Given new "UpdateOnCallSchedule" request
And request contains "schedule_id" parameter from "REPLACE.ME"
And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"seconds": 300}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule Updated", "time_zone": "America/New_York"}, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}}
And body with value {"data": {"attributes": {"layers": [{"effective_date": "2025-02-03T05:00:00Z", "end_date": "2025-12-31T00:00:00Z", "interval": {"seconds": 3600}, "members": [{"user": {"id": "00000000-aba1-0000-0000-000000000000"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "2025-02-01T00:00:00Z"}], "name": "On-Call Schedule Updated", "time_zone": "America/New_York"}, "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "relationships": {"teams": {"data": [{"id": "00000000-da3a-0000-0000-000000000000", "type": "teams"}]}}, "type": "schedules"}}
When the request is sent
Then the response status is 404 Not Found

Expand All @@ -240,6 +240,6 @@ Feature: On-Call
And there is a valid "schedule" in the system
And there is a valid "dd_team" in the system
And request contains "schedule_id" parameter from "schedule.data.id"
And body with value {"data": { "id": "{{ schedule.data.id }}", "attributes": {"layers": [{"id": "{{ schedule.data.relationships.layers.data[0].id }}" , "effective_date": "{{ timeISO('now - 10d') }}", "end_date": "{{ timeISO('now + 10d') }}", "interval": {"seconds": 300}, "members": [{"user": {"id": "{{user.data.id}}"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "{{ timeISO('now - 5d') }}"}], "name": "{{ unique }}", "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "{{dd_team.data.id}}", "type": "teams"}]}}, "type": "schedules"}}
And body with value {"data": { "id": "{{ schedule.data.id }}", "attributes": {"layers": [{"id": "{{ schedule.data.relationships.layers.data[0].id }}" , "effective_date": "{{ timeISO('now - 10d') }}", "end_date": "{{ timeISO('now + 10d') }}", "interval": {"seconds": 3600}, "members": [{"user": {"id": "{{user.data.id}}"}}], "name": "Layer 1", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}], "rotation_start": "{{ timeISO('now - 5d') }}"}], "name": "{{ unique }}", "time_zone": "America/New_York"}, "relationships": {"teams": {"data": [{"id": "{{dd_team.data.id}}", "type": "teams"}]}}, "type": "schedules"}}
When the request is sent
Then the response status is 200 OK