Class: Infrawrench::OnCallSchedulesNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.on_call.schedules

Instance Method Summary collapse

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.

Parameters:



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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as OnCallScheduleCreate.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • body: (on_call_schedule_create, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as OnCallSchedule — see sig/infrawrench/sdk.rbs.

Raises:



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: 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • schedule_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • schedule_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (nil)

    This endpoint returns no content.

Raises:



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: request_options
  )
end

#get(org_id: nil, request_options: nil) ⇒ Hash

List on-call rotations

GET /api/org/orgId/on-call/schedules

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as OnCallScheduleList — see sig/infrawrench/sdk.rbs.

Raises:



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: 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • schedule_id (String)
  • count (Integer, nil) (defaults to: nil)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • schedule_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • count: (Integer, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as OnCallShiftsResponse — see sig/infrawrench/sdk.rbs.

Raises:



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: 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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • schedule_id (String)
  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as OnCallScheduleUpdate.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • schedule_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: (on_call_schedule_update, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as OnCallSchedule — see sig/infrawrench/sdk.rbs.

Raises:



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: request_options
  )
end