Sha256: 08cddf7460500f96d3bd59d78fe53aaecf406adb3f1ecf07b0b2833240270ce9

Contents?: true

Size: 1.21 KB

Versions: 17

Compression:

Stored size: 1.21 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=#{REST_CLIENT_API_VERSION[1]}"
          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

17 entries across 17 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.4 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.3.3 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-temp-0.0.2 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-temp-0.0.1 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.3.2 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-downgraded-0.3.1 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.3.1 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-downgraded-0.3.0 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.3.0 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.7 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.6 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.5 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.4 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.3 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.2 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.1 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb
fog-azure-rm-0.2.0 lib/fog/azurerm/requests/storage/set_recovery_vault_context.rb