Class: Yao::Resources::Server

Inherits:
Base
  • Object
show all
Extended by:
Action, MetadataAvailable
Defined in:
lib/yao/resources/server.rb

Instance Attribute Summary

Attributes included from RestfullyAccessible

#api_version, #service

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MetadataAvailable

create_metadata, delete_metadata, get_metadata, list_metadata, set_metadata, update_metadata

Methods included from Action

action

Methods inherited from Base

#[], #[]=, #created, friendly_attributes, #id, #initialize, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, #updated

Methods included from RestfullyAccessible

#admin=, #as_member, #client, #create, #destroy, extended, #get, #list, #list_detail, #resources_path, #resources_path=, #return_single_on_querying=, #update, #with_resources_path

Constructor Details

This class inherits a constructor from Yao::Resources::Base

Class Method Details

.reboot(id) ⇒ Object



37
38
39
# File 'lib/yao/resources/server.rb', line 37

def self.reboot(id)
  action(id,"reboot" => { "type" => "HARD" })
end

.resize(id, flavor_id) ⇒ Object



41
42
43
# File 'lib/yao/resources/server.rb', line 41

def self.resize(id, flavor_id)
  action(id,"resize" => { "flavorRef" => flavor_id })
end

.shutoff(id) ⇒ Object Also known as: stop



33
34
35
# File 'lib/yao/resources/server.rb', line 33

def self.shutoff(id)
  action(id, "os-stop" => nil)
end

.start(id) ⇒ Object



29
30
31
# File 'lib/yao/resources/server.rb', line 29

def self.start(id)
  action(id, "os-start" => nil)
end

Instance Method Details

#old_samples(counter_name: nil, query: {}) ⇒ Object



25
26
27
# File 'lib/yao/resources/server.rb', line 25

def old_samples(counter_name: nil, query: {})
  Yao::OldSample.list(counter_name, query).select{|os| os.["instance_id"] == id}
end