Create Firewall Group

From Hostway API Documentation
Revision as of 11:00, 11 October 2013 by Mike.robski (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A Security/Firewall Group defines firewall rules for your Server. You have the ability to configure your firewall connections and secure your network as required. You may have one or multiple servers behind a firewall group. Hostway provides a default firewall group, and typical firewall rules are already configured. You can create multiple firewall groups as needed.

Contents

POST /accounts/{accountId}/flexcloud/os-security-groups

This operation will create a new firewall group.

Request

Parameters

accountId - string
The selected account Id.

JSON

 {
    "securityGroup" : {
       "displayName" : "{firewall_group_display_name}", 
       "description" : "{firewall_group_description}"
    }
 }

securityGroup

displayName - string
Display name for this firewall group.
description - string
Descriptive information for this firewall group.

Response

JSON

{
   "securityGroup" : {
      "displayName": "{firewall_group_display_name}", 
      "description": "{firewall_group_description}", 
      "links": [
         {
            "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/{firewall_group_name}/", 
            "rel": "self"
         }
      ], 
      "rules": [], 
      "id": "{firewall_group_id}", 
      "accountNumber": "{user_account_number}", 
      "servers": []
   }
}

securityGroup

displayName - string
Display name for this firewall group.
description - string
Descriptive information for this firewall group.
links - list
Hypermedia for this resource.
rules - list
List of all defined security rules for the group.
id - string
The id of the firewall group.*(Unique identifier for this firewall group.)
accountNumber - string
The account number this firewall group resource belongs to.
servers - list
List of server IDs this security group is assigned to.

Response Codes

Success
HTTP/1.1 201 Created
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 the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
HTTP/1.1 409 Conflict - The resource already exists.

Examples

Successfully create a new firewall group

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Request Body:

 {
    "securityGroup" : {
       "displayName" : "Test Firewall Group", 
       "description" : "Test firewall group description." 
    }
 } 

Response Code:

HTTP/1.1 201 Created

Response Body:

 {
    "securityGroup" : {
       "displayName": "Test Firewall Group", 
       "description": "Test firewall group description.", 
       "links": [
          {
             "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/group2012May11_OK30Zs7Ju/", 
             "rel": "self"
          }
       ], 
       "rules": [], 
       "id": "group2012May11_OK30Zs7Ju", 
       "accountNumber": "test_account_120761",
       "servers": []
    }
 }

Failure while trying to create a new firewall group with invalid data

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Request Body:

{
   Empty
}

Response Code:

HTTP/1.1 400 Bad Request

Response Body:

 {
    "badRequest" : {
       "message": "Invalid", 
       "code": 400, 
       "details": "",
       "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
    }
 }

Failure while trying to create a new firewall group with an already existing firewall group display name

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Request Body:

 {
    "securityGroup" : {
       "displayName" : "Test Firewall Group",
       "description" : "Test firewall group description."
    }
 }

Response Code:

HTTP/1.1 409 Conflict

Response Body:

 {
    "computeFault" : {
       "message": "GroupNameError", 
       "code": 400, 
       "details": "Display name in use",
       "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
    }
 }

Failure while trying to make unauthorized access

POST http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded fake_authentication_string

Response Code:

HTTP/1.1 401 Unauthorized

Response Body:

    401 Unauthorized
    This server could not verify that you are authorized to
    access the document you requested.  Either you supplied the
    wrong credentials (e.g., bad password), or your browser
    does not understand how to supply the credentials required.

Failure while trying to pass invalid account number

POST http(s)://{api_server}/accounts/fake/flexcloud/os-security-groups

Response Code:

HTTP/1.1 404 Not Found

Response Body:

 {
    "itemNotFound" : {
       "message": "Resource not found", 
       "code": 404, 
       "details": "",
       "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
    }
 }

Alternative URI /os-security-groups

An alternative way to execute this call is to omit the accountId portion of the URI. In this case the system assumes the request is executed for the account identified in the authorization header.

POST /os-security-groups

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox