Class: Infrawrench::StorageNamespace
- Inherits:
-
Object
- Object
- Infrawrench::StorageNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.storage
Instance Method Summary collapse
-
#delete(body:, org_id: nil, request_options: nil) ⇒ Hash
Delete a storage object.
-
#download(account_id:, bucket:, keys:, org_id: nil, request_options: nil) ⇒ String
Download one or many objects (zipped if more than one).
-
#initialize(transport) ⇒ StorageNamespace
constructor
private
A new instance of StorageNamespace.
-
#list(body:, org_id: nil, request_options: nil) ⇒ Array<Hash>
List objects in a bucket / prefix.
-
#mkdir(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a folder marker in a bucket.
-
#upload(body:, org_id: nil, request_options: nil) ⇒ Hash
Upload a file to object storage.
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.
4726 4727 4728 |
# File 'lib/infrawrench/client.rb', line 4726 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
4746 4747 4748 4749 4750 4751 4752 4753 4754 |
# File 'lib/infrawrench/client.rb', line 4746 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: ) 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
4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 |
# File 'lib/infrawrench/client.rb', line 4776 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" => account_id, "bucket" => bucket, "keys" => keys }, accept: :binary, 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
4804 4805 4806 4807 4808 4809 4810 4811 4812 |
# File 'lib/infrawrench/client.rb', line 4804 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: ) 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
4830 4831 4832 4833 4834 4835 4836 4837 4838 |
# File 'lib/infrawrench/client.rb', line 4830 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: ) 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
4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 |
# File 'lib/infrawrench/client.rb', line 4858 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: ) end |