lib/yao/resources/server.rb in yao-0.7.0 vs lib/yao/resources/server.rb in yao-0.8.0
- old
+ new
@@ -1,11 +1,13 @@
require 'yao/resources/metadata_available'
require 'yao/resources/action'
module Yao::Resources
class Server < Base
+ include TenantAssociationable
+
friendly_attributes :addresses, :metadata, :name, :progress,
- :status, :tenant_id, :user_id, :key_name
+ :status, :user_id, :key_name
map_attribute_to_attribute hostId: :host_id
map_attribute_to_resource flavor: Flavor
map_attribute_to_resource image: Image
map_attribute_to_resources security_groups: SecurityGroup
@@ -19,10 +21,11 @@
map_attribute_to_attribute 'OS-EXT-STS:vm_state' => :ext_sts_vm_state
self.service = "compute"
self.resource_name = "server"
self.resources_name = "servers"
+ self.resources_detail_available = true
def old_samples(counter_name: nil, query: {})
Yao::OldSample.list(counter_name, query).select{|os| os.resource_metadata["instance_id"] == id}
end
@@ -50,17 +53,9 @@
action(id, {"removeSecurityGroup": {"name": sg_name}})
end
class << self
alias :stop :shutoff
-
- def list_detail(query={})
- return_resources(
- resources_from_json(
- GET([resources_path, "detail"].join("/"), query).body
- )
- )
- end
end
extend MetadataAvailable
extend Action
end