Sha256: 764b2618fc7e7404fcaecac33592387ce7a4b8c2f0430d74ddd5e36446ecf793

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module Fog
  module Network
    class AzureRM
      # Real class for Network Request
      class Real
        def list_public_ips(resource_group)
          Fog::Logger.debug "Getting list of PublicIPs from Resource Group #{resource_group}."
          begin
            promise = @network_client.public_ipaddresses.list(resource_group)
            response = promise.value!
            result = response.body.value
            return result
          rescue  MsRestAzure::AzureOperationError => e
            msg = "Exception listing Public IPs from Resource Group '#{resource_group}'. #{e.body['error']['message']}."
            raise msg
          end
        end
      end

      # Mock class for Network Request
      class Mock
        def list_public_ips(_resource_group)
          public_ip = Azure::ARM::Network::Models::PublicIPAddress.new
          public_ip.name = 'fogtestpublicip'
          public_ip.location = 'West US'
          public_ip.type = 'Static'
          [public_ip]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.1 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.0.0 lib/fog/azurerm/requests/network/list_public_ips.rb