Class: Aws::CloudFormation::Resource
- Inherits:
-
Object
- Object
- Aws::CloudFormation::Resource
- Defined in:
- gems/aws-sdk-cloudformation/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 'gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/resource.rb', line 32 def client @client end |
#create_stack(options = {}) ⇒ Stack
325 326 327 328 329 330 331 332 333 |
# File 'gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/resource.rb', line 325 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
339 340 341 342 343 344 |
# File 'gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/resource.rb', line 339 def event(id) Event.new( id: id, client: @client ) end |
#stack(name) ⇒ Stack
348 349 350 351 352 353 |
# File 'gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/resource.rb', line 348 def stack(name) Stack.new( name: name, client: @client ) end |
#stacks(options = {}) ⇒ Stack::Collection
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'gems/aws-sdk-cloudformation/lib/aws-sdk-cloudformation/resource.rb', line 390 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 |