/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.beam.sdk.io.aws.options;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import org.apache.beam.sdk.options.Default;
import org.apache.beam.sdk.options.DefaultValueFactory;
import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.options.Validation;

/**
 * Options used to configure Amazon Web Services specific options such as credentials and region.
 */
public interface AwsOptions extends PipelineOptions {

  /**
   * AWS region used by the AWS client.
   */
  @Description("AWS region used by the AWS client")
  @Validation.Required
  String getAwsRegion();
  void setAwsRegion(String value);

  /**
   * The AWS service endpoint used by the AWS client.
   */
  @Description("AWS service endpoint used by the AWS client")
  String getAwsServiceEndpoint();
  void setAwsServiceEndpoint(String value);

  /**
   * The credential instance that should be used to authenticate against AWS services. Refer to
   * {@link DefaultAWSCredentialsProviderChain} Javadoc for usage help.
   */
  @Description("The credential instance that should be used to authenticate against AWS services. "
      + "Refer to DefaultAWSCredentialsProviderChain Javadoc for usage help.")
  @Default.InstanceFactory(AwsUserCredentialsFactory.class)
  AWSCredentialsProvider getAwsCredentialsProvider();
  void setAwsCredentialsProvider(AWSCredentialsProvider value);

  /**
   * Attempts to load AWS credentials.
   */
  class AwsUserCredentialsFactory implements DefaultValueFactory<AWSCredentialsProvider> {

    @Override
    public AWSCredentialsProvider create(PipelineOptions options) {
      return DefaultAWSCredentialsProviderChain.getInstance();
    }
  }
}

@@ -1853,16 +1853,130 @@
 ervices.
+%0A   * The option value must contain a %22@type%22 field and an AWS Credentials Provider class%0A   * as the field value.
  Refer t
@@ -1976,21 +1976,16 @@
 Refer to
-%0A   *
  %7B@link 
@@ -2023,32 +2023,37 @@
 ain%7D Javadoc for
+%0A   *
  usage help.%0A   
@@ -2049,22 +2049,267 @@
 e help.%0A
+   * %3Cp%3E%0A   * For example, to specify the AWS key ID and secret, specify the following:%0A   * %3Ccode%3E%0A   * %7B%22@type%22 : %22AWSStaticCredentialsProvider%22, %22awsAccessKeyId%22 : %22key_id_value%22,%0A   * %22awsSecretKey%22 : %22secret_value%22%7D%0A   * %3C/code%3E%0A   * %3C/p%3E%0A
    */%0A
+ 
   @Descr
@@ -2368,32 +2368,48 @@
 to authenticate 
+%22%0A           + %22
 against AWS serv
@@ -2418,89 +2418,456 @@
 es. 
-%22%0A      + %22Refer to DefaultAWSCredentialsProviderChain Javadoc for usage help.
+The option value must contain %5C%22@type%5C%22 field %22%0A           + %22and an AWS Credentials Provider class name as the field value. %22%0A           + %22Refer to DefaultAWSCredentialsProviderChain Javadoc for usage help. %22%0A           + %22For example, to specify the AWS key ID and secret, specify the following: %22%0A           + %22%7B%5C%22@type%5C%22: %5C%22AWSStaticCredentialsProvider%5C%22, %22%0A           + %22%5C%22awsAccessKeyId%5C%22:%5C%22%3Ckey_id%3E%5C%22, %5C%22awsSecretKey%5C%22:%5C%22%3Csecret_key%3E%5C%22%7D
 %22)%0A
+ 
   @D
@@ -2924,16 +2924,17 @@
 lass)%0A  
+ 
 AWSCrede
@@ -2973,24 +2973,25 @@
 Provider();%0A
+ 
   void setAw

Enhance awsCredentialsProvider option description