Sha256: 98e984e02160cd5a3076273ef7d181dac23460b5da9dc04dd5b60e1d876b3fef

Contents?: true

Size: 1.76 KB

Versions: 17

Compression:

Stored size: 1.76 KB

Contents

module Fog
  module Storage
    class AzureRM
      # Real class for Recovery Vault request
      class Real
        def list_recovery_vaults(resource_group)
          msg = "Listing Recovery Vaults in Resource Group #{resource_group}"
          Fog::Logger.debug msg
          resource_url = "#{AZURE_RESOURCE}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.RecoveryServices/vaults?api-version=#{REST_CLIENT_API_VERSION[1]}"
          begin
            token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
            recovery_vaults_response = 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 "Recovery Vaults in Resource Group #{resource_group} listed successfully"
          Fog::JSON.decode(recovery_vaults_response)['value']
        end
      end

      # Mock class for Recovery Vault Request
      class Mock
        def list_recovery_vaults(*)
          body = '{
            "value": [{
              "location": "westus",
              "name": "fog-test-vault",
              "properties": {
                "provisioningState": "Succeeded"
              },
              "id": "/subscriptions/########-####-####-####-############/resourceGroups/fog-test-rg/providers/Microsoft.RecoveryServices/vaults/fog-test-vault",
              "type": "Microsoft.RecoveryServices/vaults",
              "sku": {
                "name": "standard"
              }
            }]
          }'
          Fog::JSON.decode(body)['value']
        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/list_recovery_vaults.rb
fog-azure-rm-0.3.3 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-temp-0.0.2 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-temp-0.0.1 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.3.2 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-downgraded-0.3.1 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.3.1 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-downgraded-0.3.0 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.3.0 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.7 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.6 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.5 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.4 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.3 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.2 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.1 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb
fog-azure-rm-0.2.0 lib/fog/azurerm/requests/storage/list_recovery_vaults.rb