aromanenko-dev commented on a change in pull request #16405:
URL: https://github.com/apache/beam/pull/16405#discussion_r777474322
##########
File path:
sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsOptions.java
##########
@@ -33,11 +34,23 @@
/** AWS region used by the AWS client. */
@Description("AWS region used by the AWS client")
- @Validation.Required
+ @Default.InstanceFactory(AwsRegionFactory.class)
String getAwsRegion();
void setAwsRegion(String value);
+ /** Attempt to load default region. */
+ class AwsRegionFactory implements DefaultValueFactory<String> {
+ @Override
+ public String create(PipelineOptions options) {
+ try {
+ return new DefaultAwsRegionProviderChain().getRegion();
+ } catch (SdkClientException e) {
+ return null;
Review comment:
Should we print out an error here? Can it cause NPE later?
##########
File path:
sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/options/AwsOptions.java
##########
@@ -33,11 +34,23 @@
/** AWS region used by the AWS client. */
@Description("AWS region used by the AWS client")
- @Validation.Required
+ @Default.InstanceFactory(AwsRegionFactory.class)
String getAwsRegion();
void setAwsRegion(String value);
+ /** Attempt to load default region. */
+ class AwsRegionFactory implements DefaultValueFactory<String> {
+ @Override
+ public String create(PipelineOptions options) {
+ try {
+ return new DefaultAwsRegionProviderChain().getRegion();
+ } catch (SdkClientException e) {
+ return null;
Review comment:
Should we print out an error here?
Can it cause NPE later?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]