Class: Yao::Resources::Server
Instance Attribute Summary
#service
Class Method Summary
collapse
Instance Method Summary
collapse
create_metadata, delete_metadata, get_metadata, list_metadata, set_metadata, update_metadata
Methods included from Action
action
included, #tenant
Methods inherited from Base
#[], #[]=, #created, friendly_attributes, #id, #initialize, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, #to_hash, #updated
#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update
Class Method Details
.add_security_group(id, sg_name) ⇒ Object
48
49
50
|
# File 'lib/yao/resources/server.rb', line 48
def self.add_security_group(id, sg_name)
action(id, {"addSecurityGroup": {"name": sg_name}})
end
|
.get_vnc_console(id) ⇒ Object
56
57
58
59
|
# File 'lib/yao/resources/server.rb', line 56
def self.get_vnc_console(id)
response = action(id, {"os-getVNCConsole": {"type": "novnc"}})
response.dig("console", "url")
end
|
.reboot(id) ⇒ Object
40
41
42
|
# File 'lib/yao/resources/server.rb', line 40
def self.reboot(id)
action(id,"reboot" => { "type" => "HARD" })
end
|
.remove_security_group(id, sg_name) ⇒ Object
52
53
54
|
# File 'lib/yao/resources/server.rb', line 52
def self.remove_security_group(id, sg_name)
action(id, {"removeSecurityGroup": {"name": sg_name}})
end
|
.resize(id, flavor_id) ⇒ Object
44
45
46
|
# File 'lib/yao/resources/server.rb', line 44
def self.resize(id, flavor_id)
action(id,"resize" => { "flavorRef" => flavor_id })
end
|
.shutoff(id) ⇒ Object
Also known as:
stop
36
37
38
|
# File 'lib/yao/resources/server.rb', line 36
def self.shutoff(id)
action(id, "os-stop" => nil)
end
|
.start(id) ⇒ Object
32
33
34
|
# File 'lib/yao/resources/server.rb', line 32
def self.start(id)
action(id, "os-start" => nil)
end
|
Instance Method Details
#old_samples(counter_name: nil, query: {}) ⇒ Object
28
29
30
|
# File 'lib/yao/resources/server.rb', line 28
def old_samples(counter_name: nil, query: {})
Yao::OldSample.list(counter_name, query).select{|os| os.resource_metadata["instance_id"] == id}
end
|