创建应用分组,返回AppKey。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | CreateAppGroup |
系统规定参数。取值:CreateAppGroup。 |
| AppName | String | 是 | DocTest |
应用名称。 |
| Namespace | String | 是 | adcfc35d-e2fe-4fe9-bbaa-20e90ffc**** |
命名空间ID,在控制台的命名空间页面中获取。 |
| NamespaceSource | String | 否 | schedulerx |
暂不支持,无须填写。 |
| GroupId | String | 是 | TestSchedulerx.defaultGroup |
应用ID,在控制台的应用管理页面中获取。 |
| RegionId | String | 是 | cn-hangzhou |
地域ID。 |
| Description | String | 否 | Test |
应用描述。 |
| MaxJobs | Integer | 否 | 1000 |
最大任务数。 |
| NamespaceName | String | 是 | Test |
命名空间名称。 |
| AppKey | String | 否 | adcExHZviLcl**** |
应用Appkey。 |
| MonitorConfigJson | String | 否 | {"sendChannel":"sms,ding"} |
报警配置JSON字段。关于此字段的详细说明参见下文关于请求参数的补充说明。 |
| MonitorContactsJson | String | 否 | [{"userName":"张三","userPhone":"89756******"},{"userName":"李四","ding":"http://www.example.com"}] |
报警联系人JSON格式。 |
| ScheduleBusyWorkers | Boolean | 否 | false |
是否调度繁忙机器。 |
关于请求参数的补充说明
报警通道如下,配置多个逗号分隔。
- webhook:ding
- 短信:sms
- 邮件:mail
- 电话:phone
例如:{"sendChannel":"ding,sms,mail,phone"}
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Code | Integer | 200 |
返回码。 |
| Message | String | Your request is denied as lack of ssl protect. |
错误信息,仅错误时返回错误信息。 |
| RequestId | String | 883AFE93-FB03-4FA9-A958-E750C6DE120C |
请求唯一ID。 |
| Success | Boolean | true |
创建应用是否成功。取值如下:
|
| Data | Object |
任务分组信息。 |
|
| AppGroupId | Long | 6607 |
任务分组ID。 |
| AppKey | String | adcExHZviL****** |
应用AppKey。 |
示例
请求示例
http(s)://[Endpoint]/?Action=CreateAppGroup
&AppName=DocTest
&GroupId=TestSchedulerx.defaultGroup
&Namespace=adcfc35d-e2fe-4fe9-bbaa-20e90ffc****
&NamespaceName=Test
&<公共请求参数>
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/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格式
HTTP/1.1 200 OK
Content-Type:application/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));
}
}
}