flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bowenli86 <...@git.apache.org>
Subject [GitHub] flink pull request #5171: [FLINK-8271][Kinesis connector] upgrade deprecated...
Date Wed, 03 Jan 2018 05:43:45 GMT
Github user bowenli86 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5171#discussion_r159362925
  
    --- Diff: flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java
---
    @@ -30,37 +30,44 @@
     import com.amazonaws.auth.EnvironmentVariableCredentialsProvider;
     import com.amazonaws.auth.SystemPropertiesCredentialsProvider;
     import com.amazonaws.auth.profile.ProfileCredentialsProvider;
    -import com.amazonaws.regions.Region;
    +import com.amazonaws.client.builder.AwsClientBuilder;
     import com.amazonaws.regions.Regions;
    -import com.amazonaws.services.kinesis.AmazonKinesisClient;
    +import com.amazonaws.services.kinesis.AmazonKinesis;
    +import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder;
     
     import java.util.Properties;
     
     /**
      * Some utilities specific to Amazon Web Service.
      */
     public class AWSUtil {
    +	/** Used for formatting Flink-specific user agent string when creating Kinesis client.
*/
    +	private static final String USER_AGENT_FORMAT = "Apache Flink %s (%s) Kinesis Connector";
     
     	/**
    -	 * Creates an Amazon Kinesis Client.
    +	 * Creates an AmazonKinesis client.
     	 * @param configProps configuration properties containing the access key, secret key,
and region
    -	 * @return a new Amazon Kinesis Client
    +	 * @return a new AmazonKinesis client
     	 */
    -	public static AmazonKinesisClient createKinesisClient(Properties configProps) {
    +	public static AmazonKinesis createKinesisClient(Properties configProps) {
     		// set a Flink-specific user agent
    -		ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
    -		awsClientConfig.setUserAgent("Apache Flink " + EnvironmentInformation.getVersion()
+
    -			" (" + EnvironmentInformation.getRevisionInformation().commitId + ") Kinesis Connector");
    +		ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig()
    +				.withUserAgentPrefix(String.format(USER_AGENT_FORMAT,
    --- End diff --
    
    @tzulitai Check out [AWS source code here](https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/ClientConfiguration.java#L467),
`setUserAgent` and `withUserAgentPrefix` are both calling `setUserAgentPrefix`


---

Mime
View raw message