class Brightbox::Server
Public Class Methods
Source
# File lib/brightbox-cli/servers.rb, line 9 def self.create(options) new(conn.servers.create(options)) end
Source
# File lib/brightbox-cli/servers.rb, line 5 def self.create_servers(count, options) (0...count).map { |_i| create(options) } end
Source
# File lib/brightbox-cli/servers.rb, line 21 def self.default_field_order %i[id status type zone created_on image_id cloud_ip_ids name] end
Source
# File lib/brightbox-cli/servers.rb, line 17 def self.get(id) conn.servers.get id end
Source
# File lib/brightbox-cli/servers.rb, line 3 def self.require_account?; true; end
Public Instance Methods
Source
# File lib/brightbox-cli/servers.rb, line 35 def activate_console self.class.conn.activate_console_server id end
Source
# File lib/brightbox-cli/servers.rb, line 39 def attributes fog_attributes.tap do |attrs| attrs[:created_at] = created_at attrs[:created_on] = created_on attrs[:hostname] = hostname attrs[:image] = image_id attrs[:locked] = locked? attrs[:status] = fog_model.state attrs[:type] = server_type["handle"] attrs[:zone] = zone && zone["handle"] unless cloud_ips.empty? attrs[:public_hostname] = "public.#{fqdn}" end if interfaces.any? { |i| i["ipv6_address"] } attrs[:ipv6_hostname] = ipv6_fqdn end end end
Source
# File lib/brightbox-cli/servers.rb, line 67 def deleted? fog_model.status == "deleted" end
Source
# File lib/brightbox-cli/servers.rb, line 60 def to_row attributes.merge( cloud_ips: cloud_ips.map { |i| i["public_ip"] }.join(", "), ips: interfaces.map { |i| i["ipv4_address"] }.join(", ") ) end
Source
# File lib/brightbox-cli/servers.rb, line 25 def update(options) self.class.conn.update_server id, options reload self end