List Firewall Groups
From Hostway API Documentation
(Difference between revisions)
(→GET /os-security-groups) |
Mike.robski (Talk | contribs) m (1 revision: Release 86) |
||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
− | This operation | + | This operation lists existing firewall groups. |
− | ='''GET''' /os-security-groups= | + | ='''GET''' /accounts/''{accountId}''/flexcloud/os-security-groups= |
− | This operation | + | This operation lists existing firewall groups. |
+ | |||
+ | == Request == | ||
+ | ==== Request Parameters ==== | ||
+ | ; accountId - ''string'' | ||
+ | : The selected account Id. | ||
== Response == | == Response == | ||
Line 8: | Line 13: | ||
<nowiki> | <nowiki> | ||
{ | { | ||
− | " | + | "securityGroups" : [ |
{ | { | ||
− | " | + | "displayName" : "{firewall_group_display_name}", |
"description" : "{firewall_group_description}", | "description" : "{firewall_group_description}", | ||
"links" : [ | "links" : [ | ||
{ | { | ||
− | "href" : "http://{api-server}/os-security-groups/{ | + | "href" : "http://{api-server}/accounts/{accountId}/flexcloud/os-security-groups/{firewall_group_id}/", |
"rel" : "self" | "rel" : "self" | ||
} | } | ||
Line 20: | Line 25: | ||
"rules" : [ | "rules" : [ | ||
{ | { | ||
− | " | + | "fromPort" : {start_port}, |
− | " | + | "toPort" : {end_port}, |
"protocol" : "{ip_protocol}", | "protocol" : "{ip_protocol}", | ||
− | " | + | "cidr": "0.0.0.0/0", |
"id" : "145" | "id" : "145" | ||
} | } | ||
] | ] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
"servers" : ["{server_id}"], | "servers" : ["{server_id}"], | ||
− | " | + | "accountNumber" : "{user_account_number}", |
− | " | + | "Id" : "{firewall_group_id}" |
} | } | ||
] | ] | ||
− | } | + | }</nowiki> |
− | </nowiki> | + | |
====security_groups==== | ====security_groups==== | ||
− | ; | + | ; displayName - ''string'' |
: The display name of the firewall group. | : The display name of the firewall group. | ||
Line 59: | Line 58: | ||
: List of server ids this firewall group is assigned to. | : List of server ids this firewall group is assigned to. | ||
− | ; | + | ; accountNumber - ''string'' |
: Identifies an account that owns the firewall group. | : Identifies an account that owns the firewall group. | ||
− | ; | + | ; id - ''string'' |
− | : The | + | : The id of this firewall group.*(Unique identifier for this firewall group.) |
== Response Codes == | == Response Codes == | ||
Line 71: | Line 70: | ||
; Failure | ; Failure | ||
: ''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 404 Not Found'' - The resource does not exist. | ||
== Examples == | == Examples == | ||
'''Successfully list firewall groups''' | '''Successfully list firewall groups''' | ||
− | :'''GET''' http(s)://{api_server}/os-security-groups | + | :'''GET''' http(s)://{api_server}/accounts/{accountId}/flexcloud/os-security-groups |
''Request Headers:'' | ''Request Headers:'' | ||
Line 87: | Line 87: | ||
<nowiki> | <nowiki> | ||
{ | { | ||
− | " | + | "securityGroup" : [ |
{ | { | ||
− | " | + | "displayName": "Test Firewall Group 1", |
"description": "Test firewall group 1 description.", | "description": "Test firewall group 1 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" | ||
} | } | ||
Line 99: | Line 99: | ||
"rules": [ | "rules": [ | ||
{ | { | ||
− | ' | + | 'toPort': 1111, |
− | ' | + | 'fromPort': 1111, |
'protocol': 'TCP', | 'protocol': 'TCP', | ||
'id': 145, | 'id': 145, | ||
− | ' | + | 'cidr': '0.0.0.0/0' |
}, | }, | ||
{ | { | ||
− | ' | + | 'toPort': 80, |
− | ' | + | 'fromPort': 80, |
− | 'protocol': ' | + | 'protocol': 'TCP', |
'id': 196, | 'id': 196, | ||
− | ' | + | 'cidr': '127.0.0.1/24' |
} | } | ||
], | ], | ||
− | " | + | "id": "group2012May11_OK30Zs7Ju", |
− | " | + | "accountNumber": "test_account_120761", |
"servers": ["test-server-0003"] | "servers": ["test-server-0003"] | ||
}, | }, | ||
{ | { | ||
− | " | + | "displayName": "Test Firewall Group", |
"description": "Test firewall group description.", | "description": "Test firewall group description.", | ||
"links": [ | "links": [ | ||
{ | { | ||
− | "href": "http://{api_server}/os-security-groups/group2012Apr30_9J5qDwOIo/", | + | "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/group2012Apr30_9J5qDwOIo/", |
"rel": "self" | "rel": "self" | ||
} | } | ||
Line 128: | Line 128: | ||
"rules": [ | "rules": [ | ||
{ | { | ||
− | ' | + | 'toPort': 3389, |
− | ' | + | 'fromPort': 3389, |
'protocol': 'tcp', | 'protocol': 'tcp', | ||
'id': 116, | 'id': 116, | ||
− | ' | + | 'cidr': '0.0.0.0/0' |
}, | }, | ||
{ | { | ||
− | ' | + | 'toPort': 8443, |
− | ' | + | 'fromPort': 8443, |
'protocol': 'tcp', | 'protocol': 'tcp', | ||
'id': 117, | 'id': 117, | ||
− | ' | + | 'cidr': '0.0.0.0/0' |
}, | }, | ||
{ | { | ||
− | ' | + | 'toPort': 22, |
− | ' | + | 'fromPort': 22, |
'protocol': 'tcp', | 'protocol': 'tcp', | ||
'id': 118, | 'id': 118, | ||
− | ' | + | 'cidr': '0.0.0.0/0' |
} | } | ||
], | ], | ||
− | " | + | "id": "group2012Apr30_9J5qDwOIo", |
− | " | + | "accountNumber": "test_account_901265", |
"servers": ["test-server-0011", "test-server-0024"] | "servers": ["test-server-0011", "test-server-0024"] | ||
} | } | ||
Line 157: | Line 157: | ||
'''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 173: | Line 173: | ||
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>GET /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
This operation lists existing firewall groups.
Contents |
GET /accounts/{accountId}/flexcloud/os-security-groups
This operation lists existing firewall groups.
Request
Request Parameters
- accountId - string
- The selected account Id.
Response
JSON
{ "securityGroups" : [ { "displayName" : "{firewall_group_display_name}", "description" : "{firewall_group_description}", "links" : [ { "href" : "http://{api-server}/accounts/{accountId}/flexcloud/os-security-groups/{firewall_group_id}/", "rel" : "self" } ], "rules" : [ { "fromPort" : {start_port}, "toPort" : {end_port}, "protocol" : "{ip_protocol}", "cidr": "0.0.0.0/0", "id" : "145" } ] "servers" : ["{server_id}"], "accountNumber" : "{user_account_number}", "Id" : "{firewall_group_id}" } ] }
security_groups
- displayName - string
- The display name of the firewall group.
- description - string
- Text describing the firewall group.
- links - list
- Hypermedia for this resource.
- rules - list
- List describing all defined security rules for the group.
- fault - dictionary
- Might hold a fault information for the firewall group.
- servers - list
- List of server ids this firewall group is assigned to.
- accountNumber - string
- Identifies an account that owns the firewall group.
- id - string
- The id of this firewall group.*(Unique identifier for this firewall group.)
Response Codes
- Success
- HTTP/1.1 200 OK
- Failure
- 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 404 Not Found - The resource does not exist.
Examples
Successfully list firewall groups
- GET 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
Response Code:
HTTP/1.1 200 OK
Response Body:
{ "securityGroup" : [ { "displayName": "Test Firewall Group 1", "description": "Test firewall group 1 description.", "links": [ { "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/group2012May11_OK30Zs7Ju/", "rel": "self" } ], "rules": [ { 'toPort': 1111, 'fromPort': 1111, 'protocol': 'TCP', 'id': 145, 'cidr': '0.0.0.0/0' }, { 'toPort': 80, 'fromPort': 80, 'protocol': 'TCP', 'id': 196, 'cidr': '127.0.0.1/24' } ], "id": "group2012May11_OK30Zs7Ju", "accountNumber": "test_account_120761", "servers": ["test-server-0003"] }, { "displayName": "Test Firewall Group", "description": "Test firewall group description.", "links": [ { "href": "http://{api_server}/accounts/{accountId}/flexcloud/os-security-groups/group2012Apr30_9J5qDwOIo/", "rel": "self" } ], "rules": [ { 'toPort': 3389, 'fromPort': 3389, 'protocol': 'tcp', 'id': 116, 'cidr': '0.0.0.0/0' }, { 'toPort': 8443, 'fromPort': 8443, 'protocol': 'tcp', 'id': 117, 'cidr': '0.0.0.0/0' }, { 'toPort': 22, 'fromPort': 22, 'protocol': 'tcp', 'id': 118, 'cidr': '0.0.0.0/0' } ], "id": "group2012Apr30_9J5qDwOIo", "accountNumber": "test_account_901265", "servers": ["test-server-0011", "test-server-0024"] } } }
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.
GET /os-security-groups