LoadBalancer Listeners

Create Listener

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 for listener
$options = [
    'name'            => 'listenerName',
    'description'     => 'Load Balancer Listener',
    'loadbalancerId'  => '{loadbalancerId}',
    'adminStateUp'    => true,
    'protocol'        => 'HTTPS',
    'protocolPort'    => 443,
    'connectionLimit' => 1000
];

// Create the listener
$listener = $networking->createLoadBalancerListener($options);

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

Get Listener

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

// Get the listener
$listener = $networking->getLoadBalancerListener('{listenerId}');
$listener->retrieve();

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

List Listeners

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

foreach ($networking->listLoadBalancerListeners() as $listener) {
    // Do Stuff
}

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

Update Listener

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

// Get the listener
$listener = $networking->getLoadBalancerListener('{listenerId}');

$listener->name = 'newListener';
$listener->description = 'New Description';
$listener->update();

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

Delete Listener

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

// Get the listener
$listener = $networking->getLoadBalancerListener('{listenerId}');

$listener->delete();

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