Method: CloudmunchService#getResource

Defined in:
lib/cloudmunch_Ruby_sdk_v3/CloudmunchService.rb

#getResource(type) ⇒ Object

getResource(type) Return resources available for a given type



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/cloudmunch_Ruby_sdk_v3/CloudmunchService.rb', line 31

def getResource(type)
  if !type.nil?
    paramHash = Hash.new
    paramHash["context"] = "resources"
    paramHash["filter"] = {"type" => type}
    paramHash["fields"] = "*"

    resource = getCloudmunchData(paramHash)

    if resource.nil?
      log("DEBUG", "Unable to retrieve resource for this type")
      return nil
    else
      return resource
    end
  else
    log("DEBUG", "Type needs to be provided to retrieve resource!")
    return nil
  end
end