You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.
Class: AWS::CloudFormation::StackCollection
- Inherits:
-
Object
- Object
- AWS::CloudFormation::StackCollection
- Includes:
- AWS::Core::Collection::WithNextToken
- Defined in:
- lib/aws/cloud_formation/stack_collection.rb
Instance Method Summary collapse
-
#[](stack_name) ⇒ Object
-
#create(stack_name, template, options = {}) ⇒ Stack
Creates a new stack.
-
#with_status(*status_filters) ⇒ StackCollection
Limits the stacks that are enumerated.
Methods included from AWS::Core::Collection
#each, #each_batch, #enum, #first, #in_groups_of, #page
Instance Method Details
#[](stack_name) ⇒ Object
152 153 154 |
# File 'lib/aws/cloud_formation/stack_collection.rb', line 152 def [] stack_name Stack.new(stack_name, :config => config) end |
#create(stack_name, template, options = {}) ⇒ Stack
Creates a new stack.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/aws/cloud_formation/stack_collection.rb', line 134 def create stack_name, template, = {} client_opts = .dup client_opts[:template] = template apply_stack_name(stack_name, client_opts) apply_template(client_opts) apply_disable_rollback(client_opts) apply_notification_arns(client_opts) apply_parameters(client_opts) apply_timeout(client_opts) resp = client.create_stack(client_opts) Stack.new(stack_name, :config => config, :stack_id => resp.stack_id) end |
#with_status(*status_filters) ⇒ StackCollection
Limits the stacks that are enumerated.
cloud_formation.stacks.with_status(:create_complete).each do |stack| puts stack.name end
You can provide multiple statuses:
statuses = [:create_failed, :rollback_failed] cloud_formation.stacks.with_status(statuses).each do |stack| puts stack.name end
Status names may be symbolized (snake-cased) or upper-cased strings (e.g. :create_in_progress, 'CREATE_IN_PROGRESS').
195 196 197 198 |
# File 'lib/aws/cloud_formation/stack_collection.rb', line 195 def with_status *status_filters filters = @status_filters + status_filters.flatten.map(&:to_s).map(&:upcase) StackCollection.new(:status_filters => filters, :config => config) end |