Class: Fog::Storage::AzureRM::StorageAccount
- Inherits:
-
Model
- Object
- Model
- Fog::Storage::AzureRM::StorageAccount
- 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
- #destroy ⇒ Object
- #get_access_keys(options = {}) ⇒ Object
- #save ⇒ Object
- #update(storage_account_params) ⇒ Object
Class Method Details
.parse(storage_account) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 16 def self.parse(storage_account) hash = {} hash['id'] = storage_account.id hash['name'] = storage_account.name hash['location'] = storage_account.location hash['resource_group'] = get_resource_group_from_id(storage_account.id) hash['sku_name'] = storage_account.sku.name.split('_').first hash['replication'] = storage_account.sku.name.split('_').last hash['encryption'] = storage_account.encryption.services.blob.enabled unless storage_account.encryption.nil? hash['tags'] = storage_account. hash end |
Instance Method Details
#destroy ⇒ Object
76 77 78 |
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 76 def destroy service.delete_storage_account(resource_group, name) end |
#get_access_keys(options = {}) ⇒ Object
72 73 74 |
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 72 def get_access_keys( = {}) service.get_storage_access_keys(resource_group, name, ) end |
#save ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 29 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! storage_account = service.create_storage_account(storage_account_params) merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse(storage_account)) end |
#update(storage_account_params) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/fog/azurerm/models/storage/storage_account.rb', line 53 def update(storage_account_params) validate_input(storage_account_params) storage_account_params = merge_attributes(storage_account_params).all_attributes storage_account = service.update_storage_account(storage_account_params) merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse(storage_account)) end |