DefaultProfile.addEndpoint("cn-hangzhou", "retailcloud", "retailcloud.aliyuncs.com")
注意:这里是api的region,和聚石塔应用或者云产品的地域不一样,这里一定要设置cn-hangzhou。
SDK:
Python:
https://pypi.org/project/alibabacloud-retailcloud20180313/
python源码地址:https://github.com/aliyun/alibabacloud-python-sdk/tree/master/retailcloud-20180313
Java
<!-- https://s01.oss.sonatype.org/?spm=openapi-amp.sdkpublish.0.0.3c39281fDcklC8#nexus-search;quick~alibabacloud-retailcloud20180313 --> <dependency> <groupId>com.aliyun</groupId> <artifactId>alibabacloud-retailcloud20180313</artifactId> <version>${retialcloud.latest.version}</version> </dependency>
以 JAVA SDK 为例,在 maven 仓库中看 SDK 的最新版本:
附件:API文档
20231221 更新内容(SDK version:2.0.24)
20220615 更新内容(SDK version:2.0.22)
20220509 更新内容(SDK version: 2.0.21)
<dependency> <groupId>com.aliyun</groupId> <artifactId>aliyun-java-sdk-core</artifactId> <version>4.5.0</version> </dependency> <dependency> <groupId>com.aliyun</groupId> <artifactId>alibabacloud-retailcloud20180313</artifactId> <version>2.0.23</version> </dependency>
import com.aliyun.auth.credentials.Credential; import com.aliyun.auth.credentials.provider.StaticCredentialProvider; import com.aliyun.sdk.service.retailcloud20180313.AsyncClient; import com.aliyun.sdk.service.retailcloud20180313.models.DescribeClusterDetailRequest; import com.aliyun.sdk.service.retailcloud20180313.models.DescribeClusterDetailRequest.Builder; import com.aliyun.sdk.service.retailcloud20180313.models.DescribeClusterDetailResponse; import darabonba.core.client.ClientOverrideConfiguration; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; public class JstApi { public static void main(String[] args) throws ExecutionException, InterruptedException { //设置client StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder() .accessKeyId("<your-accessKeyId>") .accessKeySecret("<your-accessKeySecret>") .build()); AsyncClient client = AsyncClient.builder() .region("cn-hangzhou") .credentialsProvider(provider) .overrideConfiguration( ClientOverrideConfiguration.create() .setEndpointOverride("retailcloud.aliyuncs.com") ) .build(); //构造请求,这里以查询集群详情为例 Builder builder = DescribeClusterDetailRequest.create().toBuilder(); DescribeClusterDetailRequest request = builder.clusterInstanceId("clusterInstanceId").build(); //发起调用 CompletableFuture<DescribeClusterDetailResponse> future = client.describeClusterDetail(request); DescribeClusterDetailResponse response = future.get(); // System.out.println(new Gson().toJson(resp)); client.close(); } }
如果您使用Python 2.x,执行以下命令 pip install aliyun-python-sdk-cs 如果您使用Python 3.x,执行以下命令 pip install aliyun-python-sdk-core-v3
# Python 2 pip install alibabacloud_retailcloud20180313_py2 # python 3 pip install alibabacloud-retailcloud20180313
官方 SDK 参考示例:https://github.com/aliyun/alibabacloud-python-sdk/blob/master/docs/0-Usage-EN.md#quick-examples
代码地址:https://github.com/alibabacloud-go/retailcloud-20180313/blob/master/README-CN.md
使用govendor 执行以下命令,安装阿里云Go SDK: go get github.com/alibabacloud-go/retailcloud-20180313/v2