Class: OVH::Provisioner::APIObject::Vrack

Inherits:
OVH::Provisioner::APIObject show all
Defined in:
lib/ovh/provisioner/api_object/vrack.rb

Overview

Represent a VRack

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dedicated_serversObject (readonly)

Returns the value of attribute dedicated_servers.



24
25
26
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 24

def dedicated_servers
  @dedicated_servers
end

#descriptionObject (readonly)

Returns the value of attribute description.



24
25
26
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 24

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 24

def name
  @name
end

#tasksObject (readonly)

Returns the value of attribute tasks.



24
25
26
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 24

def tasks
  @tasks
end

Instance Method Details

#add(api_object) ⇒ Object



26
27
28
29
30
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 26

def add(api_object)
  path = path_from(api_object)
  ok, msg = parse_task(post(path, path => api_object.id))
  "#{api_object.id}: #{ok ? 'ok' : 'failed'}\n  #{msg}"
end

#remove(api_object) ⇒ Object



32
33
34
35
36
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 32

def remove(api_object)
  path = "#{path_from(api_object)}/#{api_object.id}"
  ok, msg = parse_task(delete(path))
  "#{api_object.id}: #{ok ? 'ok' : 'failed'}\n  #{msg}"
end

#to_sObject



38
39
40
41
42
# File 'lib/ovh/provisioner/api_object/vrack.rb', line 38

def to_s
  "#{name}: #{id}#{" - #{description}" unless description.empty?}" \
  "#{list_to_s(:dedicated_servers)}" \
  "#{list_to_s(:tasks)}"
end