Class: Fog::Network::AzureRM::PublicIps

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/azurerm/models/network/public_ips.rb

Overview

PublicIPs collection class for Network Service

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/azurerm/models/network/public_ips.rb', line 12

def all
  requires :resource_group
  public_ips = []
  pubip_list = service.list_public_ips(resource_group)
  pubip_list.each do |pip|
    hash = {}
    pip.instance_variables.each do |var|
      hash[var.to_s.delete('@')] = pip.instance_variable_get(var)
    end
    hash['resource_group'] = resource_group
    public_ips << hash
  end
  load(public_ips)
end

#check_if_exists(resource_group, name) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/azurerm/models/network/public_ips.rb', line 31

def check_if_exists(resource_group, name)
  Fog::Logger.debug "Checkng if PublicIP #{name} exists."
  if service.check_for_public_ip(resource_group, name)
    Fog::Logger.debug "PublicIP #{name} exists."
    true
  else
    Fog::Logger.debug "PublicIP #{name} doesn't exists."
    false
  end
end

#get(identity) ⇒ Object



27
28
29
# File 'lib/fog/azurerm/models/network/public_ips.rb', line 27

def get(identity)
  all.find { |f| f.name == identity }
end