class AppAbstract
Public Class Methods
new(param = nil)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 17 def initialize(param = nil) end
Public Instance Methods
cleanupApp()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 94 def cleanupApp() log("INFO", "\nExiting app") end
createAppContext()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 56 def createAppContext() @appContext = AppContext.new(@var_input) end
getAppContext()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 60 def getAppContext() return @appContext end
getCloudmunchContext(context)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/PluginLoaderAbstract.rb, line 63 def getCloudmunchContext(context) begin return @@config[context+"_context"] rescue return false end end
getCloudmunchService()
click to toggle source
def getCloudmunchContext(context)
begin return @@config[context+"_context"] rescue return false end
end
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 72 def getCloudmunchService() @cloudmunchservice = self.extend(CloudmunchService) return @cloudmunchservice end
getInsightHelper()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 77 def getInsightHelper() @insightHelper = self.extend(InsightHelper) return @insightHelper end
getIntegrationDetails(param = nil)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 82 def getIntegrationDetails(param = nil) serviceProvider = ServiceProvider.new(@json_input["providername"]) serviceProvider.load_data(@integration_input) return serviceProvider end
getJSONArgs()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 37 def getJSONArgs() jsonin = nil varin=nil integrations=nil loop { case ARGV[0] when '-jsoninput' then ARGV.shift; jsonin = ARGV.shift when '-variables' then ARGV.shift; varin = ARGV.shift when '-integrations' then ARGV.shift; integrations = ARGV.shift when /^-/ then usage("Unknown option: #{ARGV[0].inspect}") else break end; } @json_input = JSON.load(jsonin) @var_input =JSON.load(varin) @integration_input=JSON.load(integrations) createAppContext(); return @json_input end
initializeApp()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 88 def initializeApp() end
log(level,logString)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 25 def log(level,logString) if @logger.nil? logInit("DEBUG") end Util.logIt(@logger, @log_level, level.to_s.downcase, logString) end
logClose()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 33 def logClose() Util.logClose(@logger) end
logInit(log_level)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 20 def logInit(log_level) @logger = @logger ? @logger : Util.logInit() @log_level = log_level end
outputPipelineVariables(variablesHash)
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v3/AppAbstract.rb, line 88 def outputPipelineVariables(variablesHash) # check if variable key is surrounded by {} and add if not present tmp = {} variablesHash.each do |key, value| matches = key.scan(/^{.+}$/i) if matches.is_a?(Array) && matches.length == 0 key = "{" + key + "}" end tmp[key] = value end variablesHash = tmp fileLoc = @appContext.get_reports_location() + "/" + @appContext.get_step_id() + ".out" varList = nil if File.exist?(fileLoc) varList = File.read(fileLoc) end if varList.nil? || (varList.is_a?(String) && varList.length == 0) varList = variablesHash varList = JSON.generate(variablesHash) File.write(fileLoc, varList) else varList = JSON.parse(varList) variablesHash.each do |key, value| varList[key] = value end varList = JSON.generate(varList) File.write(fileLoc, varList) end end
process()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 91 def process() end
start()
click to toggle source
# File lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb, line 98 def start() initializeApp() process() cleanupApp() end