获取App信息
更新时间:
接口
getApp
参数
| 参数 | 类型 | 是否必需 | 说明 |
|---|---|---|---|
| appName | String | 是 | App名称。 |
| scope | String | 否 | 可以为Public或Private。如果为Public,那么代表查询公共App;如果为Private或者不指定,那么代表查询私有App。 |
返回值
调用成功后返回一个 GetAppResponse 实例, 通过 getApp() 得到 App ,返回的 APP 属性具体信息参考 获取APP信息。调用失败后,抛出异常: ClientException。
例子
Java 源码:
import com.aliyuncs.batchcompute.main.v20151111.*;import com.aliyuncs.batchcompute.model.v20151111.*;import com.aliyuncs.batchcompute.pojo.v20151111.*;import com.aliyuncs.exceptions.ClientException;public class GetApp {static String ACCESS_KEY_ID = "xxx"; //这里填写您的 AccessKeyIdstatic String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecretstatic String REGION_ID = "cn-xx"; //这里填写 regionstatic String appName = "JavaSdkApp";public static void main(String[] args) {BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);try {GetAppResponse getAppResponse = client.getApp(appName);App app = getAppResponse.getApp();System.out.println("AppName: " + app.getName());System.out.println("AppDesc: " + app.getDescription());System.out.println("RequestId: " + getAppResponse.getRequestId());System.out.println("StatusCode: " + getAppResponse.getStatusCode());} catch (ClientException e) {e.printStackTrace();//创建失败}}}
执行结果:
{AppName: JavaSdkAppAppDesc: JavaSdkAppRequestId: nullStatusCode: 200}
该文章对您有帮助吗?