Class: AWS::CloudFormation::Stack
- Inherits:
-
AWS::Core::Resource
- Object
- AWS::Core::Resource
- AWS::CloudFormation::Stack
- Defined in:
- lib/aws/cloud_formation/stack.rb
Instance Attribute Summary collapse
-
#capabilities ⇒ Array<String>
readonly
The capabilities allowed in the stack.
-
#creation_time ⇒ Object
readonly
returned by DescribeStacks.
-
#description ⇒ String
readonly
User defined description associated with the stack.
-
#disable_rollback ⇒ Boolean
(also: #disable_rollback?)
readonly
Specifies if the stack is rolled back due to stack creation errors.
-
#last_updated_time ⇒ Time?
readonly
The time the stack was last updated.
-
#name ⇒ String
readonly
Returns the stack name.
-
#notification_arns ⇒ Array<String>
readonly
SNS topic ARNs to which stack related events are published.
-
#parameters ⇒ Hash
readonly
Returns a hash of stack parameters.
-
#stack_id ⇒ String
readonly
Unique stack identifier.
-
#status ⇒ Symbol
readonly
The status of the stack.
-
#status_reason ⇒ String
readonly
Success/Failure message associated with the
status
. -
#template ⇒ Object
(also: #template_body)
readonly
returned by GetTemplate.
-
#timeout ⇒ Integer
(also: #timeout_in_minutes)
readonly
The number of minutes within the stack creation should complete.
Instance Method Summary collapse
-
#delete ⇒ nil
Deletes the current stack.
-
#describe_stacks ⇒ Object
attribute providers.
-
#estimate_template_cost ⇒ String
Returns a URL to the AWS Simple Monthly Calculator with a query string that describes the resources required to run the template.
-
#events ⇒ StackEventCollection
Returns a collection that represents all events for this stack.
- #exists? ⇒ Boolean
- #outputs ⇒ Array<StackOutput>
-
#resource_summaries ⇒ StackResourceSummaryCollection
Returns a stack resource summary collection, that when enumerated yields summary hashes.
-
#resources ⇒ StackResourceCollection
Returns a stack resource collection that enumerates all resources for this stack.
- #update(options = {}) ⇒ nil
Instance Attribute Details
#capabilities ⇒ Array<String> (readonly)
The capabilities allowed in the stack.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def capabilities @capabilities end |
#creation_time ⇒ Object (readonly)
returned by DescribeStacks
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def creation_time @creation_time end |
#description ⇒ String (readonly)
User defined description associated with the stack.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def description @description end |
#disable_rollback ⇒ Boolean (readonly) Also known as: disable_rollback?
Specifies if the stack is rolled back due to stack creation errors.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def disable_rollback @disable_rollback end |
#last_updated_time ⇒ Time? (readonly)
The time the stack was last updated.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def last_updated_time @last_updated_time end |
#name ⇒ String (readonly)
Returns the stack name.
61 62 63 |
# File 'lib/aws/cloud_formation/stack.rb', line 61 def name @name end |
#notification_arns ⇒ Array<String> (readonly)
SNS topic ARNs to which stack related events are published.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def notification_arns @notification_arns end |
#parameters ⇒ Hash (readonly)
Returns a hash of stack parameters.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def parameters @parameters end |
#stack_id ⇒ String (readonly)
Unique stack identifier.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def stack_id @stack_id end |
#status ⇒ Symbol (readonly)
The status of the stack.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def status @status end |
#status_reason ⇒ String (readonly)
Success/Failure message associated with the status
.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def status_reason @status_reason end |
#template ⇒ Object (readonly) Also known as: template_body
returned by GetTemplate
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def template @template end |
#timeout ⇒ Integer (readonly) Also known as: timeout_in_minutes
The number of minutes within the stack creation should complete.
50 51 52 |
# File 'lib/aws/cloud_formation/stack.rb', line 50 def timeout @timeout end |
Instance Method Details
#delete ⇒ nil
Deletes the current stack.
225 226 227 228 |
# File 'lib/aws/cloud_formation/stack.rb', line 225 def delete client.delete_stack(:stack_name => name) nil end |
#describe_stacks ⇒ Object
attribute providers
113 114 115 116 117 118 |
# File 'lib/aws/cloud_formation/stack.rb', line 113 provider(:describe_stacks) do |provider| provider.find do |resp| resp.data[:stacks].find{|stack| stack[:stack_name] == name } end provider.provides *describe_attributes.keys end |
#estimate_template_cost ⇒ String
Returns a URL to the AWS Simple Monthly Calculator with a query string that describes the resources required to run the template.
218 219 220 221 |
# File 'lib/aws/cloud_formation/stack.rb', line 218 def estimate_template_cost cloud_formation = CloudFormation.new(:config => config) cloud_formation.estimate_template_cost(template, parameters) end |
#events ⇒ StackEventCollection
Returns a collection that represents all events for this stack.
137 138 139 |
# File 'lib/aws/cloud_formation/stack.rb', line 137 def events StackEventCollection.new(self) end |
#exists? ⇒ Boolean
231 232 233 234 235 236 237 238 |
# File 'lib/aws/cloud_formation/stack.rb', line 231 def exists? begin client.describe_stacks() true rescue Errors::ValidationError false end end |
#outputs ⇒ Array<StackOutput>
128 129 130 131 132 133 |
# File 'lib/aws/cloud_formation/stack.rb', line 128 def outputs output_details.collect do |o| key, value, desc = o.values_at(:output_key, :output_value, :description) StackOutput.new(self, key, value, desc) end end |
#resource_summaries ⇒ StackResourceSummaryCollection
Returns a stack resource summary collection, that when enumerated yields summary hashes. Each hash has the following keys:
-
:last_updated_timestamp
-
:logical_resource_id
-
:physical_resource_id
-
:resource_status
-
:resource_status_reason
-
:resource_type
171 172 173 |
# File 'lib/aws/cloud_formation/stack.rb', line 171 def resource_summaries StackResourceSummaryCollection.new(self) end |
#resources ⇒ StackResourceCollection
Returns a stack resource collection that enumerates all resources for this stack.
stack.resources.each do |resource|
puts "#{resource.resource_type}: #{resource.physical_resource_id}"
end
If you want a specific resource and you know its logical resource id, you can use this collection to return a reference to it.
resource = stack.resources['logical-resource-id']
155 156 157 |
# File 'lib/aws/cloud_formation/stack.rb', line 155 def resources StackResourceCollection.new(self) end |
#update(options = {}) ⇒ nil
204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/aws/cloud_formation/stack.rb', line 204 def update = {} client_opts = .dup apply_stack_name(name, client_opts) apply_template(client_opts) apply_parameters(client_opts) client.update_stack(client_opts) nil end |