class LambdaDeployment::Client

Public Class Methods

new(region) click to toggle source
# File lib/lambda_deployment/client.rb, line 3
def initialize(region)
  @region = region
end

Public Instance Methods

kms_client() click to toggle source
# File lib/lambda_deployment/client.rb, line 7
def kms_client
  @kms_client ||= Aws::KMS::Client.new(config)
end
lambda_client() click to toggle source
# File lib/lambda_deployment/client.rb, line 11
def lambda_client
  @lambda_client ||= Aws::Lambda::Client.new(config)
end
s3_client() click to toggle source
# File lib/lambda_deployment/client.rb, line 15
def s3_client
  @s3_client ||= Aws::S3::Client.new(config)
end

Private Instance Methods

config() click to toggle source
# File lib/lambda_deployment/client.rb, line 21
def config
  config = { region: @region }
  if role_arn
    config[:credentials] = Aws::AssumeRoleCredentials.new(
      role_arn: role_arn,
      role_session_name: SecureRandom.hex(10)
    )
  end
  config
end
role_arn() click to toggle source
# File lib/lambda_deployment/client.rb, line 32
def role_arn
  ENV.fetch('LAMBDA_ASSUME_ROLE', false)
end