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.



119
120
121
122
123
124
125
126
127
# File 'lib/cfnguardian/models/event.rb', line 119

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



129
130
131
132
133
134
135
136
# File 'lib/cfnguardian/models/event.rb', line 129

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