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.
480 481 482 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 480 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.
1386 1387 1388 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1386 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.
1389 1390 1391 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1389 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.
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1246 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.48.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.
529 530 531 532 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 529 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
657 658 659 660 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 657 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
778 779 780 781 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 778 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
865 866 867 868 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 865 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
929 930 931 932 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 929 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.
1004 1005 1006 1007 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1004 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.
1093 1094 1095 1096 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1093 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
1237 1238 1239 1240 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1237 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 |
1352 1353 1354 1355 1356 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1352 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.
1360 1361 1362 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1360 def waiter_names waiters.keys end |