Create Firewall Group

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 86)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
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.
 
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.
  
='''POST''' /os-security-groups=
+
='''POST''' /accounts/''{accountId}''/flexcloud/os-security-groups=
 
This operation will create a new firewall group.
 
This operation will create a new firewall group.
  
 
== Request ==
 
== Request ==
 +
=== Parameters ===
 +
; accountId - ''string''
 +
: The selected account Id.
 +
 
=== JSON ===
 
=== JSON ===
 
  <nowiki>
 
  <nowiki>
 
  {
 
  {
     "security_group" : {
+
     "securityGroup" : {
       "display_name" : "{firewall_group_display_name}",  
+
       "displayName" : "{firewall_group_display_name}",  
 
       "description" : "{firewall_group_description}"
 
       "description" : "{firewall_group_description}"
 
     }
 
     }
 
  }</nowiki>
 
  }</nowiki>
  
====security_group====
+
====securityGroup====
; display_name - ''string''
+
; displayName - ''string''
 
: Display name for this firewall group.
 
: Display name for this firewall group.
  
Line 25: Line 29:
 
  <nowiki>
 
  <nowiki>
 
{
 
{
   "security_group" : {
+
   "securityGroup" : {
       "display_name": "{firewall_group_display_name}",  
+
       "displayName": "{firewall_group_display_name}",  
 
       "description": "{firewall_group_description}",  
 
       "description": "{firewall_group_description}",  
 
       "links": [
 
       "links": [
 
         {
 
         {
             "href": "http://{api_server}/os-security-groups/{firewall_group_name}/",  
+
             "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/{firewall_group_name}/",  
 
             "rel": "self"
 
             "rel": "self"
 
         }
 
         }
 
       ],  
 
       ],  
 
       "rules": [],  
 
       "rules": [],  
       "name": "{firewall_group_name}",  
+
       "id": "{firewall_group_id}",  
       "account_number": "{user_account_number}",  
+
       "accountNumber": "{user_account_number}",  
 
       "servers": []
 
       "servers": []
 
   }
 
   }
}
+
}</nowiki>
</nowiki>
+
  
====security_group====
+
====securityGroup====
; display_name - ''string''
+
; displayName - ''string''
 
: Display name for this firewall group.
 
: Display name for this firewall group.
  
Line 55: Line 58:
 
: List of all defined security rules for the group.
 
: List of all defined security rules for the group.
  
; name - ''string''
+
; id - ''string''
: The name of the firewall group.*(Unique identifier for this firewall group.)
+
: The id of the firewall group.*(Unique identifier for this firewall group.)
  
; account_number - ''string''
+
; accountNumber - ''string''
 
: The account number this firewall group resource belongs to.
 
: The account number this firewall group resource belongs to.
  
Line 71: Line 74:
 
: ''HTTP/1.1 400 Bad Request''
 
: ''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 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 ==
 
== Examples ==
 
'''Successfully create a new firewall group'''
 
'''Successfully create a new firewall group'''
:'''POST''' http(s)://{api_server}/os-security-groups
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups
  
 
''Request Headers:''
 
''Request Headers:''
Line 84: Line 88:
 
  <nowiki>
 
  <nowiki>
 
  {
 
  {
     "security_group" : {
+
     "securityGroup" : {
       "display_name" : "Test Firewall Group",  
+
       "displayName" : "Test Firewall Group",  
 
       "description" : "Test firewall group description."  
 
       "description" : "Test firewall group description."  
 
     }
 
     }
  }
+
  } </nowiki>
</nowiki>
+
  
 
''Response Code:''
 
''Response Code:''
Line 97: Line 100:
 
  <nowiki>
 
  <nowiki>
 
  {
 
  {
     "security_group" : {
+
     "securityGroup" : {
       "display_name": "Test Firewall Group",  
+
       "displayName": "Test Firewall Group",  
 
       "description": "Test firewall group description.",  
 
       "description": "Test firewall group description.",  
 
       "links": [
 
       "links": [
 
           {
 
           {
             "href": "http://{api_server}/os-security-groups/group2012May11_OK30Zs7Ju/",  
+
             "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/group2012May11_OK30Zs7Ju/",  
 
             "rel": "self"
 
             "rel": "self"
 
           }
 
           }
 
       ],  
 
       ],  
 
       "rules": [],  
 
       "rules": [],  
       "name": "group2012May11_OK30Zs7Ju",  
+
       "id": "group2012May11_OK30Zs7Ju",  
       "account_number": "test_account_120761",
+
       "accountNumber": "test_account_120761",
 
       "servers": []
 
       "servers": []
 
     }
 
     }
Line 114: Line 117:
  
 
'''Failure while trying to create a new firewall group with invalid data'''
 
'''Failure while trying to create a new firewall group with invalid data'''
:'''POST''' http(s)://{api_server}/os-security-groups
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups
  
 
''Request Headers:''
 
''Request Headers:''
Line 141: Line 144:
  
 
'''Failure while trying to create a new firewall group with an already existing firewall group display name'''
 
'''Failure while trying to create a new firewall group with an already existing firewall group display name'''
:'''POST''' http(s)://{api_server}/os-security-groups
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups
  
 
''Request Headers:''
 
''Request Headers:''
Line 151: Line 154:
 
  <nowiki>
 
  <nowiki>
 
  {
 
  {
     "security_group" : {
+
     "securityGroup" : {
       "display_name" : "Test Firewall Group",
+
       "displayName" : "Test Firewall Group",
 
       "description" : "Test firewall group description."
 
       "description" : "Test firewall group description."
 
     }
 
     }
Line 158: Line 161:
  
 
''Response Code:''
 
''Response Code:''
<pre>HTTP/1.1 400 Bad Request</pre>
+
<pre>HTTP/1.1 409 Conflict</pre>
  
 
''Response Body:''
 
''Response Body:''
Line 172: Line 175:
  
 
'''Failure while trying to make unauthorized access'''
 
'''Failure while trying to make unauthorized access'''
:'''POST''' http(s)://{api_server}/os-security-groups
+
:'''POST''' http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups
  
 
''Request Headers:''
 
''Request Headers:''
Line 188: Line 191:
 
     wrong credentials (e.g., bad password), or your browser
 
     wrong credentials (e.g., bad password), or your browser
 
     does not understand how to supply the credentials required.
 
     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:''
 +
<pre>HTTP/1.1 404 Not Found</pre>
 +
 +
''Response Body:''
 +
<nowiki>
 +
{
 +
    "itemNotFound" : {
 +
      "message": "Resource not found",
 +
      "code": 404,
 +
      "details": "",
 +
      "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
    }
 +
}</nowiki>
 +
 +
== 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 [[Authentication|authorization header]].
 +
 +
<code>POST /os-security-groups</code>
  
 
[[Category:Hostway API]]
 
[[Category:Hostway API]]
 
[[Category:FlexCloud Server API]]
 
[[Category:FlexCloud Server API]]

Latest revision as of 11:00, 11 October 2013

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