Class: Stackup::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/stackup/service.rb

Overview

A handle to CloudFormation.

Instance Method Summary collapse

Constructor Details

#initialize(cf_client = {}) ⇒ Service

Returns a new instance of Service.



10
11
12
13
# File 'lib/stackup/service.rb', line 10

def initialize(cf_client = {})
  cf_client = Aws::CloudFormation::Client.new(cf_client) if cf_client.is_a?(Hash)
  @cf_client = cf_client
end

Instance Method Details

#stack(name, options = {}) ⇒ Stackup::Stack

Returns the named stack.

Returns:



17
18
19
# File 'lib/stackup/service.rb', line 17

def stack(name, options = {})
  Stack.new(name, cf_client, options)
end

#stack_namesEnumeration<String>

Returns names of existing stacks.

Returns:

  • (Enumeration<String>)

    names of existing stacks



23
24
25
26
27
28
29
30
31
# File 'lib/stackup/service.rb', line 23

def stack_names
  Enumerator.new do |y|
    cf_client.describe_stacks.each do |response|
      response.stacks.each do |stack|
        y << stack.stack_name
      end
    end
  end
end