Class: Infrawrench::WorkflowApprovalsNamespace

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

Overview

client.workflow_approvals

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ WorkflowApprovalsNamespace

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

Parameters:



5274
5275
5276
# File 'lib/infrawrench/client.rb', line 5274

def initialize(transport)
  @transport = transport
end

Instance Method Details

#approve(id:, org_id: nil, request_options: nil) ⇒ Hash

Approve a pending workflow approval request

The suspended run resumes within a few seconds of the decision landing.

Requires permission: dashboards:write.

POST /api/org/orgId/workflow-approvals/id/approve

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



5296
5297
5298
5299
5300
5301
5302
5303
# File 'lib/infrawrench/client.rb', line 5296

def approve(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/workflow-approvals/{id}/approve",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

#deny(id:, org_id: nil, request_options: nil) ⇒ Hash

Deny a pending workflow approval request

Denial fails the waiting infra.waitForApproval(...) call in the run.

Requires permission: dashboards:write.

POST /api/org/orgId/workflow-approvals/id/deny

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



5323
5324
5325
5326
5327
5328
5329
5330
# File 'lib/infrawrench/client.rb', line 5323

def deny(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/workflow-approvals/{id}/deny",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

#list(org_id: nil, status: nil, workflow_id: nil, run_id: nil, request_options: nil) ⇒ Array<Hash>

List workflow approval requests

Approval requests raised by infra.waitForApproval(...) inside workflow runs, newest first. Filter with status=pending to build an approvals inbox.

Requires permission: dashboards:read.

GET /api/org/orgId/workflow-approvals

Raises on 400: Bad request

Parameters:

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

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

  • status (String, nil) (defaults to: nil)
  • workflow_id (String, nil) (defaults to: nil)
  • run_id (String, nil) (defaults to: nil)
  • request_options (Hash, nil) (defaults to: nil)

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

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

Returns:

  • (Array<Hash>)

    Parsed JSON, shaped as Array<WorkflowApproval> — see sig/infrawrench/sdk.rbs.

Raises:



5353
5354
5355
5356
5357
5358
5359
5360
5361
# File 'lib/infrawrench/client.rb', line 5353

def list(org_id: nil, status: nil, workflow_id: nil, run_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/workflow-approvals",
    path_params: { "orgId" => org_id },
    query: { "status" => status, "workflowId" => workflow_id, "runId" => run_id },
    request_options: request_options
  )
end