Search in sources :

Example 1 with Credentials

use of com.jcabi.dynamo.Credentials in project wring by yegor256.

the class Dynamo method connect.

/**
 * Connect.
 * @return Region
 */
private static Region connect() {
    final String key = Manifests.read("Wring-DynamoKey");
    final Credentials creds = new Credentials.Simple(key, Manifests.read("Wring-DynamoSecret"));
    final Region region;
    if (key.startsWith("AAAAA")) {
        final String property = System.getProperty("dynamo.port");
        if (property == null) {
            throw new IllegalStateException("You're not supposed to run this test outside of Maven");
        }
        final int port = Integer.parseInt(property);
        region = new Region.Simple(new Credentials.Direct(creds, port));
        Logger.warn(Dynamo.class, "test DynamoDB at port #%d", port);
    } else {
        region = new Region.Prefixed(new ReRegion(new Region.Simple(creds)), "wring-");
    }
    Logger.info(Dynamo.class, "DynamoDB connected as %s", key);
    return region;
}
Also used : ReRegion(com.jcabi.dynamo.retry.ReRegion) ReRegion(com.jcabi.dynamo.retry.ReRegion) Region(com.jcabi.dynamo.Region) Credentials(com.jcabi.dynamo.Credentials)

Aggregations

Credentials (com.jcabi.dynamo.Credentials)1 Region (com.jcabi.dynamo.Region)1 ReRegion (com.jcabi.dynamo.retry.ReRegion)1