Sha256: b20e8b19a130f913a15cbe612ace415a836888772cbda30c117282e9471f085c

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module Fog
  module Storage
    class AzureRM
      # This class is giving implementation of create/save and
      # delete/destroy for storage account.
      class StorageAccount < Fog::Model
        identity  :name
        attribute :location
        attribute :resource_group
        attribute :account_type

        def save
          requires :name
          requires :location
          requires :resource_group
          hash = {}
          # Create a model for new storage account.
          properties = Azure::ARM::Storage::Models::StorageAccountPropertiesCreateParameters.new
          properties.account_type = 'Standard_LRS' # This might change in the near future!

          params = Azure::ARM::Storage::Models::StorageAccountCreateParameters.new
          params.properties = properties
          params.location = location
          sa = service.create_storage_account(resource_group, name, params)
          hash['account_type'] = sa['properties']['accountType']
          merge_attributes(hash)
        end

        def destroy
          service.delete_storage_account(resource_group, name)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.3 lib/fog/azurerm/models/storage/storage_account.rb
fog-azure-rm-0.0.2 lib/fog/azurerm/models/storage/storage_account.rb