Class: CfnGuardian::Models::PortEvent

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

Direct Known Subclasses

InternalPortEvent

Instance Attribute Summary

Attributes inherited from BaseEvent

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

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ PortEvent

Returns a new instance of PortEvent.



148
149
150
151
152
153
154
155
156
# File 'lib/cfnguardian/models/event.rb', line 148

def initialize(resource)
  super(resource)
  @group = 'Port'
  @name = 'PortEvent'
  @target = 'PortCheckFunction'
  @hostname = resource['Id']
  @port = resource['Port']
  @timeout = resource.fetch('Timeout',120)
end

Instance Method Details

#payloadObject



158
159
160
161
162
163
164
165
# File 'lib/cfnguardian/models/event.rb', line 158

def payload
  return {
    'HOSTNAME' => @hostname,
    'PORT' => @port,
    'TIMEOUT' => @timeout,
    'STATUS_CODE_MATCH' => @status_code
  }.to_json
end