// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[derive(Debug)]
pub(crate) struct Handle<C, M, R = aws_smithy_client::retry::Standard> {
pub(crate) client: aws_smithy_client::Client<C, M, R>,
pub(crate) conf: crate::Config,
}
/// An ergonomic service client for `KvService`.
///
/// This client allows ergonomic access to a `KvService`-shaped service.
/// Each method corresponds to an endpoint defined in the service's Smithy model,
/// and the request and response shapes are auto-generated from that same model.
///
/// # Constructing a Client
///
/// To construct a client, you need a few different things:
///
/// - A [`Config`](crate::Config) that specifies additional configuration
/// required by the service.
/// - A connector (`C`) that specifies how HTTP requests are translated
/// into HTTP responses. This will typically be an HTTP client (like
/// `hyper`), though you can also substitute in your own, like a mock
/// mock connector for testing.
/// - A "middleware" (`M`) that modifies requests prior to them being
/// sent to the request. Most commonly, middleware will decide what
/// endpoint the requests should be sent to, as well as perform
/// authentication and authorization of requests (such as SigV4).
/// You can also have middleware that performs request/response
/// tracing, throttling, or other middleware-like tasks.
/// - A retry policy (`R`) that dictates the behavior for requests that
/// fail and should (potentially) be retried. The default type is
/// generally what you want, as it implements a well-vetted retry
/// policy implemented in [`RetryMode::Standard`](aws_smithy_types::retry::RetryMode::Standard).
///
/// To construct a client, you will generally want to call
/// [`Client::with_config`], which takes a [`aws_smithy_client::Client`] (a
/// Smithy client that isn't specialized to a particular service),
/// and a [`Config`](crate::Config). Both of these are constructed using
/// the [builder pattern] where you first construct a `Builder` type,
/// then configure it with the necessary parameters, and then call
/// `build` to construct the finalized output type. The
/// [`aws_smithy_client::Client`] builder is re-exported in this crate as
/// [`Builder`] for convenience.
///
/// In _most_ circumstances, you will want to use the following pattern
/// to construct a client:
///
/// ```
/// use rivet_kv::{Builder, Client, Config};
/// let raw_client =
/// Builder::dyn_https()
/// # /*
/// .middleware(/* discussed below */)
/// # */
/// # .middleware_fn(|r| r)
/// .build();
/// let config = Config::builder().build();
/// let client = Client::with_config(raw_client, config);
/// ```
///
/// For the middleware, you'll want to use whatever matches the
/// routing, authentication and authorization required by the target
/// service. For example, for the standard AWS SDK which uses
/// [SigV4-signed requests], the middleware looks like this:
///
// Ignored as otherwise we'd need to pull in all these dev-dependencies.
/// ```rust,ignore
/// use aws_endpoint::AwsEndpointStage;
/// use aws_http::auth::CredentialsStage;
/// use aws_http::recursion_detection::RecursionDetectionStage;
/// use aws_http::user_agent::UserAgentStage;
/// use aws_sig_auth::middleware::SigV4SigningStage;
/// use aws_sig_auth::signer::SigV4Signer;
/// use aws_smithy_client::retry::Config as RetryConfig;
/// use aws_smithy_http_tower::map_request::{AsyncMapRequestLayer, MapRequestLayer};
/// use std::fmt::Debug;
/// use tower::layer::util::{Identity, Stack};
/// use tower::ServiceBuilder;
///
/// type AwsMiddlewareStack = Stack<
/// MapRequestLayer<RecursionDetectionStage>,
/// Stack<
/// MapRequestLayer<SigV4SigningStage>,
/// Stack<
/// AsyncMapRequestLayer<CredentialsStage>,
/// Stack<
/// MapRequestLayer<UserAgentStage>,
/// Stack<MapRequestLayer<AwsEndpointStage>, Identity>,
/// >,
/// >,
/// >,
/// >;
///
/// /// AWS Middleware Stack
/// ///
/// /// This implements the middleware stack for this service. It will:
/// /// 1. Load credentials asynchronously into the property bag
/// /// 2. Sign the request with SigV4
/// /// 3. Resolve an Endpoint for the request
/// /// 4. Add a user agent to the request
/// #[derive(Debug, Default, Clone)]
/// #[non_exhaustive]
/// pub struct AwsMiddleware;
///
/// impl AwsMiddleware {
/// /// Create a new `AwsMiddleware` stack
/// ///
/// /// Note: `AwsMiddleware` holds no state.
/// pub fn new() -> Self {
/// AwsMiddleware::default()
/// }
/// }
///
/// // define the middleware stack in a non-generic location to reduce code bloat.
/// fn base() -> ServiceBuilder<AwsMiddlewareStack> {
/// let credential_provider = AsyncMapRequestLayer::for_mapper(CredentialsStage::new());
/// let signer = MapRequestLayer::for_mapper(SigV4SigningStage::new(SigV4Signer::new()));
/// let endpoint_resolver = MapRequestLayer::for_mapper(AwsEndpointStage);
/// let user_agent = MapRequestLayer::for_mapper(UserAgentStage::new());
/// let recursion_detection = MapRequestLayer::for_mapper(RecursionDetectionStage::new());
/// // These layers can be considered as occurring in order, that is:
/// // 1. Resolve an endpoint
/// // 2. Add a user agent
/// // 3. Acquire credentials
/// // 4. Sign with credentials
/// // (5. Dispatch over the wire)
/// ServiceBuilder::new()
/// .layer(endpoint_resolver)
/// .layer(user_agent)
/// .layer(credential_provider)
/// .layer(signer)
/// .layer(recursion_detection)
/// }
///
/// impl<S> tower::Layer<S> for AwsMiddleware {
/// type Service = <AwsMiddlewareStack as tower::Layer<S>>::Service;
///
/// fn layer(&self, inner: S) -> Self::Service {
/// base().service(inner)
/// }
/// }
/// ```
///
/// # Using a Client
///
/// Once you have a client set up, you can access the service's endpoints
/// by calling the appropriate method on [`Client`]. Each such method
/// returns a request builder for that endpoint, with methods for setting
/// the various fields of the request. Once your request is complete, use
/// the `send` method to send the request. `send` returns a future, which
/// you then have to `.await` to get the service's response.
///
/// [builder pattern]: https://rust-lang.github.io/api-guidelines/type-safety.html#c-builder
/// [SigV4-signed requests]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
#[derive(std::fmt::Debug)]
pub struct Client<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<Handle<C, M, R>>,
}
impl<C, M, R> std::clone::Clone for Client<C, M, R> {
fn clone(&self) -> Self {
Self {
handle: self.handle.clone(),
}
}
}
#[doc(inline)]
pub use aws_smithy_client::Builder;
impl<C, M, R> From<aws_smithy_client::Client<C, M, R>> for Client<C, M, R> {
fn from(client: aws_smithy_client::Client<C, M, R>) -> Self {
Self::with_config(client, crate::Config::builder().build())
}
}
impl<C, M, R> Client<C, M, R> {
/// Creates a client with the given service configuration.
pub fn with_config(client: aws_smithy_client::Client<C, M, R>, conf: crate::Config) -> Self {
Self {
handle: std::sync::Arc::new(Handle { client, conf }),
}
}
/// Returns the client's configuration.
pub fn conf(&self) -> &crate::Config {
&self.handle.conf
}
}
impl<C, M, R> Client<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Constructs a fluent builder for the [`Delete`](crate::client::fluent_builders::Delete) operation.
///
/// - The fluent builder is configurable:
/// - [`key(impl Into<String>)`](crate::client::fluent_builders::Delete::key) / [`set_key(Option<String>)`](crate::client::fluent_builders::Delete::set_key): A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
/// - [`namespace_id(impl Into<String>)`](crate::client::fluent_builders::Delete::namespace_id) / [`set_namespace_id(Option<String>)`](crate::client::fluent_builders::Delete::set_namespace_id): A universally unique identifier.
/// - On success, responds with [`DeleteOutput`](crate::output::DeleteOutput)
/// - On failure, responds with [`SdkError<DeleteError>`](crate::error::DeleteError)
pub fn delete(&self) -> fluent_builders::Delete<C, M, R> {
fluent_builders::Delete::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`DeleteBatch`](crate::client::fluent_builders::DeleteBatch) operation.
///
/// - The fluent builder is configurable:
/// - [`keys(Vec<String>)`](crate::client::fluent_builders::DeleteBatch::keys) / [`set_keys(Option<Vec<String>>)`](crate::client::fluent_builders::DeleteBatch::set_keys): A list of keys.
/// - [`namespace_id(impl Into<String>)`](crate::client::fluent_builders::DeleteBatch::namespace_id) / [`set_namespace_id(Option<String>)`](crate::client::fluent_builders::DeleteBatch::set_namespace_id): A universally unique identifier.
/// - On success, responds with [`DeleteBatchOutput`](crate::output::DeleteBatchOutput)
/// - On failure, responds with [`SdkError<DeleteBatchError>`](crate::error::DeleteBatchError)
pub fn delete_batch(&self) -> fluent_builders::DeleteBatch<C, M, R> {
fluent_builders::DeleteBatch::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`Get`](crate::client::fluent_builders::Get) operation.
///
/// - The fluent builder is configurable:
/// - [`key(impl Into<String>)`](crate::client::fluent_builders::Get::key) / [`set_key(Option<String>)`](crate::client::fluent_builders::Get::set_key): A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
/// - [`watch_index(impl Into<String>)`](crate::client::fluent_builders::Get::watch_index) / [`set_watch_index(Option<String>)`](crate::client::fluent_builders::Get::set_watch_index): A query parameter denoting the requests watch index.
/// - [`namespace_id(impl Into<String>)`](crate::client::fluent_builders::Get::namespace_id) / [`set_namespace_id(Option<String>)`](crate::client::fluent_builders::Get::set_namespace_id): A universally unique identifier.
/// - On success, responds with [`GetOutput`](crate::output::GetOutput) with field(s):
/// - [`value(Option<Document>)`](crate::output::GetOutput::value): The key's JSON value.
/// - [`deleted(Option<bool>)`](crate::output::GetOutput::deleted): Whether or not the entry has been deleted. Only set when watching this endpoint.
/// - [`watch(Option<WatchResponse>)`](crate::output::GetOutput::watch): Provided by watchable endpoints used in blocking loops.
/// - On failure, responds with [`SdkError<GetError>`](crate::error::GetError)
pub fn get(&self) -> fluent_builders::Get<C, M, R> {
fluent_builders::Get::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`GetBatch`](crate::client::fluent_builders::GetBatch) operation.
///
/// - The fluent builder is configurable:
/// - [`keys(Vec<String>)`](crate::client::fluent_builders::GetBatch::keys) / [`set_keys(Option<Vec<String>>)`](crate::client::fluent_builders::GetBatch::set_keys): A list of keys.
/// - [`watch_index(impl Into<String>)`](crate::client::fluent_builders::GetBatch::watch_index) / [`set_watch_index(Option<String>)`](crate::client::fluent_builders::GetBatch::set_watch_index): A query parameter denoting the requests watch index.
/// - [`namespace_id(impl Into<String>)`](crate::client::fluent_builders::GetBatch::namespace_id) / [`set_namespace_id(Option<String>)`](crate::client::fluent_builders::GetBatch::set_namespace_id): A universally unique identifier.
/// - On success, responds with [`GetBatchOutput`](crate::output::GetBatchOutput) with field(s):
/// - [`entries(Option<Vec<KvEntry>>)`](crate::output::GetBatchOutput::entries): A list of key-value entries.
/// - [`watch(Option<WatchResponse>)`](crate::output::GetBatchOutput::watch): Provided by watchable endpoints used in blocking loops.
/// - On failure, responds with [`SdkError<GetBatchError>`](crate::error::GetBatchError)
pub fn get_batch(&self) -> fluent_builders::GetBatch<C, M, R> {
fluent_builders::GetBatch::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`Put`](crate::client::fluent_builders::Put) operation.
///
/// - The fluent builder is configurable:
/// - [`namespace_id(impl Into<String>)`](crate::client::fluent_builders::Put::namespace_id) / [`set_namespace_id(Option<String>)`](crate::client::fluent_builders::Put::set_namespace_id): A universally unique identifier.
/// - [`key(impl Into<String>)`](crate::client::fluent_builders::Put::key) / [`set_key(Option<String>)`](crate::client::fluent_builders::Put::set_key): Any JSON value to set the key to.
/// - [`value(Document)`](crate::client::fluent_builders::Put::value) / [`set_value(Option<Document>)`](crate::client::fluent_builders::Put::set_value): (undocumented)
/// - On success, responds with [`PutOutput`](crate::output::PutOutput)
/// - On failure, responds with [`SdkError<PutError>`](crate::error::PutError)
pub fn put(&self) -> fluent_builders::Put<C, M, R> {
fluent_builders::Put::new(self.handle.clone())
}
/// Constructs a fluent builder for the [`PutBatch`](crate::client::fluent_builders::PutBatch) operation.
///
/// - The fluent builder is configurable:
/// - [`namespace_id(impl Into<String>)`](crate::client::fluent_builders::PutBatch::namespace_id) / [`set_namespace_id(Option<String>)`](crate::client::fluent_builders::PutBatch::set_namespace_id): A universally unique identifier.
/// - [`entries(Vec<PutEntry>)`](crate::client::fluent_builders::PutBatch::entries) / [`set_entries(Option<Vec<PutEntry>>)`](crate::client::fluent_builders::PutBatch::set_entries): A list of entries to insert.
/// - On success, responds with [`PutBatchOutput`](crate::output::PutBatchOutput)
/// - On failure, responds with [`SdkError<PutBatchError>`](crate::error::PutBatchError)
pub fn put_batch(&self) -> fluent_builders::PutBatch<C, M, R> {
fluent_builders::PutBatch::new(self.handle.clone())
}
}
pub mod fluent_builders {
//!
//! Utilities to ergonomically construct a request to the service.
//!
//! Fluent builders are created through the [`Client`](crate::client::Client) by calling
//! one if its operation methods. After parameters are set using the builder methods,
//! the `send` method can be called to initiate the request.
//!
/// Fluent builder constructing a request to `Delete`.
///
/// Deletes a key-value entry by key.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct Delete<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::delete_input::Builder,
}
impl<C, M, R> Delete<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `Delete`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::DeleteOutput,
aws_smithy_http::result::SdkError<crate::error::DeleteError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::DeleteInputOperationOutputAlias,
crate::output::DeleteOutput,
crate::error::DeleteError,
crate::input::DeleteInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.key(input.into());
self
}
/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
pub fn set_key(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_key(input);
self
}
/// A universally unique identifier.
pub fn namespace_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.namespace_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_namespace_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_namespace_id(input);
self
}
}
/// Fluent builder constructing a request to `DeleteBatch`.
///
/// Deletes multiple key-value entries by key(s).
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct DeleteBatch<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::delete_batch_input::Builder,
}
impl<C, M, R> DeleteBatch<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `DeleteBatch`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::DeleteBatchOutput,
aws_smithy_http::result::SdkError<crate::error::DeleteBatchError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::DeleteBatchInputOperationOutputAlias,
crate::output::DeleteBatchOutput,
crate::error::DeleteBatchError,
crate::input::DeleteBatchInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// Appends an item to `keys`.
///
/// To override the contents of this collection use [`set_keys`](Self::set_keys).
///
/// A list of keys.
pub fn keys(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.keys(input.into());
self
}
/// A list of keys.
pub fn set_keys(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_keys(input);
self
}
/// A universally unique identifier.
pub fn namespace_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.namespace_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_namespace_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_namespace_id(input);
self
}
}
/// Fluent builder constructing a request to `Get`.
///
/// Returns a specific key-value entry by key.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct Get<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::get_input::Builder,
}
impl<C, M, R> Get<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `Get`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::GetOutput,
aws_smithy_http::result::SdkError<crate::error::GetError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::GetInputOperationOutputAlias,
crate::output::GetOutput,
crate::error::GetError,
crate::input::GetInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.key(input.into());
self
}
/// A string reprenting a key in the key-value database. Key path components are split by a slash (e.g. `a/b/c` has the path components `["a", "b", "c"]`). Slashes can be escaped by using a forward slash (e.g. `a/b\/c/d` has the path components `["a", "b/c", "d"]`). See `rivet.api.kv.common#KeyComponents` for the structure of a `rivet.api.kv.common#Key` split by `/`.
pub fn set_key(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_key(input);
self
}
/// A query parameter denoting the requests watch index.
pub fn watch_index(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.watch_index(input.into());
self
}
/// A query parameter denoting the requests watch index.
pub fn set_watch_index(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_watch_index(input);
self
}
/// A universally unique identifier.
pub fn namespace_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.namespace_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_namespace_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_namespace_id(input);
self
}
}
/// Fluent builder constructing a request to `GetBatch`.
///
/// Gets multiple key-value entries by key(s).
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct GetBatch<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::get_batch_input::Builder,
}
impl<C, M, R> GetBatch<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `GetBatch`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::GetBatchOutput,
aws_smithy_http::result::SdkError<crate::error::GetBatchError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::GetBatchInputOperationOutputAlias,
crate::output::GetBatchOutput,
crate::error::GetBatchError,
crate::input::GetBatchInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// Appends an item to `keys`.
///
/// To override the contents of this collection use [`set_keys`](Self::set_keys).
///
/// A list of keys.
pub fn keys(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.keys(input.into());
self
}
/// A list of keys.
pub fn set_keys(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.inner = self.inner.set_keys(input);
self
}
/// A query parameter denoting the requests watch index.
pub fn watch_index(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.watch_index(input.into());
self
}
/// A query parameter denoting the requests watch index.
pub fn set_watch_index(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_watch_index(input);
self
}
/// A universally unique identifier.
pub fn namespace_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.namespace_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_namespace_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_namespace_id(input);
self
}
}
/// Fluent builder constructing a request to `Put`.
///
/// Puts (sets or overwrites) a key-value entry by key.
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct Put<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::put_input::Builder,
}
impl<C, M, R> Put<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `Put`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::PutOutput,
aws_smithy_http::result::SdkError<crate::error::PutError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::PutInputOperationOutputAlias,
crate::output::PutOutput,
crate::error::PutError,
crate::input::PutInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A universally unique identifier.
pub fn namespace_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.namespace_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_namespace_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_namespace_id(input);
self
}
/// Any JSON value to set the key to.
pub fn key(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.key(input.into());
self
}
/// Any JSON value to set the key to.
pub fn set_key(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_key(input);
self
}
#[allow(missing_docs)] // documentation missing in model
pub fn value(mut self, input: aws_smithy_types::Document) -> Self {
self.inner = self.inner.value(input);
self
}
#[allow(missing_docs)] // documentation missing in model
pub fn set_value(mut self, input: std::option::Option<aws_smithy_types::Document>) -> Self {
self.inner = self.inner.set_value(input);
self
}
}
/// Fluent builder constructing a request to `PutBatch`.
///
/// Puts (sets or overwrites) multiple key-value entries by key(s).
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PutBatch<C, M, R = aws_smithy_client::retry::Standard> {
handle: std::sync::Arc<super::Handle<C, M, R>>,
inner: crate::input::put_batch_input::Builder,
}
impl<C, M, R> PutBatch<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
/// Creates a new `PutBatch`.
pub(crate) fn new(handle: std::sync::Arc<super::Handle<C, M, R>>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::output::PutBatchOutput,
aws_smithy_http::result::SdkError<crate::error::PutBatchError>,
>
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::PutBatchInputOperationOutputAlias,
crate::output::PutBatchOutput,
crate::error::PutBatchError,
crate::input::PutBatchInputOperationRetryAlias,
>,
{
let op = self
.inner
.build()
.map_err(|err| aws_smithy_http::result::SdkError::ConstructionFailure(err.into()))?
.make_operation(&self.handle.conf)
.await
.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
})?;
self.handle.client.call(op).await
}
/// A universally unique identifier.
pub fn namespace_id(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.namespace_id(input.into());
self
}
/// A universally unique identifier.
pub fn set_namespace_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_namespace_id(input);
self
}
/// Appends an item to `entries`.
///
/// To override the contents of this collection use [`set_entries`](Self::set_entries).
///
/// A list of entries to insert.
pub fn entries(mut self, input: crate::model::PutEntry) -> Self {
self.inner = self.inner.entries(input);
self
}
/// A list of entries to insert.
pub fn set_entries(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::PutEntry>>,
) -> Self {
self.inner = self.inner.set_entries(input);
self
}
}
}
/// A wrapper around [`Client`]. Helps reduce external imports.
pub struct ClientWrapper {
pub(crate) client: Client<aws_smithy_client::erase::DynConnector, tower::layer::util::Identity>,
}
impl std::ops::Deref for ClientWrapper {
type Target = Client<aws_smithy_client::erase::DynConnector, tower::layer::util::Identity>;
fn deref(&self) -> &Self::Target {
&self.client
}
}