注意:以下文档只适用于TOP接口,请谨慎使用!

文档中心 > 聚石塔

聚石塔OpenApi使用说明

更新时间:2024/07/29 访问次数:7584
  1. 只支持 SDK 调试,不支持阿里云 OpenApi Explorer 上页面调试。
  2. 与阿里云容器服务的API不是一回事


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 的最新版本:

https://s01.oss.sonatype.org/?spm=openapi-amp.sdkpublish.0.0.3c39281fDcklC8#nexus-search;quick~alibabacloud-retailcloud20180313


附件:API文档

20231221 更新内容(SDK version:2.0.24)

  • ListDeployConfig(支持获取普通非yaml配置的cpu、内存资源配置)

>文档下载地址

20220615 更新内容(SDK version:2.0.22)

  • RestartAppInstance(应用实例重启,仅支持轻容器应用);
  • UpdateNormalDeployConfig(更新非Yaml的部署配置,目前仅支持CPU内存配置);

>文档下载地址

20220509 更新内容(SDK version: 2.0.21)

  • OfflineAppEnvironment(下线应用环境)

>文档下载地址


一、聚石塔 AK/SK 获取

聚石塔 AK/SK 调用云产品 OpenAPI

二、Java SDK示例

设置Maven依赖

<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 SDK示例

安装SDK核心库依赖

如果您使用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

四、Go SDK示例

代码地址:https://github.com/alibabacloud-go/retailcloud-20180313/blob/master/README-CN.md

安装Go SDK

使用govendor
执行以下命令,安装阿里云Go SDK:
go get github.com/alibabacloud-go/retailcloud-20180313/v2

代码示例

官方 SDK 参考示例:https://github.com/aliyun/alibabacloud-go-sdk/blob/master/docs/Usage-CN.md#%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B

FAQ

关于此文档暂时还没有FAQ
返回
顶部