Skip to content

Commit fa11f19

Browse files
author
Jamie Hannaford
committed
Add Security Groups docs
1 parent 5b1c7b0 commit fa11f19

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

doc/services/networking/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Operations
2323
networks
2424
subnets
2525
ports
26+
security-groups
27+
security-group-rules
2628

2729
Glossary
2830
--------
@@ -49,6 +51,14 @@ Glossary
4951
associated with a subet, as the IP address is taken from the allocation
5052
pool for a specific subnet.
5153

54+
security group
55+
A security group is a named container for security group rules.
56+
57+
security group rule
58+
A security group rule provides users the ability to specify the types of
59+
traffic that are allowed to pass through to and from ports on a virtual
60+
server instance.
61+
5262

5363
Further links
5464
-------------
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Security Group Rules
2+
====================
3+
4+
Create a security group rule
5+
----------------------------
6+
7+
This operation takes one parameter, an associative array, with the
8+
following keys:
9+
10+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
11+
| Name | Description | Data type | Required? | Default value | Example value |
12+
+=======================+===================================================================================================================================================================================================================================================================+=======================================+=============+=================+============================================+
13+
| ``securityGroupId`` | The security group ID to associate with this security group rule. | String | Yes | - | ``2076db17-a522-4506-91de-c6dd8e837028`` |
14+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
15+
| ``direction`` | The direction in which the security group rule is applied. For a compute instance, an ingress security group rule is applied to incoming (ingress) traffic for that instance. An egress rule is applied to traffic leaving the instance. | String (``ingress`` or ``egress``) | Yes | - | ``ingress`` |
16+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
17+
| ``ethertype`` | Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. | String (``IPv4`` or ``IPv6``) | No | ``IPv4`` | ``IPv6`` |
18+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
19+
| ``portRangeMin`` | The minimum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the value of the ``portRangeMax`` attribute. If the protocol is ICMP, this value must be an ICMP type. | Integer | No | ``null`` | ``80`` |
20+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
21+
| ``portRangeMax`` | The maximum port number in the range that is matched by the security group rule. The port\_range\_min attribute constrains the attribute. If the protocol is ICMP, this value must be an ICMP type. | Integer | No | ``null`` | ``80`` |
22+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
23+
| ``protocol`` | The protocol that is matched by the security group rule. | String (``tcp``, ``udp``, ``icmp``) | No | ``null`` | ``tcp`` |
24+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
25+
| ``remoteGroupId`` | The remote group ID to be associated with this security group rule. You can specify either ``remoteGroupId`` or ``remoteGroupPrefix``. | String | Optional | ``null`` | ``85cc3048-abc3-43cc-89b3-377341426ac5`` |
26+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
27+
| ``remoteIpPrefix`` | The remote IP prefix to be associated with this security group rule. You can specify either ``remoteGroupId`` or ``remoteGroupPrefix``. | String | Optional | ``null`` | ``192.168.5.0`` |
28+
+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+-------------+-----------------+--------------------------------------------+
29+
30+
You can create a security group rule as shown in the following example:
31+
32+
.. code:: php
33+
34+
/** @var $securityGroupRule OpenCloud\Networking\Resource\SecurityGroupRule **/
35+
$securityGroupRule = $networkingService->createSecurityGroupRule(array(
36+
'securityGroupId' => '2076db17-a522-4506-91de-c6dd8e837028',
37+
'direction' => 'egress',
38+
'ethertype' => 'IPv4',
39+
'portRangeMin' => 80,
40+
'portRangeMax' => 80,
41+
'protocol' => 'tcp',
42+
'remoteGroupId' => '85cc3048-abc3-43cc-89b3-377341426ac5'
43+
));
44+
45+
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/working/samples/Networking/create-security-group-rule.php>`_
46+
47+
48+
List security group rules
49+
-------------------------
50+
51+
You can list all the security group rules to which you have access as
52+
shown in the following example:
53+
54+
.. code:: php
55+
56+
$securityGroupRules = $networkingService->listSecurityGroupRules();
57+
foreach ($securityGroupRules as $securityGroupRule) {
58+
/** @var $securityGroupRule OpenCloud\Networking\Resource\SecurityGroupRule **/
59+
}
60+
61+
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/working/samples/Networking/list-security-group-rules.php>`_
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Security Groups
2+
===============
3+
4+
Create a security group
5+
~~~~~~~~~~~~~~~~~~~~~~~
6+
7+
This operation takes one parameter, an associative array, with the
8+
following keys:
9+
10+
+-------------------+--------------------------------------------------------------------------------+-------------+-------------+-----------------+-------------------------------------+
11+
| Name | Description | Data type | Required? | Default value | Example value |
12+
+===================+================================================================================+=============+=============+=================+=====================================+
13+
| ``name`` | A human-readable name for the security group. This name might not be unique. | String | Yes | - | ``new-webservers`` |
14+
+-------------------+--------------------------------------------------------------------------------+-------------+-------------+-----------------+-------------------------------------+
15+
| ``description`` | Description of the security group. | String | No | ``null`` | ``security group for webservers`` |
16+
+-------------------+--------------------------------------------------------------------------------+-------------+-------------+-----------------+-------------------------------------+
17+
18+
You can create a security group as shown in the following example:
19+
20+
.. code-block:: php
21+
22+
/** @var $securityGroup OpenCloud\Networking\Resource\SecurityGroup **/
23+
$securityGroup = $networkingService->createSecurityGroup(array(
24+
'name' => 'new-webservers',
25+
'description' => 'security group for webservers'
26+
));
27+
28+
`Get the executable PHP script for this example <https://raw.githubusercontent.com/rackspace/php-opencloud/working/samples/Networking/create-security-group.php>`_
29+
30+
List security groups
31+
~~~~~~~~~~~~~~~~~~~~
32+
33+
You can list all the security groups to which you have access as shown
34+
in the following example:
35+
36+
.. code-block:: php
37+
38+
$securityGroups = $networkingService->listSecurityGroups();
39+
foreach ($securityGroups as $securityGroup) {
40+
/** @var $securityGroup OpenCloud\Networking\Resource\SecurityGroup **/
41+
}
42+
43+
`Get the executable PHP script for this example </samples/Networking/list-security-groups.php>`_
44+
45+
Get a security group
46+
~~~~~~~~~~~~~~~~~~~~
47+
48+
You can retrieve a specific security group by using that security
49+
group’s ID, as shown in the following example:
50+
51+
.. code-block:: php
52+
53+
/** @var $securityGroup OpenCloud\Networking\Resource\SecurityGroup **/
54+
$securityGroup = $networkingService->getSecurityGroup('{secGroupId}');
55+
56+
`Get the executable PHP script for this example </samples/Networking/get-security-group.php>`_
57+
58+
Delete a security group
59+
~~~~~~~~~~~~~~~~~~~~~~~
60+
61+
You can delete a security group as shown in the following example:
62+
63+
.. code-block:: php
64+
65+
$securityGroup->delete();
66+
67+
`Get the executable PHP script for this example </samples/Networking/delete-security-group.php>`_

0 commit comments

Comments
 (0)