Class: Infrawrench::SshKeysNamespace

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

Overview

client.ssh_keys

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ SshKeysNamespace

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

Parameters:



4848
4849
4850
# File 'lib/infrawrench/client.rb', line 4848

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Generate a new Ed25519 keypair (private key returned once)

Requires permission: ssh-keys:write.

POST /api/org/orgId/ssh-keys

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

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

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

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

Returns:

  • (Hash)

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

Raises:



4866
4867
4868
4869
4870
4871
4872
4873
4874
# File 'lib/infrawrench/client.rb', line 4866

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

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

Delete an SSH key (owner only)

Requires permission: ssh-keys:write.

DELETE /api/org/orgId/ssh-keys/id

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

Raises:



4888
4889
4890
4891
4892
4893
4894
4895
# File 'lib/infrawrench/client.rb', line 4888

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

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

Import an existing public key

Requires permission: ssh-keys:write.

POST /api/org/orgId/ssh-keys/import

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

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

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

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

Returns:

  • (Hash)

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

Raises:



4911
4912
4913
4914
4915
4916
4917
4918
4919
# File 'lib/infrawrench/client.rb', line 4911

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

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

List org SSH keys

Requires permission: ssh-keys:read.

GET /api/org/orgId/ssh-keys

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

Raises:



4933
4934
4935
4936
4937
4938
4939
4940
# File 'lib/infrawrench/client.rb', line 4933

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