Sha256: 94a6825def8b8c51e98ad574500fc9a20ac8beed961b23f8a9a0ba263f2767bd

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

module Fog
  module Network
    class AzureRM
      # Real class for Network Request
      class Real
        def get_public_ip(resource_group_name, public_ip_name)
          Fog::Logger.debug "Getting Public IP #{public_ip_name} from Resource Group #{resource_group_name}"
          begin
            public_ip = @network_client.public_ipaddresses.get(resource_group_name, public_ip_name)
            Fog::Logger.debug "Public IP #{public_ip_name} retrieved successfully"
            public_ip
          rescue MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, "Getting Public IP #{public_ip_name} from Resource Group #{resource_group_name}")
          end
        end
      end

      # Mock class for Network Request
      class Mock
        def get_public_ip(resource_group_name, public_ip_name)
          public_ip = {
            'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/publicIPAddresses/#{public_ip_name}",
            'name' => public_ip_name,
            'type' => 'Microsoft.Network/publicIPAddresses',
            'location' => 'westus',
            'properties' =>
              {
                'publicIPAllocationMethod' => 'Dynamic',
                'ipAddress' => '13.91.253.67',
                'idleTimeoutInMinutes' => 4,
                'resourceGuid' => '767b1955-94de-433c-8e4a-ea0ad25e8d0c',
                'provisioningState' => 'Succeeded'
              }
          }
          public_ip_mapper = Azure::ARM::Network::Models::PublicIPAddress.mapper
          @network_client.deserialize(public_ip_mapper, public_ip, 'result.body')
        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/get_public_ip.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/network/get_public_ip.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/requests/network/get_public_ip.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/requests/network/get_public_ip.rb
fog-azure-rm-0.0.6 lib/fog/azurerm/requests/network/get_public_ip.rb
fog-azure-rm-0.0.5 lib/fog/azurerm/requests/network/get_public_ip.rb