Sha256: b5af9b25792bae73c6ed93fdb8c83d775a73c30b4597eb01e67cea2e1332acc3

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# rubocop:disable LineLength
module Fog
  module Storage
    class AzureRM
      # This class provides the actual implemention for service calls.
      class Real
        def create_storage_account(resource_group, name, params)
          Fog::Logger.debug "Creating Storage Account: #{name}."
          begin
            promise = @storage_mgmt_client.storage_accounts.create(resource_group, name, params)
            response = promise.value!
            Fog::Logger.debug "Storage Account created successfully."
            response
          rescue MsRestAzure::AzureOperationError => e
            msg = "Exception creating Storage Account #{name} in Resource Group #{resource_group}. #{e.body['error']['message']}"
            raise msg
          end
        end
      end
      # This class provides the mock implementation for unit tests.
      class Mock
        def create_storage_account(resource_group, name, params)
          storage_acc = {
            name: name,
            location: params.location,
            resource_group: resource_group
          }
          storage_acc
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.1 lib/fog/azurerm/requests/storage/create_storage_account.rb
fog-azure-rm-0.0.0 lib/fog/azurerm/requests/storage/create_storage_account.rb