Class: CfnGuardian::Models::SqlEvent

Inherits:
BaseEvent
  • Object
show all
Defined in:
lib/cfnguardian/models/event.rb

Instance Attribute Summary

Attributes inherited from BaseEvent

#cron, #enabled, #environment, #group, #hash, #name, #resource, #target, #type

Instance Method Summary collapse

Constructor Details

#initialize(resource, query, environment) ⇒ SqlEvent

Returns a new instance of SqlEvent.



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/cfnguardian/models/event.rb', line 222

def initialize(resource,query,environment)
  super(resource)
  @group = 'Sql'
  @name = 'SqlEvent'
  @target = "SqlCheckFunction#{environment}"
  @host = resource['Id']
  @engine = resource['Engine']
  @port = resource['Port']
  @ssm_username = resource['SSMUsername']
  @ssm_password = resource['SSMPassword']
  @query = query
  @region = resource.fetch('Region',"${AWS::Region}")
  @test_type = '1-row-1-value-zero-is-good'
  @environment = environment
end

Instance Method Details

#payloadObject



238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/cfnguardian/models/event.rb', line 238

def payload
  return {
    'Host' => @host,
    'Engine' => @engine,
    'Port' => @port,
    'SqlCall' => @query,
    'SSMUsername' => @ssm_username,
    'SSMPassword' => @ssm_password,
    'Region' => @region,
    'TestType' => @test_type
  }.to_json
end

#ssm_parametersObject



251
252
253
254
255
256
# File 'lib/cfnguardian/models/event.rb', line 251

def ssm_parameters
  params = []
  params << @ssm_username
  params << @ssm_password
  return params
end