Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions samples/networking/v2/floatingIPs/create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2ExtLayer3();

/** @var \OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp $ip */
$ip = $networking->createFloatingIp([
"floatingNetworkId" => "{networkId}",
"portId" => "{portId}",
]);
17 changes: 17 additions & 0 deletions samples/networking/v2/floatingIPs/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$openstack->networkingV2ExtLayer3()
->getFloatingIp('{id}')
->delete();
17 changes: 17 additions & 0 deletions samples/networking/v2/floatingIPs/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

/** @var \OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp $ip */
$ip = $openstack->networkingV2ExtLayer3()
->getFloatingIp('{id}');
20 changes: 20 additions & 0 deletions samples/networking/v2/floatingIPs/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$floatingIps = $openstack->networkingV2ExtLayer3()
->listFloatingIps();

foreach ($floatingIps as $floatingIp) {
/** @var \OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp $floatingIp */
}
19 changes: 19 additions & 0 deletions samples/networking/v2/floatingIPs/update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$floatingIp = $openstack->networkingV2ExtLayer3()
->getFloatingIp('{id}');

$floatingIp->portId = '{newPortId}';
$floatingIp->update();
26 changes: 26 additions & 0 deletions samples/networking/v2/securityGroupRules/create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2ExtSecGroups();

/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
$rule = $networking->createSecurityGroupRule([
"direction" => "ingress",
"ethertype" => "IPv4",
"portRangeMin" => "80",
"portRangeMax" => "80",
"protocol" => "tcp",
"remoteGroupId" => "{groupId}",
"securityGroupId" => "{secGroupId}",
]);
19 changes: 19 additions & 0 deletions samples/networking/v2/securityGroupRules/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
$rule = $openstack->networkingV2ExtSecGroups()
->getSecurityGroupRule('{id}');

$rule->delete();
17 changes: 17 additions & 0 deletions samples/networking/v2/securityGroupRules/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
$rule = $openstack->networkingV2ExtSecGroups()
->getSecurityGroupRule('{id}');
20 changes: 20 additions & 0 deletions samples/networking/v2/securityGroupRules/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$rules = $openstack->networkingV2ExtSecGroups()
->listSecurityGroupRules();

foreach ($rules as $rule) {
/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroupRule $rule */
}
21 changes: 21 additions & 0 deletions samples/networking/v2/securityGroups/create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2ExtSecGroups();

/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup $secGroup */
$secGroup = $networking->createSecurityGroup([
'name' => 'new-webservers',
'description' => 'security group for webservers',
]);
19 changes: 19 additions & 0 deletions samples/networking/v2/securityGroups/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2ExtSecGroups();

/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup $secGroup */
$secGroup = $networking->getSecurityGroup('{id}');
$secGroup->delete();
19 changes: 19 additions & 0 deletions samples/networking/v2/securityGroups/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2ExtSecGroups();

/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup $secGroup */
$secGroup = $networking->getSecurityGroup('{id}');
$secGroup->retrieve();
21 changes: 21 additions & 0 deletions samples/networking/v2/securityGroups/list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

require 'vendor/autoload.php';

$openstack = new OpenStack\OpenStack([
'authUrl' => '{authUrl}',
'region' => '{region}',
'user' => [
'id' => '{userId}',
'password' => '{password}'
],
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2ExtSecGroups();

$secGroups = $networking->listSecurityGroups();

foreach ($secGroups as $secGroup) {
/** @var \OpenStack\Networking\v2\Extensions\SecurityGroups\Models\SecurityGroup $secGroup */
}
6 changes: 1 addition & 5 deletions samples/networking/v2/subnets/create.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
'id' => '{userId}',
'password' => '{password}'
],
'scope' => [
'project' => [
'id' => '{projectId}'
]
]
'scope' => ['project' => ['id' => '{projectId}']]
]);

$networking = $openstack->networkingV2();
Expand Down
4 changes: 2 additions & 2 deletions src/BlockStorage/v2/Models/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenStack\BlockStorage\v2\Models;

