Class: Fog::Storage::AzureRM::StorageAccounts

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

Overview

This class is giving implementation of all/list, get and check name availability for storage account.

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fog/azurerm/models/storage/storage_accounts.rb', line 12

def all
  accounts = []
  if !resource_group.nil?
    requires :resource_group
    hash_of_storage_accounts = service.(resource_group)
  else
    hash_of_storage_accounts = service.list_storage_accounts
  end
  hash_of_storage_accounts.each do ||
    hash = {}
    hash['name'] = ['name']
    hash['location'] = ['location']
    hash['resource_group'] = ['id'].split('/')[4]
    hash['account_type'] = ['properties']['accountType']
    accounts << hash
  end
  load(accounts)
end

#check_name_availability(name) ⇒ Object



35
36
37
38
39
40
# File 'lib/fog/azurerm/models/storage/storage_accounts.rb', line 35

def check_name_availability(name)
  params = Azure::ARM::Storage::Models::StorageAccountCheckNameAvailabilityParameters.new
  params.name = name
  params.type = 'Microsoft.Storage/storageAccounts'
  service.(params)
end

#get(identity) ⇒ Object



31
32
33
# File 'lib/fog/azurerm/models/storage/storage_accounts.rb', line 31

def get(identity)
  all.find { |f| f.name == identity }
end