Class: Fog::AzureRM::Storage::Directories
- Inherits:
-
Collection
- Object
- Collection
- Fog::AzureRM::Storage::Directories
- Includes:
- Utilities::General
- Defined in:
- lib/fog/azurerm/models/storage/directories.rb
Overview
This class is giving implementation of listing containers.
Instance Method Summary collapse
-
#all ⇒ Fog::AzureRM::Storage::Directories
List all directories(containers) in the storage account.
- #check_container_exists(name) ⇒ Object
- #delete_temporary_container(storage_account_name, access_key, container_name) ⇒ Object
-
#get(identity, options = {}) ⇒ Fog::AzureRM::Storage::Directory
Get a directory with files(blobs) under this directory.
Methods included from Utilities::General
#authority_url, #get_blob_endpoint, #get_blob_endpoint_with_domain, #get_circuit_name_from_id, #get_end_point_type, #get_hash_from_object, #get_image_name, #get_record_set_from_id, #get_record_type, #get_resource_from_resource_id, #get_resource_group_from_id, #get_subscription_id, #get_traffic_manager_profile_name_from_endpoint_id, #get_type_from_recordset_type, #get_virtual_machine_from_id, #get_virtual_network_from_id, #parse_storage_object, #raise_azure_exception, #random_string, #remove_trailing_periods_from_path_segments, #storage_endpoint_suffix, #storage_resource, #validate_params
Instance Method Details
#all ⇒ Fog::AzureRM::Storage::Directories
List all directories(containers) in the storage account.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 14 def all containers = service.list_containers data = [] containers.each do |container| c = parse_storage_object(container) c[:acl] = 'unknown' data << c end load(data) end |
#check_container_exists(name) ⇒ Object
71 72 73 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 71 def check_container_exists(name) service.check_container_exists(name) end |
#delete_temporary_container(storage_account_name, access_key, container_name) ⇒ Object
66 67 68 69 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 66 def delete_temporary_container(storage_account_name, access_key, container_name) storage_data = Fog::AzureRM::Storage.new(azure_storage_account_name: storage_account_name, azure_storage_access_key: access_key) storage_data.delete_container(container_name) end |
#get(identity, options = {}) ⇒ Fog::AzureRM::Storage::Directory
Get a directory with files(blobs) under this directory. You can set max_keys to 1 if you do not want to return all files under this directory.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 40 def get(identity, = {}) remap_attributes(, max_keys: :max_results) container = service.get_container_properties(identity) data = parse_storage_object(container) data[:acl] = 'unknown' directory = new(key: identity, is_persisted: true) directory.merge_attributes(data) data = service.list_blobs(identity, ) = .merge(next_marker: data[:next_marker]) directory.files.merge_attributes() blobs = [] data[:blobs].each do |blob| blobs << parse_storage_object(blob) end directory.files.load(blobs) directory rescue Exception => error return nil if error. == 'NotFound' raise error end |