Class: Openstack::Client::Storage
- Inherits:
-
Object
- Object
- Openstack::Client::Storage
- Includes:
- ActiveModel::Model, Helpers::HTTPSClient
- Defined in:
- lib/openstack/client/storage.rb,
lib/openstack/client/storage/get_object.rb,
lib/openstack/client/storage/put_object.rb,
lib/openstack/client/storage/list_objects.rb,
lib/openstack/client/storage/delete_object.rb,
lib/openstack/client/storage/object_store_url.rb,
lib/openstack/client/storage/bulk_delete_objects.rb,
lib/openstack/client/storage/get_object_by_range.rb,
lib/openstack/client/storage/create_temporary_uri.rb,
lib/openstack/client/storage/show_object_metadata.rb
Overview
:reek:IrresponsibleModule
Instance Attribute Summary collapse
-
#authenticator ⇒ Object
readonly
Returns the value of attribute authenticator.
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
- #bulk_delete_objects(key_collection) ⇒ Object
- #create_temporary_uri(key, http_method, **options) ⇒ Object
- #delete_object(key) ⇒ Object
- #get_object(key, **options) ⇒ Object
- #get_object_by_range(key, range, **options) ⇒ Object
-
#initialize(authenticator:, container:, region:) ⇒ Storage
constructor
A new instance of Storage.
- #list_objects(**options) ⇒ Object
- #put_object(key, io, checksum: nil) ⇒ Object
- #show_object_metadata(key) ⇒ Object
- #temporary_url(key, http_method, **options) ⇒ Object
- #uri ⇒ Object
Methods included from Helpers::HTTPSClient
Constructor Details
#initialize(authenticator:, container:, region:) ⇒ Storage
Returns a new instance of Storage.
21 22 23 24 25 |
# File 'lib/openstack/client/storage.rb', line 21 def initialize(authenticator:, container:, region:) @authenticator = authenticator @container = container @region = region end |
Instance Attribute Details
#authenticator ⇒ Object (readonly)
Returns the value of attribute authenticator.
11 12 13 |
# File 'lib/openstack/client/storage.rb', line 11 def authenticator @authenticator end |
#container ⇒ Object (readonly)
Returns the value of attribute container.
11 12 13 |
# File 'lib/openstack/client/storage.rb', line 11 def container @container end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
11 12 13 |
# File 'lib/openstack/client/storage.rb', line 11 def region @region end |
Instance Method Details
#bulk_delete_objects(key_collection) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/openstack/client/storage.rb', line 101 def bulk_delete_objects(key_collection) https_client.request( prepare_request do BulkDeleteObjects.new(uri: uri, keys: key_collection).request end ) end |
#create_temporary_uri(key, http_method, **options) ⇒ Object
89 90 91 92 93 94 95 |
# File 'lib/openstack/client/storage.rb', line 89 def create_temporary_uri(key, http_method, **) CreateTemporaryURI.new( uri: absolute_uri(key), http_method: http_method, options: ).generate end |
#delete_object(key) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/openstack/client/storage.rb', line 65 def delete_object(key) https_client.request( prepare_request do DeleteObject.new(uri: absolute_uri(key)).request end ) end |
#get_object(key, **options) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/openstack/client/storage.rb', line 35 def get_object(key, **) https_client.request( prepare_request do GetObject.new(uri: absolute_uri(key), options: ).request end ) end |
#get_object_by_range(key, range, **options) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/openstack/client/storage.rb', line 43 def get_object_by_range(key, range, **) https_client.request( prepare_request do GetObjectByRange.new( uri: absolute_uri(key), range: range, options: ).request end ) end |
#list_objects(**options) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/openstack/client/storage.rb', line 81 def list_objects(**) https_client.request( prepare_request do ListObjects.new(uri: uri, options: ).request end ) end |
#put_object(key, io, checksum: nil) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/openstack/client/storage.rb', line 53 def put_object(key, io, checksum: nil) https_client.request( prepare_request do PutObject.new( io: io, uri: absolute_uri(key), checksum: checksum ).request end ) end |
#show_object_metadata(key) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/openstack/client/storage.rb', line 73 def (key) https_client.request( prepare_request do ShowObjectMetadata.new(uri: absolute_uri(key)).request end ) end |
#temporary_url(key, http_method, **options) ⇒ Object
97 98 99 |
# File 'lib/openstack/client/storage.rb', line 97 def temporary_url(key, http_method, **) create_temporary_uri(key, http_method, ).to_s end |
#uri ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/openstack/client/storage.rb', line 27 def uri URI(ObjectStoreURL.new( authenticator: authenticator, container: container, region: region ).call) end |