Sha256: 43e7451a0e0d9b3f30e22e55d721814cd79d0a0e984aa751a906e60040b32042

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

module Fog
  module Storage
    class AzureRM
      # Real class for Recovery Vault request
      class Real
        def set_recovery_vault_context(resource_group, name)
          msg = "Set context for Recovery Vault #{name}"
          Fog::Logger.debug msg

          resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults/#{name}?api-version=2016-05-01"
          begin
            token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
            RestClient.get(
              resource_url,
              accept: 'application/json',
              content_type: 'application/json',
              authorization: token
            )
          rescue RestClient::Exception => e
            raise_azure_exception(e, msg)
          end
          Fog::Logger.debug "Successfully set context for Recovery Vault #{name}"
          true
        end
      end

      # Mock class for Recovery Vault request
      class Mock
        def set_recovery_vault_context(*)
          Fog::Logger.debug 'Successfully set context for Recovery Vault {name}'
          true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb