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.
1357 1358 1359 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1357 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.
1360 1361 1362 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1360 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.
1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1217 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.34.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.
500 501 502 503 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 500 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
628 629 630 631 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 628 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
749 750 751 752 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 749 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
836 837 838 839 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 836 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
900 901 902 903 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 900 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.
975 976 977 978 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 975 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.
1064 1065 1066 1067 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1064 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
1208 1209 1210 1211 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1208 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 |
1323 1324 1325 1326 1327 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1323 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.
1331 1332 1333 |
# File 'lib/aws-sdk-cloudcontrolapi/client.rb', line 1331 def waiter_names waiters.keys end |