1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
// 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
}
}
}