aws_sdk_ec2/operation/describe_vpc_endpoint_service_configurations/
paginator.rs1pub struct DescribeVpcEndpointServiceConfigurationsPaginator {
4 handle: std::sync::Arc<crate::client::Handle>,
5 builder: crate::operation::describe_vpc_endpoint_service_configurations::builders::DescribeVpcEndpointServiceConfigurationsInputBuilder,
6 stop_on_duplicate_token: bool,
7}
8
9impl DescribeVpcEndpointServiceConfigurationsPaginator {
10 pub(crate) fn new(
12 handle: std::sync::Arc<crate::client::Handle>,
13 builder: crate::operation::describe_vpc_endpoint_service_configurations::builders::DescribeVpcEndpointServiceConfigurationsInputBuilder,
14 ) -> Self {
15 Self {
16 handle,
17 builder,
18 stop_on_duplicate_token: true,
19 }
20 }
21
22 pub fn page_size(mut self, limit: i32) -> Self {
26 self.builder.max_results = ::std::option::Option::Some(limit);
27 self
28 }
29
30 pub fn items(
35 self,
36 ) -> crate::operation::describe_vpc_endpoint_service_configurations::paginator::DescribeVpcEndpointServiceConfigurationsPaginatorItems {
37 crate::operation::describe_vpc_endpoint_service_configurations::paginator::DescribeVpcEndpointServiceConfigurationsPaginatorItems(self)
38 }
39
40 pub fn stop_on_duplicate_token(mut self, stop_on_duplicate_token: bool) -> Self {
48 self.stop_on_duplicate_token = stop_on_duplicate_token;
49 self
50 }
51
52 pub fn send(
57 self,
58 ) -> ::aws_smithy_async::future::pagination_stream::PaginationStream<
59 ::std::result::Result<
60 crate::operation::describe_vpc_endpoint_service_configurations::DescribeVpcEndpointServiceConfigurationsOutput,
61 ::aws_smithy_runtime_api::client::result::SdkError<
62 crate::operation::describe_vpc_endpoint_service_configurations::DescribeVpcEndpointServiceConfigurationsError,
63 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
64 >,
65 >,
66 > {
67 let builder = self.builder;
69 let handle = self.handle;
70 let runtime_plugins =
71 crate::operation::describe_vpc_endpoint_service_configurations::DescribeVpcEndpointServiceConfigurations::operation_runtime_plugins(
72 handle.runtime_plugins.clone(),
73 &handle.conf,
74 ::std::option::Option::None,
75 )
76 .with_operation_plugin(crate::sdk_feature_tracker::paginator::PaginatorFeatureTrackerRuntimePlugin::new());
77 ::aws_smithy_async::future::pagination_stream::PaginationStream::new(::aws_smithy_async::future::pagination_stream::fn_stream::FnStream::new(
78 move |tx| {
79 ::std::boxed::Box::pin(async move {
80 let mut input = match builder
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)
84 {
85 ::std::result::Result::Ok(input) => input,
86 ::std::result::Result::Err(e) => {
87 let _ = tx.send(::std::result::Result::Err(e)).await;
88 return;
89 }
90 };
91 loop {
92 let resp =
93 crate::operation::describe_vpc_endpoint_service_configurations::DescribeVpcEndpointServiceConfigurations::orchestrate(
94 &runtime_plugins,
95 input.clone(),
96 )
97 .await;
98 let done = match resp {
100 ::std::result::Result::Ok(ref resp) => {
101 let new_token = crate::lens::reflens_describe_vpc_endpoint_service_configurations_output_output_next_token(resp);
102 let is_empty = new_token.map(|token| token.is_empty()).unwrap_or(true);
104 if !is_empty && new_token == input.next_token.as_ref() && self.stop_on_duplicate_token {
105 true
106 } else {
107 input.next_token = new_token.cloned();
108 is_empty
109 }
110 }
111 ::std::result::Result::Err(_) => true,
112 };
113 if tx.send(resp).await.is_err() {
114 return;
116 }
117 if done {
118 return;
119 }
120 }
121 })
122 },
123 ))
124 }
125}
126
127pub struct DescribeVpcEndpointServiceConfigurationsPaginatorItems(DescribeVpcEndpointServiceConfigurationsPaginator);
131
132impl DescribeVpcEndpointServiceConfigurationsPaginatorItems {
133 pub fn send(
140 self,
141 ) -> ::aws_smithy_async::future::pagination_stream::PaginationStream<
142 ::std::result::Result<
143 crate::types::ServiceConfiguration,
144 ::aws_smithy_runtime_api::client::result::SdkError<
145 crate::operation::describe_vpc_endpoint_service_configurations::DescribeVpcEndpointServiceConfigurationsError,
146 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
147 >,
148 >,
149 > {
150 ::aws_smithy_async::future::pagination_stream::TryFlatMap::new(self.0.send()).flat_map(|page| {
151 crate::lens::lens_describe_vpc_endpoint_service_configurations_output_output_service_configurations(page)
152 .unwrap_or_default()
153 .into_iter()
154 })
155 }
156}