Class: Infrawrench::DeploymentsRunsNamespace

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

Overview

client.deployments.runs

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ DeploymentsRunsNamespace

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

Parameters:



6147
6148
6149
# File 'lib/infrawrench/client.rb', line 6147

def initialize(transport)
  @transport = transport
end

Instance Method Details

#cost_impact(id:, org_id: nil, window_days: nil, cost_basis: nil, request_options: nil) ⇒ Hash

Cost impact of a deployment run

The same comparison as POST /changes/cost-impacts, run over the resources this deploy provisioned, with a per-resource breakdown that sums to the total.

Requires permission: costs:read.

GET /api/org/orgId/deployments/runs/id/cost-impact

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.

  • id (String)
  • window_days (Integer, nil) (defaults to: nil)
  • cost_basis (String, nil) (defaults to: nil)

    Which charge-type basis both windows are read on. cash (the default) is what the provider charged on the day it charged it; amortized spreads a commitment's up-front fee across the term it buys. It is echoed on every response because a delta whose basis is unstated is unreadable — an amortized 'after' against a cash 'before' looks exactly like a saving.

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

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

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

Returns:

  • (Hash)

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

Raises:



6178
6179
6180
6181
6182
6183
6184
6185
6186
# File 'lib/infrawrench/client.rb', line 6178

def cost_impact(id:, org_id: nil, window_days: nil, cost_basis: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/deployments/runs/{id}/cost-impact",
    path_params: { "orgId" => org_id, "id" => id },
    query: { "windowDays" => window_days, "costBasis" => cost_basis },
    request_options: request_options
  )
end

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

Record a deployment that ran elsewhere

The CLI builds on the operator's own machine, so the server never sees that run. Reporting it here keeps one history across both origins.

Requires permission: deployments:write.

POST /api/org/orgId/deployments/runs

Raises on 400: Bad request

Raises on 401: Unauthenticated

Raises on 403: Forbidden

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

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

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

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

Returns:

  • (Hash)

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

Raises:



6209
6210
6211
6212
6213
6214
6215
6216
6217
# File 'lib/infrawrench/client.rb', line 6209

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

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

Get one deployment run, with its logs and rendered Dockerfile

Requires permission: deployments:read.

GET /api/org/orgId/deployments/runs/id

Raises on 401: Unauthenticated

Raises on 403: Forbidden

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.

  • 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 DeploymentRun — see sig/infrawrench/sdk.rbs.

Raises:



6237
6238
6239
6240
6241
6242
6243
6244
# File 'lib/infrawrench/client.rb', line 6237

def get(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/deployments/runs/{id}",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

#list(org_id: nil, env: nil, limit: nil, request_options: nil) ⇒ Array<Hash>

List deployment runs

Requires permission: deployments:read.

GET /api/org/orgId/deployments/runs

Raises on 401: Unauthenticated

Raises on 403: Forbidden

Parameters:

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

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

  • env (String, nil) (defaults to: nil)
  • limit (Integer, 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)
  • env: (String, nil) (defaults to: nil)
  • limit: (Integer, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Array<Hash>)

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

Raises:



6264
6265
6266
6267
6268
6269
6270
6271
6272
# File 'lib/infrawrench/client.rb', line 6264

def list(org_id: nil, env: nil, limit: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/deployments/runs",
    path_params: { "orgId" => org_id },
    query: { "env" => env, "limit" => limit },
    request_options: request_options
  )
end

#rollback(id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Roll back to a previous deployment

Re-runs that run's deploy() with the image and plan it recorded, building nothing — the exact artifact that was known good ships again. The Infrafile is read at the commit that run deployed, not at the branch head. Only a successful run that produced an image can be rolled back to. With deleteCreated, resources that runs after the target created through infra.accounts are deleted once the rollback has succeeded — undoing the provisioning, not just the shipping. Deletions are best-effort and reported in the result's notes.

Requires permission: deployments:write.

POST /api/org/orgId/deployments/runs/id/rollback

Raises on 400: Bad request

Raises on 401: Unauthenticated

Raises on 402: Payment required — the organization's plan does not include this

Raises on 403: Forbidden

Raises on 404: Not found

Raises on 409: Conflict

Raises on 423: Blocked by an active change freeze. Retry with the x-change-freeze-override: true header if you hold freezes:override; both blocks and overrides are audit-logged.

Parameters:

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

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

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

    Request body, shaped as DeployRollbackInput.

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

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

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

Returns:

  • (Hash)

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

Raises:



6313
6314
6315
6316
6317
6318
6319
6320
6321
# File 'lib/infrawrench/client.rb', line 6313

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