Class: AwsCftTools::Client::CFT

Inherits:
Base
  • Object
show all
Includes:
ChangesetManagement, StackManagement
Defined in:
lib/aws_cft_tools/client/cft.rb,
lib/aws_cft_tools/client/cft/stack_management.rb,
lib/aws_cft_tools/client/cft/changeset_management.rb

Overview

CloudFormation Client

All of the business logic behind direct interaction with the AWS API for CloudFormation templates and stacks.

Defined Under Namespace

Modules: ChangesetManagement, StackManagement

Instance Attribute Summary

Attributes inherited from Base

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StackManagement

#create_stack, #delete_stack, #update_stack

Methods included from ChangesetManagement

#changes_on_stack_create, #changes_on_stack_delete, #changes_on_stack_update

Methods inherited from Base

#aws_client

Constructor Details

#initialize(options) ⇒ CFT

Returns a new instance of CFT.

Parameters:

  • options (Hash)

    client configuration

Options Hash (options):

  • :environment (String)

    the operational environment in which to act

  • :profile (String)

    the AWS credential profile to use

  • :region (String)

    the AWS region in which to act



25
26
27
# File 'lib/aws_cft_tools/client/cft.rb', line 25

def initialize(options)
  super(options)
end

Class Method Details

.aws_client_classObject



29
30
31
# File 'lib/aws_cft_tools/client/cft.rb', line 29

def self.aws_client_class
  Aws::CloudFormation::Client
end

Instance Method Details

#all_stacksArray<OpenStruct>

List all of the stacks in CloudFormation.

Returns:

  • (Array<OpenStruct>)


61
62
63
# File 'lib/aws_cft_tools/client/cft.rb', line 61

def all_stacks
  @all_stacks ||= AWSEnumerator.new(aws_client, :describe_stacks, &method(:map_stacks)).to_a
end

#exportsArray<Aws::CloudFormation::Types::Export>

Lists all exports from stacks in CloudFormation.

Returns:

  • (Array<Aws::CloudFormation::Types::Export>)


38
39
40
# File 'lib/aws_cft_tools/client/cft.rb', line 38

def exports
  @exports ||= AWSEnumerator.new(aws_client, :list_exports, {}, &:exports).to_a
end

#stacksArray<OpenStruct>

Lists all of the stacks in CloudFormation that are specific to the selected environment.

Returns:

  • (Array<OpenStruct>)


47
48
49
50
51
52
53
54
# File 'lib/aws_cft_tools/client/cft.rb', line 47

def stacks
  @stacks ||= all_stacks.select do |stack|
    tags = stack.tags
    satisfies_environment(tags) &&
      satisfies_role(tags) &&
      satisfies_tags(tags)
  end
end