Sha256: 60a5c36ac8dfe2bd70d1c924a5ccbcd9ba0099bdecab397dfa2a8ddac75b621b

Contents?: true

Size: 1.71 KB

Versions: 47

Compression:

Stored size: 1.71 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

47 entries across 47 versions & 4 rubygems

Version Path
fog-azure-rm-0.2.5 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.2.4 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.2.3 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.2.2 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.2.1 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.2.0 lib/fog/azurerm/requests/network/list_public_ips.rb
fog-azure-rm-0.1.2 lib/fog/azurerm/requests/network/list_public_ips.rb