Class: Aws::DSQL::Client
- Inherits:
-
Seahorse::Client::Base
- Object
- Seahorse::Client::Base
- Aws::DSQL::Client
- Includes:
- ClientStubs
- Defined in:
- gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb
Overview
An API client for DSQL. To construct a client, you need to configure a :region and :credentials.
client = Aws::DSQL::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
-
#create_cluster(params = {}) ⇒ Types::CreateClusterOutput
The CreateCluster API allows you to create both single-Region clusters and multi-Region clusters.
-
#create_stream(params = {}) ⇒ Types::CreateStreamOutput
Creates a new change data capture (CDC) stream for a cluster.
-
#delete_cluster(params = {}) ⇒ Types::DeleteClusterOutput
Deletes a cluster in Amazon Aurora DSQL.
-
#delete_cluster_policy(params = {}) ⇒ Types::DeleteClusterPolicyOutput
Deletes the resource-based policy attached to a cluster.
-
#delete_stream(params = {}) ⇒ Types::DeleteStreamOutput
Deletes a stream from a cluster.
-
#get_cluster(params = {}) ⇒ Types::GetClusterOutput
Retrieves information about a cluster.
-
#get_cluster_policy(params = {}) ⇒ Types::GetClusterPolicyOutput
Retrieves the resource-based policy document attached to a cluster.
-
#get_stream(params = {}) ⇒ Types::GetStreamOutput
Retrieves information about a stream.
-
#get_vpc_endpoint_service_name(params = {}) ⇒ Types::GetVpcEndpointServiceNameOutput
Retrieves the VPC endpoint service name.
-
#list_clusters(params = {}) ⇒ Types::ListClustersOutput
Retrieves information about a list of clusters.
-
#list_streams(params = {}) ⇒ Types::ListStreamsOutput
Retrieves information about a list of streams for a cluster.
-
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceOutput
Lists all of the tags for a resource.
-
#put_cluster_policy(params = {}) ⇒ Types::PutClusterPolicyOutput
Attaches a resource-based policy to a cluster.
-
#tag_resource(params = {}) ⇒ Struct
Tags a resource with a map of key and value pairs.
-
#untag_resource(params = {}) ⇒ Struct
Removes a tag from a resource.
-
#update_cluster(params = {}) ⇒ Types::UpdateClusterOutput
The UpdateCluster API allows you to modify both single-Region and multi-Region cluster configurations.
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 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.
471 472 473 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 471 def initialize(*args) super end |
Instance Method Details
#create_cluster(params = {}) ⇒ Types::CreateClusterOutput
The CreateCluster API allows you to create both single-Region clusters and multi-Region clusters. With the addition of the multiRegionProperties parameter, you can create a cluster with witness Region support and establish peer relationships with clusters in other Regions during creation.
Required permissions
- dsql:CreateCluster
Required to create a cluster.
Resources:
arn:aws:dsql:region:account-id:cluster/*- dsql:TagResource
Permission to add tags to a resource.
Resources:
arn:aws:dsql:region:account-id:cluster/*- dsql:PutMultiRegionProperties
Permission to configure multi-Region properties for a cluster.
Resources:
arn:aws:dsql:region:account-id:cluster/*- dsql:AddPeerCluster
When specifying
multiRegionProperties.clusters, permission to add peer clusters.Resources:
Local cluster:
arn:aws:dsql:region:account-id:cluster/*Each peer cluster: exact ARN of each specified peer cluster
- dsql:PutWitnessRegion
When specifying
multiRegionProperties.witnessRegion, permission to set a witness Region. This permission is checked both in the cluster Region and in the witness Region.Resources:
arn:aws:dsql:region:account-id:cluster/*Condition Keys:
dsql:WitnessRegion(matching the specified witness region)
- The witness Region specified in
multiRegionProperties.witnessRegioncannot be the same as the cluster's Region.
^
633 634 635 636 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 633 def create_cluster(params = {}, = {}) req = build_request(:create_cluster, params) req.send_request() end |
#create_stream(params = {}) ⇒ Types::CreateStreamOutput
Creates a new change data capture (CDC) stream for a cluster. The stream captures database changes and delivers them to the specified target destination.
Required permissions
- dsql:CreateStream
Permission to create a new stream.
Resources:
arn:aws:dsql:region:account-id:cluster/cluster-id- iam:PassRole
Permission to pass the IAM role specified in the target definition to the service.
Resources: ARN of the IAM role specified in
targetDefinition.kinesis.roleArn- kms:Decrypt
Required when the cluster uses a customer managed KMS key (CMK). Permission to decrypt data using the cluster's CMK.
Resources: ARN of the KMS key used by the cluster
738 739 740 741 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 738 def create_stream(params = {}, = {}) req = build_request(:create_stream, params) req.send_request() end |
#delete_cluster(params = {}) ⇒ Types::DeleteClusterOutput
Deletes a cluster in Amazon Aurora DSQL.
794 795 796 797 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 794 def delete_cluster(params = {}, = {}) req = build_request(:delete_cluster, params) req.send_request() end |
#delete_cluster_policy(params = {}) ⇒ Types::DeleteClusterPolicyOutput
Deletes the resource-based policy attached to a cluster. This removes all access permissions defined by the policy, reverting to default access controls.
837 838 839 840 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 837 def delete_cluster_policy(params = {}, = {}) req = build_request(:delete_cluster_policy, params) req.send_request() end |
#delete_stream(params = {}) ⇒ Types::DeleteStreamOutput
Deletes a stream from a cluster.
892 893 894 895 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 892 def delete_stream(params = {}, = {}) req = build_request(:delete_stream, params) req.send_request() end |
#get_cluster(params = {}) ⇒ Types::GetClusterOutput
Retrieves information about a cluster.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- cluster_active
- cluster_not_exists
954 955 956 957 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 954 def get_cluster(params = {}, = {}) req = build_request(:get_cluster, params) req.send_request() end |
#get_cluster_policy(params = {}) ⇒ Types::GetClusterPolicyOutput
Retrieves the resource-based policy document attached to a cluster. This policy defines the access permissions and conditions for the cluster.
986 987 988 989 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 986 def get_cluster_policy(params = {}, = {}) req = build_request(:get_cluster_policy, params) req.send_request() end |
#get_stream(params = {}) ⇒ Types::GetStreamOutput
Retrieves information about a stream.
The following waiters are defined for this operation (see #wait_until for detailed usage):
- stream_active
- stream_not_exists
1045 1046 1047 1048 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1045 def get_stream(params = {}, = {}) req = build_request(:get_stream, params) req.send_request() end |
#get_vpc_endpoint_service_name(params = {}) ⇒ Types::GetVpcEndpointServiceNameOutput
Retrieves the VPC endpoint service name.
1082 1083 1084 1085 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1082 def get_vpc_endpoint_service_name(params = {}, = {}) req = build_request(:get_vpc_endpoint_service_name, params) req.send_request() end |
#list_clusters(params = {}) ⇒ Types::ListClustersOutput
Retrieves information about a list of clusters.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1130 1131 1132 1133 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1130 def list_clusters(params = {}, = {}) req = build_request(:list_clusters, params) req.send_request() end |
#list_streams(params = {}) ⇒ Types::ListStreamsOutput
Retrieves information about a list of streams for a cluster.
The returned response is a pageable response and is Enumerable. For details on usage see PageableResponse.
1179 1180 1181 1182 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1179 def list_streams(params = {}, = {}) req = build_request(:list_streams, params) req.send_request() end |
#list_tags_for_resource(params = {}) ⇒ Types::ListTagsForResourceOutput
Lists all of the tags for a resource.
1215 1216 1217 1218 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1215 def (params = {}, = {}) req = build_request(:list_tags_for_resource, params) req.send_request() end |
#put_cluster_policy(params = {}) ⇒ Types::PutClusterPolicyOutput
Attaches a resource-based policy to a cluster. This policy defines access permissions and conditions for the cluster, allowing you to control which principals can perform actions on the cluster.
1270 1271 1272 1273 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1270 def put_cluster_policy(params = {}, = {}) req = build_request(:put_cluster_policy, params) req.send_request() end |
#tag_resource(params = {}) ⇒ Struct
Tags a resource with a map of key and value pairs.
1308 1309 1310 1311 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1308 def tag_resource(params = {}, = {}) req = build_request(:tag_resource, params) req.send_request() end |
#untag_resource(params = {}) ⇒ Struct
Removes a tag from a resource.
1345 1346 1347 1348 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1345 def untag_resource(params = {}, = {}) req = build_request(:untag_resource, params) req.send_request() end |
#update_cluster(params = {}) ⇒ Types::UpdateClusterOutput
The UpdateCluster API allows you to modify both single-Region and multi-Region cluster configurations. With the multiRegionProperties parameter, you can add or modify witness Region support and manage peer relationships with clusters in other Regions.
Required permissions
- dsql:UpdateCluster
Permission to update a DSQL cluster.
Resources:
arn:aws:dsql:region:account-id:cluster/cluster-id^- dsql:PutMultiRegionProperties
Permission to configure multi-Region properties for a cluster.
Resources:
arn:aws:dsql:region:account-id:cluster/cluster-id^- dsql:GetCluster
Permission to retrieve cluster information.
Resources:
arn:aws:dsql:region:account-id:cluster/cluster-id- dsql:AddPeerCluster
Permission to add peer clusters.
Resources:
Local cluster:
arn:aws:dsql:region:account-id:cluster/cluster-idEach peer cluster: exact ARN of each specified peer cluster
- dsql:RemovePeerCluster
Permission to remove peer clusters. The dsql:RemovePeerCluster permission uses a wildcard ARN pattern to simplify permission management during updates.
Resources:
arn:aws:dsql:*:account-id:cluster/*^- dsql:PutWitnessRegion
Permission to set a witness Region.
Resources:
arn:aws:dsql:region:account-id:cluster/cluster-idCondition Keys: dsql:WitnessRegion (matching the specified witness Region)
This permission is checked both in the cluster Region and in the witness Region.
The witness region specified in
multiRegionProperties.witnessRegioncannot be the same as the cluster's Region.When updating clusters with peer relationships, permissions are checked for both adding and removing peers.
The
dsql:RemovePeerClusterpermission uses a wildcard ARN pattern to simplify permission management during updates.
1493 1494 1495 1496 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1493 def update_cluster(params = {}, = {}) req = build_request(:update_cluster, 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 |
|---|---|---|---|
| cluster_active | #get_cluster | 2 | 60 |
| cluster_not_exists | #get_cluster | 2 | 60 |
| stream_active | #get_stream | 2 | 60 |
| stream_not_exists | #get_stream | 2 | 60 |
1611 1612 1613 1614 1615 |
# File 'gems/aws-sdk-dsql/lib/aws-sdk-dsql/client.rb', line 1611 def wait_until(waiter_name, params = {}, = {}) w = waiter(waiter_name, ) yield(w.waiter) if block_given? # deprecated w.wait(params) end |