Update
Update a Load Balancer
To update a load balancer's settings, send a PUT request to
/v2/load_balancers/$LOAD_BALANCER_ID. The request should contain a full
representation of the load balancer including existing attributes. It may
contain one of the droplets_ids or tag attributes as they are mutually
exclusive. Note that any attribute that is not provided will be reset to its
default value.
Parameters
A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.
An array containing the IDs of the Droplets assigned to the load balancer.
A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.
A boolean value indicating whether PROXY Protocol is in use.
An integer value which configures the idle timeout for HTTP requests to the target droplets.
A human-readable name for a load balancer instance.
The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created.
A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.
How many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the size field to scale load balancers that reside in these regions.
An array containing the UUIDs of the Regional load balancers to be used as target backends for a Global load balancer.
A string specifying the UUID of the VPC to which the load balancer is assigned.
Returns
Update a Load Balancer
from gradient import Gradient
client = Gradient(
access_token="My Access Token",
)
load_balancer = client.gpu_droplets.load_balancers.update(
lb_id="4de7ac8b-495b-4884-9a69-1050c6793cd6",
forwarding_rules=[{
"entry_protocol": "http",
"entry_port": 80,
"target_protocol": "http",
"target_port": 80,
"certificate_id": "",
"tls_passthrough": False,
}, {
"entry_protocol": "https",
"entry_port": 443,
"target_protocol": "https",
"target_port": 443,
"certificate_id": "",
"tls_passthrough": True,
}],
algorithm="round_robin",
droplet_ids=[3164444, 3164445],
enable_backend_keepalive=True,
enable_proxy_protocol=True,
firewall={
"deny": ["cidr:1.2.0.0/16", "ip:2.3.4.5"],
"allow": ["ip:1.2.3.4", "cidr:2.3.4.0/24"],
},
health_check={
"protocol": "http",
"port": 80,
"path": "/",
"check_interval_seconds": 10,
"response_timeout_seconds": 5,
"healthy_threshold": 5,
"unhealthy_threshold": 3,
},
http_idle_timeout_seconds=60,
name="updated-example-lb-01",
project_id="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
redirect_http_to_https=False,
region="nyc3",
sticky_sessions={
"type": "none"
},
vpc_uuid="c33931f2-a26a-4e61-b85c-4e95a2ec431b",
)
print(load_balancer.load_balancer)
{
"load_balancer": {
"id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
"name": "updated-example-lb-01",
"ip": "104.131.186.241",
"size": "lb-small",
"algorithm": "round_robin",
"status": "new",
"created_at": "2017-02-01T22:22:58Z",
"forwarding_rules": [
{
"entry_protocol": "http",
"entry_port": 80,
"target_protocol": "http",
"target_port": 80,
"certificate_id": "",
"tls_passthrough": false
},
{
"entry_protocol": "https",
"entry_port": 443,
"target_protocol": "https",
"target_port": 443,
"certificate_id": "",
"tls_passthrough": true
}
],
"health_check": {
"protocol": "http",
"port": 80,
"path": "/",
"check_interval_seconds": 10,
"response_timeout_seconds": 5,
"healthy_threshold": 5,
"unhealthy_threshold": 3
},
"sticky_sessions": {
"type": "none"
},
"region": {
"name": "New York 3",
"slug": "nyc3",
"sizes": [
"s-1vcpu-1gb",
"s-1vcpu-2gb",
"s-1vcpu-3gb",
"s-2vcpu-2gb",
"s-3vcpu-1gb",
"s-2vcpu-4gb",
"s-4vcpu-8gb",
"s-6vcpu-16gb",
"s-8vcpu-32gb",
"s-12vcpu-48gb",
"s-16vcpu-64gb",
"s-20vcpu-96gb",
"s-24vcpu-128gb",
"s-32vcpu-192gb"
],
"features": [
"private_networking",
"backups",
"ipv6",
"metadata",
"install_agent"
],
"available": true
},
"tag": "",
"droplet_ids": [
3164444,
3164445
],
"redirect_http_to_https": false,
"enable_proxy_protocol": true,
"enable_backend_keepalive": true,
"vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b",
"disable_lets_encrypt_dns_records": false,
"project_id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
"http_idle_timeout_seconds": 60,
"firewall": {
"deny": [
"cidr:1.2.0.0/16",
"ip:2.3.4.5"
],
"allow": [
"ip:1.2.3.4",
"cidr:2.3.4.0/24"
]
}
}
}Returns Examples
{
"load_balancer": {
"id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
"name": "updated-example-lb-01",
"ip": "104.131.186.241",
"size": "lb-small",
"algorithm": "round_robin",
"status": "new",
"created_at": "2017-02-01T22:22:58Z",
"forwarding_rules": [
{
"entry_protocol": "http",
"entry_port": 80,
"target_protocol": "http",
"target_port": 80,
"certificate_id": "",
"tls_passthrough": false
},
{
"entry_protocol": "https",
"entry_port": 443,
"target_protocol": "https",
"target_port": 443,
"certificate_id": "",
"tls_passthrough": true
}
],
"health_check": {
"protocol": "http",
"port": 80,
"path": "/",
"check_interval_seconds": 10,
"response_timeout_seconds": 5,
"healthy_threshold": 5,
"unhealthy_threshold": 3
},
"sticky_sessions": {
"type": "none"
},
"region": {
"name": "New York 3",
"slug": "nyc3",
"sizes": [
"s-1vcpu-1gb",
"s-1vcpu-2gb",
"s-1vcpu-3gb",
"s-2vcpu-2gb",
"s-3vcpu-1gb",
"s-2vcpu-4gb",
"s-4vcpu-8gb",
"s-6vcpu-16gb",
"s-8vcpu-32gb",
"s-12vcpu-48gb",
"s-16vcpu-64gb",
"s-20vcpu-96gb",
"s-24vcpu-128gb",
"s-32vcpu-192gb"
],
"features": [
"private_networking",
"backups",
"ipv6",
"metadata",
"install_agent"
],
"available": true
},
"tag": "",
"droplet_ids": [
3164444,
3164445
],
"redirect_http_to_https": false,
"enable_proxy_protocol": true,
"enable_backend_keepalive": true,
"vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b",
"disable_lets_encrypt_dns_records": false,
"project_id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
"http_idle_timeout_seconds": 60,
"firewall": {
"deny": [
"cidr:1.2.0.0/16",
"ip:2.3.4.5"
],
"allow": [
"ip:1.2.3.4",
"cidr:2.3.4.0/24"
]
}
}
}