AssignSecurityGroupToServer
From Hostway API Documentation
Revision as of 05:37, 28 May 2015 by Velimira.metodieva (Talk)
This operation will assign a securityGroup to the specified server
Contents |
PUT /accounts/{accountId}/flexcloud/servers/{id}/os-security-group
Parameters
- accountId - string
- The selected account Id.
- id
- The unique identifier of the server.
Request
JSON
{ "securityGroup" : { "id": "{security_group_id}", "status": "{status}" } }
- securityGroup.id - string
- The unique name of the securityGroup.
- status - string
- Status. Only enabled is supported currently
Response Codes
- Success
- HTTP/1.1 200 OK
- Failure
- HTTP/1.1 400 Bad Request
- HTTP/1.1 401 Unauthorized : This server could not verify that you are authorized to access the document you requested. Either you supplied incorrect credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
Examples
Successfully assign a securityGroup to the specified server
- PUT http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-security-group
Request Headers:
Content-Type:application/json Charset=UTF-8 Authorization:Base64-encoded username & password string
Request Body:
{ "securityGroup" : { "id": "group2012Nov02_jD6NX8BsK" "status": "enabled" } }
Response Code:
HTTP/1.1 200 OK
Response Body:
{ "securityGroup" : { "id": "2012May08_61EfdIZ3Y" "links": [{"href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/group2012Nov02_jD6NX8BsK/", "rel": "self"}] } }
Failure while trying to assign a firewall group to server
- PUT http(s)://{api_server}/accounts/{accountId}/flexcloud/servers/test_server_0013/os-security-group
Request Headers:
Content-Type:application/json Charset=UTF-8 Authorization:Base64-encoded username & password string
{ "securityGroup" : { "id": "not_exist", "status": "enabled" } }
Response Code:
HTTP/1.1 400 Bad Request