Class: Infrawrench::StorageNamespace

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

Overview

client.storage

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ StorageNamespace

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

Parameters:



3781
3782
3783
# File 'lib/infrawrench/client.rb', line 3781

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Delete a storage object

Requires permission: storage:write.

POST /api/org/orgId/storage/delete

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)

    Request body, shaped as StoragePathRequest.

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

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

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



3801
3802
3803
3804
3805
3806
3807
3808
3809
# File 'lib/infrawrench/client.rb', line 3801

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

#download(account_id:, bucket:, keys:, org_id: nil, request_options: nil) ⇒ String

Download one or many objects (zipped if more than one)

Requires permission: storage:read.

GET /api/org/orgId/v1/storage/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)
  • bucket (String)
  • keys (String)

    JSON-encoded array of object keys, e.g. ["a.txt","b.txt"]

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

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

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

Returns:

  • (String)

    Raw response bytes.

Raises:



3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
# File 'lib/infrawrench/client.rb', line 3831

def download(account_id:, bucket:, keys:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/v1/storage/download",
    path_params: { "orgId" => org_id },
    query: { "accountId" => , "bucket" => bucket, "keys" => keys },
    accept: :binary,
    request_options: request_options
  )
end

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

List objects in a bucket / prefix

Requires permission: storage:read.

POST /api/org/orgId/storage/list

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)

    Request body, shaped as StorageListRequest.

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

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

  • body: (storage_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<StorageObject> — see sig/infrawrench/sdk.rbs.

Raises:



3859
3860
3861
3862
3863
3864
3865
3866
3867
# File 'lib/infrawrench/client.rb', line 3859

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

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

Create a folder marker in a bucket

Requires permission: storage:write.

POST /api/org/orgId/storage/mkdir

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)

    Request body, shaped as StoragePathRequest.

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

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

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



3885
3886
3887
3888
3889
3890
3891
3892
3893
# File 'lib/infrawrench/client.rb', line 3885

def mkdir(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/storage/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 to object storage

Multipart/form-data. Plugin must implement uploadStorageObject.

Requires permission: storage:write.

POST /api/org/orgId/v1/storage/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: (storage_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:



3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
# File 'lib/infrawrench/client.rb', line 3913

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