aws_sdk_cognitosync/operation/list_datasets/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_datasets::_list_datasets_output::ListDatasetsOutputBuilder;
3
4pub use crate::operation::list_datasets::_list_datasets_input::ListDatasetsInputBuilder;
5
6impl crate::operation::list_datasets::builders::ListDatasetsInputBuilder {
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::list_datasets::ListDatasetsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::list_datasets::ListDatasetsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.list_datasets();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ListDatasets`.
24///
25/// <p>Lists datasets for an identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data.</p>
26/// <p>ListDatasets can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use the Cognito Identity credentials to make this API call.</p><examples>
27/// <example>
28/// <name>
29/// ListDatasets
30/// </name>
31/// <description>
32/// The following examples have been edited for readability.
33/// </description>
34/// <request>
35/// POST / HTTP/1.1 CONTENT-TYPE: application/json X-AMZN-REQUESTID: 15225768-209f-4078-aaed-7494ace9f2db X-AMZ-TARGET: com.amazonaws.cognito.sync.model.AWSCognitoSyncService.ListDatasets HOST: cognito-sync.us-east-1.amazonaws.com:443 X-AMZ-DATE: 20141111T215640Z AUTHORIZATION: AWS4-HMAC-SHA256 Credential=
36/// <credential>
37/// , SignedHeaders=content-type;host;x-amz-date;x-amz-target;x-amzn-requestid, Signature=
38/// <signature>
39/// { "Operation": "com.amazonaws.cognito.sync.model#ListDatasets", "Service": "com.amazonaws.cognito.sync.model#AWSCognitoSyncService", "Input": { "IdentityPoolId": "IDENTITY_POOL_ID", "IdentityId": "IDENTITY_ID", "MaxResults": "3" } }
40/// </signature>
41/// </credential>
42/// </request>
43/// <response>
44/// 1.1 200 OK x-amzn-requestid: 15225768-209f-4078-aaed-7494ace9f2db, 15225768-209f-4078-aaed-7494ace9f2db content-type: application/json content-length: 355 date: Tue, 11 Nov 2014 21:56:40 GMT { "Output": { "__type": "com.amazonaws.cognito.sync.model#ListDatasetsResponse", "Count": 1, "Datasets": \[ { "CreationDate": 1.412974057151E9, "DataStorage": 16, "DatasetName": "my_list", "IdentityId": "IDENTITY_ID", "LastModifiedBy": "123456789012", "LastModifiedDate": 1.412974057244E9, "NumRecords": 1 }\], "NextToken": null }, "Version": "1.0" }
45/// </response>
46/// </example>
47/// </examples>
48#[derive(::std::clone::Clone, ::std::fmt::Debug)]
49pub struct ListDatasetsFluentBuilder {
50    handle: ::std::sync::Arc<crate::client::Handle>,
51    inner: crate::operation::list_datasets::builders::ListDatasetsInputBuilder,
52    config_override: ::std::option::Option<crate::config::Builder>,
53}
54impl
55    crate::client::customize::internal::CustomizableSend<
56        crate::operation::list_datasets::ListDatasetsOutput,
57        crate::operation::list_datasets::ListDatasetsError,
58    > for ListDatasetsFluentBuilder
59{
60    fn send(
61        self,
62        config_override: crate::config::Builder,
63    ) -> crate::client::customize::internal::BoxFuture<
64        crate::client::customize::internal::SendResult<
65            crate::operation::list_datasets::ListDatasetsOutput,
66            crate::operation::list_datasets::ListDatasetsError,
67        >,
68    > {
69        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
70    }
71}
72impl ListDatasetsFluentBuilder {
73    /// Creates a new `ListDatasetsFluentBuilder`.
74    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
75        Self {
76            handle,
77            inner: ::std::default::Default::default(),
78            config_override: ::std::option::Option::None,
79        }
80    }
81    /// Access the ListDatasets as a reference.
82    pub fn as_input(&self) -> &crate::operation::list_datasets::builders::ListDatasetsInputBuilder {
83        &self.inner
84    }
85    /// Sends the request and returns the response.
86    ///
87    /// If an error occurs, an `SdkError` will be returned with additional details that
88    /// can be matched against.
89    ///
90    /// By default, any retryable failures will be retried twice. Retry behavior
91    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
92    /// set when configuring the client.
93    pub async fn send(
94        self,
95    ) -> ::std::result::Result<
96        crate::operation::list_datasets::ListDatasetsOutput,
97        ::aws_smithy_runtime_api::client::result::SdkError<
98            crate::operation::list_datasets::ListDatasetsError,
99            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
100        >,
101    > {
102        let input = self
103            .inner
104            .build()
105            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
106        let runtime_plugins = crate::operation::list_datasets::ListDatasets::operation_runtime_plugins(
107            self.handle.runtime_plugins.clone(),
108            &self.handle.conf,
109            self.config_override,
110        );
111        crate::operation::list_datasets::ListDatasets::orchestrate(&runtime_plugins, input).await
112    }
113
114    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
115    pub fn customize(
116        self,
117    ) -> crate::client::customize::CustomizableOperation<
118        crate::operation::list_datasets::ListDatasetsOutput,
119        crate::operation::list_datasets::ListDatasetsError,
120        Self,
121    > {
122        crate::client::customize::CustomizableOperation::new(self)
123    }
124    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
125        self.set_config_override(::std::option::Option::Some(config_override.into()));
126        self
127    }
128
129    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
130        self.config_override = config_override;
131        self
132    }
133    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
134    pub fn identity_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.identity_pool_id(input.into());
136        self
137    }
138    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
139    pub fn set_identity_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_identity_pool_id(input);
141        self
142    }
143    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
144    pub fn get_identity_pool_id(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_identity_pool_id()
146    }
147    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
148    pub fn identity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.identity_id(input.into());
150        self
151    }
152    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
153    pub fn set_identity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_identity_id(input);
155        self
156    }
157    /// A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.
158    pub fn get_identity_id(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_identity_id()
160    }
161    /// A pagination token for obtaining the next page of results.
162    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.inner = self.inner.next_token(input.into());
164        self
165    }
166    /// A pagination token for obtaining the next page of results.
167    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_next_token(input);
169        self
170    }
171    /// A pagination token for obtaining the next page of results.
172    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
173        self.inner.get_next_token()
174    }
175    /// The maximum number of results to be returned.
176    pub fn max_results(mut self, input: i32) -> Self {
177        self.inner = self.inner.max_results(input);
178        self
179    }
180    /// The maximum number of results to be returned.
181    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
182        self.inner = self.inner.set_max_results(input);
183        self
184    }
185    /// The maximum number of results to be returned.
186    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
187        self.inner.get_max_results()
188    }
189}