module AwsAsCode::Concerns::AwsTaskHelpers

Private Instance Methods

cloud_formation() click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 20
def cloud_formation
  @cloud_formation ||= Aws::CloudFormation::Client.new
end
exit_code_for_stack_state(stack) click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 12
def exit_code_for_stack_state(stack)
  state_indicates_failure?(stack) ? 1 : 0
end
s3() click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 24
def s3
  @s3 ||= Aws::S3::Resource.new
end
semaphore() click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 8
def semaphore
  StackStateSemaphore.new logger: logger
end
stack() click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 28
def stack
  @stack ||= Aws::CloudFormation::Stack.new config.stack
end
state_indicates_failure?(stack) click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 16
def state_indicates_failure?(stack)
  stack.stack_status =~ /ROLLBACK/ || stack.stack_status =~ /FAILED/
end
template_object() click to toggle source
# File lib/aws_as_code/concerns/aws_task_helpers.rb, line 32
def template_object
  bucket = s3.bucket config.bucket
  prefix = "#{config.stack}/#{config.version}"
  bucket.object "#{prefix}/#{config.template}.json"
end