class Fog::Compute::ProfitBricks::Lan

Attributes

options[RW]

Public Instance Methods

delete() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 61
def delete
  requires :datacenter_id, :id
  service.delete_lan(datacenter_id, id)
  true
end
failed?() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 87
def failed?
  state == 'ERROR'
end
ready?() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 83
def ready?
  state == 'AVAILABLE'
end
reload() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 67
def reload
  requires :datacenter_id, :id

  data = begin
    collection.get(datacenter_id, id)
  rescue Excon::Errors::SocketError
    nil
  end

  return unless data

  new_attributes = data.attributes
  merge_attributes(new_attributes)
  self
end
save() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 32
def save
  requires :datacenter_id

  properties = {}
  properties[:name]   = name if name
  properties[:public] = public if public
  properties[:ipFailover] = ip_failover if ip_failover

  entities = {}
  entities[:nics] = nics if nics

  data = service.create_lan(datacenter_id, properties, entities)
  merge_attributes(flatten(data.body))
  true
end
update() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 48
def update
  requires :datacenter_id, :id

  options = {}
  options[:name]   = name if name
  options[:public] = public if public
  options[:ipFailover] = ip_failover if ip_failover

  data = service.update_lan(datacenter_id, id, options)
  merge_attributes(flatten(data.body))
  true
end