Git Product home page Git Product logo

results-iterator-for-aws-java-sdk's Introduction

Results Iterator For AWS Java SDK

A library that handles iterating over results from the AWS Java SDK with minimal boilerplate. It also contains additional convenience functions that make the AWS Java SDKs even easier to work with.

Highlights

AWS allows applications to use certificates registered in AWS IoT to make direct calls to AWS services. Using this requires a small amount of setup but it is the best way to make sure hard-coded IAM credentials are not being shared.

SDK v2 support only!

Only the v2 SDK is supported now.

Dagger support

This library has Dagger modules that simplify the setup of AWS SDK clients and the classes that enable the iteration functions.

v2 Dagger helper module

Stream support

This library is designed to return streams. There is no need to worry about pagination as those details are all taken care of for you.

Example: Find all buckets you have access to that start with "sagemaker":

  ResultsIterator<Bucket> bucketIterator = new ResultsIterator<>(s3Client, ListBucketsRequest.class);
  List<Bucket> sageMakerBuckets = bucketIterator.stream()
                .filter(bucket -> bucket.name().startsWith("sagemaker"))
                .collect(Collectors.toList());

Multi-region S3 support

If you work with S3 buckets in different regions this library will automatically give you the correct, region-specific client:

Example: Get a region-specific S3 client for a bucket, regardless of your default region:

  S3Client regionSpecificS3Client = s3Helper.getRegionSpecificClientForBucket(bucket);

How do I include it in my Gradle project?

  1. Add the jitpack repo to the repositories section

    maven { url 'https://jitpack.io' }
    
  2. Add the dependency version (replace x.y.z with the appropriate version from the JitPack site)

    def resultsIteratorForAwsJavaSdkVersion = 'x.y.z'
    
  3. Add the dependency to the dependencies section

    compile "com.github.awslabs:results-iterator-for-aws-java-sdk:$resultsIteratorForAwsJavaSdkVersion"
    

How do I use it?

Check out an example in the IoT reference architectures repo.

What are some of the other features that are useful?

Automatic or manual configuration

If you're using Dagger you can use the V1HelperModule and HelperModule classes in your own components (AKA injectors) to get SDK clients and helper objects that are constructed with sane defaults.

If you need to configure the SDK client classes you can instead get a builder that is pre-populated with the default values that can all be overridden.

See the TestV1ResultsIterator and TestResultsIterator test classes to see how the normal classes are used.

The TestResultsIterator.listAll method shows how to use a builder provider to build an S3Client object that connects to a different region when a bucket is not located in the region that the default injected S3Client is configured for.

License

This library is licensed under the Apache 2.0 License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.