CreateMachineGroup

Last Updated: Mar 31, 2017

You can create a group of machines to collect logs and deliver configuration.

Example:

POST /machinegroups

Request syntax

  1. POST /machinegroups HTTP/1.1
  2. Authorization: <AuthorizationString>
  3. Content-Type:application/json
  4. Content-Length:<Content Length>
  5. Content-MD5<:<Content MD5>
  6. Date: <GMT Date>
  7. Host: <Project Endpoint>
  8. x-log-apiversion: 0.6.0
  9. x-log-signaturemethod: hmac-sha1
  10. {
  11. "groupName" : "testgroup",
  12. "groupType" : "",
  13. "groupAttribute" : {
  14. "externalName" : "testgroup",
  15. "groupTopic": "testgrouptopic"
  16. },
  17. "machineIdentifyType" : "ip",
  18. "machineList" : [
  19. "test-ip1",
  20. "test-ip2"
  21. ]
  22. }

Request parameters

Body parameters:

Name Type Required or Not Description
groupName string Yes The machine group name, which is unique under a project
groupType string No The machine group type, which is empty by default
machineIdentifyType string Yes The machine identifier type, including IP and userdefined
groupAttribute object Yes The machine group attribute, which is empty by default
machineList array Yes The specific machine ID, which can be an IP address or a user-defined ID

Group attributes are described as follows:

Name Type Required or Not Description
groupTopic string No The topic of a machine group, which is empty by default
externalName string No The external management ID, which is empty by default

Request header

No special request header is available. For details about the public request header of the log service API, refer to Public Request Header.

Response header

No special response header is available. For details about the public response header of the log service API, refer to Public Response Header.

Response element

The system returns the HTTP status code 200.

Error code

I addition to general error codes of the log service API, the following special error codes may be returned:

HTTP Status Code Error Code Error Message
400 GroupAlreadyExist group {GroupName} already exist
400 InvalidParameter invalid group resource json
500 InternalServerError Internal server error

Detailed description

None

Example

Request example:
  1. POST /machinegroups HTTP/1.1
  2. Header :
  3. {
  4. "x-log-apiversion": "0.6.0",
  5. "Authorization": "LOG 94to3z418yupi6ikawqqd370:aws39CB5OUyx39BjQ5bW3G/zBv4=",
  6. "Host": "ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
  7. "Date": "Tue, 10 Nov 2015 17:57:33 GMT",
  8. "Content-Length": "187",
  9. "x-log-signaturemethod": "hmac-sha1",
  10. "Content-MD5": "82033D507DEAAD72067BB58DFDCB590D",
  11. "User-Agent": "sls-java-sdk-v-0.6.0",
  12. "Content-Type": "application/json",
  13. "x-log-bodyrawsize": "0"
  14. }
  15. Body :
  16. {
  17. "groupName": "test-machine-group",
  18. "groupType": "",
  19. "machineIdentifyType": "ip",
  20. "groupAttribute": {
  21. "groupTopic": "testtopic",
  22. "externalName": "testgroup"
  23. },
  24. "machineList": [
  25. "127.0.0.1",
  26. "127.0.0.2"
  27. ]
  28. }
Response example:
  1. HTTP/1.1 200 OK
  2. Header :
  3. {
  4. "Date": "Tue, 10 Nov 2015 17:57:33 GMT",
  5. "Content-Length": "0",
  6. "x-log-requestid": "5642300D99248CB76D005D36",
  7. "Connection": "close",
  8. "Server": "nginx/1.6.1"
  9. }
Thank you! We've received your feedback.