Class: Fog::Compute::Brightbox::ServerGroup
- Defined in:
- lib/fog/brightbox/models/compute/server_group.rb
Overview
A server group is a collection of servers
Certain actions can accept a server group and affect all members
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#add_servers(identifiers) ⇒ Fog::Compute::ServerGroup
Adds specified servers to this server group.
- #destroy ⇒ Object
-
#move_servers(identifiers, destination_group_id) ⇒ Fog::Compute::ServerGroup
Moves specified servers from this server group to the specified destination server group.
-
#remove_servers(identifiers) ⇒ Fog::Compute::ServerGroup
Removes specified servers from this server group.
- #save ⇒ Object
- #servers ⇒ Object
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#add_servers(identifiers) ⇒ Fog::Compute::ServerGroup
Adds specified servers to this server group
44 45 46 47 48 49 50 51 |
# File 'lib/fog/brightbox/models/compute/server_group.rb', line 44 def add_servers identifiers requires :identity = { :servers => server_references(identifiers) } data = connection.add_servers_server_group identity, merge_attributes data end |
#destroy ⇒ Object
81 82 83 84 85 |
# File 'lib/fog/brightbox/models/compute/server_group.rb', line 81 def destroy requires :identity connection.destroy_server_group(identity) true end |
#move_servers(identifiers, destination_group_id) ⇒ Fog::Compute::ServerGroup
Moves specified servers from this server group to the specified destination server group
71 72 73 74 75 76 77 78 79 |
# File 'lib/fog/brightbox/models/compute/server_group.rb', line 71 def move_servers identifiers, destination_group_id requires :identity = { :servers => server_references(identifiers), :destination => destination_group_id } data = connection.move_servers_server_group identity, merge_attributes data end |
#remove_servers(identifiers) ⇒ Fog::Compute::ServerGroup
Removes specified servers from this server group
57 58 59 60 61 62 63 64 |
# File 'lib/fog/brightbox/models/compute/server_group.rb', line 57 def remove_servers identifiers requires :identity = { :servers => server_references(identifiers) } data = connection.remove_servers_server_group identity, merge_attributes data end |
#save ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/brightbox/models/compute/server_group.rb', line 23 def save = { :name => name, :description => description }.delete_if {|k,v| v.nil? || v == "" } data = connection.create_server_group() merge_attributes(data) true end |
#servers ⇒ Object
33 34 35 36 37 38 |
# File 'lib/fog/brightbox/models/compute/server_group.rb', line 33 def servers srv_ids = server_ids.collect {|srv| srv["id"]} srv_ids.collect do |srv_id| connection.servers.get(srv_id) end end |