文档

获取App信息

更新时间:

接口

getApp

参数

参数 类型 是否必需 说明
appName String App名称。
scope String 可以为Public或Private。如果为Public,那么代表查询公共App;如果为Private或者不指定,那么代表查询私有App。

返回值

调用成功后返回一个 GetAppResponse 实例, 通过 getApp() 得到 App ,返回的 APP 属性具体信息参考 获取APP信息。调用失败后,抛出异常: ClientException。

例子

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. public class GetApp {
  6. static String ACCESS_KEY_ID = "xxx"; //这里填写您的 AccessKeyId
  7. static String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecret
  8. static String REGION_ID = "cn-xx"; //这里填写 region
  9. static String appName = "JavaSdkApp";
  10. public static void main(String[] args) {
  11. BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
  12. try {
  13. GetAppResponse getAppResponse = client.getApp(appName);
  14. App app = getAppResponse.getApp();
  15. System.out.println("AppName: " + app.getName());
  16. System.out.println("AppDesc: " + app.getDescription());
  17. System.out.println("RequestId: " + getAppResponse.getRequestId());
  18. System.out.println("StatusCode: " + getAppResponse.getStatusCode());
  19. } catch (ClientException e) {
  20. e.printStackTrace();
  21. //创建失败
  22. }
  23. }
  24. }

执行结果:

  1. {
  2. AppName: JavaSdkApp
  3. AppDesc: JavaSdkApp
  4. RequestId: null
  5. StatusCode: 200
  6. }
  • 本页导读 (0)
文档反馈