LoadBalancer Pools

Create Pool

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 pool
$options = [
    'name'               => 'poolName',
    'description'        => 'Load Balancer Pool',
    'listenerId'         => '{listenerId}',
    'adminStateUp'       => true,
    'protocol'           => 'HTTPS',
    'lbAlgorithm'        => 'ROUND_ROBIN',
    'sessionPersistence' => [
        'type'        => 'APP_COOKIE',
        'cookie_name' => 'example_cookie'
    ]
];

// Create the pool
$pool = $networking->createLoadBalancerPool($options);

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

Get Pool

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');
$pool->retrieve();

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

List Pools

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->listLoadBalancerPools() as $pool) {
    // Do Stuff
}

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

Update Pool

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');

$pool->name = 'newPool';
$pool->description = 'New Description';
$pool->update();

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

Delete Pool

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');

$pool->delete();

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

Add Member

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');

// Member options
$options = [
    'address'      => '10.1.2.3',
    'protocolPort' => 443,
    'weight'       => 1,
    'adminStateUp' => true,
    'subnetId'     => '{subnetId}'
];

$member = $pool->addMember($options);

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

Get Member

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');
$pool->retrieve();

// Get a member
$member = $pool->getMember('{memberId}');
$member->retrieve();

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

Delete Member

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');
$pool->retrieve();

// Get a member
$member = $pool->getMember('{memberId}');

$member->delete();

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

Add Health Monitor

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 pool
$pool = $networking->getLoadBalancerPool('{poolId}');
$pool->retrieve();

// Health Monitor options
$options = [
    'type'          => 'HTTPS',
    'delay'         => 1,
    'timeout'       => 1,
    'httpMethod'    => 'GET',
    'urlPath'       => '/',
    'expectedCodes' => '200,201,302',
    'maxRetries'    => 5,
    'adminStateUp'  => true
];

$healthmonitor = $pool->addHealthMonitor($options);

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