文档

CreateAppGroup - 创建应用分组

更新时间:
一键部署

创建应用分组,返回appKey。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
AppNamestring

应用名称。

DocTest
Namespacestring

命名空间ID,在控制台的命名空间页面中获取。

adcfc35d-e2fe-4fe9-bbaa-20e90ffc****
NamespaceSourcestring

暂不支持,无须填写。

schedulerx
GroupIdstring

应用ID,在控制台的应用管理页面中获取。

TestSchedulerx.defaultGroup
RegionIdstring

地域ID。

cn-hangzhou
Descriptionstring

应用描述。

Test
MaxJobsinteger

最大任务数。

1000
NamespaceNamestring

命名空间名称。

Test
AppKeystring

应用Appkey。

adcExHZviLcl****
MonitorConfigJsonstring

报警配置JSON字段。关于此字段的详细说明参见下文关于请求参数的补充说明

{"sendChannel":"sms,ding"}
MonitorContactsJsonstring

报警联系人JSON格式。

[{"userName":"张三","userPhone":"89756******"},{"userName":"李四","ding":"http://www.example.com"}]
ScheduleBusyWorkersboolean

是否调度繁忙机器。

false
EnableLogboolean

是否开启日志。

  • true:开启

  • false:关闭

true
AppTypeinteger

应用类型。

  • 1、普通应用。
  • 2、k8s应用。
1

关于请求参数的补充说明

报警通道如下,配置多个逗号分隔。

  • webhook:ding

  • 短信:sms

  • 邮件:mail

  • 电话:phone

例如:{"sendChannel":"ding,sms,mail,phone"}

返回参数

名称类型描述示例值
object
Codeinteger

返回码。

200
Messagestring

错误信息,仅错误时返回错误信息。

Your request is denied as lack of ssl protect.
RequestIdstring

请求唯一ID。

883AFE93-FB03-4FA9-A958-E750C6DE120C
Successboolean

创建应用是否成功。取值如下:

  • true:创建应用成功。
  • false:创建应用失败。
true
Dataobject

任务分组信息。

AppGroupIdlong

任务分组ID。

6607
AppKeystring

应用AppKey。

adcExHZviL******

示例

正常返回示例

JSON格式

{
  "Code": 200,
  "Message": "Your request is denied as lack of ssl protect.",
  "RequestId": "883AFE93-FB03-4FA9-A958-E750C6DE120C",
  "Success": true,
  "Data": {
    "AppGroupId": 6607,
    "AppKey": "adcExHZviL******"
  }
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2022-01-13OpenAPI 入参发生变更,OpenAPI 返回结构发生变更
变更项变更内容
入参OpenAPI 入参发生变更
    新增入参:AppKey
    新增入参:MonitorConfigJson
    新增入参:MonitorContactsJson
出参OpenAPI 返回结构发生变更

示例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));
        }
    }
    
}
  • 本页导读 (1)
文档反馈