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:



5571
5572
5573
# File 'lib/infrawrench/client.rb', line 5571

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:



5593
5594
5595
5596
5597
5598
5599
5600
# File 'lib/infrawrench/client.rb', line 5593

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:



5620
5621
5622
5623
5624
5625
5626
5627
# File 'lib/infrawrench/client.rb', line 5620

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:



5650
5651
5652
5653
5654
5655
5656
5657
5658
# File 'lib/infrawrench/client.rb', line 5650

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