Class: Infrawrench::AgentClaimNamespace

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

Overview

client.agent.claim

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ AgentClaimNamespace

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

Parameters:



864
865
866
# File 'lib/infrawrench/client.rb', line 864

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Confirm a claim, binding the workspace to the signed-in user

The code is re-resolved here rather than trusting a registration id from the lookup, so the lookup cannot be used as an oracle. Rate limited per user.

POST /api/agent/claim

Raises on 400: Bad code, already claimed, revoked, or a merge with no valid target

Raises on 401: Unauthenticated

Raises on 402: The merge would put a free target organization over its plan limits

Raises on 403: You lack the permission the merge needs in the target organization (accounts:write, plus costs:write when moving history).

Raises on 429: Too many attempts

Parameters:

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

    Request body, shaped as AgentClaimRequest.

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

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

  • body: (agent_claim_request, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

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

Raises:



893
894
895
896
897
898
899
900
# File 'lib/infrawrench/client.rb', line 893

def create(body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/agent/claim",
    body: body,
    request_options: request_options
  )
end

#lookup(body: nil, request_options: nil) ⇒ Hash

Resolve a user code so the claim page can show what is being claimed

A POST rather than a GET with the code in the path: the code is a live bearer secret for 15 minutes, and a URL lands in history, in Referer, and in access logs. Rate limited per user.

POST /api/agent/claim/lookup

Raises on 400: Missing, malformed, or expired code

Raises on 401: Unauthenticated

Raises on 404: The workspace no longer exists

Raises on 429: Too many attempts

Parameters:

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

    Request body, shaped as AgentClaimLookupRequest.

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

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

  • body: (agent_claim_lookup_request, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

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

Raises:



922
923
924
925
926
927
928
929
# File 'lib/infrawrench/client.rb', line 922

def lookup(body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/agent/claim/lookup",
    body: body,
    request_options: request_options
  )
end