Class: Infrawrench::AgentsSessionsNamespace

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

Overview

client.agents.sessions

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ AgentsSessionsNamespace

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

Parameters:



325
326
327
# File 'lib/infrawrench/client.rb', line 325

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Create an agent session

Requires permission: resources:write.

POST /api/org/orgId/agents/sessions

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.

  • body (Hash)

    Request body, shaped as CreateAgentSession.

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

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

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

Returns:

  • (Hash)

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

Raises:



343
344
345
346
347
348
349
350
351
# File 'lib/infrawrench/client.rb', line 343

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

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

Delete an agent session and destroy its VM

Requires permission: resources:delete.

DELETE /api/org/orgId/agents/sessions/id

Raises on 404: Not found

Raises on 502: The provider refused to delete the VM

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

Raises:



369
370
371
372
373
374
375
376
# File 'lib/infrawrench/client.rb', line 369

def delete(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/agents/sessions/{id}",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

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

List agent sessions

Requires permission: resources:read.

GET /api/org/orgId/agents/sessions

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

Raises:



390
391
392
393
394
395
396
397
# File 'lib/infrawrench/client.rb', line 390

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

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

Return the command and working directory for an agent session

Requires permission: resources:execute.

POST /api/org/orgId/agents/sessions/id/open

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

Raises:



413
414
415
416
417
418
419
420
# File 'lib/infrawrench/client.rb', line 413

def open(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/agents/sessions/{id}/open",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

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

Return reconciliation branch metadata

Requires permission: resources:execute.

POST /api/org/orgId/agents/sessions/id/reconcile

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

Raises:



436
437
438
439
440
441
442
443
# File 'lib/infrawrench/client.rb', line 436

def reconcile(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/agents/sessions/{id}/reconcile",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end