Class: Fog::Compute::Brightbox::Servers
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::Brightbox::Servers
- Defined in:
- lib/fog/brightbox/models/compute/servers.rb
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
- #all ⇒ Object
-
#bootstrap(options = {}) ⇒ Object
Creates a server and maps an Cloud IP.
- #get(identifier) ⇒ Object
Methods inherited from Fog::Collection
#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all ⇒ Object
12 13 14 15 |
# File 'lib/fog/brightbox/models/compute/servers.rb', line 12 def all data = service.list_servers load(data) end |
#bootstrap(options = {}) ⇒ Object
TODO:
Support uploading of arbitary SSH keys
Creates a server and maps an Cloud IP
By default the public SSH key you have registered with Brightbox is already made available in an AWS compatible metdata service.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fog/brightbox/models/compute/servers.rb', line 34 def bootstrap( = {}) server = create() # Ensure server is now available server.wait_for { ready? } # To get a public IP address we need to map a cloud IP address cip = service.cloud_ips.allocate cip.map(server) cip.wait_for { mapped? } # Reload so the public IP is now available server.reload end |
#get(identifier) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/fog/brightbox/models/compute/servers.rb', line 49 def get(identifier) return nil if identifier.nil? || identifier == "" data = service.get_server(identifier) new(data) rescue Excon::Errors::NotFound nil end |