调用CreateAppGroup创建应用分组。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
AppName | String | 是 | DocTest |
应用名称。 |
GroupId | String | 是 | TestSchedulerx.defaultGroup |
应用ID,在控制台的应用管理页面中获取。 |
Namespace | String | 是 | adcfc35d-e2fe-4fe9-bbaa-20e90ffc**** |
命名空间ID,在控制台的命名空间页面中获取。 |
NamespaceName | String | 是 | Test |
命名空间名称。 |
RegionId | String | 是 | cn-hangzhou |
地域ID。 |
NamespaceSource | String | 否 | schedulerx |
特殊第三方才需要填写。 |
Description | String | 否 | Test |
应用描述。 |
MaxJobs | Integer | 否 | 1000 |
最大任务数。 |
AlarmJson | String | 否 | AlarmTest |
告警JSON。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Code | Integer | 200 |
返回码 |
Data | Struct |
任务分组信息 |
|
AppGroupId | Long | 6607 |
任务分组ID |
Message | String | Your request is denied as lack of ssl protect. |
错误信息,仅错误时返回错误信息。 |
RequestId | String | 883AFE93-FB03-4FA9-A958-E750C6DE120C |
请求唯一ID |
Success | Boolean | true |
创建应用是否成功。取值如下:
|
示例
请求示例
http(s)://[Endpoint]/?Action=CreateAppGroup
&AppName=DocTest
&GroupId=TestSchedulerx.defaultGroup
&Namespace=adcfc35d-e2fe-4fe9-bbaa-20e90ffc****
&NamespaceName=Test
&<公共请求参数>
正常返回示例
XML
格式
<CreateAppGroupResponse>
<RequestId>883AFE93-FB03-4FA9-A958-E750C6DE120C</RequestId>
<Message>Your request is denied as lack of ssl protect.</Message>
<Data>
<AppGroupId>6607</AppGroupId>
</Data>
<Code>200</Code>
<Success>true</Success>
</CreateAppGroupResponse>
JSON
格式
{
"RequestId": "883AFE93-FB03-4FA9-A958-E750C6DE120C",
"Message": "Your request is denied as lack of ssl protect.",
"Data": {
"AppGroupId": 6607
},
"Code": 200,
"Success": true
}
示例Demo
package com.alibaba.schedulerx.pop;
import com.alibaba.schedulerx.common.util.JsonUtil;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.schedulerx2.model.v20190430.CreateAppGroupRequest;
import com.aliyuncs.schedulerx2.model.v20190430.CreateAppGroupResponse;
public class TestCreateAppGroup {
public static void main(String[] args) throws Exception {
// OpenAPI的接入点,具体查看上表支持地域列表以及购买机器地域填写。
String regionId = "cn-shanghai";
//鉴权使用的AccessKeyId,由阿里云官网控制台获取。
String accessKeyId = "<yourAccessKeyId>";
//鉴权使用的AccessKeySecret,由阿里云官网控制台获取。
String accessKeySecret = "<yourAccessKeySecret>";
//产品名称
String productName ="schedulerx2";
//对照支持地域列表选择Domain填写。
String domain ="schedulerx.cn-shanghai.aliyuncs.com";
//构建OpenAPI客户端。
DefaultProfile.addEndpoint(regionId, productName, domain);
DefaultProfile defaultProfile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(defaultProfile);
CreateAppGroupRequest request = new CreateAppGroupRequest();
request.setNamespace("xxxxxx");
request.setNamespaceName("xxxx");
request.setAppName("xxxx");
request.setDescription("xxx");
request.setGroupId("xxx");
//发送请求。
CreateAppGroupResponse response = client.getAcsResponse(request);
if (!response.getSuccess()) {
System.out.println(response.getMessage());
System.out.println("createApp: "+response.getRequestId());
} else {
System.out.println(JsonUtil.toJson(response));
}
}
}