Class: Infrawrench::RunbooksNamespace

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

Overview

client.runbooks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ RunbooksNamespace

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 RunbooksNamespace.

Parameters:



13325
13326
13327
13328
13329
# File 'lib/infrawrench/client.rb', line 13325

def initialize(transport)
  @transport = transport
  @get = RunbooksGetNamespace.new(@transport)
  @runs = RunbooksRunsNamespace.new(@transport)
end

Instance Attribute Details

#getRunbooksGetNamespace (readonly)

Returns client.runbooks.get.

Returns:



13319
13320
13321
# File 'lib/infrawrench/client.rb', line 13319

def get
  @get
end

#runsRunbooksRunsNamespace (readonly)

Returns client.runbooks.runs.

Returns:



13321
13322
13323
# File 'lib/infrawrench/client.rb', line 13321

def runs
  @runs
end

Instance Method Details

#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash

Write a runbook

Editing takes org:settings:write — a procedure is an org-wide statement about how something is done, and it is read by strangers under pressure. Names are unique within an organization: two runbooks called "Failover" is how the wrong one gets run.

POST /api/org/orgId/runbooks

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 RunbookCreate.

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

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

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

Returns:

  • (Hash)

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

Raises:



13350
13351
13352
13353
13354
13355
13356
13357
13358
# File 'lib/infrawrench/client.rb', line 13350

def create(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/runbooks",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#delete(runbook_id:, org_id: nil, request_options: nil) ⇒ nil

Delete a runbook

Takes its run history with it. To retire a procedure without losing the record of the runs performed against it, set enabled to false instead.

DELETE /api/org/orgId/runbooks/runbookId

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.

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

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

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



13375
13376
13377
13378
13379
13380
13381
13382
13383
# File 'lib/infrawrench/client.rb', line 13375

def delete(runbook_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/runbooks/{runbookId}",
    path_params: { "orgId" => org_id, "runbookId" => runbook_id },
    accept: :empty,
    request_options: request_options
  )
end

#update(runbook_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Edit a runbook

Omitted fields are left alone. The result is validated after merging, so a patch that only changes the steps still has to produce a runbook that is valid as a whole. A step sent with its id keeps its identity, so a run in progress still matches it.

PATCH /api/org/orgId/runbooks/runbookId

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.

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

    Request body, shaped as RunbookUpdate.

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

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

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

Returns:

  • (Hash)

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

Raises:



13407
13408
13409
13410
13411
13412
13413
13414
13415
# File 'lib/infrawrench/client.rb', line 13407

def update(runbook_id:, org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "PATCH",
    path: "/api/org/{orgId}/runbooks/{runbookId}",
    path_params: { "orgId" => org_id, "runbookId" => runbook_id },
    body: body,
    request_options: request_options
  )
end