Class: Fog::Storage::AzureRM::Container
- Inherits:
-
Model
- Object
- Model
- Fog::Storage::AzureRM::Container
- Defined in:
- lib/fog/azurerm/models/storage/container.rb
Overview
This class is giving implementation of create and delete a container.
Class Method Summary collapse
Instance Method Summary collapse
- #create(options = {}) ⇒ Object (also: #save)
- #destroy(options = {}) ⇒ Object
- #get_access_control_list(options = {}) ⇒ Object
- #get_properties(options = { metadata: true }) ⇒ Object
Class Method Details
.parse(container) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/fog/azurerm/models/storage/container.rb', line 37 def self.parse(container) hash = {} if container.is_a? Hash hash['name'] = container['name'] hash['metadata'] = container['metadata'] return hash unless container.key?('properties') hash['last_modified'] = container['properties']['last_modified'] hash['etag'] = container['properties']['etag'] hash['lease_duration'] = container['properties']['lease_duration'] hash['lease_status'] = container['properties']['lease_status'] hash['lease_state'] = container['properties']['lease_state'] else hash['name'] = container.name hash['metadata'] = container. return hash unless container.respond_to?('properties') hash['last_modified'] = container.properties[:last_modified] hash['etag'] = container.properties[:etag] hash['lease_duration'] = container.properties[:lease_duration] hash['lease_status'] = container.properties[:lease_status] hash['lease_state'] = container.properties[:lease_state] end hash end |
Instance Method Details
#create(options = {}) ⇒ Object Also known as: save
15 16 17 18 |
# File 'lib/fog/azurerm/models/storage/container.rb', line 15 def create( = {}) requires :name merge_attributes(Container.parse(service.create_container(name, ))) end |
#destroy(options = {}) ⇒ Object
32 33 34 35 |
# File 'lib/fog/azurerm/models/storage/container.rb', line 32 def destroy( = {}) requires :name service.delete_container name, end |