Skip to content

Commit d2023e3

Browse files
committed
Add samples for security groups
1 parent 3b0a429 commit d2023e3

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

samples/networking/v2ext/security_group/create_security_group.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@
2626
'description' => 'Foo Barrr'
2727
]);
2828

29+
30+
$networkingExtSecGroup->listSecurityGroups();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
use OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup;
4+
5+
require 'vendor/autoload.php';
6+
7+
$openstack = new OpenStack\OpenStack([
8+
'authUrl' => '{authUrl}',
9+
'region' => '{region}',
10+
'user' => [
11+
'id' => '{userId}',
12+
'password' => '{password}'
13+
],
14+
'scope' => [
15+
'project' => [
16+
'id' => '{projectId}'
17+
]
18+
]
19+
]);
20+
21+
$networkingExtSecGroup = $openstack->networkingV2ExtSecGroups();
22+
23+
foreach($networkingExtSecGroup->listSecurityGroups() as $group)
24+
{
25+
26+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup;
4+
5+
require 'vendor/autoload.php';
6+
7+
$openstack = new OpenStack\OpenStack([
8+
'authUrl' => '{authUrl}',
9+
'region' => '{region}',
10+
'user' => [
11+
'id' => '{userId}',
12+
'password' => '{password}'
13+
],
14+
'scope' => [
15+
'project' => [
16+
'id' => '{projectId}'
17+
]
18+
]
19+
]);
20+
21+
$networkingExtSecGroup = $openstack->networkingV2ExtSecGroups();
22+
23+
//List rules belong to a security group
24+
$securityGroup = $networkingExtSecGroup->getSecurityGroup(['id' => '{uuid}']);
25+
foreach($securityGroup->securityGroupRules as $rule)
26+
{
27+
28+
}
29+
30+
31+
//All rules
32+
foreach($networkingExtSecGroup->listSecurityGroupRules() as $group)
33+
{
34+
35+
}

0 commit comments

Comments
 (0)