use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\OperatorResource;
use OpenCloud\Common\Resource\Creatable;
use OpenCloud\Common\Resource\Deletable;
use OpenCloud\Common\Resource\HasMetadata;
Expand All @@ -16,7 +16,7 @@
/**
* @property \OpenStack\BlockStorage\v2\Api $api
*/
class Snapshot extends AbstractResource implements Listable, Creatable, Updateable, Deletable, Retrievable, HasMetadata
class Snapshot extends OperatorResource implements Listable, Creatable, Updateable, Deletable, Retrievable, HasMetadata
{
use HasWaiterTrait;

Expand Down
4 changes: 2 additions & 2 deletions src/BlockStorage/v2/Models/Volume.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php declare (strict_types=1);
namespace OpenStack\BlockStorage\v2\Models;

use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\OperatorResource;
use OpenCloud\Common\Resource\Creatable;
use OpenCloud\Common\Resource\Deletable;
use OpenCloud\Common\Resource\HasMetadata;
Expand All @@ -15,7 +15,7 @@
/**
* @property \OpenStack\BlockStorage\v2\Api $api
*/
class Volume extends AbstractResource implements Creatable, Listable, Updateable, Deletable, Retrievable, HasMetadata
class Volume extends OperatorResource implements Creatable, Listable, Updateable, Deletable, Retrievable, HasMetadata
{
use HasWaiterTrait;

Expand Down
4 changes: 2 additions & 2 deletions src/BlockStorage/v2/Models/VolumeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenStack\BlockStorage\v2\Models;

use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\OperatorResource;
use OpenCloud\Common\Resource\Creatable;
use OpenCloud\Common\Resource\Deletable;
use OpenCloud\Common\Resource\Listable;
Expand All @@ -11,7 +11,7 @@
/**
* @property \OpenStack\BlockStorage\v2\Api $api
*/
class VolumeType extends AbstractResource implements Listable, Creatable, Updateable, Deletable
class VolumeType extends OperatorResource implements Listable, Creatable, Updateable, Deletable
{
/** @var string */
public $id;
Expand Down
4 changes: 2 additions & 2 deletions src/Compute/v2/Models/Flavor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenStack\Compute\v2\Models;

use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\OperatorResource;
use OpenCloud\Common\Resource\Listable;
use OpenCloud\Common\Resource\Retrievable;

Expand All @@ -11,7 +11,7 @@
*
* @property \OpenStack\Compute\v2\Api $api
*/
class Flavor extends AbstractResource implements Listable, Retrievable
class Flavor extends OperatorResource implements Listable, Retrievable
{
/** @var int */
public $disk;
Expand Down
4 changes: 2 additions & 2 deletions src/Compute/v2/Models/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenStack\Compute\v2\Models;

use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\OperatorResource;
use OpenCloud\Common\Resource\Deletable;
use OpenCloud\Common\Resource\HasMetadata;
use OpenCloud\Common\Resource\Listable;
Expand All @@ -15,7 +15,7 @@
*
* @property \OpenStack\Compute\v2\Api $api
*/
class Image extends AbstractResource implements Listable, Retrievable, Deletable, HasMetadata
class Image extends OperatorResource implements Listable, Retrievable, Deletable, HasMetadata
{
/** @var string */
public $id;
Expand Down
4 changes: 2 additions & 2 deletions src/Compute/v2/Models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
use OpenCloud\Common\Resource\Listable;
use OpenCloud\Common\Resource\Retrievable;
use OpenCloud\Common\Resource\Updateable;
use OpenCloud\Common\Resource\AbstractResource;
use OpenCloud\Common\Resource\OperatorResource;
use OpenCloud\Common\Transport\Utils;
use OpenStack\Compute\v2\Enum;
use Psr\Http\Message\ResponseInterface;

/**
* @property \OpenStack\Compute\v2\Api $api
*/
class Server extends AbstractResource implements
class Server extends OperatorResource implements
Creatable,
Updateable,
Deletable,
Expand Down
Loading