Sha256: ab6a511aae03d14b6ca38185487e4a24195ed8ac27de7cbd8ea44e9143c5dc35

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 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)
            result = promise.value!
            Azure::ARM::Network::Models::PublicIPAddressListResult.serialize_object(result.body)['value']
          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)
          [
            {
              'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group}/providers/Microsoft.Network/publicIPAddresses/test-PubIP",
              'name' => 'test-PubIP',
              'type' => 'Microsoft.Network/publicIPAddresses',
              'location' => 'westus',
              'properties' =>
                {
                  'publicIPAllocationMethod' => 'Static',
                  'ipAddress' => '13.93.203.153',
                  'idleTimeoutInMinutes' => 4,
                  'resourceGuid' => 'c78f0c95-d8b9-409b-897c-74260b686392',
                  'provisioningState' => 'Succeeded'
                }
            }
          ]
        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/list_public_ips.rb
fog-azure-rm-0.0.3 lib/fog/azurerm/requests/network/list_public_ips.rb