Class: Aws::OpsWorks::Resource
- Inherits:
-
Object
- Object
- Aws::OpsWorks::Resource
- Defined in:
- gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/resource.rb
Overview
This class provides a resource oriented interface for OpsWorks. To create a resource object:
resource = Aws::OpsWorks::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::OpsWorks::Client.new(region: 'us-west-2')
resource = Aws::OpsWorks::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-opsworks/lib/aws-sdk-opsworks/resource.rb', line 32 def client @client end |
#create_stack(options = {}) ⇒ Stack
357 358 359 360 361 362 363 364 365 |
# File 'gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/resource.rb', line 357 def create_stack( = {}) resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_stack() end Stack.new( id: resp.data.stack_id, client: @client ) end |
#layer(id) ⇒ Layer
371 372 373 374 375 376 |
# File 'gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/resource.rb', line 371 def layer(id) Layer.new( id: id, client: @client ) end |
#stack(id) ⇒ Stack
380 381 382 383 384 385 |
# File 'gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/resource.rb', line 380 def stack(id) Stack.new( id: id, client: @client ) end |
#stacks(options = {}) ⇒ Stack::Collection
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'gems/aws-sdk-opsworks/lib/aws-sdk-opsworks/resource.rb', line 402 def stacks( = {}) batches = Enumerator.new do |y| batch = [] resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_stacks() end resp.data.stacks.each do |s| batch << Stack.new( id: s.stack_id, data: s, client: @client ) end y.yield(batch) end Stack::Collection.new(batches) end |