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
#initialize(options = {}) ⇒ Resource
Returns a new instance of Resource.
27 28 29 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 27 def initialize( = {}) @client = [:client] || Client.new() end |
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
332 333 334 335 336 337 338 339 340 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 332 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
346 347 348 349 350 351 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 346 def event(id) Event.new( id: id, client: @client ) end |
#stack(name) ⇒ Stack
355 356 357 358 359 360 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 355 def stack(name) Stack.new( name: name, client: @client ) end |
#stacks(options = {}) ⇒ Stack::Collection
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/aws-sdk-cloudformation/resource.rb', line 395 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 |