Class: Infrawrench::SchedulesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::SchedulesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.schedules
Instance Method Summary collapse
-
#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Create a sleep/wake schedule.
-
#delete(schedule_id:, org_id: nil, request_options: nil) ⇒ nil
Delete a schedule.
-
#get(org_id: nil, request_options: nil) ⇒ Hash
List sleep/wake schedules.
-
#initialize(transport) ⇒ SchedulesNamespace
constructor
private
A new instance of SchedulesNamespace.
-
#preview(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Preview a schedule's projected saving.
-
#update(schedule_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Update or pause a schedule.
Constructor Details
#initialize(transport) ⇒ SchedulesNamespace
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 SchedulesNamespace.
13603 13604 13605 |
# File 'lib/infrawrench/client.rb', line 13603 def initialize(transport) @transport = transport end |
Instance Method Details
#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Create a sleep/wake schedule
Attach an off-at/on-at weekly window to a resource. The resource's type must declare lifecycle start/stop actions (see the resource type metadata); one schedule per resource. Times are wall-clock in the given IANA timezone and remain correct across DST. Audit-logged.
Requires permission: resources:write.
POST /api/org/orgId/schedules
Raises on 400: Bad request
Raises on 404: Not found
Raises on 409: The resource already has a schedule
13630 13631 13632 13633 13634 13635 13636 13637 13638 |
# File 'lib/infrawrench/client.rb', line 13630 def create(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/schedules", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(schedule_id:, org_id: nil, request_options: nil) ⇒ nil
Delete a schedule
Remove the schedule. The resource is left in whatever state it is in. Audit-logged.
Requires permission: resources:write.
DELETE /api/org/orgId/schedules/scheduleId
Raises on 404: Not found
13657 13658 13659 13660 13661 13662 13663 13664 13665 |
# File 'lib/infrawrench/client.rb', line 13657 def delete(schedule_id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/schedules/{scheduleId}", path_params: { "orgId" => org_id, "scheduleId" => schedule_id }, accept: :empty, request_options: ) end |
#get(org_id: nil, request_options: nil) ⇒ Hash
List sleep/wake schedules
Every schedule in the organization with its next transition, last run outcome and a projected monthly saving computed from trailing per-resource spend and the weekly off-hours fraction. Schedules attach to resources whose plugin declares lifecycle start/stop actions; the poller executes due transitions server-side.
Requires permission: resources:read.
GET /api/org/orgId/schedules
13684 13685 13686 13687 13688 13689 13690 13691 |
# File 'lib/infrawrench/client.rb', line 13684 def get(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/schedules", path_params: { "orgId" => org_id }, request_options: ) end |
#preview(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Preview a schedule's projected saving
Quote a timing against a resource before saving: the weekly off-hours fraction, the resource's trailing spend normalized to a month, the projected monthly saving, and the next few transitions. Makes no provider API calls and changes nothing.
Requires permission: resources:read.
POST /api/org/orgId/schedules/preview
Raises on 400: Bad request
Raises on 404: Not found
13715 13716 13717 13718 13719 13720 13721 13722 13723 |
# File 'lib/infrawrench/client.rb', line 13715 def preview(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/schedules/preview", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#update(schedule_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash
Update or pause a schedule
Edit the timing and/or toggle paused. Any change recomputes the next
transition; pausing clears it. Audit-logged.
Requires permission: resources:write.
PUT /api/org/orgId/schedules/scheduleId
Raises on 400: Bad request
Raises on 404: Not found
13745 13746 13747 13748 13749 13750 13751 13752 13753 |
# File 'lib/infrawrench/client.rb', line 13745 def update(schedule_id:, org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/schedules/{scheduleId}", path_params: { "orgId" => org_id, "scheduleId" => schedule_id }, body: body, request_options: ) end |