File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ networking = $ openstack ->networkingV2ExtLayer3 ();
16+
17+ /** @var \OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp $ip */
18+ $ ip = $ networking ->createFloatingIp ([
19+ "floatingNetworkId " => "{networkId} " ,
20+ "portId " => "{portId} " ,
21+ ]);
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ openstack ->networkingV2ExtLayer3 ()
16+ ->getFloatingIp ('{id} ' )
17+ ->delete ();
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ /** @var \OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp $ip */
16+ $ ip = $ openstack ->networkingV2ExtLayer3 ()
17+ ->getFloatingIp ('{id} ' );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ floatingIps = $ openstack ->networkingV2ExtLayer3 ()
16+ ->listFloatingIps ();
17+
18+ foreach ($ floatingIps as $ floatingIp ) {
19+ /** @var \OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp $floatingIp */
20+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ floatingIp = $ openstack ->networkingV2ExtLayer3 ()
16+ ->getFloatingIp ('{id} ' );
17+
18+ $ floatingIp ->portId = '{newPortId} ' ;
19+ $ floatingIp ->update ();
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ networking = $ openstack ->networkingV2ExtSecGroups ();
16+
17+ /** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
18+ $ rule = $ networking ->createSecurityGroupRule ([
19+ "direction " => "ingress " ,
20+ "ethertype " => "IPv4 " ,
21+ "portRangeMin " => "80 " ,
22+ "portRangeMax " => "80 " ,
23+ "protocol " => "tcp " ,
24+ "remoteGroupId " => "{groupId} " ,
25+ "securityGroupId " => "{secGroupId} " ,
26+ ]);
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ /** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
16+ $ rule = $ openstack ->networkingV2ExtSecGroups ()
17+ ->getSecurityGroupRule ('{id} ' );
18+
19+ $ rule ->delete ();
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ /** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
16+ $ rule = $ openstack ->networkingV2ExtSecGroups ()
17+ ->getSecurityGroupRule ('{id} ' );
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ rules = $ openstack ->networkingV2ExtSecGroups ()
16+ ->listSecurityGroupRules ();
17+
18+ foreach ($ rules as $ rule ) {
19+ /** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
20+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require 'vendor/autoload.php ' ;
4+
5+ $ openstack = new OpenStack \OpenStack ([
6+ 'authUrl ' => '{authUrl} ' ,
7+ 'region ' => '{region} ' ,
8+ 'user ' => [
9+ 'id ' => '{userId} ' ,
10+ 'password ' => '{password} '
11+ ],
12+ 'scope ' => ['project ' => ['id ' => '{projectId} ' ]]
13+ ]);
14+
15+ $ networking = $ openstack ->networkingV2ExtSecGroups ();
16+
17+ /** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup $secGroup */
18+ $ secGroup = $ networking ->createSecurityGroup ([
19+ 'name ' => 'new-webservers ' ,
20+ 'description ' => 'security group for webservers ' ,
21+ ]);
You can’t perform that action at this time.
0 commit comments