Sha256: 664b69172c724124582e97c311aef94d8ce5d6c5f8324a062b6774e3cda1d061

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 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

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.2.0 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
fog-azure-rm-0.1.2 lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb