Sha256: 498334aa92541474c69027911ee675e64fb9650fe73e1286e27f510bc6d81c89

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

module Fog
  module Storage
    class AzureRM
      # This class provides the actual implementation for service calls.
      class Real
        def check_storage_account_name_availability(params)
          msg = "Checking Name availability: #{params.name}."
          Fog::Logger.debug msg
          begin
            name_available_obj = @storage_mgmt_client.storage_accounts.check_name_availability(params)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end
          if name_available_obj.name_available
            Fog::Logger.debug "Name: #{params.name} is available."
            true
          else
            Fog::Logger.debug "Name: #{params.name} is not available."
            Fog::Logger.debug "Reason: #{name_available_obj.reason}."
            false
          end
        end
      end
      # This class provides the mock implementation for unit tests.
      class Mock
        def check_storage_account_name_availability(params)
          Fog::Logger.debug "Name: #{params.name} is available."
          true
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
fog-azure-rm-0.0.6 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
fog-azure-rm-0.0.5 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb