Class: Infrawrench::OnCallSchedulesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::OnCallSchedulesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.on_call.schedules
Instance Method Summary collapse
-
#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Create an on-call rotation.
-
#delete(schedule_id:, org_id: nil, request_options: nil) ⇒ nil
Delete an on-call rotation.
-
#get(org_id: nil, request_options: nil) ⇒ Hash
List on-call rotations.
-
#initialize(transport) ⇒ OnCallSchedulesNamespace
constructor
private
A new instance of OnCallSchedulesNamespace.
-
#shifts(schedule_id:, org_id: nil, count: nil, request_options: nil) ⇒ Hash
Preview upcoming shifts.
-
#update(schedule_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Edit an on-call rotation.
Constructor Details
#initialize(transport) ⇒ OnCallSchedulesNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of OnCallSchedulesNamespace.
10664 10665 10666 |
# File 'lib/infrawrench/client.rb', line 10664 def initialize(transport) @transport = transport end |
Instance Method Details
#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Create an on-call rotation
Shift boundaries are calendar-day arithmetic in the rotation's own zone, not 24-hour arithmetic: a rotation stepped in fixed milliseconds drifts an hour at each daylight-saving change until the 09:00 Monday handover happens at 08:00 — or until two people each think the other is on call.
Writing takes org:settings:write: a rotation decides who gets woken up.
POST /api/org/orgId/on-call/schedules
Raises on 400: Bad request
Raises on 409: Conflict
10689 10690 10691 10692 10693 10694 10695 10696 10697 |
# File 'lib/infrawrench/client.rb', line 10689 def create(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/on-call/schedules", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(schedule_id:, org_id: nil, request_options: nil) ⇒ nil
Delete an on-call rotation
Takes its covers with it. Routing rules naming it resolve to nobody afterwards.
DELETE /api/org/orgId/on-call/schedules/scheduleId
Raises on 404: Not found
10714 10715 10716 10717 10718 10719 10720 10721 10722 |
# File 'lib/infrawrench/client.rb', line 10714 def delete(schedule_id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/on-call/schedules/{scheduleId}", path_params: { "orgId" => org_id, "scheduleId" => schedule_id }, accept: :empty, request_options: ) end |
#get(org_id: nil, request_options: nil) ⇒ Hash
List on-call rotations
GET /api/org/orgId/on-call/schedules
10734 10735 10736 10737 10738 10739 10740 10741 |
# File 'lib/infrawrench/client.rb', line 10734 def get(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/on-call/schedules", path_params: { "orgId" => org_id }, request_options: ) end |
#shifts(schedule_id:, org_id: nil, count: nil, request_options: nil) ⇒ Hash
Preview upcoming shifts
The same computation the alert path resolves with, so a preview can never disagree with who actually gets woken up.
GET /api/org/orgId/on-call/schedules/scheduleId/shifts
Raises on 400: Bad request
Raises on 404: Not found
10762 10763 10764 10765 10766 10767 10768 10769 10770 |
# File 'lib/infrawrench/client.rb', line 10762 def shifts(schedule_id:, org_id: nil, count: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/on-call/schedules/{scheduleId}/shifts", path_params: { "orgId" => org_id, "scheduleId" => schedule_id }, query: { "count" => count }, request_options: ) end |
#update(schedule_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Edit an on-call rotation
Omitted fields are left alone, and the result is validated after merging.
Sending participantUserIds replaces the list wholesale — position is
rotation order, so reordering re-plans the future.
PATCH /api/org/orgId/on-call/schedules/scheduleId
Raises on 400: Bad request
Raises on 404: Not found
Raises on 409: Conflict
10793 10794 10795 10796 10797 10798 10799 10800 10801 |
# File 'lib/infrawrench/client.rb', line 10793 def update(schedule_id:, org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "PATCH", path: "/api/org/{orgId}/on-call/schedules/{scheduleId}", path_params: { "orgId" => org_id, "scheduleId" => schedule_id }, body: body, request_options: ) end |