Sha256: df7696b6f7568ca8c1125bcba953a3cc02563555e35bbeff49dd6dc5177a8f62

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 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_mgmt_client.storage_accounts.get_properties(resource_group_name, storage_account_name)
            Fog::Logger.debug "Storage Account #{storage_account_name} exists."
            true
          rescue MsRestAzure::AzureOperationError => e
            if e.body['error']['code'] == 'ResourceNotFound'
              Fog::Logger.debug "Storage Account #{storage_account_name} doesn't exist."
              false
            else
              raise_azure_exception(e, msg)
            end
          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

1 entries across 1 versions & 1 rubygems

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