4 releases (breaking)

0.4.0 Jan 8, 2020
0.3.0 Jul 11, 2019
0.2.0 Mar 25, 2019
0.1.0 Mar 24, 2019

#8 in #adventure

MIT/Apache

53KB
1.5K SLoC

Adventure

docs.rs

Provides general utilities for the web requests, like exponential backoff and pagination.

Examples

use std::sync::Arc;

use adventure::prelude::*;
use futures::prelude::*;

use adventure_rusoto_ecs::AwsEcs;
use rusoto_core::Region;
use rusoto_ecs::{EcsClient, ListServicesRequest};

fn main() {
    let client = EcsClient::new(Region::default());
    let req = ListServicesRequest {
        cluster: Some("MyEcsCluster".to_owned()),
        ..Default::default()
    };

    tokio::run(

        // prepare a request
        AwsEcs::from(req)
            // backoff if server error is occured
            .retry()
            // repeat to retrieve all results
            .paginate(Arc::new(client))

            // compatible with futures
            .for_each(|page| {
                for service in page.service_arns.unwrap_or_else(Vec::new) {
                    println!("{}", service);
                }
                Ok(())
            })
            .or_else(|err| {
                eprintln!("Error occured: {}", err);
                Ok(())
            }),
    );
}

lib.rs:

A proof-of-concept crate to provides trait implementations of types in rusoto_ecs, to work with adventure.

Examples

let req = ListServicesRequest {
    cluster: Some("MyEcsCluster".to_owned()),
    ..Default::default()
};

AwsEcs::from(req)
    .retry()
    .paginate(Arc::new(client))

Dependencies

~16–30MB
~468K SLoC