class Yao::Resources::VolumeServices

Public Class Methods

disable(host, binary, reason = nil) click to toggle source

@param host [String] @param binary [String] @param resason [String] @return [Hash]

# File lib/yao/resources/volume_services.rb, line 49
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
enable(host, binary) click to toggle source

@param host [String] @param binary [String] @return [Hash]

# File lib/yao/resources/volume_services.rb, line 37
def enable(host, binary)
  params = {
    "host" => host,
    "binary" => binary,
  }
  put("enable", params)
end

Private Class Methods

put(path, params) click to toggle source

@param path [String] @param params [Hash] @return [Hash]

# File lib/yao/resources/volume_services.rb, line 67
def put(path, params)
  res = PUT(create_url(path), params) do |req|
    req.body = params.to_json
    req.headers['Content-Type'] = 'application/json'
  end
  res.body
end

Public Instance Methods

disable(reason = nil) click to toggle source
# File lib/yao/resources/volume_services.rb, line 29
def disable(reason = nil)
  self.class.disable(host, binary, reason)
end
disabled?() click to toggle source

return true if ComputeServices is disabled @return [Bool]

# File lib/yao/resources/volume_services.rb, line 21
def disabled?
  status == 'disabled'
end
enable() click to toggle source
# File lib/yao/resources/volume_services.rb, line 25
def enable
  self.class.enable(host, binary)
end
enabled?() click to toggle source

return true if ComputeServices is enabled @return [Bool]

# File lib/yao/resources/volume_services.rb, line 15
def enabled?
  status == 'enabled'
end