Class: Fog::Compute::ProfitBricks::Group

Inherits:
Models::ProfitBricks::Base show all
Includes:
Helpers::ProfitBricks::DataHelper
Defined in:
lib/fog/profitbricks/models/compute/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::ProfitBricks::DataHelper

#flatten

Methods inherited from Models::ProfitBricks::Base

#failed?, #ready?, #request_status, #wait_for

Constructor Details

#initialize(attributes = {}) ⇒ Group

Returns a new instance of Group.



27
28
29
# File 'lib/fog/profitbricks/models/compute/group.rb', line 27

def initialize(attributes = {})
  super
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



25
26
27
# File 'lib/fog/profitbricks/models/compute/group.rb', line 25

def options
  @options
end

Instance Method Details

#deleteObject



61
62
63
64
65
# File 'lib/fog/profitbricks/models/compute/group.rb', line 61

def delete
  requires :id
  service.delete_group(id)
  true
end

#saveObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fog/profitbricks/models/compute/group.rb', line 31

def save
  requires :name

  options = {}
  options[:name]              = name
  options[:createDataCenter]  = create_datacenter if create_datacenter
  options[:createSnapshot]    = create_snapshot if create_snapshot
  options[:reserveIp]         = reserve_ip if reserve_ip
  options[:accessActivityLog] = access_activity_log if access_activity_log

  data = service.create_group(options)
  merge_attributes(flatten(data.body))
  true
end

#updateObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fog/profitbricks/models/compute/group.rb', line 46

def update
  requires :id, :name

  options = {}
  options[:name]              = name
  options[:createDataCenter]  = create_datacenter if [true, false].include?(create_datacenter)
  options[:createSnapshot]    = create_snapshot if [true, false].include?(create_snapshot)
  options[:reserveIp]         = reserve_ip if [true, false].include?(reserve_ip)
  options[:accessActivityLog] = access_activity_log if [true, false].include?(access_activity_log)

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