Class: Fog::Storage::AzureRM::Containers

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/azurerm/models/storage/containers.rb

Overview

This class is giving implementation of listing containers.

Instance Method Summary collapse

Instance Method Details

#all(options = { :metadata => true }) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/fog/azurerm/models/storage/containers.rb', line 11

def all(options = { :metadata => true })
  containers = []
  service.list_containers(options).each do |container|
    hash = Container.parse container
    hash['public_access_level'] = 'unknown'
    containers << hash
  end
  load containers
end

#get(identity) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/azurerm/models/storage/containers.rb', line 21

def get(identity)
  container = all(prefix: identity, metadata: true).find { |item| item.name == identity }
  return if container.nil?

  access_control_list = service.get_container_access_control_list(identity)[0]
  container.public_access_level = if access_control_list.is_a? Hash
                                    access_control_list['public_access_level']
                                  else
                                    access_control_list.public_access_level
                                  end
  container
end

#get_container_metadata(name) ⇒ Object



34
35
36
# File 'lib/fog/azurerm/models/storage/containers.rb', line 34

def (name)
  service.(name)
end

#set_container_metadata(name, metadata) ⇒ Object



38
39
40
# File 'lib/fog/azurerm/models/storage/containers.rb', line 38

def (name, )
  service.(name, )
end