Java Code Examples for com.aliyun.openservices.log.Client#setUserAgent()

The following examples show how to use com.aliyun.openservices.log.Client#setUserAgent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogProducer.java    From aliyun-log-java-producer with Apache License 2.0 6 votes vote down vote up
private Client buildClient(ProjectConfig projectConfig) {
  Client client =
      new Client(
          projectConfig.getEndpoint(),
          projectConfig.getAccessKeyId(),
          projectConfig.getAccessKeySecret(),
          serviceClient);
  String userAgent = projectConfig.getUserAgent();
  if (userAgent != null) {
    client.setUserAgent(userAgent);
  }
  String stsToken = projectConfig.getStsToken();
  if (stsToken != null) {
    client.setSecurityToken(stsToken);
  }
  return client;
}
 
Example 2
Source File: SlsClientProvider.java    From alibaba-flink-connectors with Apache License 2.0 5 votes vote down vote up
@Override
protected Client produceNormalClient(String accessId, String accessKey) {
	Client client = new Client(endPoint, accessId, accessKey);
	if (directMode){
		client.EnableDirectMode();
	}
	client.setUserAgent("Blink-ak" + "-" + String.valueOf(consumerGroup) + "-" +
						getHostName());
	return client;
}
 
Example 3
Source File: SlsClientProvider.java    From alibaba-flink-connectors with Apache License 2.0 5 votes vote down vote up
@Override
protected Client produceStsClient(String accessId, String accessKey, String securityToken) {
	Client client = new Client(endPoint, accessId, accessKey);
	client.setUserAgent("Blink-sts" + "-" + String.valueOf(consumerGroup) + "-" +
						getHostName());
	client.SetSecurityToken(securityToken);
	return client;
}
 
Example 4
Source File: ClientPool.java    From aliyun-log-producer-java with Apache License 2.0 5 votes vote down vote up
private Client buildClient(final ProjectConfig config) {
    Client client = new Client(config.endpoint, config.accessKeyId, config.accessKey);
    client.setUserAgent(producerConfig.userAgent);
    if (config.stsToken != null) {
        client.SetSecurityToken(config.stsToken);
    }
    return client;
}