获取App所有版本号

接口

getAppRevisions

参数

参数 类型 是否必需 说明
appName String App名称。

返回值

调用成功后返回一个 GetAppRevisionsResponse 实例, 通过 getAppRevisions 得到 AppRevisions 列表;调用失败后,抛出异常: ClientException

AppRevision 的属性

参数名称 类型 描述
revision number App资源的版本号
updateTime string App资源对于版本的修改时间

例子

Java 源码:

  1. import com.aliyuncs.batchcompute.main.v20151111.*;
  2. import com.aliyuncs.batchcompute.model.v20151111.*;
  3. import com.aliyuncs.batchcompute.pojo.v20151111.*;
  4. import com.aliyuncs.exceptions.ClientException;
  5. import java.util.List;
  6. public class GetAppRevisions {
  7. static String ACCESS_KEY_ID = ""; //这里填写您的 AccessKeyId
  8. static String ACCESS_KEY_SECRET = ""; //这里填写您的 AccessKeySecret
  9. static String REGION_ID = "cn-xxx"; //这里填写 region
  10. static String appName = "JavaSdkApp";
  11. public static void main(String[] args) {
  12. BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
  13. try {
  14. GetAppRevisionsResponse getAppRevisionsResponse = client.getAppRevisions(appName);
  15. List<AppRevision> appRevisions = getAppRevisionsResponse.getAppRevisions();
  16. for (int i = 0; i < appRevisions.size(); i++){
  17. AppRevision appRevision = appRevisions.get(i);
  18. System.out.println("appVersion: " + appRevision.getRevision());
  19. System.out.println("appUpdateTime: " + appRevision.getUpdateTime());
  20. }
  21. System.out.println("RequestId: " + getAppRevisionsResponse.getRequestId());
  22. System.out.println("StatusCode: " + getAppRevisionsResponse.getStatusCode());
  23. } catch (ClientException e) {
  24. e.printStackTrace();
  25. //创建失败
  26. }
  27. }
  28. }

执行结果

  1. {
  2. appVersion: 0
  3. appUpdateTime: Tue Nov 13 11:27:47 CST 2018
  4. appVersion: 1
  5. appUpdateTime: Tue Nov 13 14:42:18 CST 2018
  6. appVersion: 2
  7. appUpdateTime: Tue Nov 13 14:43:12 CST 2018
  8. RequestId: null
  9. StatusCode: 200
  10. }