AssignSecurityGroupToServer

From Hostway API Documentation
Revision as of 14:13, 29 August 2013 by Youngbae.oh (Talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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}"
    }
 }
securityGroup.id - string
The unique name of the securityGroup.

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"
    }
 }

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"
    }
 }

Response Code:

HTTP/1.1 400 Bad Request
Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox