Class: Aws::CloudControlApi::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::CloudControlApi::Client
- Includes:
- Aws::ClientStubs
- Defined in:
- gems/aws-sdk-cloudcontrolapi/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.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::Base
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.
Instance Method Summary collapse
-
#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.
Methods included from Aws::ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
483 484 485 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 483 def initialize(*args) super end |
Instance Method Details
#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.
532 533 534 535 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 532 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
.
660 661 662 663 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 660 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
.
781 782 783 784 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 781 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.
868 869 870 871 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 868 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
932 933 934 935 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 932 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.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1007 1008 1009 1010 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 1007 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.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1096 1097 1098 1099 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 1096 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 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.
1240 1241 1242 1243 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 1240 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 |
1355 1356 1357 1358 1359 |
# File 'gems/aws-sdk-cloudcontrolapi/lib/aws-sdk-cloudcontrolapi/client.rb', line 1355 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |