Class: Infrawrench::SharedConsolesNamespace

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

Overview

client.shared_consoles

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ SharedConsolesNamespace

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

Parameters:



12795
12796
12797
12798
12799
# File 'lib/infrawrench/client.rb', line 12795

def initialize(transport)
  @transport = transport
  @invites = SharedConsolesInvitesNamespace.new(@transport)
  @participants = SharedConsolesParticipantsNamespace.new(@transport)
end

Instance Attribute Details

#invitesSharedConsolesInvitesNamespace (readonly)

Returns client.shared_consoles.invites.

Returns:



12789
12790
12791
# File 'lib/infrawrench/client.rb', line 12789

def invites
  @invites
end

#participantsSharedConsolesParticipantsNamespace (readonly)

Returns client.shared_consoles.participants.

Returns:



12791
12792
12793
# File 'lib/infrawrench/client.rb', line 12791

def participants
  @participants
end

Instance Method Details

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

Share a live SSH session

Opens a share on a session you already have running and mints its first invite. You become the driver.

Returns 409 console_not_here when the pty is held by a different server replica than the one answering this call — reopen the terminal and share again. Writing the share anyway would produce a link that authorises correctly and then finds nothing to attach to.

Requires resources:execute — the same permission as opening the terminal. Closed to API keys: sharing a shell is an act a person performs.

Requires permission: resources:execute.

POST /api/org/orgId/shared-consoles

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.

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

    Request body, shaped as CreateSharedConsole.

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

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

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

Returns:

  • (Hash)

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

Raises:



12831
12832
12833
12834
12835
12836
12837
12838
12839
# File 'lib/infrawrench/client.rb', line 12831

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

#delete(console_id:, org_id: nil, request_options: nil) ⇒ Hash

Revoke a share

Disconnects every guest and stops the fan-out. The sharer's own SSH session carries on — revoking a share is not killing a terminal.

The sharer or a holder of org:settings:write. Deliberately does not require resources:execute: ending access must never be gated on still holding the access, or an owner whose role was narrowed mid-incident could not close the session they opened.

DELETE /api/org/orgId/shared-consoles/consoleId

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



12863
12864
12865
12866
12867
12868
12869
12870
# File 'lib/infrawrench/client.rb', line 12863

def delete(console_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/shared-consoles/{consoleId}",
    path_params: { "orgId" => org_id, "consoleId" => console_id },
    request_options: request_options
  )
end

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

Get one shared console

Visible to participants and to anyone who could revoke it (the sharer, or a holder of org:settings:write). Others get 404 — that a named colleague has a root shell open on a named production host right now is operational information.

Requires permission: resources:execute.

GET /api/org/orgId/shared-consoles/consoleId

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



12892
12893
12894
12895
12896
12897
12898
12899
# File 'lib/infrawrench/client.rb', line 12892

def get(console_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/shared-consoles/{consoleId}",
    path_params: { "orgId" => org_id, "consoleId" => console_id },
    request_options: request_options
  )
end

#handover(console_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Move the keyboard to another participant

Authorised by the current driver (the keyboard is theirs to give) or by the sharer (it is their box, and asking permission from somebody who has stopped responding is not a control). An observer cannot promote themselves — that is /request-driver.

Two simultaneous grants cannot both win: the database's partial unique index decides the order, and the loser gets 409 driver-race-lost.

The pty resizes to the new driver's viewport; everyone else letterboxes.

Requires permission: resources:execute.

POST /api/org/orgId/shared-consoles/consoleId/handover

Raises on 400: Bad request

Raises on 403: Forbidden

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.

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

    Request body, shaped as Hash.

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

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

  • console_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: ({ "participantId" => String }, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

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

Raises:



12933
12934
12935
12936
12937
12938
12939
12940
12941
# File 'lib/infrawrench/client.rb', line 12933

def handover(console_id:, org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/shared-consoles/{consoleId}/handover",
    path_params: { "orgId" => org_id, "consoleId" => console_id },
    body: body,
    request_options: request_options
  )
end

#join(console_id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Redeem an invite and join

Admission needs live org membership and resources:execute — the invite is a locator, never a capability, so a leaked link admits nobody who could not have opened the shell themselves.

The invite is consumed by the first person it admits. Somebody already on the console resumes their own row without a token, so a reload costs them nothing and obliges the sharer to mint nothing. New joiners always start as observers whatever the link said.

Audit-logged as shared_console.join, and written onto the recording's timeline as an asciicast marker.

Requires permission: resources:execute.

POST /api/org/orgId/shared-consoles/consoleId/join

Raises on 400: Bad request

Raises on 403: Forbidden

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.

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

    Request body, shaped as Hash.

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

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

  • console_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • body: ({ "token" => String }, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

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

Raises:



12977
12978
12979
12980
12981
12982
12983
12984
12985
# File 'lib/infrawrench/client.rb', line 12977

def join(console_id:, org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/shared-consoles/{consoleId}/join",
    path_params: { "orgId" => org_id, "consoleId" => console_id },
    body: body,
    request_options: request_options
  )
end

#leave(console_id:, org_id: nil, request_options: nil) ⇒ Hash

Leave a shared console

Steps you off without ending the session. Your row survives, so the same invite is not needed again. Deliberately does not require resources:execute: giving access up must never be gated on still holding it.

POST /api/org/orgId/shared-consoles/consoleId/leave

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



13005
13006
13007
13008
13009
13010
13011
13012
# File 'lib/infrawrench/client.rb', line 13005

def leave(console_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/shared-consoles/{consoleId}/leave",
    path_params: { "orgId" => org_id, "consoleId" => console_id },
    request_options: request_options
  )
end

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

List sessions currently shared

Live shared SSH sessions in this organization, with who is on each. Only cloud SSH can be shared: those sessions are already proxied by the server, so fanning the pty out to a second socket is a consumer of a stream it holds. A desktop session dialling a host directly never reaches the server and cannot be shared.

Requires permission: resources:execute.

GET /api/org/orgId/shared-consoles

Parameters:

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

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

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

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

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

Returns:

  • (Array<Hash>)

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

Raises:



13032
13033
13034
13035
13036
13037
13038
13039
# File 'lib/infrawrench/client.rb', line 13032

def list(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/shared-consoles",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#request_driver(console_id:, org_id: nil, request_options: nil) ⇒ Hash

Ask for the keyboard

Raises a flag the driver and the sharer can see. Grants nothing on its own — that is the point.

Requires permission: resources:execute.

POST /api/org/orgId/shared-consoles/consoleId/request-driver

Raises on 403: Forbidden

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



13063
13064
13065
13066
13067
13068
13069
13070
# File 'lib/infrawrench/client.rb', line 13063

def request_driver(console_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/shared-consoles/{consoleId}/request-driver",
    path_params: { "orgId" => org_id, "consoleId" => console_id },
    request_options: request_options
  )
end