Class: Aws::CloudControlApi::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::CloudControlApi::Client
- Includes:
- Aws::ClientStubs
- Defined in:
- lib/aws-sdk-cloudcontrolapi/client.rb
Overview
An API client for CloudControlApi. To construct a client, you need to configure a ‘:region` and `:credentials`.
client = Aws::CloudControlApi::Client.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
See #initialize for a full list of supported configuration options.
Class Attribute Summary collapse
- .identifier ⇒ Object readonly private
API Operations collapse
-
#cancel_resource_request(params = {}) ⇒ Types::CancelResourceRequestOutput
Cancels the specified resource operation request.
-
#create_resource(params = {}) ⇒ Types::CreateResourceOutput
Creates the specified resource.
-
#delete_resource(params = {}) ⇒ Types::DeleteResourceOutput
Deletes the specified resource.
-
#get_resource(params = {}) ⇒ Types::GetResourceOutput
Returns information about the current state of the specified resource.
-
#get_resource_request_status(params = {}) ⇒ Types::GetResourceRequestStatusOutput
Returns the current status of a resource operation request.
-
#list_resource_requests(params = {}) ⇒ Types::ListResourceRequestsOutput
Returns existing resource operation requests.
-
#list_resources(params = {}) ⇒ Types::ListResourcesOutput
Returns information about the specified resources.
-
#update_resource(params = {}) ⇒ Types::UpdateResourceOutput
Updates the specified property values in the resource.
Class Method Summary collapse
- .errors_module ⇒ Object private
Instance Method Summary collapse
- #build_request(operation_name, params = {}) ⇒ Object private
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
-
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
- #waiter_names ⇒ Object deprecated private Deprecated.
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
474 475 476 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 474 def initialize(*args) super end |
Class Attribute Details
.identifier ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1380 1381 1382 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1380 def identifier @identifier end |
Class Method Details
.errors_module ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1383 1384 1385 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1383 def errors_module Errors end |
Instance Method Details
#build_request(operation_name, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1240 def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) tracer = config.telemetry_provider.tracer_provider.tracer( Aws::Telemetry.module_to_tracer_name('Aws::CloudControlApi') ) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config, tracer: tracer ) context[:gem_name] = 'aws-sdk-cloudcontrolapi' context[:gem_version] = '1.35.0' Seahorse::Client::Request.new(handlers, context) end |
#cancel_resource_request(params = {}) ⇒ Types::CancelResourceRequestOutput
Cancels the specified resource operation request. For more information, see [Canceling resource operation requests] in the *Amazon Web Services Cloud Control API User Guide*.
Only resource operations requests with a status of ‘PENDING` or `IN_PROGRESS` can be canceled.
523 524 525 526 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 523 def cancel_resource_request(params = {}, = {}) req = build_request(:cancel_resource_request, params) req.send_request() end |
#create_resource(params = {}) ⇒ Types::CreateResourceOutput
Creates the specified resource. For more information, see [Creating a resource] in the *Amazon Web Services Cloud Control API User Guide*.
After you have initiated a resource creation request, you can monitor the progress of your request by calling [GetResourceRequestStatus] using the ‘RequestToken` of the `ProgressEvent` type returned by `CreateResource`.
[1]: docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-create.html [2]: docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html
651 652 653 654 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 651 def create_resource(params = {}, = {}) req = build_request(:create_resource, params) req.send_request() end |
#delete_resource(params = {}) ⇒ Types::DeleteResourceOutput
Deletes the specified resource. For details, see [Deleting a resource] in the *Amazon Web Services Cloud Control API User Guide*.
After you have initiated a resource deletion request, you can monitor the progress of your request by calling [GetResourceRequestStatus] using the ‘RequestToken` of the `ProgressEvent` returned by `DeleteResource`.
[1]: docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-delete.html [2]: docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html
772 773 774 775 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 772 def delete_resource(params = {}, = {}) req = build_request(:delete_resource, params) req.send_request() end |
#get_resource(params = {}) ⇒ Types::GetResourceOutput
Returns information about the current state of the specified resource. For details, see [Reading a resource’s current state].
You can use this action to return information about an existing resource in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.
[1]: docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-read.html
859 860 861 862 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 859 def get_resource(params = {}, = {}) req = build_request(:get_resource, params) req.send_request() end |
#get_resource_request_status(params = {}) ⇒ Types::GetResourceRequestStatusOutput
Returns the current status of a resource operation request. For more information, see [Tracking the progress of resource operation requests] in the *Amazon Web Services Cloud Control API User Guide*.
The following waiters are defined for this operation (see #wait_until for detailed usage):
* resource_request_success
923 924 925 926 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 923 def get_resource_request_status(params = {}, = {}) req = build_request(:get_resource_request_status, params) req.send_request() end |
#list_resource_requests(params = {}) ⇒ Types::ListResourceRequestsOutput
Returns existing resource operation requests. This includes requests of all status types. For more information, see [Listing active resource operation requests] in the *Amazon Web Services Cloud Control API User Guide*.
<note markdown=“1”> Resource operation requests expire after 7 days.
</note>
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
998 999 1000 1001 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 998 def list_resource_requests(params = {}, = {}) req = build_request(:list_resource_requests, params) req.send_request() end |
#list_resources(params = {}) ⇒ Types::ListResourcesOutput
Returns information about the specified resources. For more information, see [Discovering resources] in the *Amazon Web Services Cloud Control API User Guide*.
You can use this action to return information about existing resources in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.
[1]: docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-list.html
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1087 1088 1089 1090 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1087 def list_resources(params = {}, = {}) req = build_request(:list_resources, params) req.send_request() end |
#update_resource(params = {}) ⇒ Types::UpdateResourceOutput
Updates the specified property values in the resource.
You specify your resource property updates as a list of patch operations contained in a JSON patch document that adheres to the [ *RFC 6902 - JavaScript Object Notation (JSON) Patch* ][1] standard.
For details on how Cloud Control API performs resource update operations, see [Updating a resource] in the *Amazon Web Services Cloud Control API User Guide*.
After you have initiated a resource update request, you can monitor the progress of your request by calling [GetResourceRequestStatus] using the ‘RequestToken` of the `ProgressEvent` returned by `UpdateResource`.
For more information about the properties of a specific resource, refer to the related topic for the resource in the [Resource and property types reference] in the *CloudFormation Users Guide*.
[1]: datatracker.ietf.org/doc/html/rfc6902 [2]: docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-update.html [3]: docs.aws.amazon.com/cloudcontrolapi/latest/APIReference/API_GetResourceRequestStatus.html [4]: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
1231 1232 1233 1234 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1231 def update_resource(params = {}, = {}) req = build_request(:update_resource, params) req.send_request() end |
#wait_until(waiter_name, params = {}, options = {}) {|w.waiter| ... } ⇒ Boolean
Polls an API operation until a resource enters a desired state.
## Basic Usage
A waiter will call an API operation until:
-
It is successful
-
It enters a terminal state
-
It makes the maximum number of attempts
In between attempts, the waiter will sleep.
# polls in a loop, sleeping between attempts
client.wait_until(waiter_name, params)
## Configuration
You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You can pass configuration as the final arguments hash.
# poll for ~25 seconds
client.wait_until(waiter_name, params, {
max_attempts: 5,
delay: 5,
})
## Callbacks
You can be notified before each polling attempt and before each delay. If you throw ‘:success` or `:failure` from these callbacks, it will terminate the waiter.
started_at = Time.now
client.wait_until(waiter_name, params, {
# disable max attempts
max_attempts: nil,
# poll for 1 hour, instead of a number of attempts
before_wait: -> (attempts, response) do
throw :failure if Time.now - started_at > 3600
end
})
## Handling Errors
When a waiter is unsuccessful, it will raise an error. All of the failure errors extend from Waiters::Errors::WaiterFailed.
begin
client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
# resource did not enter the desired state in time
end
## Valid Waiters
The following table lists the valid waiter names, the operations they call, and the default ‘:delay` and `:max_attempts` values.
| waiter_name | params | :delay | :max_attempts | | ———————— | ———————————— | ——– | ————- | | resource_request_success | #get_resource_request_status | 5 | 24 |
1346 1347 1348 1349 1350 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1346 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |
#waiter_names ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1354 1355 1356 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1354 def waiter_names waiters.keys end |