阅读192 返回首页    go 技术社区[云栖]


CreateMachineGroup__Logtail机器组相关接口_API-Reference_日志服务-阿里云

用户根据需求创建一组机器,用以日志收集下发配置。

示例:

POST /machinegroups

请求语法

POST /machinegroups HTTP/1.1
Authorization: <AuthorizationString> 
Content-Type:application/json
Content-Length:<Content Length>
Content-MD5<:<Content MD5>
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1


{
    "groupName" : "testgroup",
    "groupType" : "",
    "groupAttribute" : {
        "externalName" : "testgroup",
        "groupTopic": "testgrouptopic"
    },
    "machineIdentifyType" : "ip",
    "machineList" : [
        "test-ip1",
        "test-ip2"
    ]

}

请求参数

Body参数:

属性名称 类型 是否必须 描述
groupName string 机器分组名称,Project下唯一
groupType string 机器分组类型,默认为空
machineIdentifyType string 机器标识类型,分为ip和userdefined两种
groupAttribute object 机器分组的属性,默认为空
machineList array 具体的机器标识,可以是ip或userdefined-id

groupAttribute说明如下:

属性名称 类型 是否必须 描述
groupTopic string 机器分组的topic,默认为空
externalName string 机器分组所依赖的外部管理标识,默认为空

请求头

无特有请求头,关于Log Service API的公共请求头请参考公共请求头

响应头

无特有响应头,关于Log Service API的公共响应头请参考公共响应头

响应元素

HTTP状态码返回200

错误码

除了返回Log Service API的通用错误码,还可能返回如下特有错误码:

HTTP状态码 ErrorCode ErrorMessage
400 GroupAlreadyExist group {GroupName} already exist
400 InvalidParameter invalid group resource json
500 InternalServerError Internal server error

细节描述

示例

请求示例:
POST /machinegroups HTTP/1.1
Header :
{
    "x-log-apiversion": "0.6.0",
    "Authorization": "LOG 94to3z418yupi6ikawqqd370:aws39CB5OUyx39BjQ5bW3G/zBv4=",
    "Host": "ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
    "Date": "Tue, 10 Nov 2015 17:57:33 GMT",
    "Content-Length": "187",
    "x-log-signaturemethod": "hmac-sha1",
    "Content-MD5": "82033D507DEAAD72067BB58DFDCB590D",
    "User-Agent": "sls-java-sdk-v-0.6.0",
    "Content-Type": "application/json",
    "x-log-bodyrawsize": "0"
}
Body :
{
    "groupName": "test-machine-group",
    "groupType": "",
    "machineIdentifyType": "ip",
    "groupAttribute":     {
        "groupTopic": "testtopic",
        "externalName": "testgroup"
    },
    "machineList":     [
        "127.0.0.1",
        "127.0.0.2"
    ]
}
响应示例:
HTTP/1.1 200 OK
Header :
{
    "Date": "Tue, 10 Nov 2015 17:57:33 GMT",
    "Content-Length": "0",
    "x-log-requestid": "5642300D99248CB76D005D36",
    "Connection": "close",
    "Server": "nginx/1.6.1"
}

最后更新:2016-11-23 16:04:02

  上一篇:go GetHistograms__日志库相关接口_API-Reference_日志服务-阿里云
  下一篇:go DeleteMachineGroup__Logtail机器组相关接口_API-Reference_日志服务-阿里云