summaryrefslogtreecommitdiff
path: root/api-ref/source/os-security-group-rules.inc
blob: 1a750c60d0d0cc3bb68f0ff0fea574afc13f658c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.. -*- rst -*-

================================================================
 Rules for security group (os-security-group-rules) (DEPRECATED)
================================================================

.. warning::

   These APIs are proxy calls to the Network service. Nova has
   deprecated all the proxy APIs and users should use the native APIs
   instead. These will fail with a 404 starting from microversion 2.36.
   See: `Relevant Network APIs
   <https://docs.openstack.org/api-ref/network/v2/#security-group-rules-security-group-rules>`__.

Creates and deletes security group rules.

Create Security Group Rule
==========================

.. rest_method:: POST /os-security-group-rules

Creates a rule for a security group. Either ``cidr`` or ``group_id`` must be
specified when creating a rule.

.. note::
    nova-network only supports ingress rules. If you want to define egress
    rules you must use the Neutron networking service.

Normal response codes: 200

Error response codes: badRequest(400), unauthorized(401), forbidden(403)

Request
-------

.. rest_parameters:: parameters.yaml


  - security_group_rule: security_group_rule
  - parent_group_id: parent_group_id
  - ip_protocol: ip_protocol
  - from_port: from_port
  - to_port: to_port
  - cidr: secgroup_rule_cidr
  - group_id: group_id

**Example Create security group rule: JSON request**

.. literalinclude:: ../../doc/api_samples/os-security-groups/security-group-rules-post-req.json
   :language: javascript

Response
--------

The ``group`` is empty if ``group_id`` was not provided on the request.

The ``ip_range`` is empty if ``cidr`` was not provided on the request.

.. rest_parameters:: parameters.yaml

  - security_group_rule: security_group_rule
  - ip_protocol: ip_protocol
  - from_port: from_port
  - to_port: to_port
  - ip_range: secgroup_rule_ip_range
  - ip_range.cidr: secgroup_rule_cidr
  - id: secgroup_rule_id
  - parent_group_id: parent_group_id
  - group: group
  - group.name: name_sec_group_optional
  - group.tenant_id: secgroup_tenant_id_body

**Example Create security group rule: JSON response**

.. literalinclude:: ../../doc/api_samples/os-security-groups/security-group-rules-post-resp.json
   :language: javascript

Delete Security Group Rule
==========================

.. rest_method:: DELETE /os-security-group-rules/{security_group_rule_id}

Deletes a security group rule.

Normal response codes: 202

Error response codes: badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404), conflict(409)

Request
-------

.. rest_parameters:: parameters.yaml


  - security_group_rule_id: security_group_rule_id

Response
--------

There is no body content for the response of a successful DELETE query.