Sha256: 3c8e7ce2f07c9508e292419b77c6791b3bd26918f5a6b9b6c471006ac23bbd60
Contents?: true
Size: 1.06 KB
Versions: 6
Compression:
Stored size: 1.06 KB
Contents
module Brightbox class ServerGroup < Api def self.all conn.server_groups end def self.get(id) conn.server_groups.get(id) end def self.create(options) new(conn.server_groups.create(options)) end def self.default_field_order [:id, :server_count, :name] end def firewall_policy FirewallPolicy.all.detect do |policy| policy.server_group_id == self.id end end def update(options) self.class.conn.update_server_group(id, options) self.reload self end def destroy fog_model.destroy end def attributes fog_model.attributes end def to_row o = attributes o[:servers] = server_string o[:server_count] = server_count o end def server_ids attributes[:server_ids].map{|id| id.is_a?(Hash) ? id['id'] : id } end def server_count server_ids.respond_to?(:size) ? server_ids.size : 0 end def server_string server_ids.respond_to?(:join) ? server_ids.join(" ") : "" end end end
Version data entries
6 entries across 6 versions & 1 rubygems