Sha256: 9211a5b5a2053d75d0aa279320732f865eb50e313107baeca7f4da8b714d67bf

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

module Fog
  module Network
    class AzureRM
      # Mock class for Network Request
      class Real
        def check_for_virtual_network(resource_group, name)
          begin
            promise = @network_client.virtual_networks.get(resource_group, name)
            promise.value!
            return true
          rescue MsRestAzure::AzureOperationError => e
            msg = "Exception checking name availability: #{e.body['error']['message']}"
            raise msg if e.body['error']['code'] == 'ResourceGroupNotFound'
            return false if e.body['error']['code'] == 'ResourceNotFound'
          end
        end
      end

      # Mock class for Network Request
      class Mock
        def check_for_virtual_network(resource_group, name)
          Fog::Logger.debug "Virtual Network #{name} from Resource group #{resource_group} is available."
          true
        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/network/check_for_virtual_network.rb
fog-azure-rm-0.0.3 lib/fog/azurerm/requests/network/check_for_virtual_network.rb