pub struct ListRequestedServiceQuotaChangeHistoryByQuotaPaginator {
handle: std::sync::Arc<crate::client::Handle>,
builder:
crate::operation::list_requested_service_quota_change_history_by_quota::builders::ListRequestedServiceQuotaChangeHistoryByQuotaInputBuilder,
stop_on_duplicate_token: bool,
}
impl ListRequestedServiceQuotaChangeHistoryByQuotaPaginator {
pub(crate) fn new(
handle: std::sync::Arc<crate::client::Handle>,
builder: crate::operation::list_requested_service_quota_change_history_by_quota::builders::ListRequestedServiceQuotaChangeHistoryByQuotaInputBuilder,
) -> Self {
Self {
handle,
builder,
stop_on_duplicate_token: true,
}
}
pub fn page_size(mut self, limit: i32) -> Self {
self.builder.max_results = ::std::option::Option::Some(limit);
self
}
pub fn items(
self,
) -> crate::operation::list_requested_service_quota_change_history_by_quota::paginator::ListRequestedServiceQuotaChangeHistoryByQuotaPaginatorItems
{
crate::operation::list_requested_service_quota_change_history_by_quota::paginator::ListRequestedServiceQuotaChangeHistoryByQuotaPaginatorItems(
self,
)
}
pub fn stop_on_duplicate_token(mut self, stop_on_duplicate_token: bool) -> Self {
self.stop_on_duplicate_token = stop_on_duplicate_token;
self
}
pub fn send(
self,
) -> impl ::tokio_stream::Stream<
Item = ::std::result::Result<
crate::operation::list_requested_service_quota_change_history_by_quota::ListRequestedServiceQuotaChangeHistoryByQuotaOutput,
::aws_smithy_http::result::SdkError<
crate::operation::list_requested_service_quota_change_history_by_quota::ListRequestedServiceQuotaChangeHistoryByQuotaError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
>,
> + ::std::marker::Unpin {
let builder = self.builder;
let handle = self.handle;
let runtime_plugins = crate::operation::list_requested_service_quota_change_history_by_quota::ListRequestedServiceQuotaChangeHistoryByQuota::operation_runtime_plugins(
handle.runtime_plugins.clone(),
&handle.conf,
::std::option::Option::None,
);
::aws_smithy_async::future::fn_stream::FnStream::new(move |tx| {
::std::boxed::Box::pin(async move {
let mut input = match builder.build().map_err(::aws_smithy_http::result::SdkError::construction_failure) {
::std::result::Result::Ok(input) => input,
::std::result::Result::Err(e) => {
let _ = tx.send(::std::result::Result::Err(e)).await;
return;
}
};
loop {
let resp = crate::operation::list_requested_service_quota_change_history_by_quota::ListRequestedServiceQuotaChangeHistoryByQuota::orchestrate(&runtime_plugins, input.clone()).await;
let done = match resp {
::std::result::Result::Ok(ref resp) => {
let new_token = crate::lens::reflens_list_requested_service_quota_change_history_by_quota_output_next_token(resp);
let is_empty = new_token.map(|token| token.is_empty()).unwrap_or(true);
if !is_empty && new_token == input.next_token.as_ref() && self.stop_on_duplicate_token {
true
} else {
input.next_token = new_token.cloned();
is_empty
}
}
::std::result::Result::Err(_) => true,
};
if tx.send(resp).await.is_err() {
return;
}
if done {
return;
}
}
})
})
}
}
pub struct ListRequestedServiceQuotaChangeHistoryByQuotaPaginatorItems(ListRequestedServiceQuotaChangeHistoryByQuotaPaginator);
impl ListRequestedServiceQuotaChangeHistoryByQuotaPaginatorItems {
pub fn send(
self,
) -> impl ::tokio_stream::Stream<
Item = ::std::result::Result<
crate::types::RequestedServiceQuotaChange,
::aws_smithy_http::result::SdkError<
crate::operation::list_requested_service_quota_change_history_by_quota::ListRequestedServiceQuotaChangeHistoryByQuotaError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
>,
> + ::std::marker::Unpin {
::aws_smithy_async::future::fn_stream::TryFlatMap::new(self.0.send()).flat_map(|page| {
crate::lens::lens_list_requested_service_quota_change_history_by_quota_output_requested_quotas(page)
.unwrap_or_default()
.into_iter()
})
}
}