Sha256: 10b9e555af93f3c721a3b28c38c872158d90b9b79f058ca55967f4550bd49e4f

Contents?: true

Size: 1.22 KB

Versions: 21

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Storage
    class AzureRM
      # This class provides the actual implementation for service calls.
      class Real
        def check_storage_account_exists(resource_group_name, storage_account_name)
          msg = "Checking Storage Account: #{storage_account_name}."
          Fog::Logger.debug msg
          begin
            storage_account = @storage_mgmt_client.storage_accounts.get_properties(resource_group_name, storage_account_name)
          rescue MsRestAzure::AzureOperationError => e
            if resource_not_found?(e)
              Fog::Logger.debug "Storage Account #{storage_account_name} doesn't exist."
              return false
            else
              raise_azure_exception(e, msg)
            end
          end

          if storage_account.provisioning_state == 'Succeeded'
            Fog::Logger.debug "Storage Account #{storage_account_name} exists."
            true
          else
            Fog::Logger.debug "Storage Account #{storage_account_name} doesn't exist."
            false
          end
        end
      end
      # This class provides the mock implementation.
      class Mock
        def check_storage_account_exists(*)
          true
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
fog-azure-rm-0.6.0 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.5.3 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.5.2 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
far-gem-0.5.6 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.5.1 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
far-gem-0.5.5 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.5.0 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
far-gem-0.5.4 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
far-gem-0.5.3 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.9 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
far-gem-0.5.2 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.8 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.7 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.6 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.5 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-temp-0.0.5 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.4 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.3 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
far-gem-0.5.1 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb
fog-azure-rm-0.4.2 lib/fog/azurerm/requests/storage/check_storage_account_exists.rb