Class: Kybus::CLI::AWSBotJobRunnerDeployer

Inherits:
AWSBotDeployer show all
Defined in:
lib/kybus/cli/bot/deployers/aws_bot_job_runner_deployer.rb

Instance Method Summary collapse

Methods inherited from AWSBotDeployer

#create_or_update!, #destroy!, #initialize, #url

Methods inherited from BotDeployerBase

#account_id, #function_name, #initialize

Constructor Details

This class inherits a constructor from Kybus::CLI::AWSBotDeployer

Instance Method Details

#assign_sqs_policyObject



25
26
27
# File 'lib/kybus/cli/bot/deployers/aws_bot_job_runner_deployer.rb', line 25

def assign_sqs_policy
  @role.add_policy(@queue.make_processor_policy) if @queue
end

#init_lambda(configs) ⇒ Object



21
22
23
# File 'lib/kybus/cli/bot/deployers/aws_bot_job_runner_deployer.rb', line 21

def init_lambda(configs)
  @lambda = ::Kybus::AWS::Lambda.new(configs.merge(lambda_config), role_name)
end

#lambda_configObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/kybus/cli/bot/deployers/aws_bot_job_runner_deployer.rb', line 6

def lambda_config
  {
    'triggers' => [{ 'type' => 'sqs', 'queue_arn' => @queue.arn }],
    'layers' => [
      { 'type' => 'existing',
        'name' => "#{function_name}-deps" }
    ],
    'handler' => 'handler.sqs_job_handler'
  }
end

#role_nameObject



17
18
19
# File 'lib/kybus/cli/bot/deployers/aws_bot_job_runner_deployer.rb', line 17

def role_name
  "#{function_name}_job_processor"
end