lib/nephophobia/compute.rb in nephophobia-0.1.2 vs lib/nephophobia/compute.rb in nephophobia-0.2.0
- old
+ new
@@ -25,10 +25,18 @@
@placement = item['placement']['availabilityZone']
@instance_type = item['instanceType']
end
end
+ class VncData
+ attr_reader :url
+
+ def initialize attributes
+ @url = attributes['url']
+ end
+ end
+
class Compute
def initialize client
@client = client
end
@@ -144,8 +152,24 @@
}
response = @client.action "StartInstances", params
ResponseData.new response.body
+ end
+
+ ##
+ # Returns the VNC browser URL. Used by the Portal.
+ # __Must__ have an +admin+ role to use.
+ #
+ # +instance_id+: A String representing the ID of the instance.
+
+ def vnc_url instance_id
+ params = {
+ "InstanceId" => instance_id
+ }
+
+ response = @client.action "GetVncConsole", params
+
+ VncData.new response.body['GetVncConsoleResponse']
end
end
end