IAcsClient is the Java client of aliyun-java-sdk-green, the SDK for Java. Before you use aliyun-java-sdk-green to make an API call, you must initialize an IAcsClient instance and modify the IClientProfile configurations as needed.

Usage notes

When you create an IAcsClient instance, you must specify the region and the AccessKey ID and AccessKey secret of your Alibaba Cloud account.
  • For more information about the supported regions, see Endpoint.
  • For more information about how to obtain the AccessKey ID and AccessKey secret of your Alibaba Cloud account, see Create an AccessKey pair.

Create an IAcsClient instance to moderate images, audios, videos, and text

The following regions are supported:
  • China (Shanghai): cn-shanghai
  • China (Beijing): cn-beijing
  • Singapore (Singapore): ap-southeast-1
  • US (Silicon Valley): us-west-1
Note Only specific algorithmic models are available in the Singapore (Singapore) and US (Silicon Valley) regions.
Use the following code to create an IAcsClient instance to moderate images, audios, videos, and text:
/**
      * Set the ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET parameters to the AccessKey ID and AccessKey secret of your Alibaba Cloud account, respectively.
      * Valid values of the REGION_ID parameter: cn-shanghai, cn-beijing, ap-southeast-1, and us-west-1. Other regions are not supported.
      * Security risks may arise if you log on with the AccessKey pair of an Alibaba Cloud account because the account has permissions on all API operations. We recommend that you log on as a Resource Access Management (RAM) user to call API operations or perform routine operations and maintenance (O&M).
      */
     String ALIYUN_ACCESS_KEY_ID = "<yourAccessKeyId>"
     String ALIYUN_ACCESS_KEY_SECRET = "<yourAccessKeySecret>";
     String REGION_ID = "cn-shanghai";

     IClientProfile profile = DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET);
     IAcsClient recognitionClient = new DefaultAcsClient(profile)

Create an IAcsClient instance to manage custom image libraries, term libraries, and text pattern libraries

Only the China (Shanghai) region is supported. The region ID is cn-shanghai. The server can automatically synchronize data if you initiate a request in a region other than the China (Shanghai) region.

Use the following code to create an IAcsClient instance to manage custom image libraries, term libraries, and text pattern libraries:
/**
      * Set the ALIYUN_ACCESS_KEY_ID and ALIYUN_ACCESS_KEY_SECRET parameters to the AccessKey ID and AccessKey secret of your Alibaba Cloud account, respectively.
      * Set the REGION_ID parameter to cn-shanghai. Other regions are not supported.
      * Security risks may arise if you log on with the AccessKey pair of an Alibaba Cloud account because the account has permissions on all API operations. We recommend that you log on as a RAM user to call API operations or perform routine O&M.
      */
     String ALIYUN_ACCESS_KEY_ID = "<yourAccessKeyId>"
     String ALIYUN_ACCESS_KEY_SECRET = "<yourAccessKeySecret>";
     String REGION_ID = "cn-shanghai";

     IClientProfile profile = DefaultProfile.getProfile(REGION_ID, ALIYUN_ACCESS_KEY_ID, ALIYUN_ACCESS_KEY_SECRET);
     IAcsClient managementClient = new DefaultAcsClient(profile)