Method: CloudmunchService#createInsight

Defined in:
lib/cloudmunch_Ruby_sdk_v2/CloudmunchService.rb

#createInsight(insightName) ⇒ Object



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/cloudmunch_Ruby_sdk_v2/CloudmunchService.rb', line 122

def createInsight(insightName)
  if !insightName.nil?
    insightID = nil
    insightID = getInsightID(insightName)
    
    if !insightID.nil?
      log("DEBUG", "Insight with name "+insightName+" already exists!")
      return insightID
    else
      paramHash = {}
      paramHash["context"]    = "insights"
      paramHash["data"]       = {"name" => insightName}
      insight = updateCloudmunchData(paramHash)
      
      if insight["id"].nil?
        log("DEBUG", "Unable to create insight : "+insightName+"! refer log for more details")
        return nil
      else
        return insight["id"]
      end
    end
  else
      log("DEBUG", "Insights name is needed for creating an insight")
      return nil
  end
end