aws_sdk_qldb/operation/get_block/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_block::_get_block_output::GetBlockOutputBuilder;
3
4pub use crate::operation::get_block::_get_block_input::GetBlockInputBuilder;
5
6impl crate::operation::get_block::builders::GetBlockInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::get_block::GetBlockOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_block::GetBlockError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_block();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetBlock`.
24///
25/// <p>Returns a block object at a specified address in a journal. Also returns a proof of the specified block for verification if <code>DigestTipAddress</code> is provided.</p>
26/// <p>For information about the data contents in a block, see <a href="https://docs.aws.amazon.com/qldb/latest/developerguide/journal-contents.html">Journal contents</a> in the <i>Amazon QLDB Developer Guide</i>.</p>
27/// <p>If the specified ledger doesn't exist or is in <code>DELETING</code> status, then throws <code>ResourceNotFoundException</code>.</p>
28/// <p>If the specified ledger is in <code>CREATING</code> status, then throws <code>ResourcePreconditionNotMetException</code>.</p>
29/// <p>If no block exists with the specified address, then throws <code>InvalidParameterException</code>.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct GetBlockFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::get_block::builders::GetBlockInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl crate::client::customize::internal::CustomizableSend<crate::operation::get_block::GetBlockOutput, crate::operation::get_block::GetBlockError>
37    for GetBlockFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<crate::operation::get_block::GetBlockOutput, crate::operation::get_block::GetBlockError>,
44    > {
45        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
46    }
47}
48impl GetBlockFluentBuilder {
49    /// Creates a new `GetBlockFluentBuilder`.
50    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
51        Self {
52            handle,
53            inner: ::std::default::Default::default(),
54            config_override: ::std::option::Option::None,
55        }
56    }
57    /// Access the GetBlock as a reference.
58    pub fn as_input(&self) -> &crate::operation::get_block::builders::GetBlockInputBuilder {
59        &self.inner
60    }
61    /// Sends the request and returns the response.
62    ///
63    /// If an error occurs, an `SdkError` will be returned with additional details that
64    /// can be matched against.
65    ///
66    /// By default, any retryable failures will be retried twice. Retry behavior
67    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
68    /// set when configuring the client.
69    pub async fn send(
70        self,
71    ) -> ::std::result::Result<
72        crate::operation::get_block::GetBlockOutput,
73        ::aws_smithy_runtime_api::client::result::SdkError<
74            crate::operation::get_block::GetBlockError,
75            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
76        >,
77    > {
78        let input = self
79            .inner
80            .build()
81            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
82        let runtime_plugins = crate::operation::get_block::GetBlock::operation_runtime_plugins(
83            self.handle.runtime_plugins.clone(),
84            &self.handle.conf,
85            self.config_override,
86        );
87        crate::operation::get_block::GetBlock::orchestrate(&runtime_plugins, input).await
88    }
89
90    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
91    pub fn customize(
92        self,
93    ) -> crate::client::customize::CustomizableOperation<crate::operation::get_block::GetBlockOutput, crate::operation::get_block::GetBlockError, Self>
94    {
95        crate::client::customize::CustomizableOperation::new(self)
96    }
97    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
98        self.set_config_override(::std::option::Option::Some(config_override.into()));
99        self
100    }
101
102    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
103        self.config_override = config_override;
104        self
105    }
106    /// <p>The name of the ledger.</p>
107    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108        self.inner = self.inner.name(input.into());
109        self
110    }
111    /// <p>The name of the ledger.</p>
112    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113        self.inner = self.inner.set_name(input);
114        self
115    }
116    /// <p>The name of the ledger.</p>
117    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
118        self.inner.get_name()
119    }
120    /// <p>The location of the block that you want to request. An address is an Amazon Ion structure that has two fields: <code>strandId</code> and <code>sequenceNo</code>.</p>
121    /// <p>For example: <code>{strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:14}</code>.</p>
122    pub fn block_address(mut self, input: crate::types::ValueHolder) -> Self {
123        self.inner = self.inner.block_address(input);
124        self
125    }
126    /// <p>The location of the block that you want to request. An address is an Amazon Ion structure that has two fields: <code>strandId</code> and <code>sequenceNo</code>.</p>
127    /// <p>For example: <code>{strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:14}</code>.</p>
128    pub fn set_block_address(mut self, input: ::std::option::Option<crate::types::ValueHolder>) -> Self {
129        self.inner = self.inner.set_block_address(input);
130        self
131    }
132    /// <p>The location of the block that you want to request. An address is an Amazon Ion structure that has two fields: <code>strandId</code> and <code>sequenceNo</code>.</p>
133    /// <p>For example: <code>{strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:14}</code>.</p>
134    pub fn get_block_address(&self) -> &::std::option::Option<crate::types::ValueHolder> {
135        self.inner.get_block_address()
136    }
137    /// <p>The latest block location covered by the digest for which to request a proof. An address is an Amazon Ion structure that has two fields: <code>strandId</code> and <code>sequenceNo</code>.</p>
138    /// <p>For example: <code>{strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:49}</code>.</p>
139    pub fn digest_tip_address(mut self, input: crate::types::ValueHolder) -> Self {
140        self.inner = self.inner.digest_tip_address(input);
141        self
142    }
143    /// <p>The latest block location covered by the digest for which to request a proof. An address is an Amazon Ion structure that has two fields: <code>strandId</code> and <code>sequenceNo</code>.</p>
144    /// <p>For example: <code>{strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:49}</code>.</p>
145    pub fn set_digest_tip_address(mut self, input: ::std::option::Option<crate::types::ValueHolder>) -> Self {
146        self.inner = self.inner.set_digest_tip_address(input);
147        self
148    }
149    /// <p>The latest block location covered by the digest for which to request a proof. An address is an Amazon Ion structure that has two fields: <code>strandId</code> and <code>sequenceNo</code>.</p>
150    /// <p>For example: <code>{strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:49}</code>.</p>
151    pub fn get_digest_tip_address(&self) -> &::std::option::Option<crate::types::ValueHolder> {
152        self.inner.get_digest_tip_address()
153    }
154}