REST API for Groups
Create Group
Description
Create a new node group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>", "regions": [ "<egion-code>"," ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> }
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup?accessToken=xyz123
- Method: POST
- Data : JSON
{ "regions": [ "us-west-2" ], "launchConfig": "default", "scalePolicy": "default" }
RESPONSE
- Success: HTTP CODE
201
- Data:
{ "id": 36, "name": "group-bbcc379d-57ed-4649-ac68-9f3365dea59f", "originConnections": 0, "regions": [ "us-west-2" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": 1463514107313 }
baseCapacity
Minimum subscriber connections that this group should support. This parameter helps the scale-in process decide when to scale down an edge. This should be based on the connectionCapacity
that you define for new instances in the launchconfig policy file.
For example: If your connectionCapacity
for an edge is set to 1000, and you anticipate that your active concurrent connections are generally going to exceed 2000, then you will want to set this to 2000 to ensure there are always at least two active edges in your group.
originConnections
Minimum connections at origin. This should always be zero (0) for the current version of Stream Manager.
regions
The compute zones where you would like the edges to be created. Stream Manager usually lets the Autoscaler use this list in a round-robin style. You can find a list of zones to use on official Google Cloud documentation page: https://cloud.google.com/compute/docs/zones?hl=en
launchConfig
Name of the launch configuration to be used for launching a new instance. Usually this implies the consistent machine configuration for a group. A launch configuration defines your compute machine type, max connections, etc. for an instance.
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.
Read Group
Description
Reads a node group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>, "name": "<autogen-group-name>", "region": [ "<compute-region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> }
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup/cluster-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f?accessToken=xyz123
- Method : GET
RESPONSE
- Success: HTTP CODE
200
- Data:
{ "id": 2, "name": "cluster-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f", "baseCapacity": 100, "originConnections": 0, "regions": [ "us-central1-a", "us-central1-f" ], "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 a background separately and then the group itself is deleted once it is empty.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>", "baseCapacity": <group-min-connections>, "originConnections": <min-origin-connections>, "regions": [ "<compute-region-code>", "<compute-region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> }
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup/cluster-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f?accessToken=xyz123
- Method: DELETE
RESPONSE
- Success: HTTP CODE
200
- Data:
{ "id": 2, "name": "cluster-d2f6aade-c6eb-4b92-b056-3f3a9f99b96f", "baseCapacity": 100, "originConnections": 0, "regions": [ "us-central1-a", "us-central1-f" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": 1452595891000 }
List Groups
Description
List all available groups in the system.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>", "baseCapacity": <group-min-connections>, "originConnections": <min-origin-connections>, "regions": [ "<compute-region-code>", "<compute-region-code>" ], "launchConfig": "<launch-config-name>", "scalePolicy": "<scale-policy-name>", "timestamp": <timestamp> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- Data:
[ { "id": 3, "name": "cluster-e658a196-cb39-411a-86c1-d1e618222100", "baseCapacity": 100, "originConnections": 0, "regions": [ "us-central1-a", "us-central1-f" ], "launchConfig": "default", "scalePolicy": "default", "timestamp": null }, { "id": 4, "name": "cluster-51921df1-d68e-4fee-8332-6dbdf7102e47", "baseCapacity": 200, "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/1.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>", "region": "<compute-region-code", "adddress": "<host>", "state": "<node-state>", "launchConfigurationName": "<launch-config-name>", "capacity": <connection-capacity> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup/cluster-8bcc96ed-b7e5-4044-b797-1bc93d5f0be4/node?accessToken=xyz123
- Method: GET
RESPONSE
- Success: HTTP CODE
200
- Data:
[ { "identifier": "node-us-central1-a-1452586832022", "role": "origin", "region": "us-central1-a", "adddress": "104.197.131.87", "state": "inservice", "launchConfigurationName": "default", "capacity": 1500 }, { "identifier": "node-us-central1-a-1452587484090", "role": "edge", "region": "us-central1-a", "adddress": "104.197.138.228", "state": "inservice", "launchConfigurationName": "default", "capacity": 500 } ]
List Group Origins
Description
List all origin nodes in a group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>", "region": "<compute-region-code", "adddress": "<host>", "state": "<node-state>", "launchConfigurationName": "<launch-config-name>", "capacity": <connection-capacity> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup/cluster-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", "region": "us-central1-a", "adddress": "104.197.131.87", "state": "inservice", "launchConfigurationName": "default", "capacity": 1500 } ]
List Group Edges
Description
List all edge nodes in a group.
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>", "region": "<compute-region-code", "adddress": "<host>", "state": "<node-state>", "launchConfigurationName": "<launch-config-name>", "capacity": <connection-capacity> } ]
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup/cluster-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", "region": "us-central1-a", "adddress": "104.197.138.228", "state": "inservice", "launchConfigurationName": "default", "capacity": 500 }, { "identifier": "node-us-central1-f-1452587643929", "role": "edge", "region": "us-central1-f", "adddress": "104.197.234.171", "state": "inservice", "launchConfigurationName": "default", "capacity": 500 } ]
Launch New Origin
Description
Launches a new origin node for a node group. Only one origin per group is permitted in this version of Red5 Pro Stream Manager. 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 actual instance boot up may take up to 2 minutes or less (for Google Compute Platform).
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.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>", "region": "<compute-region-code>", "role": "<role>", "group": "<group-identifier>", "requestTime": <timestamp> }
Example
REQUEST
- URI:
http://{host}:{port}/streammanager/api/1.0/admin/nodegroup/cluster-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", "region": "us-central1-a", "role": "origin", "group": "cluster-51921df1-d68e-4fee-8332-6dbdf7102e47", "requestTime": 1452600723615 }