Class: AppAbstract

Inherits:
Object
  • Object
show all
Includes:
CloudmunchService, InsightHelper, Util
Defined in:
lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb,
lib/cloudmunch_Ruby_sdk_v2/PluginLoaderAbstract.rb,
lib/cloudmunch_Ruby_sdk_v2/PluginReporterAbstract.rb

Constant Summary collapse

@@config =
nil

Instance Method Summary collapse

Methods included from Util

getJSONArgs, log, logClose, logInit, logIt, openJSONFile

Methods included from InsightHelper

#createInsight, #createInsightDataStore, #createInsightDataStoreExtract, #createInsightReport, #createInsightReportCard, #createInsightReportKeyMetric, #getDataStoreID, #getExtractID, #getInsightDataStoreExtracts, #getInsightDataStores, #getInsightReportCards, #getInsightReportDataTemplateHash, #getInsightReportKeyMetrics, #getInsightReportMetaTemplateHash, #getInsightReportVisualizationMapTemplateHash, #getInsightReports, #getInsights, #getKeyMetricID, #getListOfDatesForADuration, #getReportCardID, #getReportID, #updateInsight, #updateInsightDataStore, #updateInsightDataStoreExtract, #updateInsightReport, #updateInsightReportCard, #updateInsightReportKeyMetric

Methods included from CloudmunchService

#deleteCloudmunchData, #deleteKeys, #downloadKeys, #generateServerURL, #getCloudmunchData, getCustomDataContext, #getDataForContext, http_get, http_post, #parseResponse, putCustomDataContext, #updateCloudmunchData, #updateDataForContext

Constructor Details

#initialize(param = nil) ⇒ AppAbstract

Returns a new instance of AppAbstract.



17
18
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 17

def initialize(param = nil)
end

Instance Method Details

#cleanupAppObject



94
95
96
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 94

def cleanupApp()
   log("INFO", "\nExiting app")
end

#createAppContextObject



56
57
58
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 56

def createAppContext()
    @appContext = AppContext.new(@var_input)        
end

#getAppContextObject



60
61
62
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 60

def getAppContext()
    return @appContext
end

#getCloudmunchContext(context) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/cloudmunch_Ruby_sdk_v2/PluginLoaderAbstract.rb', line 63

def getCloudmunchContext(context)
    begin
        return @@config[context+"_context"]
    rescue
        return false
    end
end

#getCloudmunchServiceObject

def getCloudmunchContext(context)

begin
    return @@config[context+"_context"]
rescue
    return false
end

end



72
73
74
75
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 72

def getCloudmunchService()
    @cloudmunchservice = self.extend(CloudmunchService)
    return @cloudmunchservice
end

#getInsightHelperObject



77
78
79
80
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 77

def getInsightHelper()
    @insightHelper = self.extend(InsightHelper)
    return @insightHelper
end

#getIntegrationDetails(param = nil) ⇒ Object



82
83
84
85
86
# 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

#getJSONArgsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# 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

#initializeAppObject



88
89
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 88

def initializeApp()
end

#log(level, logString) ⇒ Object



25
26
27
28
29
30
# 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

#logCloseObject



33
34
35
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 33

def logClose()
    Util.logClose(@logger)
end

#logInit(log_level) ⇒ Object



20
21
22
23
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 20

def logInit(log_level)
    @logger = @logger ? @logger : Util.logInit()
    @log_level = log_level
end

#processObject



91
92
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 91

def process()
end

#startObject



98
99
100
101
102
# File 'lib/cloudmunch_Ruby_sdk_v2/AppAbstract.rb', line 98

def start()
    initializeApp()
    process()
    cleanupApp()
end