Ports

Create port

Show auth code
<?php

require 'vendor/autoload.php';

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

$port = $networking->createPort([
    'name'         => 'portName',
    'networkId'    => '{networkId}',
    'adminStateUp' => true
]);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Create ports

Show auth code
<?php

require 'vendor/autoload.php';

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

$ports = $networking->createPorts([
    [
        'name'         => 'port1',
        'networkId'    => '{networkId}',
        'adminStateUp' => true
    ],
    [
        'name'         => 'port2',
        'networkId'    => '{networkId}',
        'adminStateUp' => true
    ],
]);

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Get port

Show auth code
<?php

require 'vendor/autoload.php';

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

$port = $networking->getPort('{portId}');

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Update port

Show auth code
<?php

require 'vendor/autoload.php';

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

$port = $networking->getPort('{portId}');
$port->name = 'newName';
$port->update();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.

Delete port

Show auth code
<?php

require 'vendor/autoload.php';

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

$port = $networking->getPort('{portId}');
$port->delete();

To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.