Sha256: 37105bcbd2ff0c2e9ae95f151ff6c4cdbde107c1e37d72d4a38e134f5f962a29

Contents?: true

Size: 1.75 KB

Versions: 6

Compression:

Stored size: 1.75 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
            public_ips = @network_client.public_ipaddresses.list_as_lazy(resource_group)
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, "Getting list of PublicIPs from Resource Group #{resource_group}")
          end
          Fog::Logger.debug 'Public IP listed successfully'
          public_ips.value
        end
      end

      # Mock class for Network Request
      class Mock
        def list_public_ips(resource_group)
          public_ip = {
            'value' =>
            [
              {
                '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'
                  }
              }
            ]
          }
          public_ip_mapper = Azure::ARM::Network::Models::PublicIPAddressListResult.mapper
          @network_client.deserialize(public_ip_mapper, public_ip, 'result.body').value
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.0.6 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.0.5 lib/fog/azurerm/requests/network/list_public_ips.rb