pub async fn list_shards(client: &Client, stream_name: &str) -> Result<Vec<Shard>, anyhow::Error> {
    let mut next_token = None;
    let mut all_shards = Vec::new();
    loop {
        let output = client
            .list_shards()
            .set_next_token(next_token)
            .stream_name(stream_name)
            .send()
            .await
            .context("fetching shard list")?;

        match output.shards {
            Some(shards) => {
                all_shards.extend(shards);
            }
            None => {
                return Err(anyhow::Error::msg(format!(
                    "kinesis stream {} does not contain any shards",
                    stream_name
                )));
            }
        }

        if output.next_token.is_some() {
            // Use the `next_token` field to paginate through Shards.
            next_token = output.next_token;
        } else {
            // When `next_token` is None, we've paginated through all of the Shards.
            break Ok(all_shards);
        }
    }
}
/// Wrapper around AWS Kinesis ListShards API.
///
/// Returns all shards in a given Kinesis stream, potentially paginating through
/// a list of shards (greater than 100) using the next_token request parameter.
///
/// Does not currently handle any ListShards errors, will return all errors
/// directly to the caller.
Wrapper around AWS Kinesis ListShards API.
Returns all shards in a given Kinesis stream, potentially paginating through
a list of shards (greater than 100) using the next_token request parameter.

Does not currently handle any ListShards errors, will return all errors
directly to the caller.
Wrapper around AWS Kinesis ListShards API . Returns all shards in a given Kinesis stream potentially paginating through a list of shards ( greater than 100 ) using the next_token request parameter . Does not currently handle any ListShards errors will return all errors directly to the caller .
pub async fn list_shards(client: &Client, stream_name: &str) -> Result<Vec<Shard>, anyhow::Error> {
    let mut next_token = None;
    let mut all_shards = Vec::new();
    loop {
        let output = client
            .list_shards()
            .set_next_token(next_token)
            .stream_name(stream_name)
            .send()
            .await
            .context("fetching shard list")?;
        match output.shards {
            Some(shards) => {
                all_shards.extend(shards);
            }
            None => {
                return Err(anyhow::Error::msg(format!(
                    "kinesis stream {} does not contain any shards",
                    stream_name
                )));
            }
        }
        if output.next_token.is_some() {
            // Use the `next_token` field to paginate through Shards.
            next_token = output.next_token;
        } else {
            // When `next_token` is None, we've paginated through all of the Shards.
            break Ok(all_shards);
        }
    }
}
pub async fn list_shards ( client : & Client , stream_name : & str ) -> Result < Vec < Shard > , anyhow :: Error > { let mut next_token = None ; let mut all_shards = Vec :: new ( ) ; loop { let output = client . list_shards ( ) . set_next_token ( next_token ) . stream_name ( stream_name ) . send ( ) . await . context ( " " ) ? ; match output . shards { Some ( shards ) => { all_shards . extend ( shards ) ; } None => { return Err ( anyhow :: Error :: msg ( format ! ( " " stream_name ) ) ) ; } } if output . next_token . is_some ( ) { // Use the `next_token` field to paginate through Shards. next_token = output . next_token ; } else { // When `next_token` is None, we've paginated through all of the Shards. break Ok ( all_shards ) ; } } }
Wrapper around AWS Kinesis ListShards API.
Wrapper around AWS Kinesis ListShards API .
client
&Client
stream_name
&str
client
&Client
stream_name
&str