REST API for Groups
- Create Group
- Read Group
- Delete Group
- List Groups
- List Group Nodes
- List Group Origins
- List Group Edges
- Launch New Origin
- Read Group Statistics
Create Group
Description
Create a new node group.
REQUEST
- URI :
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup?accessToken=<accessToken>
- Method: POST
- Data: JSON
{ "regions": [ "<region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>" }
RESPONSE
- Failure: HTTP CODE
400
or404
- Data:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
201
- Data:
{ "id": <autogen-group-id>, "name": "<autogen-group-name>", "originConnections": <min-origin-connections>, "regions": [ "<region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> }
Example
REQUEST
- URI:
http://{host}:5080/streammanager/api/2.0/admin/nodegroup?accessToken=xyz123
- Method: POST
- Data : JSON
{ "regions": [ "us-central1", "us-east1" ], "launchConfig": "default", "scalePolicy": "default" }
RESPONSE
- Success: HTTP CODE
201
- Data:
{ "id": 2, "name": "group-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f", "originConnections": 0, "regions": [ "us-central1", "us-east1" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": 1452595891000 }
regions
The geographical regions where you would like the nodes to be created. Stream Manager usually lets the Autoscaler use this list in a round-robin style. You can find a list of available Google Cloud regions here or a list of available AWS regions here.
originConnections
An attribute reserved for future use. Currently this is always set to zero, whena new group is created.
launchConfig
Name of the launch configuration to be used for launching each new instance in the nodegroup. Usually this implies the consistent machine configuration for a group. A launch configuration defines your machine type, max connections, etc. for each instance type (origin and edge).
scalePolicy
Name of the scale policy to be used by Autoscaler to launch new edges when load conditions occur. A scale policy defines details such as min-max edges allowed, instances warm-up time, cooldown period, etc.
List Groups
Description
List all available groups in the system.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup?accessToken=<accessToken>
- Method: GET
RESPONSE
- Failure: HTTP CODE
400
or404
- Data:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- Data:
[ { "id": <autogen-group-id>, "name": "<autogen-group-name>" "originConnections": <min-origin-connections>, "regions": [ "<compute-region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- Data:
[ { "id": 3, "name": "group-e658a196-cb39-411a-86c1-d1e618222100" "originConnections": 0, "regions": [ "us-central1-a", "us-central1-f" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": null }, { "id": 4, "name": "group-51921df1-d68e-4fee-8332-6dbdf7102e47", "originConnections": 0, "regions": [ "us-central1-a", "us-central1-f" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": null } ]
List Group Nodes
Description
List all nodes in a group and their status. The different statuses for a node are:
- pending (stream manager has contacted the cloud service to start an instance)
- running (instance has been launched, and services are starting up)
- inservice (node is active and available for streaming)
- terminating (node is being deactivated)
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/{groupName}/node?accessToken=<accessToken>
- Method: GET
RESPONSE
- Failure: HTTP CODE
400
or404
- DATA:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- Data:
[ { "identifier": "<node-identifier>", "role": "<role>", "availabilityZone": "<availability-zone-code>", "address": "<host>", "state": "<node-state>", "launchConfig": "<launch-config-name>", "capacity": <connection-capacity> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/group-8bcc96ed-b7e5-4044-b797-1bc93d5f0be4/node?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- Data:
[ { "identifier": "node-us-central1-a-1452586832022", "role": "origin", "availabilityZone": "us-central1-a", "address": "104.197.131.87", "state": "inservice", "launchConfig": "default", "capacity": 1500 }, { "identifier": "node-us-central1-a-1452587484090", "role": "edge", "availabilityZone": "us-central1-a", "address": "104.197.138.228", "state": "inservice", "launchConfig": "default", "capacity": 500 } ]
List Group Origins
Description
List all origin nodes in a group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/{groupName}/node/origin?accessToken=<accessToken>
- Method: GET
RESPONSE
- Failure: HTTP CODE
400
or404
- DATA:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- DATA:
[ { "identifier": "<node-identifier>", "role": "<role>", "availabilityZone": "<availability-zone-code", "address": "<host>", "state": "<node-state>", "launchConfig": "<launch-config-name>", "capacity": <connection-capacity> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/group-8bcc96ed-b7e5-4044-b797-1bc93d5f0be4/node/origin?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- DATA:
[ { "identifier": "node-us-central1-a-1452586832022", "role": "origin", "availabilityZone": "us-central1-a", "address": "104.197.131.87", "state": "inservice", "launchConfig": "default", "capacity": 1500 } ]
List Group Edges
Description
List all edge nodes in a group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/{groupName}/node/edge?accessToken=<accessToken>
- Method: GET
RESPONSE
- Failure: HTTP CODE
400
or404
- Data:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- Data:
[ { "identifier": "<node-identifier>", "role": "<role>", "availabilityZone": "<availability-zone-code", "address": "<host>", "state": "<node-state>", "launchConfig": "<launch-config-name>", "capacity": <connection-capacity> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/group-8bcc96ed-b7e5-4044-b797-1bc93d5f0be4/node/edge?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- Data:
[ { "identifier": "node-us-central1-a-1452587484090", "role": "edge", "availabilityZone": "us-central1-a", "address": "104.197.138.228", "state": "inservice", "launchConfig": "default", "capacity": 500 }, { "identifier": "node-us-central1-f-1452587643929", "role": "edge", "availabilityZone": "us-central1-f", "address": "104.197.234.171", "state": "inservice", "launchConfig": "default", "capacity": 500 } ]
Read Group
Description
Reads a node group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/<groupName>?accessToken=<accessToken>
- Method: GET
RESPONSE
- Failure: HTTP CODE
400
or404
- Data:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- Data:
{ "id": <autogen-group-id>, "originConnections": 0, "name": "<autogen-group-name>", "region": [ "<region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> }
Example
REQUEST
- URI:
http://{host}:5080/streammanager/api/2.0/admin/nodegroup/group-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f?accessToken=xyz123
- Method : GET
RESPONSE
- Success: HTTP CODE
200
- Data:
{ "id": 2, "name": "group-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f", "originConnections": 0, "regions": [ "us-central1", "us-east1" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": 1452595891000 }
Delete Group
Description
Deletes a node group. If the group has no nodes in it then it is deleted right away, otherwise all the nodes of the group are deleted in the background separately, and then the group itself is deleted once it is empty.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/<groupName>?accessToken=<accessToken>
- Method: DELETE
RESPONSE
- FAILURE: HTTP CODE
400
or404
- Data :
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- Data:
{ "id": <autogen-group-id>, "name": "<autogen-group-name>", "originConnections": 0, "regions": [ "<compute-region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> }
Example
REQUEST
- URI:
http://{host}:5080/streammanager/api/2.0/admin/nodegroup/group-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f?accessToken=xyz123
- Method: DELETE
RESPONSE
- Success: HTTP CODE
200
- Data:
{ "id": 2, "name": "group-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f", "originConnections": 0, "regions": [ "us-central1", "us-central1" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": 1452595891000 }
Launch New Origin
Description
Launches a new origin for a node group. Launching a node on a Cloud Platform is a complex asynchronous process. The REST gateway will provide you a response as soon as it knows that the cloud platform has acknowledged the request.
The maximum number of origins allowed in a nodegroup is defined through the scale policy file.
Additional origins cannot be launched in a group after an edge has been launched in it.
The actual instance boot up may take up to two minutes, dependingo on the environment.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/{groupName}/node/origin?accessToken=<accessToken>
- Method: POST
RESPONSE
- Failure: HTTP CODE
400
or404
- Data:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
201
- Data:
{ "id": <auto-gen-id>, "identifier": "<node-identifier>", "availabilityZone": "<availability-zone-code>", "role": "<role>", "group": "<group-identifier>", "requestTime": <timestamp> }
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/group-51921df1-d68e-4fee-8332-6dbdf7102e47/node/origin?accessToken=xyz123
- Method: POST
RESPONSE
- Success: HTTP CODE
201
- Data:
{ "id": 6, "identifier": "node-us-central1-a-1452600712264", "availabilityZone": "us-central1-a", "role": "origin", "group": "group-51921df1-d68e-4fee-8332-6dbdf7102e47", "requestTime": 1452600723615 }
Read Group Stats
Description
Displays the load statistics for this node group. Edge statistics is gathered via the reports received through origin, whereas the origin statistics are directly evaluated by streammanager.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/{groupName}/stats?accessToken=<accessToken>
- Method: GET
RESPONSE
- Failure: HTTP CODE
400
or404
- DATA:
{ "errorMessage": "<error-message-string>", "timestamp": <error-timestamp> }
- Success: HTTP CODE
200
- Data:
{ "totalConnections": <total-group-connections>, "targetTypeLoadSummary": [ { "type": "<role>", "totalNodeCount": <total-node-count>, "totalActiveNodeCount": <total-active-nodes>, "netConnectionCapacity": <total-available-capacity>, "netConnectionLoad": <total-connection-load> } ] }
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/2.0/admin/nodegroup/group-8bcc96ed-b7e5-4044-b797-1bc93d5f0be4/stats?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- Data:
{ "totalConnections": 0, "targetTypeLoadSummary": [ { "type": "origin", "totalNodeCount": 1, "totalActiveNodeCount": 1, "netConnectionCapacity": 5, "netConnectionLoad": 0 }, { "type": "edge", "totalNodeCount": 1, "totalActiveNodeCount": 0, "netConnectionCapacity": 30, "netConnectionLoad": 0 } ] }