Sha256: c76c354c7a44d9604b136443419d4e7ac742c901a5815821b3200cc395beb71b

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

module Fog
  module Compute
    class AzureRM
      # This class provides the actual implemention for service calls.
      class Real
        def list_availability_sets(resource_group)
          begin
            promise = @compute_mgmt_client.availability_sets.list(resource_group)
            response = promise.value!
            Azure::ARM::Compute::Models::AvailabilitySetListResult.serialize_object(response.body)['value']
          rescue MsRestAzure::AzureOperationError => e
            msg = "Exception listing availability sets in Resource Group #{resource_group}. #{e.body['error']['message']}"
            raise msg
          end
        end
      end
      # This class provides the mock implementation for unit tests.
      class Mock
        def list_availability_sets(resource_group)
          [
              {
                "id"=>"/subscriptions/{subscription-id}/resourceGroups/#{resource_group}/providers/Microsoft.Compute/availabilitySets/test_availability_set",
                "name"=>"test_availability_set",
                "type"=>"Microsoft.Compute/availabilitySets",
                "location"=>"westus",
                "tags"=> {},
                "properties"=>
                  {
                    "platformUpdateDomainCount"=>5,
                    "platformFaultDomainCount"=>3,
                    "virtualMachines"=>[]
                  }
              }
          ]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.2 lib/fog/azurerm/requests/compute/list_availability_sets.rb