Sha256: cb9fc96833d0ebbe8f018f250629b35c1a689d48bb3a533daefaa0c6f58b5f5d

Contents?: true

Size: 1.45 KB

Versions: 2

Compression:

Stored size: 1.45 KB

Contents

module Fog
  module Resources
    class AzureRM
      # This class provides the actual implemention for service calls.
      class Real
        def list_resource_groups
          begin
            promise = @rmc.resource_groups.list
            result = promise.value!
            result.body.next_link = ''
            Azure::ARM::Resources::Models::ResourceGroupListResult.serialize_object(result.body)['value']
          rescue  MsRestAzure::AzureOperationError => e
            msg = "Exception listing Resource Groups. #{e.body['error']['message']}"
            raise msg
          end
        end
      end

      # This class provides the mock implementation for unit tests.
      class Mock
        def list_resource_groups
          [
            {
              'location' => 'westus',
              'id' => '/subscriptions/########-####-####-####-############/resourceGroups/Fog_test_rg',
              'name' => 'Fog_test_rg',
              'properties' =>
              {
                'provisioningState' => 'Succeeded'
              }
            },
            {
              'location' => 'westus',
              'id' => '/subscriptions/########-####-####-####-############/resourceGroups/Fog_test_rg1',
              'name' => 'Fog_test_rg1',
              'properties' =>
              {
                'provisioningState' => 'Succeeded'
              }
            }
          ]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.4 lib/fog/azurerm/requests/resources/list_resource_groups.rb
fog-azure-rm-0.0.3 lib/fog/azurerm/requests/resources/list_resource_groups.rb