Class: CfnGuardian::Models::SFTPEvent
- Defined in:
- lib/cfnguardian/models/event.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseEvent
#cron, #enabled, #environment, #group, #hash, #name, #resource, #target, #type
Instance Method Summary collapse
-
#initialize(resource) ⇒ SFTPEvent
constructor
A new instance of SFTPEvent.
- #payload ⇒ Object
- #ssm_parameters ⇒ Object
Constructor Details
#initialize(resource) ⇒ SFTPEvent
Returns a new instance of SFTPEvent.
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/cfnguardian/models/event.rb', line 275 def initialize(resource) super(resource) @group = 'SFTP' @name = 'SFTPEvent' @target = 'SFTPCheckFunction' @cron = resource.fetch('Schedule', "0/5 * * * ? *") @host = resource['Id'] @user = resource['User'] @port = resource.fetch('Port', nil) @server_key = resource.fetch('ServerKey', nil) @password = resource.fetch('Password', nil) @private_key = resource.fetch('PrivateKey', nil) @private_key_pass = resource.fetch('PrivateKeyPass', nil) @file = resource.fetch('File', nil) @file_regex_match = resource.fetch('FileRegexMatch', nil) @timeout = resource.fetch('Timeout', nil) end |
Instance Method Details
#payload ⇒ Object
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/cfnguardian/models/event.rb', line 293 def payload payload = { 'HOSTNAME' => @host, 'USERNAME' => @user } payload['PORT'] = @port unless @port.nil? payload['SERVER_KEY'] = @server_key unless @server_key.nil? payload['PASSWORD'] = @password unless @password.nil? payload['PRIVATEKEY'] = @private_key unless @private_key.nil? payload['PRIVATEKEY_PASSWORD'] = @private_key_pass unless @private_key_pass.nil? payload['FILE'] = @file unless @file.nil? payload['FILE_REGEX_MATCH'] = @file_regex_match unless @file_regex_match.nil? payload['TIMEOUT'] = @timeout unless @timeout.nil? return payload.to_json end |
#ssm_parameters ⇒ Object
309 310 311 312 313 314 315 |
# File 'lib/cfnguardian/models/event.rb', line 309 def ssm_parameters params = [] params << @password unless @password.nil? params << @private_key unless @private_key.nil? params << @private_key_pass unless @private_key_pass.nil? return params end |