Class: Infrawrench::SftpNamespace

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

Overview

client.sftp

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ SftpNamespace

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

Parameters:



3337
3338
3339
# File 'lib/infrawrench/client.rb', line 3337

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Delete a file or directory over SFTP

Requires permission: storage:write.

POST /api/org/orgId/sftp/delete

Raises on 404: Not found

Raises on 500: Server error

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

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

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

  • body: (sftp_delete_request)
  • 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:



3357
3358
3359
3360
3361
3362
3363
3364
3365
# File 'lib/infrawrench/client.rb', line 3357

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

#download(account_id:, paths:, org_id: nil, base_path: nil, ssh_key_id: nil, ssh_host: nil, ssh_username: nil, request_options: nil) ⇒ String

Download one or many files via SFTP (zipped if more than one)

Requires permission: storage:read.

GET /api/org/orgId/v1/sftp/download

Raises on 400: Bad request

Raises on 404: Not found

Raises on 500: Server error

Parameters:

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

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

  • account_id (String)
  • paths (String)

    JSON-encoded array of remote paths

  • base_path (String, nil) (defaults to: nil)
  • ssh_key_id (String, nil) (defaults to: nil)
  • ssh_host (String, nil) (defaults to: nil)
  • ssh_username (String, nil) (defaults to: nil)
  • request_options (Hash, nil) (defaults to: nil)

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

  • account_id: (String)
  • paths: (String)
  • org_id: (String, nil) (defaults to: nil)
  • base_path: (String, nil) (defaults to: nil)
  • ssh_key_id: (String, nil) (defaults to: nil)
  • ssh_host: (String, nil) (defaults to: nil)
  • ssh_username: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (String)

    Raw response bytes.

Raises:



3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
# File 'lib/infrawrench/client.rb', line 3390

def download(
  account_id:,
  paths:,
  org_id: nil,
  base_path: nil,
  ssh_key_id: nil,
  ssh_host: nil,
  ssh_username: nil,
  request_options: nil
)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/v1/sftp/download",
    path_params: { "orgId" => org_id },
    query: {
      "accountId" => ,
      "paths" => paths,
      "basePath" => base_path,
      "sshKeyId" => ssh_key_id,
      "sshHost" => ssh_host,
      "sshUsername" => ssh_username
    },
    accept: :binary,
    request_options: request_options
  )
end

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

List a directory over SFTP

Requires permission: storage:read.

POST /api/org/orgId/sftp/list

Raises on 404: Not found

Raises on 500: Server error

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

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

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

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

Returns:

  • (Array<Hash>)

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

Raises:



3434
3435
3436
3437
3438
3439
3440
3441
3442
# File 'lib/infrawrench/client.rb', line 3434

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

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

Create a directory over SFTP

Requires permission: storage:write.

POST /api/org/orgId/sftp/mkdir

Raises on 404: Not found

Raises on 500: Server error

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

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

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

  • body: (sftp_path_request)
  • 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:



3460
3461
3462
3463
3464
3465
3466
3467
3468
# File 'lib/infrawrench/client.rb', line 3460

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

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

Upload a file via SFTP

Requires permission: storage:write.

POST /api/org/orgId/v1/sftp/upload

Raises on 400: Bad request

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.

  • body (Hash)

    Sent as multipart/form-data; file carries the file bytes.

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

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

  • body: (sftp_upload_form)
  • 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:



3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
# File 'lib/infrawrench/client.rb', line 3486

def upload(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/v1/sftp/upload",
    path_params: { "orgId" => org_id },
    form: body,
    form_files: ["file"],
    request_options: request_options
  )
end