Networks

Create network

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();

$options = [
    'name'         => '{networkName}',
    'adminStateUp' => true,
];

// Create the network
$network = $networking->createNetwork($options);

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

Create networks

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();

$options = [
    [
      'name' => '{networkName1}'
    ],
    [
      'name' => '{networkName2}'
    ],
];

$networks = $networking->createNetworks($options);

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

Get network

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();

$network = $networking->getNetwork('{networkId}');

// By default, this will return an empty Network object and NOT hit the API.
// This is convenient for when you want to use the object for operations
// that do not require an initial GET request. To retrieve the network's details,
// run the following, which *will* call the API with a GET request:

$network->retrieve();

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

Update network

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();

$network = $networking->getNetwork('{networkId}');

$network->name = '{newName}';
$network->update();

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

Delete network

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();

$network = $networking->getNetwork('{networkId}');

$network->delete();

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