Sha256: 4c7f7698e907b2780b8508571c1b13a6d83e970824a59bd2384f8eab13385541

Contents?: true

Size: 1.07 KB

Versions: 21

Compression:

Stored size: 1.07 KB

Contents

module Fog
  module TrafficManager
    class AzureRM
      # This class provides the actual implementation for service calls.
      class Real
        def check_traffic_manager_profile_exists(resource_group, traffic_manager_profile_name)
          msg = "Checking Traffic Manager Profile #{traffic_manager_profile_name}"
          Fog::Logger.debug msg
          begin
            @traffic_mgmt_client.profiles.get(resource_group, traffic_manager_profile_name)
            Fog::Logger.debug "Traffic Manager Profile #{traffic_manager_profile_name} exists."
            true
          rescue MsRestAzure::AzureOperationError => e
            if resource_not_found?(e)
              Fog::Logger.debug "Traffic Manager Profile #{traffic_manager_profile_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_traffic_manager_profile_exists(*)
          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/traffic_manager/check_traffic_manager_profile_exists.rb