Class: Aws::CloudFormation::Resource
- Inherits:
-
Object
- Object
- Aws::CloudFormation::Resource
- Defined in:
- lib/aws-sdk-cloudformation/resource.rb
Overview
This class provides a resource oriented interface for CloudFormation. To create a resource object:
resource = Aws::CloudFormation::Resource.new(region: 'us-west-2')
You can supply a client object with custom configuration that will be used for all resource operations. If you do not pass ‘:client`, a default client will be constructed.
client = Aws::CloudFormation::Client.new(region: 'us-west-2')
resource = Aws::CloudFormation::Resource.new(client: client)
Actions collapse
Associations collapse
Instance Method Summary collapse
- #client ⇒ Client
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
Instance Method Details
#client ⇒ Client
32 33 34 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 32 def client @client end |
#create_stack(options = {}) ⇒ Stack
338 339 340 341 342 343 344 345 346 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 338 def create_stack( = {}) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_stack() end Stack.new( name: [:stack_name], client: @client ) end |
#event(id) ⇒ Event
352 353 354 355 356 357 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 352 def event(id) Event.new( id: id, client: @client ) end |
#stack(name) ⇒ Stack
361 362 363 364 365 366 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 361 def stack(name) Stack.new( name: name, client: @client ) end |
#stacks(options = {}) ⇒ Stack::Collection
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 404 def stacks( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_stacks() end resp.each_page do |page| batch = [] page.data.stacks.each do |s| batch << Stack.new( name: s.stack_name, data: s, client: @client ) end y.yield(batch) end end Stack::Collection.new(batches) end |