LoadBalancers¶
Create LoadBalancer¶
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' => 'loadBalancerName',
'description' => 'My LoadBalancer',
'vipSubnetId' => '{subnetId}',
'adminStateUp' => true,
];
// Create the loadbalancer
$lb = $networking->createLoadBalancer($options);
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
Get LoadBalancer¶
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 loadbalancer
$lb = $networking->getLoadBalancer('{loadbalancerId}');
$lb->retrieve();
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
List LoadBalancers¶
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->listLoadBalancers() as $lb) {
// Do Stuff
}
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
Update LoadBalancer¶
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 loadbalancer
$lb = $networking->getLoadBalancer('{loadbalancerId}');
$lb->name = 'newLoadBalancer1';
$lb->description = 'New Description';
$lb->update();
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
Delete LoadBalancer¶
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 loadbalancer
$lb = $networking->getLoadBalancer('{loadbalancerId}');
$lb->delete();
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
Add Listener to LoadBalancer¶
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 loadbalancer
$lb = $networking->getLoadBalancer('{loadbalancerId}');
// Options for listener
$options = [
'name' => 'listenerName',
'description' => 'Load Balancer Listener',
'adminStateUp' => true,
'protocol' => 'HTTPS',
'protocolPort' => 443,
'connectionLimit' => 1000
];
$listener = $lb->addListener($options);
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
Get Stats for LoadBalancer¶
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 loadbalancer
$lb = $networking->getLoadBalancer('{loadbalancerId}');
$stats = $lb->getStats();
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.
Get Status Tree for LoadBalancer¶
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 loadbalancer
$lb = $networking->getLoadBalancer('{loadbalancerId}');
$stats = $lb->getStats();
To see all the required and optional parameters for this operation, along with their types and descriptions, view the reference documentation.