class CfnGuardian::Models::SFTPEvent

Public Class Methods

new(resource) click to toggle source
Calls superclass method CfnGuardian::Models::BaseEvent::new
# File lib/cfnguardian/models/event.rb, line 241
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)
end

Public Instance Methods

payload() click to toggle source
# File lib/cfnguardian/models/event.rb, line 258
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?
  return payload.to_json
end
ssm_parameters() click to toggle source
# File lib/cfnguardian/models/event.rb, line 273
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