Class: Fog::Storage::AzureRM::StorageAccount

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

Overview

This class is giving implementation of create/save and delete/destroy for storage account.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(storage_account) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 15

def self.parse()
  hash = {}
  hash['id'] = .id
  hash['name'] = .name
  hash['location'] = .location
  hash['resource_group'] = get_resource_group_from_id(.id)
  hash['sku_name'] = .sku.name.split('_').first
  hash['replication'] = .sku.name.split('_').last
  hash['encryption'] = .encryption.services.blob.enabled unless .encryption.nil?
  hash
end

Instance Method Details

#destroyObject



73
74
75
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 73

def destroy
  service.(resource_group, name)
end

#get_access_keys(options = {}) ⇒ Object



69
70
71
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 69

def get_access_keys(options = {})
  service.get_storage_access_keys(resource_group, name, options)
end

#saveObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 27

def save
  requires :name
  requires :location
  requires :resource_group
  # Create a model for new storage account.
  self.sku_name = STANDARD_STORAGE if sku_name.nil?
  self.replication = ALLOWED_STANDARD_REPLICATION.first if replication.nil?
  validate_sku_name!
   = service.()
  merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse())
end

#update(storage_account_params) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 50

def update()
  validate_input()
   = merge_attributes().all_attributes

   = service.()
  merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse())
end