Class: Fog::Storage::AzureRM::Directories
- Inherits:
-
Collection
- Object
- Collection
- Fog::Storage::AzureRM::Directories
- Defined in:
- lib/fog/azurerm/models/storage/directories.rb
Overview
This class is giving implementation of listing containers.
Instance Method Summary collapse
-
#all ⇒ Fog::Storage::AzureRM::Directories
List all directories(containers) in the storage account.
- #check_container_exists(name) ⇒ Object
-
#get(identity, options = {}) ⇒ Fog::Storage::AzureRM::Directory
Get a directory with files(blobs) under this directory.
Instance Method Details
#all ⇒ Fog::Storage::AzureRM::Directories
List all directories(containers) in the storage account.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 12 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
64 65 66 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 64 def check_container_exists(name) service.check_container_exists(name) end |
#get(identity, options = {}) ⇒ Fog::Storage::AzureRM::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.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/azurerm/models/storage/directories.rb', line 38 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 => error return nil if error. == 'NotFound' raise error end |