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.
451 452 453 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 451 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.
1341 1342 1343 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1341 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.
1344 1345 1346 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1344 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.
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1201 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.32.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.
499 500 501 502 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 499 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
626 627 628 629 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 626 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
746 747 748 749 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 746 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
833 834 835 836 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 833 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
886 887 888 889 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 886 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.
960 961 962 963 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 960 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.
1049 1050 1051 1052 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1049 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
1192 1193 1194 1195 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1192 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 |
1307 1308 1309 1310 1311 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1307 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.
1315 1316 1317 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1315 def waiter_names waiters.keys end |