Difference between revisions of "Os-security-groups"
Line 10: | Line 10: | ||
| 1 | | 1 | ||
| GET | | GET | ||
− | | / | + | | /security_groups |
| No Request body | | No Request body | ||
|- | |- | ||
| 2 | | 2 | ||
| GET | | GET | ||
− | | / | + | | /security_groups/id |
| No Request body | | No Request body | ||
|- | |- | ||
| 3 | | 3 | ||
| POST | | POST | ||
− | | / | + | | /security_groups |
| Request body | | Request body | ||
|- | |- | ||
| 4 | | 4 | ||
| DELETE | | DELETE | ||
− | | / | + | | /security_groups/id |
| No Request body | | No Request body | ||
|- | |- | ||
| 5 | | 5 | ||
| POST | | POST | ||
− | | / | + | | /security_group_rules |
| Request body | | Request body | ||
|- | |- | ||
| 6 | | 6 | ||
− | | | + | | DELETE |
− | | / | + | | /security_group_rules/id |
− | | | + | | No request body |
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
Line 47: | Line 42: | ||
== Create Security Group API == | == Create Security Group API == | ||
− | URL : http://10.2.3.150:8774/v1.1/ | + | URL : http://10.2.3.150:8774/v1.1/security_groups |
{| border="1" cellpadding="2" cellspacing="0" | {| border="1" cellpadding="2" cellspacing="0" | ||
Line 54: | Line 49: | ||
|- | |- | ||
| POST | | POST | ||
− | | / | + | | /security_groups |
|} | |} | ||
Line 100: | Line 95: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | < | + | <security_group name="11111"> |
− | + | <description>test</description> | |
− | </ | + | </security_group> |
</nowiki></pre> | </nowiki></pre> | ||
Line 109: | Line 104: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | < | + | <security_group id="39" name="11111" tenant_id="admin" xmlns="http://docs.openstack.org/compute/api/v1.1"> |
+ | <rules/> | ||
<description> | <description> | ||
test | test | ||
</description> | </description> | ||
− | </ | + | </security_group> |
</nowiki></pre> | </nowiki></pre> | ||
− | * Note: | + | * Note: tenant_id will be the project Id. |
=== Request JSON === | === Request JSON === | ||
Line 123: | Line 119: | ||
<pre><nowiki> | <pre><nowiki> | ||
{ | { | ||
− | " | + | "security_group" : |
{ | { | ||
"name" : "test12", | "name" : "test12", | ||
Line 136: | Line 132: | ||
<pre><nowiki> | <pre><nowiki> | ||
{ | { | ||
− | " | + | "security_group": |
− | + | { | |
− | + | "rules": [], | |
− | + | "tenant_id": "admin", | |
− | + | "id": 41, | |
− | + | "name": "test12", | |
+ | "description": "security group description" | ||
+ | } | ||
} | } | ||
</nowiki></pre> | </nowiki></pre> | ||
Line 147: | Line 145: | ||
== Get Security Group == | == Get Security Group == | ||
− | URL: http://10.2.3.150:8774/v1.1/ | + | URL: http://10.2.3.150:8774/v1.1/security_groups/<id> |
{| border="1" cellpadding="2" cellspacing="0" | {| border="1" cellpadding="2" cellspacing="0" | ||
Line 154: | Line 152: | ||
|- | |- | ||
| GET | | GET | ||
− | | / | + | | /security_groups/id |
|} | |} | ||
Line 161: | Line 159: | ||
Error Response Code(s): unauthorized(401), [[ItemNotFound]](404) | Error Response Code(s): unauthorized(401), [[ItemNotFound]](404) | ||
− | This operation returns the details of a security group | + | This operation returns the details of a security group |
This operation does not require a request body | This operation does not require a request body | ||
Line 168: | Line 166: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | < | + | <security_group id="28" name="default" tenant_id="admin" xmlns="http://docs.openstack.org/compute/api/v1.1"> |
− | < | + | <rules> |
− | < | + | <rule id="108" parent_group_id="28"> |
− | + | <from_port> | |
− | |||
− | |||
− | < | ||
22 | 22 | ||
− | </ | + | </from_port> |
− | < | + | <group/> |
− | < | + | <ip_protocol> |
tcp | tcp | ||
− | </ | + | </ip_protocol> |
− | < | + | <to_port> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
22 | 22 | ||
− | </ | + | </to_port> |
− | < | + | <ip_range> |
+ | <cidr> | ||
+ | 10.2.6.0/24 | ||
+ | </cidr> | ||
+ | </ip_range> | ||
+ | </rule> | ||
+ | <rule id="109" parent_group_id="28"> | ||
+ | <from_port> | ||
22 | 22 | ||
− | </ | + | </from_port> |
− | < | + | <group> |
− | < | + | <tenant_id> |
+ | admin | ||
+ | </tenant_id> | ||
+ | <name> | ||
+ | 11111 | ||
+ | </name> | ||
+ | </group> | ||
+ | <ip_protocol> | ||
tcp | tcp | ||
− | </ | + | </ip_protocol> |
− | < | + | <to_port> |
− | + | 22 | |
− | + | </to_port> | |
− | + | <ip_range/> | |
− | + | </rule> | |
− | + | </rules> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | < | ||
− | </ | ||
− | </ | ||
<description> | <description> | ||
default | default | ||
</description> | </description> | ||
− | </ | + | </security_group> |
</nowiki></pre> | </nowiki></pre> | ||
Line 240: | Line 215: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | |||
{ | { | ||
− | " | + | "security_group": |
− | + | { | |
− | " | + | "rules": [ |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{ | { | ||
− | + | "from_port": 22, | |
− | + | "group": {}, | |
− | + | "ip_protocol": "tcp", | |
− | + | "to_port": 22, | |
− | + | "parent_group_id": 28, | |
− | + | "ip_range": { | |
− | + | "cidr": "10.2.6.0/24" | |
− | + | }, | |
− | + | "id": 108 | |
− | |||
}, | }, | ||
{ | { | ||
− | + | "from_port": 22, | |
− | + | "group": { | |
− | + | "tenant_id": "admin", | |
− | + | "name": "11111" | |
− | + | }, | |
− | + | "ip_protocol": "tcp", | |
− | + | "to_port": 22, | |
− | + | "parent_group_id": 28, | |
− | + | "ip_range": {}, | |
− | + | "id": 109 | |
− | |||
} | } | ||
− | + | ], | |
− | + | "tenant_id": "admin", | |
− | + | "id": 28, | |
− | + | "name": "default", | |
− | + | "description": "default" | |
− | + | } | |
− | + | } | |
</nowiki></pre> | </nowiki></pre> | ||
− | == List | + | == List Security Groups == |
− | URL : http://10.2.3.150:8774/v1.1/ | + | URL : http://10.2.3.150:8774/v1.1/security-groups |
{| border="1" cellpadding="2" cellspacing="0" | {| border="1" cellpadding="2" cellspacing="0" | ||
Line 301: | Line 260: | ||
|- | |- | ||
| GET | | GET | ||
− | | / | + | | /security_groups |
|} | |} | ||
Line 309: | Line 268: | ||
This operation provides a list of security groups with your account. Security groups that have been deleted are not included in this list. | This operation provides a list of security groups with your account. Security groups that have been deleted are not included in this list. | ||
− | The list of security groups doesn't support filtering in this version. The list returned is sorted based on the id, if you are a admin user then the list returned is sorted based on the | + | The list of security groups doesn't support filtering in this version. The list returned is sorted based on the id, if you are a admin user then the list returned is sorted based on the tenant_id (ProjectID) and security group name. |
This operation does not require a request body. | This operation does not require a request body. | ||
Line 316: | Line 275: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | < | + | <security_groups xmlns="http://docs.openstack.org/compute/api/v1.1"> |
− | < | + | <security_group id="39" name="11111" tenant_id="admin"> |
− | < | + | <rules/> |
− | |||
− | |||
− | |||
− | |||
<description> | <description> | ||
test | test | ||
</description> | </description> | ||
− | </ | + | </security_group> |
− | < | + | <security_group id="28" name="default" tenant_id="admin"> |
− | + | <rules> | |
− | + | <rule id="108" parent_group_id="28"> | |
− | = | + | <from_port> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | ||
22 | 22 | ||
− | </ | + | </from_port> |
− | < | + | <group/> |
− | < | + | <ip_protocol> |
tcp | tcp | ||
− | </ | + | </ip_protocol> |
− | < | + | <to_port> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
22 | 22 | ||
− | </ | + | </to_port> |
− | < | + | <ip_range> |
+ | <cidr> | ||
+ | 10.2.6.0/24 | ||
+ | </cidr> | ||
+ | </ip_range> | ||
+ | </rule> | ||
+ | <rule id="109" parent_group_id="28"> | ||
+ | <from_port> | ||
22 | 22 | ||
− | </ | + | </from_port> |
− | < | + | <group> |
− | < | + | <tenant_id> |
+ | admin | ||
+ | </tenant_id> | ||
+ | <name> | ||
+ | 11111 | ||
+ | </name> | ||
+ | </group> | ||
+ | <ip_protocol> | ||
tcp | tcp | ||
− | </ | + | </ip_protocol> |
− | < | + | <to_port> |
− | + | 22 | |
− | + | </to_port> | |
− | + | <ip_range/> | |
− | + | </rule> | |
− | + | </rules> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | < | ||
− | </ | ||
− | </ | ||
<description> | <description> | ||
default | default | ||
</description> | </description> | ||
− | </ | + | </security_group> |
− | + | </security_groups> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
</nowiki></pre> | </nowiki></pre> | ||
− | |||
=== Response JSON === | === Response JSON === | ||
Line 457: | Line 333: | ||
<pre><nowiki> | <pre><nowiki> | ||
{ | { | ||
− | " | + | "security_groups": [ |
− | + | { | |
− | + | "rules": [], | |
− | " | + | "tenant_id": "admin", |
− | + | "id": 39, | |
− | + | "name": "11111", | |
− | " | + | "description": "test" |
− | " | + | }, |
− | " | + | { |
− | " | + | "rules": [ |
− | " | + | { |
− | + | "from_port": 22, | |
− | + | "group": {}, | |
− | + | "ip_protocol": "tcp", | |
− | + | "to_port": 22, | |
− | + | "parent_group_id": 28, | |
− | } | + | "ip_range": { |
− | + | "cidr": "10.2.6.0/24" | |
− | + | }, | |
− | + | "id": 108 | |
− | + | }, | |
− | + | { | |
− | + | "from_port": 22, | |
− | + | "group": { | |
− | + | "tenant_id": "admin", | |
− | + | "name": "11111" | |
− | + | }, | |
− | + | "ip_protocol": "tcp", | |
− | + | "to_port": 22, | |
− | + | "parent_group_id": 28, | |
− | + | "ip_range": {}, | |
− | + | "id": 109 | |
− | + | } | |
− | + | ], | |
− | + | "tenant_id": "admin", | |
− | + | "id": 28, | |
− | + | "name": "default", | |
− | + | "description": "default" | |
− | + | } | |
− | + | ] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
</nowiki></pre> | </nowiki></pre> | ||
Line 514: | Line 384: | ||
|- | |- | ||
| DELETE | | DELETE | ||
− | | / | + | | /security-groups/id |
|} | |} | ||
− | Normal Response Code(s): | + | Normal Response Code(s): 202 |
Error Response Code(s): unauthorized (401), itemNotFound (404) | Error Response Code(s): unauthorized (401), itemNotFound (404) | ||
Line 523: | Line 393: | ||
This operation does not require a request or a response body. | This operation does not require a request or a response body. | ||
− | = | + | = Create Security Group Rule = |
{| border="1" cellpadding="2" cellspacing="0" | {| border="1" cellpadding="2" cellspacing="0" | ||
Line 530: | Line 400: | ||
|- | |- | ||
| POST | | POST | ||
− | | / | + | | /security_group_rules |
|} | |} | ||
Line 537: | Line 407: | ||
Error Response Code(s): computeFault(500), unauthorized(401), [[BadRequest]](400), [[UnprocessableEntity]](422), itemNotfound(400) | Error Response Code(s): computeFault(500), unauthorized(401), [[BadRequest]](400), [[UnprocessableEntity]](422), itemNotfound(400) | ||
− | This operation adds one | + | This operation adds one rule to a security group in a single request. |
+ | |||
+ | === Exmaple 1 Request XML === | ||
− | + | <pre><nowiki> | |
+ | <security_group_rule> | ||
+ | <ip_protocol>tcp</ip_protocol> | ||
+ | <from_port>22</from_port> | ||
+ | <to_port>22</to_port> | ||
+ | <parent_group_id>28</parent_group_id> | ||
+ | <cidr>10.2.6.0/24</cidr> | ||
+ | </security_group_rule> | ||
+ | </nowiki></pre> | ||
− | |||
− | |||
− | |||
− | === Example 1 | + | === Example 1 XML Response === |
<pre><nowiki> | <pre><nowiki> | ||
− | < | + | <security_group_rule id="108" parent_group_id="28" xmlns="http://docs.openstack.org/compute/api/v1.1"> |
− | + | <from_port> | |
− | + | 22 | |
− | + | </from_port> | |
− | + | <group/> | |
− | + | <ip_protocol> | |
− | + | tcp | |
− | + | </ip_protocol> | |
− | + | <to_port> | |
− | + | 22 | |
− | + | </to_port> | |
− | + | <ip_range> | |
− | + | <cidr> | |
− | + | 10.2.6.0/24 | |
− | + | </cidr> | |
+ | </ip_range> | ||
+ | </security_group_rule> | ||
</nowiki></pre> | </nowiki></pre> | ||
Line 569: | Line 448: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | < | + | <security_group_rule> |
− | + | <ip_protocol>tcp</ip_protocol> | |
− | + | <from_port>22</from_port> | |
− | + | <to_port>22</to_port> | |
− | + | <parent_group_id>28</parent_group_id> | |
− | + | <group_id>45</group_id> | |
− | + | </security_group_rule> | |
− | + | </nowiki></pre> | |
− | + | ||
− | + | ||
− | + | === Example 2 XML Response === | |
− | + | ||
− | + | <pre><nowiki> | |
+ | <security_group_rule id="108" parent_group_id="28" xmlns="http://docs.openstack.org/compute/api/v1.1"> | ||
+ | <from_port> | ||
+ | 22 | ||
+ | </from_port> | ||
+ | </group> | ||
+ | <tenant_id>testproject<tenant_id> | ||
+ | <name>test</name> | ||
+ | <group> | ||
+ | <ip_protocol> | ||
+ | tcp | ||
+ | </ip_protocol> | ||
+ | <to_port> | ||
+ | 22 | ||
+ | </to_port> | ||
+ | </ip_range> | ||
+ | </security_group_rule> | ||
</nowiki></pre> | </nowiki></pre> | ||
Line 589: | Line 484: | ||
<pre><nowiki> | <pre><nowiki> | ||
{ | { | ||
− | + | "security_group_rule": { | |
− | + | "ip_protocol": "tcp", | |
− | + | "from_port": "22", | |
− | + | "to_port": "22", | |
− | + | "parent_group_id": 2, | |
− | + | "cidr": "10.2.3.124/24" | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
</nowiki></pre> | </nowiki></pre> | ||
Line 608: | Line 498: | ||
<pre><nowiki> | <pre><nowiki> | ||
{ | { | ||
− | + | "security_group_rule": { | |
− | + | "ip_protocol": "tcp", | |
− | + | "from_port": "22", | |
− | + | "to_port": "22", | |
− | + | "group_id": 1, | |
− | + | "parent_group_id": 2 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
Line 626: | Line 509: | ||
− | = | + | = Delete Security Group Rule = |
{| border="1" cellpadding="2" cellspacing="0" | {| border="1" cellpadding="2" cellspacing="0" | ||
Line 633: | Line 516: | ||
|- | |- | ||
| POST | | POST | ||
− | | / | + | | /security_group_rules/id |
|} | |} | ||
Normal Response Code(s): 202 | Normal Response Code(s): 202 | ||
− | Error Response Code(s): | + | Error Response Code(s): unauthorized(401), itemNotfound(404) |
− | This operation removes one | + | This operation removes one rule from a security group. |
− | This operation does not | + | This operation does not require a request or a response body. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 21:57, 3 August 2011
Support management of security group in OS API 1.1 or later version same as it is present in the EC2 API.
Design
Sr No. | verb | URI | Request |
1 | GET | /security_groups | No Request body |
2 | GET | /security_groups/id | No Request body |
3 | POST | /security_groups | Request body |
4 | DELETE | /security_groups/id | No Request body |
5 | POST | /security_group_rules | Request body |
6 | DELETE | /security_group_rules/id | No request body |
API Operations
Create Security Group API
URL : http://10.2.3.150:8774/v1.1/security_groups
Verb | URI |
POST | /security_groups |
Normal Response Code(s): 200
Error Response Code(s): 500, unauthorized(401), badRequest(400)
This operation creates a new security group into your account.
Error Handling
Name | Description | Error Description |
name | Name of the security group | Security group name is mandatory |
Security group name is an empty string | ||
Security group name should not be greater than 255 characters | ||
description | Description of the security group | Security group description is mandatory |
Security group description is an empty string | ||
Security group description should not be greater than 255 characters |
In all of the above error cases, it returns HTTP status code 400.
Request XML
<security_group name="11111"> <description>test</description> </security_group>
Response XML
<security_group id="39" name="11111" tenant_id="admin" xmlns="http://docs.openstack.org/compute/api/v1.1"> <rules/> <description> test </description> </security_group>
- Note: tenant_id will be the project Id.
Request JSON
{ "security_group" : { "name" : "test12", "description" : "security group description" } }
Response JSON
{ "security_group": { "rules": [], "tenant_id": "admin", "id": 41, "name": "test12", "description": "security group description" } }
Get Security Group
URL: http://10.2.3.150:8774/v1.1/security_groups/<id>
Verb | URI |
GET | /security_groups/id |
Normal Response Code(s): 200
Error Response Code(s): unauthorized(401), ItemNotFound(404)
This operation returns the details of a security group
This operation does not require a request body
Response XML
<security_group id="28" name="default" tenant_id="admin" xmlns="http://docs.openstack.org/compute/api/v1.1"> <rules> <rule id="108" parent_group_id="28"> <from_port> 22 </from_port> <group/> <ip_protocol> tcp </ip_protocol> <to_port> 22 </to_port> <ip_range> <cidr> 10.2.6.0/24 </cidr> </ip_range> </rule> <rule id="109" parent_group_id="28"> <from_port> 22 </from_port> <group> <tenant_id> admin </tenant_id> <name> 11111 </name> </group> <ip_protocol> tcp </ip_protocol> <to_port> 22 </to_port> <ip_range/> </rule> </rules> <description> default </description> </security_group>
Response JSON
{ "security_group": { "rules": [ { "from_port": 22, "group": {}, "ip_protocol": "tcp", "to_port": 22, "parent_group_id": 28, "ip_range": { "cidr": "10.2.6.0/24" }, "id": 108 }, { "from_port": 22, "group": { "tenant_id": "admin", "name": "11111" }, "ip_protocol": "tcp", "to_port": 22, "parent_group_id": 28, "ip_range": {}, "id": 109 } ], "tenant_id": "admin", "id": 28, "name": "default", "description": "default" } }
List Security Groups
URL : http://10.2.3.150:8774/v1.1/security-groups
Verb | URI |
GET | /security_groups |
Normal Response Code(s): 200
Error Response Code(s): unauthorized(401)
This operation provides a list of security groups with your account. Security groups that have been deleted are not included in this list. The list of security groups doesn't support filtering in this version. The list returned is sorted based on the id, if you are a admin user then the list returned is sorted based on the tenant_id (ProjectID) and security group name.
This operation does not require a request body.
Response XML
<security_groups xmlns="http://docs.openstack.org/compute/api/v1.1"> <security_group id="39" name="11111" tenant_id="admin"> <rules/> <description> test </description> </security_group> <security_group id="28" name="default" tenant_id="admin"> <rules> <rule id="108" parent_group_id="28"> <from_port> 22 </from_port> <group/> <ip_protocol> tcp </ip_protocol> <to_port> 22 </to_port> <ip_range> <cidr> 10.2.6.0/24 </cidr> </ip_range> </rule> <rule id="109" parent_group_id="28"> <from_port> 22 </from_port> <group> <tenant_id> admin </tenant_id> <name> 11111 </name> </group> <ip_protocol> tcp </ip_protocol> <to_port> 22 </to_port> <ip_range/> </rule> </rules> <description> default </description> </security_group> </security_groups>
Response JSON
{ "security_groups": [ { "rules": [], "tenant_id": "admin", "id": 39, "name": "11111", "description": "test" }, { "rules": [ { "from_port": 22, "group": {}, "ip_protocol": "tcp", "to_port": 22, "parent_group_id": 28, "ip_range": { "cidr": "10.2.6.0/24" }, "id": 108 }, { "from_port": 22, "group": { "tenant_id": "admin", "name": "11111" }, "ip_protocol": "tcp", "to_port": 22, "parent_group_id": 28, "ip_range": {}, "id": 109 } ], "tenant_id": "admin", "id": 28, "name": "default", "description": "default" } ] }
Delete Security Group
verb | URI |
DELETE | /security-groups/id |
Normal Response Code(s): 202
Error Response Code(s): unauthorized (401), itemNotFound (404)
This operation does not require a request or a response body.
Create Security Group Rule
Verb | URI |
POST | /security_group_rules |
Normal Response Code(s): 202
Error Response Code(s): computeFault(500), unauthorized(401), BadRequest(400), UnprocessableEntity(422), itemNotfound(400)
This operation adds one rule to a security group in a single request.
Exmaple 1 Request XML
<security_group_rule> <ip_protocol>tcp</ip_protocol> <from_port>22</from_port> <to_port>22</to_port> <parent_group_id>28</parent_group_id> <cidr>10.2.6.0/24</cidr> </security_group_rule>
Example 1 XML Response
<security_group_rule id="108" parent_group_id="28" xmlns="http://docs.openstack.org/compute/api/v1.1"> <from_port> 22 </from_port> <group/> <ip_protocol> tcp </ip_protocol> <to_port> 22 </to_port> <ip_range> <cidr> 10.2.6.0/24 </cidr> </ip_range> </security_group_rule>
Example 2 Request XML
<security_group_rule> <ip_protocol>tcp</ip_protocol> <from_port>22</from_port> <to_port>22</to_port> <parent_group_id>28</parent_group_id> <group_id>45</group_id> </security_group_rule>
Example 2 XML Response
<security_group_rule id="108" parent_group_id="28" xmlns="http://docs.openstack.org/compute/api/v1.1"> <from_port> 22 </from_port> </group> <tenant_id>testproject<tenant_id> <name>test</name> <group> <ip_protocol> tcp </ip_protocol> <to_port> 22 </to_port> </ip_range> </security_group_rule>
Example 1 Request JSON
{ "security_group_rule": { "ip_protocol": "tcp", "from_port": "22", "to_port": "22", "parent_group_id": 2, "cidr": "10.2.3.124/24" } }
Example 2 Request JSON
{ "security_group_rule": { "ip_protocol": "tcp", "from_port": "22", "to_port": "22", "group_id": 1, "parent_group_id": 2 } }
Delete Security Group Rule
Verb | URI |
POST | /security_group_rules/id |
Normal Response Code(s): 202
Error Response Code(s): unauthorized(401), itemNotfound(404)
This operation removes one rule from a security group.
This operation does not require a request or a response body.