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 57
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 83
def failed?
  state == 'ERROR'
end
ready?() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 79
def ready?
  state == 'AVAILABLE'
end
reload() click to toggle source
# File lib/fog/profitbricks/models/compute/lan.rb, line 63
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 30
def save
  requires :datacenter_id

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

  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 45
def update
  requires :datacenter_id, :id

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

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