Class: DatabasusRuby::Storages
- Includes:
- Endpoint
- Defined in:
- lib/databasus_ruby/objects/storages.rb,
sig/databasus_ruby.rbs
Overview
Backup destinations.
client.storages.save(name: "offsite", type: "S3",
workspaceId: id, s3Storage: { ... })
POST /storages both creates and updates: include id in the payload to
update an existing storage.
Constant Summary collapse
- TYPES =
%w[LOCAL S3 GOOGLE_DRIVE NAS AZURE_BLOB FTP SFTP RCLONE].freeze
Instance Attribute Summary
Attributes included from Endpoint
Instance Method Summary collapse
-
#delete(id) ⇒ Boolean
DELETE /storages/id.
-
#direct_test(**attributes) ⇒ Boolean
POST /storages/direct-test — tests a payload that has not been saved yet.
-
#get(id) ⇒ Object
(also: #find)
GET /storages/id.
-
#list(workspace_id: nil) ⇒ Collection
(also: #all)
GET /storages.
-
#save(**attributes) ⇒ Object
(also: #create, #update)
POST /storages.
-
#test(id) ⇒ Boolean
POST /storages/id/test.
-
#transfer(id, target_workspace_id:) ⇒ Boolean
POST /storages/id/transfer.
Methods included from Endpoint
#acknowledged, #build, #collection, #compact, #escape, #http_delete, #http_get, #http_post, #http_put, #initialize, #inspect, #object, #single_value, #with_default_workspace
Methods inherited from Object
#==, #[], #hash, #initialize, #inspect, #key?, #keys, #method_missing, #respond_to_missing?, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class DatabasusRuby::Object
Instance Method Details
#delete(id) ⇒ Boolean
DELETE /storages/id
36 37 38 |
# File 'lib/databasus_ruby/objects/storages.rb', line 36 def delete(id) acknowledged(http_delete("storages/#{escape(id)}")) end |
#direct_test(**attributes) ⇒ Boolean
POST /storages/direct-test — tests a payload that has not been saved yet.
46 47 48 |
# File 'lib/databasus_ruby/objects/storages.rb', line 46 def direct_test(**attributes) acknowledged(http_post("storages/direct-test", attributes)) end |
#get(id) ⇒ Object Also known as: find
GET /storages/id
23 24 25 |
# File 'lib/databasus_ruby/objects/storages.rb', line 23 def get(id) object(http_get("storages/#{escape(id)}")) end |
#list(workspace_id: nil) ⇒ Collection Also known as: all
GET /storages
17 18 19 |
# File 'lib/databasus_ruby/objects/storages.rb', line 17 def list(workspace_id: nil) collection(http_get("storages", { workspace_id: workspace_id || client.workspace_id! }), key: "storages") end |
#save(**attributes) ⇒ Object Also known as: create, update
POST /storages
29 30 31 |
# File 'lib/databasus_ruby/objects/storages.rb', line 29 def save(**attributes) object(http_post("storages", with_default_workspace(attributes))) end |
#test(id) ⇒ Boolean
POST /storages/id/test
41 42 43 |
# File 'lib/databasus_ruby/objects/storages.rb', line 41 def test(id) acknowledged(http_post("storages/#{escape(id)}/test")) end |
#transfer(id, target_workspace_id:) ⇒ Boolean
POST /storages/id/transfer
51 52 53 |
# File 'lib/databasus_ruby/objects/storages.rb', line 51 def transfer(id, target_workspace_id:) acknowledged(http_post("storages/#{escape(id)}/transfer", { targetWorkspaceId: target_workspace_id })) end |