pub struct ListEntitlementsPaginator<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
> {
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_entitlements_input::Builder,
}
impl<C, M, R> ListEntitlementsPaginator<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_entitlements_input::Builder,
) -> Self {
Self { handle, builder }
}
pub fn page_size(mut self, limit: i32) -> Self {
self.builder.max_results = Some(limit);
self
}
pub fn items(self) -> crate::paginator::ListEntitlementsPaginatorItems<C, M, R> {
crate::paginator::ListEntitlementsPaginatorItems(self)
}
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::output::ListEntitlementsOutput,
aws_smithy_http::result::SdkError<crate::error::ListEntitlementsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListEntitlementsInputOperationOutputAlias,
crate::output::ListEntitlementsOutput,
crate::error::ListEntitlementsError,
crate::input::ListEntitlementsInputOperationRetryAlias,
>,
{
let builder = self.builder;
let handle = self.handle;
aws_smithy_async::future::fn_stream::FnStream::new(move |tx| {
Box::pin(async move {
let mut input = match builder.build().map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(input) => input,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
loop {
let op = match input.make_operation(&handle.conf).await.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(op) => op,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
let resp = handle.client.call(op).await;
let done = match resp {
Ok(ref resp) => {
let new_token = crate::lens::reflens_structure_crate_output_list_entitlements_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() {
let _ = tx.send(Err(aws_smithy_http::result::SdkError::ConstructionFailure("next token did not change, aborting paginator. This indicates an SDK or AWS service bug.".into()))).await;
return;
}
input.next_token = new_token.cloned();
is_empty
}
Err(_) => true,
};
if tx.send(resp).await.is_err() {
return;
}
if done {
return;
}
}
})
})
}
}
pub struct ListFlowsPaginator<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
> {
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_flows_input::Builder,
}
impl<C, M, R> ListFlowsPaginator<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_flows_input::Builder,
) -> Self {
Self { handle, builder }
}
pub fn page_size(mut self, limit: i32) -> Self {
self.builder.max_results = Some(limit);
self
}
pub fn items(self) -> crate::paginator::ListFlowsPaginatorItems<C, M, R> {
crate::paginator::ListFlowsPaginatorItems(self)
}
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::output::ListFlowsOutput,
aws_smithy_http::result::SdkError<crate::error::ListFlowsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListFlowsInputOperationOutputAlias,
crate::output::ListFlowsOutput,
crate::error::ListFlowsError,
crate::input::ListFlowsInputOperationRetryAlias,
>,
{
let builder = self.builder;
let handle = self.handle;
aws_smithy_async::future::fn_stream::FnStream::new(move |tx| {
Box::pin(async move {
let mut input = match builder.build().map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(input) => input,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
loop {
let op = match input.make_operation(&handle.conf).await.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(op) => op,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
let resp = handle.client.call(op).await;
let done = match resp {
Ok(ref resp) => {
let new_token = crate::lens::reflens_structure_crate_output_list_flows_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() {
let _ = tx.send(Err(aws_smithy_http::result::SdkError::ConstructionFailure("next token did not change, aborting paginator. This indicates an SDK or AWS service bug.".into()))).await;
return;
}
input.next_token = new_token.cloned();
is_empty
}
Err(_) => true,
};
if tx.send(resp).await.is_err() {
return;
}
if done {
return;
}
}
})
})
}
}
pub struct ListOfferingsPaginator<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
> {
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_offerings_input::Builder,
}
impl<C, M, R> ListOfferingsPaginator<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_offerings_input::Builder,
) -> Self {
Self { handle, builder }
}
pub fn page_size(mut self, limit: i32) -> Self {
self.builder.max_results = Some(limit);
self
}
pub fn items(self) -> crate::paginator::ListOfferingsPaginatorItems<C, M, R> {
crate::paginator::ListOfferingsPaginatorItems(self)
}
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::output::ListOfferingsOutput,
aws_smithy_http::result::SdkError<crate::error::ListOfferingsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListOfferingsInputOperationOutputAlias,
crate::output::ListOfferingsOutput,
crate::error::ListOfferingsError,
crate::input::ListOfferingsInputOperationRetryAlias,
>,
{
let builder = self.builder;
let handle = self.handle;
aws_smithy_async::future::fn_stream::FnStream::new(move |tx| {
Box::pin(async move {
let mut input = match builder.build().map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(input) => input,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
loop {
let op = match input.make_operation(&handle.conf).await.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(op) => op,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
let resp = handle.client.call(op).await;
let done = match resp {
Ok(ref resp) => {
let new_token = crate::lens::reflens_structure_crate_output_list_offerings_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() {
let _ = tx.send(Err(aws_smithy_http::result::SdkError::ConstructionFailure("next token did not change, aborting paginator. This indicates an SDK or AWS service bug.".into()))).await;
return;
}
input.next_token = new_token.cloned();
is_empty
}
Err(_) => true,
};
if tx.send(resp).await.is_err() {
return;
}
if done {
return;
}
}
})
})
}
}
pub struct ListReservationsPaginator<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
> {
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_reservations_input::Builder,
}
impl<C, M, R> ListReservationsPaginator<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub(crate) fn new(
handle: std::sync::Arc<crate::client::Handle<C, M, R>>,
builder: crate::input::list_reservations_input::Builder,
) -> Self {
Self { handle, builder }
}
pub fn page_size(mut self, limit: i32) -> Self {
self.builder.max_results = Some(limit);
self
}
pub fn items(self) -> crate::paginator::ListReservationsPaginatorItems<C, M, R> {
crate::paginator::ListReservationsPaginatorItems(self)
}
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::output::ListReservationsOutput,
aws_smithy_http::result::SdkError<crate::error::ListReservationsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListReservationsInputOperationOutputAlias,
crate::output::ListReservationsOutput,
crate::error::ListReservationsError,
crate::input::ListReservationsInputOperationRetryAlias,
>,
{
let builder = self.builder;
let handle = self.handle;
aws_smithy_async::future::fn_stream::FnStream::new(move |tx| {
Box::pin(async move {
let mut input = match builder.build().map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(input) => input,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
loop {
let op = match input.make_operation(&handle.conf).await.map_err(|err| {
aws_smithy_http::result::SdkError::ConstructionFailure(err.into())
}) {
Ok(op) => op,
Err(e) => {
let _ = tx.send(Err(e)).await;
return;
}
};
let resp = handle.client.call(op).await;
let done = match resp {
Ok(ref resp) => {
let new_token = crate::lens::reflens_structure_crate_output_list_reservations_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() {
let _ = tx.send(Err(aws_smithy_http::result::SdkError::ConstructionFailure("next token did not change, aborting paginator. This indicates an SDK or AWS service bug.".into()))).await;
return;
}
input.next_token = new_token.cloned();
is_empty
}
Err(_) => true,
};
if tx.send(resp).await.is_err() {
return;
}
if done {
return;
}
}
})
})
}
}
pub struct ListEntitlementsPaginatorItems<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
>(ListEntitlementsPaginator<C, M, R>);
impl<C, M, R> ListEntitlementsPaginatorItems<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::model::ListedEntitlement,
aws_smithy_http::result::SdkError<crate::error::ListEntitlementsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListEntitlementsInputOperationOutputAlias,
crate::output::ListEntitlementsOutput,
crate::error::ListEntitlementsError,
crate::input::ListEntitlementsInputOperationRetryAlias,
>,
{
aws_smithy_async::future::fn_stream::TryFlatMap::new(self.0.send()).flat_map(|page| {
crate::lens::lens_structure_crate_output_list_entitlements_output_entitlements(page)
.unwrap_or_default()
.into_iter()
})
}
}
pub struct ListFlowsPaginatorItems<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
>(ListFlowsPaginator<C, M, R>);
impl<C, M, R> ListFlowsPaginatorItems<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::model::ListedFlow,
aws_smithy_http::result::SdkError<crate::error::ListFlowsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListFlowsInputOperationOutputAlias,
crate::output::ListFlowsOutput,
crate::error::ListFlowsError,
crate::input::ListFlowsInputOperationRetryAlias,
>,
{
aws_smithy_async::future::fn_stream::TryFlatMap::new(self.0.send()).flat_map(|page| {
crate::lens::lens_structure_crate_output_list_flows_output_flows(page)
.unwrap_or_default()
.into_iter()
})
}
}
pub struct ListOfferingsPaginatorItems<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
>(ListOfferingsPaginator<C, M, R>);
impl<C, M, R> ListOfferingsPaginatorItems<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::model::Offering,
aws_smithy_http::result::SdkError<crate::error::ListOfferingsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListOfferingsInputOperationOutputAlias,
crate::output::ListOfferingsOutput,
crate::error::ListOfferingsError,
crate::input::ListOfferingsInputOperationRetryAlias,
>,
{
aws_smithy_async::future::fn_stream::TryFlatMap::new(self.0.send()).flat_map(|page| {
crate::lens::lens_structure_crate_output_list_offerings_output_offerings(page)
.unwrap_or_default()
.into_iter()
})
}
}
pub struct ListReservationsPaginatorItems<
C = aws_smithy_client::erase::DynConnector,
M = crate::middleware::DefaultMiddleware,
R = aws_smithy_client::retry::Standard,
>(ListReservationsPaginator<C, M, R>);
impl<C, M, R> ListReservationsPaginatorItems<C, M, R>
where
C: aws_smithy_client::bounds::SmithyConnector,
M: aws_smithy_client::bounds::SmithyMiddleware<C>,
R: aws_smithy_client::retry::NewRequestPolicy,
{
pub fn send(
self,
) -> impl tokio_stream::Stream<
Item = std::result::Result<
crate::model::Reservation,
aws_smithy_http::result::SdkError<crate::error::ListReservationsError>,
>,
> + Unpin
where
R::Policy: aws_smithy_client::bounds::SmithyRetryPolicy<
crate::input::ListReservationsInputOperationOutputAlias,
crate::output::ListReservationsOutput,
crate::error::ListReservationsError,
crate::input::ListReservationsInputOperationRetryAlias,
>,
{
aws_smithy_async::future::fn_stream::TryFlatMap::new(self.0.send()).flat_map(|page| {
crate::lens::lens_structure_crate_output_list_reservations_output_reservations(page)
.unwrap_or_default()
.into_iter()
})
}
}