class Fog::Network::AzureRM::PublicIp

PublicIP model class for Network Service

Public Class Methods

parse(public_ip) click to toggle source
# File lib/fog/azurerm/models/network/public_ip.rb, line 19
def self.parse(public_ip)
  hash = {}
  hash['id'] = public_ip.id
  hash['name'] = public_ip.name
  hash['location'] = public_ip.location
  hash['resource_group'] = get_resource_group_from_id(public_ip.id)
  hash['public_ip_allocation_method'] = public_ip.public_ipallocation_method
  hash['ip_address'] = public_ip.ip_address
  hash['idle_timeout_in_minutes'] = public_ip.idle_timeout_in_minutes
  hash['ip_configuration_id'] = public_ip.ip_configuration.id unless public_ip.ip_configuration.nil?
  hash['tags'] = public_ip.tags

  unless public_ip.dns_settings.nil?
    hash['domain_name_label'] = public_ip.dns_settings.domain_name_label
    hash['fqdn'] = public_ip.dns_settings.fqdn
    hash['reverse_fqdn'] = public_ip.dns_settings.reverse_fqdn
  end

  hash
end

Public Instance Methods

destroy() click to toggle source
# File lib/fog/azurerm/models/network/public_ip.rb, line 49
def destroy
  service.delete_public_ip(resource_group, name)
end
save() click to toggle source
# File lib/fog/azurerm/models/network/public_ip.rb, line 40
def save
  requires :name
  requires :public_ip_allocation_method
  requires :location
  requires :resource_group
  public_ip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
  merge_attributes(Fog::Network::AzureRM::PublicIp.parse(public_ip))
end
update(input_hash) click to toggle source
# File lib/fog/azurerm/models/network/public_ip.rb, line 53
def update(input_hash)
  validate_input(input_hash)
  merge_attributes(input_hash)
  pip = service.create_or_update_public_ip(resource_group, name, location, public_ip_allocation_method, idle_timeout_in_minutes, domain_name_label, tags)
  merge_attributes(Fog::Network::AzureRM::PublicIp.parse(pip))
end

Private Instance Methods

validate_input(input_hash) click to toggle source
# File lib/fog/azurerm/models/network/public_ip.rb, line 62
def validate_input(input_hash)
  invalid_attr = [:resource_group, :name, :location, :id]
  result = invalid_attr & input_hash.keys
  raise 'Cannot modify the given attribute' unless result.empty?
end