Parent

Class/Module Index [+]

Quicksearch

Fog::Compute::Brightbox::ServerGroup

A server group is a collection of servers

Certain actions can accept a server group and affect all members

Public Instance Methods

add_servers(identifiers) click to toggle source

Adds specified servers to this server group

@param [Array] identifiers array of server identifier strings to add @return [Fog::Compute::ServerGroup]

# File lib/fog/brightbox/models/compute/server_group.rb, line 44
def add_servers identifiers
  requires :identity
  options = {
    :servers => server_references(identifiers)
  }
  data = service.add_servers_server_group identity, options
  merge_attributes data
end
destroy() click to toggle source
# File lib/fog/brightbox/models/compute/server_group.rb, line 81
def destroy
  requires :identity
  service.destroy_server_group(identity)
  true
end
move_servers(identifiers, destination_group_id) click to toggle source

Moves specified servers from this server group to the specified destination server group

@param [Array] identifiers array of server identifier strings to move @param [String] destination_group_id destination server group identifier @return [Fog::Compute::ServerGroup]

# File lib/fog/brightbox/models/compute/server_group.rb, line 71
def move_servers identifiers, destination_group_id
  requires :identity
  options = {
    :servers => server_references(identifiers),
    :destination => destination_group_id
  }
  data = service.move_servers_server_group identity, options
  merge_attributes data
end
remove_servers(identifiers) click to toggle source

Removes specified servers from this server group

@param [Array] identifiers array of server identifier strings to remove @return [Fog::Compute::ServerGroup]

# File lib/fog/brightbox/models/compute/server_group.rb, line 57
def remove_servers identifiers
  requires :identity
  options = {
    :servers => server_references(identifiers)
  }
  data = service.remove_servers_server_group identity, options
  merge_attributes data
end
save() click to toggle source
# File lib/fog/brightbox/models/compute/server_group.rb, line 23
def save
  options = {
    :name => name,
    :description => description
  }.delete_if {|k,v| v.nil? || v == "" }
  data = service.create_server_group(options)
  merge_attributes(data)
  true
end
servers() click to toggle source
# 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|
    service.servers.get(srv_id)
  end
end

Protected Instance Methods

server_references(identifiers) click to toggle source
# File lib/fog/brightbox/models/compute/server_group.rb, line 89
def server_references identifiers
  identifiers.map {|id| {"server" => id} }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.