Class: Infrawrench::AppsNamespace

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

Overview

client.apps

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ AppsNamespace

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

Parameters:



1601
1602
1603
# File 'lib/infrawrench/client.rb', line 1601

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Check whether a host can run Linux applications

Runs a read-only shell probe over SSH and reports what the host is missing, plus the packages and commands that would fix it. A POST because it opens a connection to the named host and must never be cached — its whole value is saying what the host is now.

POST /api/org/orgId/apps/check

Raises on 400: Bad request

Raises on 404: Not found

Raises on 409: The host key is new or has changed; trust it and retry

Raises on 502: The host could not be reached or probed

Parameters:

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

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

  • body (Hash)

    Request body, shaped as LinuxAppHostTarget.

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

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

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

Returns:

  • (Hash)

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

Raises:



1628
1629
1630
1631
1632
1633
1634
1635
1636
# File 'lib/infrawrench/client.rb', line 1628

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

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

Install what a host needs to run Linux applications

Installs the named requirements using the host's own package manager, then re-probes and reports what the host now is. Takes requirement ids, never commands — the commands are derived server-side from a fresh probe. Needs root or passwordless sudo on the host, respects change freezes, and is audited as linux_app.host_setup.

Responds with application/x-ndjson: one {"line":"…"} per line of package-manager output, then a final {"outcome":{…}}. A failure arrives as {"error":"…"} inside the stream, because the status line has already been sent by then.

POST /api/org/orgId/apps/setup

Raises on 400: Bad request

Raises on 404: Not found

Raises on 409: A change freeze is in effect, or the host key needs trusting

Parameters:

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

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

  • body (Hash)

    Request body, shaped as LinuxAppSetupRequest.

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

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

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

Returns:

  • (Hash)

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

Raises:



1667
1668
1669
1670
1671
1672
1673
1674
1675
# File 'lib/infrawrench/client.rb', line 1667

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