Sha256: 63ae7b77544f950ef9cc2ad68696a01f29925a4a6a1d2b6d2e98bf6c353e7a56
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
module Yao::Resources class ComputeServices < Base friendly_attributes :status, :binary, :host, :zone, :state, :disabled_reason, :forced_down map_attributes_to_time :updated_at alias :updated :updated_at self.service = "compute" self.resource_name = "service" self.resources_name = "os-services" # return true if ComputeServices is enabled # @return [Bool] def enabled? status == 'enabled' end # return true if ComputeServices is disabled # @return [Bool] def disabled? status == 'disabled' end # @return [] def delete self.class.delete(id) end class << self # @param host [String] # @param binary [String] # @return [Yao::Resources::ComputeServices] def enable(host, binary) params = { "host" => host, "binary" => binary, } put("enable", params) end # @param host [String] # @param binary [String] # @param resason [String] # @return [Yao::Resources::ComputeServices] def disable(host, binary, reason = nil) params = { "host" => host, "binary" => binary, } if reason params["disabled_reason"] = reason put("disable-log-reason", params) else put("disable", params) end end private # @param path [String] # @param params [Hash] # @return [Yao::Resources::ComputeServices] def put(path, params) res = PUT(create_url(path), params) do |req| req.body = params.to_json req.headers['Content-Type'] = 'application/json' end resource_from_json(res.body) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yao-0.21.0 | lib/yao/resources/compute_services.rb |
yao-0.20.0 | lib/yao/resources/compute_services.rb |