Sha256: 901cd6903d39d17dde82a10b24ad59cfb9238f376a1ed95d5b6c9d82a0639d34

Contents?: true

Size: 966 Bytes

Versions: 21

Compression:

Stored size: 966 Bytes

Contents

module Fog
  module Compute
    class AzureRM
      # This class provides the actual implementation for service calls.
      class Real
        def check_availability_set_exists(resource_group, name)
          msg = "Checking Availability set: #{name}"
          Fog::Logger.debug msg
          begin
            @compute_mgmt_client.availability_sets.get(resource_group, name)
            Fog::Logger.debug "Availability set #{name} exists."
            true
          rescue MsRestAzure::AzureOperationError => e
            if resource_not_found?(e)
              Fog::Logger.debug "Availability set #{name} doesn't exist."
              false
            else
              raise_azure_exception(e, msg)
            end
          end
        end
      end
      # This class provides the mock implementation for unit tests.
      class Mock
        def check_availability_set_exists(_resource_group, _name)
          true
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.1 lib/fog/azurerm/requests/compute/check_availability_set_exists.rb