Struct aws_sdk_keyspaces::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for Amazon Keyspaces
Client for invoking operations on Amazon Keyspaces. Each operation on Amazon Keyspaces is a method on this
this struct. .send()
MUST be invoked on the generated operations to dispatch the request to the service.
Constructing a Client
A Config
is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env()
, since this will resolve an SdkConfig
which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env()
instead, which returns a ConfigLoader
that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_keyspaces::Client::new(&config);
Occasionally, SDKs may have additional service-specific that can be set on the Config
that
is absent from SdkConfig
, or slightly different settings for a specific client may be desired.
The Config
struct implements From<&SdkConfig>
, so setting these specific settings can be
done as follows:
let sdk_config = aws_config::load_from_env().await;
let config = aws_sdk_keyspaces::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();
See the aws-config
docs and Config
for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CreateKeyspace
operation has
a Client::create_keyspace
, function which returns a builder for that operation.
The fluent builder ultimately has a send()
function that returns an async future that
returns a result, as illustrated below:
let result = client.create_keyspace()
.keyspace_name("example")
.send()
.await;
The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize
module for more
information.
Implementations§
source§impl Client
impl Client
sourcepub fn create_keyspace(&self) -> CreateKeyspaceFluentBuilder
pub fn create_keyspace(&self) -> CreateKeyspaceFluentBuilder
Constructs a fluent builder for the CreateKeyspace
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace to be created.
tags(Vec<Tag>)
/set_tags(Option<Vec<Tag>>)
:A list of key-value pair tags to be attached to the keyspace.
For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
- On success, responds with
CreateKeyspaceOutput
with field(s):resource_arn(Option<String>)
:The unique identifier of the keyspace in the format of an Amazon Resource Name (ARN).
- On failure, responds with
SdkError<CreateKeyspaceError>
source§impl Client
impl Client
sourcepub fn create_table(&self) -> CreateTableFluentBuilder
pub fn create_table(&self) -> CreateTableFluentBuilder
Constructs a fluent builder for the CreateTable
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace that the table is going to be created in.
table_name(impl Into<String>)
/set_table_name(Option<String>)
:The name of the table.
schema_definition(SchemaDefinition)
/set_schema_definition(Option<SchemaDefinition>)
:The
schemaDefinition
consists of the following parameters.For each column to be created:
-
name
- The name of the column. -
type
- An Amazon Keyspaces data type. For more information, see Data types in the Amazon Keyspaces Developer Guide.
The primary key of the table consists of the following columns:
-
partitionKeys
- The partition key can be a single column, or it can be a compound value composed of two or more columns. The partition key portion of the primary key is required and determines how Amazon Keyspaces stores your data. -
name
- The name of each partition key column. -
clusteringKeys
- The optional clustering column portion of your primary key determines how the data is clustered and sorted within each partition. -
name
- The name of the clustering column. -
orderBy
- Sets the ascendant (ASC
) or descendant (DESC
) order modifier.To define a column as static use
staticColumns
- Static columns store values that are shared by all rows in the same partition: -
name
- The name of the column. -
type
- An Amazon Keyspaces data type.
-
comment(Comment)
/set_comment(Option<Comment>)
:This parameter allows to enter a description of the table.
capacity_specification(CapacitySpecification)
/set_capacity_specification(Option<CapacitySpecification>)
:Specifies the read/write throughput capacity mode for the table. The options are:
-
throughputMode:PAY_PER_REQUEST
and -
throughputMode:PROVISIONED
- Provisioned capacity mode requiresreadCapacityUnits
andwriteCapacityUnits
as input.
The default is
throughput_mode:PAY_PER_REQUEST
.For more information, see Read/write capacity modes in the Amazon Keyspaces Developer Guide.
-
encryption_specification(EncryptionSpecification)
/set_encryption_specification(Option<EncryptionSpecification>)
:Specifies how the encryption key for encryption at rest is managed for the table. You can choose one of the following KMS key (KMS key):
-
type:AWS_OWNED_KMS_KEY
- This key is owned by Amazon Keyspaces. -
type:CUSTOMER_MANAGED_KMS_KEY
- This key is stored in your account and is created, owned, and managed by you. This option requires thekms_key_identifier
of the KMS key in Amazon Resource Name (ARN) format as input.
The default is
type:AWS_OWNED_KMS_KEY
.For more information, see Encryption at rest in the Amazon Keyspaces Developer Guide.
-
point_in_time_recovery(PointInTimeRecovery)
/set_point_in_time_recovery(Option<PointInTimeRecovery>)
:Specifies if
pointInTimeRecovery
is enabled or disabled for the table. The options are:-
status=ENABLED
-
status=DISABLED
If it’s not specified, the default is
status=DISABLED
.For more information, see Point-in-time recovery in the Amazon Keyspaces Developer Guide.
-
ttl(TimeToLive)
/set_ttl(Option<TimeToLive>)
:Enables Time to Live custom settings for the table. The options are:
-
status:enabled
-
status:disabled
The default is
status:disabled
. Afterttl
is enabled, you can’t disable it for the table.For more information, see Expiring data by using Amazon Keyspaces Time to Live (TTL) in the Amazon Keyspaces Developer Guide.
-
default_time_to_live(i32)
/set_default_time_to_live(Option<i32>)
:The default Time to Live setting in seconds for the table.
For more information, see Setting the default TTL value for a table in the Amazon Keyspaces Developer Guide.
tags(Vec<Tag>)
/set_tags(Option<Vec<Tag>>)
:A list of key-value pair tags to be attached to the resource.
For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
client_side_timestamps(ClientSideTimestamps)
/set_client_side_timestamps(Option<ClientSideTimestamps>)
:Enables client-side timestamps for the table. By default, the setting is disabled. You can enable client-side timestamps with the following option:
-
status: “enabled”
Once client-side timestamps are enabled for a table, this setting cannot be disabled.
-
- On success, responds with
CreateTableOutput
with field(s):resource_arn(Option<String>)
:The unique identifier of the table in the format of an Amazon Resource Name (ARN).
- On failure, responds with
SdkError<CreateTableError>
source§impl Client
impl Client
sourcepub fn delete_keyspace(&self) -> DeleteKeyspaceFluentBuilder
pub fn delete_keyspace(&self) -> DeleteKeyspaceFluentBuilder
Constructs a fluent builder for the DeleteKeyspace
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace to be deleted.
- On success, responds with
DeleteKeyspaceOutput
- On failure, responds with
SdkError<DeleteKeyspaceError>
source§impl Client
impl Client
sourcepub fn delete_table(&self) -> DeleteTableFluentBuilder
pub fn delete_table(&self) -> DeleteTableFluentBuilder
Constructs a fluent builder for the DeleteTable
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace of the to be deleted table.
table_name(impl Into<String>)
/set_table_name(Option<String>)
:The name of the table to be deleted.
- On success, responds with
DeleteTableOutput
- On failure, responds with
SdkError<DeleteTableError>
source§impl Client
impl Client
sourcepub fn get_keyspace(&self) -> GetKeyspaceFluentBuilder
pub fn get_keyspace(&self) -> GetKeyspaceFluentBuilder
Constructs a fluent builder for the GetKeyspace
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace.
- On success, responds with
GetKeyspaceOutput
with field(s):keyspace_name(Option<String>)
:The name of the keyspace.
resource_arn(Option<String>)
:The ARN of the keyspace.
- On failure, responds with
SdkError<GetKeyspaceError>
source§impl Client
impl Client
sourcepub fn get_table(&self) -> GetTableFluentBuilder
pub fn get_table(&self) -> GetTableFluentBuilder
Constructs a fluent builder for the GetTable
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace that the table is stored in.
table_name(impl Into<String>)
/set_table_name(Option<String>)
:The name of the table.
- On success, responds with
GetTableOutput
with field(s):keyspace_name(Option<String>)
:The name of the keyspace that the specified table is stored in.
table_name(Option<String>)
:The name of the specified table.
resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the specified table.
creation_timestamp(Option<DateTime>)
:The creation timestamp of the specified table.
status(Option<TableStatus>)
:The current status of the specified table.
schema_definition(Option<SchemaDefinition>)
:The schema definition of the specified table.
capacity_specification(Option<CapacitySpecificationSummary>)
:The read/write throughput capacity mode for a table. The options are:
-
throughputMode:PAY_PER_REQUEST
-
throughputMode:PROVISIONED
-
encryption_specification(Option<EncryptionSpecification>)
:The encryption settings of the specified table.
point_in_time_recovery(Option<PointInTimeRecoverySummary>)
:The point-in-time recovery status of the specified table.
ttl(Option<TimeToLive>)
:The custom Time to Live settings of the specified table.
default_time_to_live(Option<i32>)
:The default Time to Live settings in seconds of the specified table.
comment(Option<Comment>)
:The the description of the specified table.
client_side_timestamps(Option<ClientSideTimestamps>)
:The client-side timestamps setting of the table.
- On failure, responds with
SdkError<GetTableError>
source§impl Client
impl Client
sourcepub fn list_keyspaces(&self) -> ListKeyspacesFluentBuilder
pub fn list_keyspaces(&self) -> ListKeyspacesFluentBuilder
Constructs a fluent builder for the ListKeyspaces
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:The pagination token. To resume pagination, provide the
NextToken
value as argument of a subsequent API invocation.max_results(i32)
/set_max_results(Option<i32>)
:The total number of keyspaces to return in the output. If the total number of keyspaces available is more than the value specified, a
NextToken
is provided in the output. To resume pagination, provide theNextToken
value as an argument of a subsequent API invocation.
- On success, responds with
ListKeyspacesOutput
with field(s):next_token(Option<String>)
:A token to specify where to start paginating. This is the
NextToken
from a previously truncated response.keyspaces(Option<Vec<KeyspaceSummary>>)
:A list of keyspaces.
- On failure, responds with
SdkError<ListKeyspacesError>
source§impl Client
impl Client
sourcepub fn list_tables(&self) -> ListTablesFluentBuilder
pub fn list_tables(&self) -> ListTablesFluentBuilder
Constructs a fluent builder for the ListTables
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
next_token(impl Into<String>)
/set_next_token(Option<String>)
:The pagination token. To resume pagination, provide the
NextToken
value as an argument of a subsequent API invocation.max_results(i32)
/set_max_results(Option<i32>)
:The total number of tables to return in the output. If the total number of tables available is more than the value specified, a
NextToken
is provided in the output. To resume pagination, provide theNextToken
value as an argument of a subsequent API invocation.keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace.
- On success, responds with
ListTablesOutput
with field(s):next_token(Option<String>)
:A token to specify where to start paginating. This is the
NextToken
from a previously truncated response.tables(Option<Vec<TableSummary>>)
:A list of tables.
- On failure, responds with
SdkError<ListTablesError>
source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the Amazon Keyspaces resource.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:The pagination token. To resume pagination, provide the
NextToken
value as argument of a subsequent API invocation.max_results(i32)
/set_max_results(Option<i32>)
:The total number of tags to return in the output. If the total number of tags available is more than the value specified, a
NextToken
is provided in the output. To resume pagination, provide theNextToken
value as an argument of a subsequent API invocation.
- On success, responds with
ListTagsForResourceOutput
with field(s):next_token(Option<String>)
:A token to specify where to start paginating. This is the
NextToken
from a previously truncated response.tags(Option<Vec<Tag>>)
:A list of tags.
- On failure, responds with
SdkError<ListTagsForResourceError>
source§impl Client
impl Client
sourcepub fn restore_table(&self) -> RestoreTableFluentBuilder
pub fn restore_table(&self) -> RestoreTableFluentBuilder
Constructs a fluent builder for the RestoreTable
operation.
- The fluent builder is configurable:
source_keyspace_name(impl Into<String>)
/set_source_keyspace_name(Option<String>)
:The keyspace name of the source table.
source_table_name(impl Into<String>)
/set_source_table_name(Option<String>)
:The name of the source table.
target_keyspace_name(impl Into<String>)
/set_target_keyspace_name(Option<String>)
:The name of the target keyspace.
target_table_name(impl Into<String>)
/set_target_table_name(Option<String>)
:The name of the target table.
restore_timestamp(DateTime)
/set_restore_timestamp(Option<DateTime>)
:The restore timestamp in ISO 8601 format.
capacity_specification_override(CapacitySpecification)
/set_capacity_specification_override(Option<CapacitySpecification>)
:Specifies the read/write throughput capacity mode for the target table. The options are:
-
throughputMode:PAY_PER_REQUEST
-
throughputMode:PROVISIONED
- Provisioned capacity mode requiresreadCapacityUnits
andwriteCapacityUnits
as input.
The default is
throughput_mode:PAY_PER_REQUEST
.For more information, see Read/write capacity modes in the Amazon Keyspaces Developer Guide.
-
encryption_specification_override(EncryptionSpecification)
/set_encryption_specification_override(Option<EncryptionSpecification>)
:Specifies the encryption settings for the target table. You can choose one of the following KMS key (KMS key):
-
type:AWS_OWNED_KMS_KEY
- This key is owned by Amazon Keyspaces. -
type:CUSTOMER_MANAGED_KMS_KEY
- This key is stored in your account and is created, owned, and managed by you. This option requires thekms_key_identifier
of the KMS key in Amazon Resource Name (ARN) format as input.
The default is
type:AWS_OWNED_KMS_KEY
.For more information, see Encryption at rest in the Amazon Keyspaces Developer Guide.
-
point_in_time_recovery_override(PointInTimeRecovery)
/set_point_in_time_recovery_override(Option<PointInTimeRecovery>)
:Specifies the
pointInTimeRecovery
settings for the target table. The options are:-
status=ENABLED
-
status=DISABLED
If it’s not specified, the default is
status=DISABLED
.For more information, see Point-in-time recovery in the Amazon Keyspaces Developer Guide.
-
tags_override(Vec<Tag>)
/set_tags_override(Option<Vec<Tag>>)
:A list of key-value pair tags to be attached to the restored table.
For more information, see Adding tags and labels to Amazon Keyspaces resources in the Amazon Keyspaces Developer Guide.
- On success, responds with
RestoreTableOutput
with field(s):restored_table_arn(Option<String>)
:The Amazon Resource Name (ARN) of the restored table.
- On failure, responds with
SdkError<RestoreTableError>
source§impl Client
impl Client
sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the Amazon Keyspaces resource to which to add tags.
tags(Vec<Tag>)
/set_tags(Option<Vec<Tag>>)
:The tags to be assigned to the Amazon Keyspaces resource.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
source§impl Client
impl Client
sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:The Amazon Keyspaces resource that the tags will be removed from. This value is an Amazon Resource Name (ARN).
tags(Vec<Tag>)
/set_tags(Option<Vec<Tag>>)
:A list of existing tags to be removed from the Amazon Keyspaces resource.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn update_table(&self) -> UpdateTableFluentBuilder
pub fn update_table(&self) -> UpdateTableFluentBuilder
Constructs a fluent builder for the UpdateTable
operation.
- The fluent builder is configurable:
keyspace_name(impl Into<String>)
/set_keyspace_name(Option<String>)
:The name of the keyspace the specified table is stored in.
table_name(impl Into<String>)
/set_table_name(Option<String>)
:The name of the table.
add_columns(Vec<ColumnDefinition>)
/set_add_columns(Option<Vec<ColumnDefinition>>)
:For each column to be added to the specified table:
-
name
- The name of the column. -
type
- An Amazon Keyspaces data type. For more information, see Data types in the Amazon Keyspaces Developer Guide.
-
capacity_specification(CapacitySpecification)
/set_capacity_specification(Option<CapacitySpecification>)
:Modifies the read/write throughput capacity mode for the table. The options are:
-
throughputMode:PAY_PER_REQUEST
and -
throughputMode:PROVISIONED
- Provisioned capacity mode requiresreadCapacityUnits
andwriteCapacityUnits
as input.
The default is
throughput_mode:PAY_PER_REQUEST
.For more information, see Read/write capacity modes in the Amazon Keyspaces Developer Guide.
-
encryption_specification(EncryptionSpecification)
/set_encryption_specification(Option<EncryptionSpecification>)
:Modifies the encryption settings of the table. You can choose one of the following KMS key (KMS key):
-
type:AWS_OWNED_KMS_KEY
- This key is owned by Amazon Keyspaces. -
type:CUSTOMER_MANAGED_KMS_KEY
- This key is stored in your account and is created, owned, and managed by you. This option requires thekms_key_identifier
of the KMS key in Amazon Resource Name (ARN) format as input.
The default is
AWS_OWNED_KMS_KEY
.For more information, see Encryption at rest in the Amazon Keyspaces Developer Guide.
-
point_in_time_recovery(PointInTimeRecovery)
/set_point_in_time_recovery(Option<PointInTimeRecovery>)
:Modifies the
pointInTimeRecovery
settings of the table. The options are:-
status=ENABLED
-
status=DISABLED
If it’s not specified, the default is
status=DISABLED
.For more information, see Point-in-time recovery in the Amazon Keyspaces Developer Guide.
-
ttl(TimeToLive)
/set_ttl(Option<TimeToLive>)
:Modifies Time to Live custom settings for the table. The options are:
-
status:enabled
-
status:disabled
The default is
status:disabled
. Afterttl
is enabled, you can’t disable it for the table.For more information, see Expiring data by using Amazon Keyspaces Time to Live (TTL) in the Amazon Keyspaces Developer Guide.
-
default_time_to_live(i32)
/set_default_time_to_live(Option<i32>)
:The default Time to Live setting in seconds for the table.
For more information, see Setting the default TTL value for a table in the Amazon Keyspaces Developer Guide.
client_side_timestamps(ClientSideTimestamps)
/set_client_side_timestamps(Option<ClientSideTimestamps>)
:Enables client-side timestamps for the table. By default, the setting is disabled. You can enable client-side timestamps with the following option:
-
status: “enabled”
Once client-side timestamps are enabled for a table, this setting cannot be disabled.
-
- On success, responds with
UpdateTableOutput
with field(s):resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the modified table.
- On failure, responds with
SdkError<UpdateTableError>
source§impl Client
impl Client
sourcepub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
pub fn with_config( client: Client<DynConnector, DynMiddleware<DynConnector>>, conf: Config ) -> Self
Creates a client with the given service configuration.
source§impl Client
impl Client
sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
Panics
- This method will panic if the
sdk_config
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
sdk_config
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it.
sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config
.
Panics
- This method will panic if the
conf
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
conf
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it.