This repository has been archived by the owner on Mar 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from agorapulse/feature/endpoint-configuration
endpoint configuration
- Loading branch information
Showing
32 changed files
with
303 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
13 changes: 13 additions & 0 deletions
13
...src/main/groovy/com/agorapulse/micronaut/aws/DefaultRegionAndEndpointConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.agorapulse.micronaut.aws | ||
|
||
import javax.annotation.Nullable | ||
|
||
/** | ||
* Default region and endpoint configuration. | ||
*/ | ||
class DefaultRegionAndEndpointConfiguration implements RegionAndEndpointConfiguration { | ||
|
||
@Nullable String region | ||
@Nullable String endpoint | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...-aws-sdk/src/main/groovy/com/agorapulse/micronaut/aws/RegionAndEndpointConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.agorapulse.micronaut.aws; | ||
|
||
import com.amazonaws.client.builder.AwsClientBuilder; | ||
import com.amazonaws.regions.AwsRegionProvider; | ||
|
||
import java.util.Optional; | ||
|
||
public interface RegionAndEndpointConfiguration { | ||
|
||
String getRegion(); | ||
|
||
String getEndpoint(); | ||
|
||
default <C, B extends AwsClientBuilder<B, C>> B configure(B builder, AwsRegionProvider awsRegionProvider) { | ||
String region = Optional.ofNullable(getRegion()).orElseGet(awsRegionProvider::getRegion); | ||
if (getEndpoint() != null) { | ||
builder.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(getEndpoint(), region)); | ||
} else { | ||
builder.setRegion(region); | ||
} | ||
return builder; | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...dk/src/main/groovy/com/agorapulse/micronaut/aws/cloudwatch/CloudWatchConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.agorapulse.micronaut.aws.cloudwatch | ||
|
||
import com.agorapulse.micronaut.aws.DefaultRegionAndEndpointConfiguration | ||
import com.amazonaws.services.cloudwatch.AmazonCloudWatch | ||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.annotation.ConfigurationProperties | ||
import io.micronaut.context.annotation.Requires | ||
|
||
import javax.inject.Named | ||
|
||
/** | ||
* Default simple storage service configuration. | ||
*/ | ||
@Named('default') | ||
@CompileStatic | ||
@ConfigurationProperties('aws.cloudwatch') | ||
@Requires(classes = AmazonCloudWatch) | ||
class CloudWatchConfiguration extends DefaultRegionAndEndpointConfiguration { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ws-sdk/src/main/groovy/com/agorapulse/micronaut/aws/dynamodb/DynamoDBConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.agorapulse.micronaut.aws.dynamodb | ||
|
||
import com.agorapulse.micronaut.aws.DefaultRegionAndEndpointConfiguration | ||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDB | ||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.annotation.ConfigurationProperties | ||
import io.micronaut.context.annotation.Requires | ||
|
||
import javax.inject.Named | ||
|
||
/** | ||
* Default simple storage service configuration. | ||
*/ | ||
@Named('default') | ||
@CompileStatic | ||
@ConfigurationProperties('aws.dynamodb') | ||
@Requires(classes = DynamoDB) | ||
class DynamoDBConfiguration extends DefaultRegionAndEndpointConfiguration { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...k/src/main/groovy/com/agorapulse/micronaut/aws/kinesis/DefaultKinesisConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.agorapulse.micronaut.aws.kinesis | ||
|
||
import com.amazonaws.services.kinesis.AmazonKinesis | ||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.annotation.ConfigurationProperties | ||
import io.micronaut.context.annotation.Requires | ||
|
||
import javax.inject.Named | ||
|
||
/** | ||
* Default Kinesis configuration, published with <code>default</code> named qualifier. | ||
*/ | ||
@Named('default') | ||
@CompileStatic | ||
@ConfigurationProperties('aws.kinesis') | ||
@Requires(classes = AmazonKinesis) | ||
class DefaultKinesisConfiguration extends KinesisConfiguration { | ||
|
||
} |
11 changes: 3 additions & 8 deletions
11
...-aws-sdk/src/main/groovy/com/agorapulse/micronaut/aws/kinesis/KinesisConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...oovy/com/agorapulse/micronaut/aws/kinesis/worker/DefaultKinesisClientConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.agorapulse.micronaut.aws.kinesis.worker | ||
|
||
import com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibConfiguration | ||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.annotation.ConfigurationProperties | ||
import io.micronaut.context.annotation.Requires | ||
import io.micronaut.context.annotation.Value | ||
|
||
import javax.inject.Named | ||
|
||
/** | ||
* Default configuration for Kinesis listener. | ||
*/ | ||
@CompileStatic | ||
@Named('default') | ||
@ConfigurationProperties('aws.kinesis.listener') | ||
@Requires(classes = KinesisClientLibConfiguration) | ||
@SuppressWarnings('NoWildcardImports') | ||
class DefaultKinesisClientConfiguration extends KinesisClientConfiguration { | ||
|
||
DefaultKinesisClientConfiguration( | ||
@Value('${aws.kinesis.application.name:}') String applicationName, | ||
@Value('${aws.kinesis.worker.id:}') String workerId | ||
) { | ||
super(applicationName, workerId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...in/groovy/com/agorapulse/micronaut/aws/s3/DefaultSimpleStorageServiceConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.agorapulse.micronaut.aws.s3 | ||
|
||
import com.amazonaws.services.s3.AmazonS3 | ||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.annotation.ConfigurationProperties | ||
import io.micronaut.context.annotation.Requires | ||
|
||
import javax.inject.Named | ||
|
||
/** | ||
* Default simple storage service configuration. | ||
*/ | ||
@Named('default') | ||
@CompileStatic | ||
@ConfigurationProperties('aws.s3') | ||
@Requires(classes = AmazonS3) | ||
class DefaultSimpleStorageServiceConfiguration extends SimpleStorageServiceConfiguration { | ||
|
||
} |
11 changes: 3 additions & 8 deletions
11
.../src/main/groovy/com/agorapulse/micronaut/aws/s3/SimpleStorageServiceConfiguration.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.