Load Balancer

Create an API Key and access token:-

For create a API Key and Access Token to refer this link :-

https://www.e2enetworks.com/help/knowledge-base/how-to-create-an-api-access-token/

Get List of all Plans on Load Balancer

To get the list of all plans for creating a Load Balancer it send a get Request.

https://api.e2enetworks.net/myaccount/api/v1/appliance-type/?apikey=
{{apikey}}&project_id={{apikey}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "appliance_config": [
                {
                    "ram": 4,
                    "name": "E2E-LB-Shubh-4GB",
                    "vcpu": 2,
                    "price": 2000.0,
                    "hourly": 15.0,
                    "disk": 10,
                    "template_id": "14",
                    "description": "",
                    "location": "Delhi",
                    "can_support_bitninja": {
                        "show_bitninja": true,
                        "bitninja_cost": 760.0
                    }
                },
                {
                    "ram": 6,
                    "name": "E2E-LB-Shubh-6GB",
                    "vcpu": 3,
                    "price": 4000.0,
                    "hourly": 25.0,
                    "disk": 10,
                    "template_id": "14",
                    "description": "",
                    "location": "Delhi",
                    "can_support_bitninja": {
                        "show_bitninja": true,
                        "bitninja_cost": 760.0
                    }
                }
            ]
        }
    ],
    "errors": {},
    "message": "Success"
}

List of Load Balancer

To find a list of Load Balancer to send a GET request

https://api.e2enetworks.com/myaccount/api/v1/appliances/?location=Delhi&apikey
={{api_key}}&contact_person_id=null&page_no=1&per_page=5&project_id={{project_id}}

The request returns a JSON object that contains the following attributes:

Name

Type

Description

id

Integer

A unique integer identifier created and assigned to the LB after its creation.

name

string

The name assigned to the node

template_id

Integer

A unique integer identifier created and assigned to the LB after its creation

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
        'Authorization': ' API_Token ',
        'Content-Type': 'application/json',
    }
conn.request("GET", "/myaccount/api/v1/appliances/?location=Delhi&apikey=API_Key&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "id": 2449,
            "name": "E2E-LB-1-714",
            "appliance_type": {
                "id": 1,
                "name": "LoadBalancer",
                "appliance_config": [
                    {
                        "hourly": 1,
                        "name": "E2E-LB-1",
                        "vcpu": 2,
                        "price": "730",
                        "ram": "3GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 2248,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Delhi"
                    },
                    {
                        "hourly": 2,
                        "name": "E2E-LB-2",
                        "vcpu": 4,
                        "price": "1460",
                        "ram": "6GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 2249,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Delhi"
                    },
                    {
                        "hourly": 4,
                        "name": "E2E-LB-3",
                        "vcpu": 8,
                        "price": "2920",
                        "ram": "12GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 2250,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Delhi"
                    },
                    {
                        "hourly": 8,
                        "name": "E2E-LB-4",
                        "vcpu": 12,
                        "price": "5840",
                        "ram": "24GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 2251,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Delhi"
                    },
                    {
                        "hourly": 16,
                        "name": "E2E-LB-5",
                        "vcpu": 24,
                        "price": "11680",
                        "ram": "48GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 2252,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Delhi"
                    },
                    {
                        "hourly": 1,
                        "name": "MUM-E2E-LB-1",
                        "vcpu": 2,
                        "price": "730",
                        "ram": "3GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 10842,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Mumbai"
                    },
                    {
                        "hourly": 2,
                        "name": "MUM-E2E-LB-2",
                        "vcpu": 4,
                        "price": "1460",
                        "ram": "6GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 10845,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Mumbai"
                    },
                    {
                        "hourly": 4,
                        "name": "MUM-E2E-LB-3",
                        "vcpu": 8,
                        "price": "2920",
                        "ram": "12GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 10844,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Mumbai"
                    },
                    {
                        "hourly": 8,
                        "name": "MUM-E2E-LB-4",
                        "vcpu": 12,
                        "price": "5840",
                        "ram": "24GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 10843,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Mumbai"
                    },
                    {
                        "hourly": 16,
                        "name": "MUM-E2E-LB-5",
                        "vcpu": 24,
                        "price": "11680",
                        "ram": "48GB",
                        "user": 1,
                        "disk": "10GB",
                        "template_id": 10841,
                        "description": "",
                        "can_support_bitninja": {
                            "show_bitninja": true,
                            "bitninja_cost": "760.00"
                        },
                        "location": "Mumbai"
                    }
                ],
                "bitninja_discount_percentage": 0.0
            },
            "customer": 18933,
            "node_detail": {
                "node_id": 89389,
                "zabbix_host_id": 93024,
                "private_ip": "172.16.112.237",
                "allow_reserve_ip": {
                    "is_limit_available": true,
                    "is_already_reserved": false,
                    "can_we_reserved": true,
                    "reserve_ip_price": "199 infra credits",
                    "can_we_attach_detach_public_ip": true
                },
                "vm_id": 100151,
                "ram": "3 GB",
                "disk": "10 GB",
                "additional_ip": [],
                "public_ip": "164.52.192.128",
                "vcpu": 2,
                "support_bitninja": {
                    "show_bitninja": true,
                    "bitninja_cost": "760.00"
                },
                "is_bitninja_license_active": false,
                "bitninja_discount_percentage": 0.0
            },
            "appliance_instance": [
                {
                    "id": "5845",
                    "run": "2022-03-07 08:40:52.921174+00:00",
                    "context": {
                        "lb_port": "80",
                        "lb_type": "External",
                        "lb_name": "E2E-LB-1-714",
                        "lb_mode": "HTTP",
                        "plan_name": "E2E-LB-1",
                        "vpc_list": [],
                        "acl_list": [],
                        "acl_map": [],
                        "backends": [
                            {
                                "balance": "source",
                                "name": "alpha",
                                "backend_mode": "http",
                                "network_id": null,
                                "servers": [
                                    {
                                        "backend_name": "E2E-LB-1-5555",
                                        "backend_ip": "172.16.112.221",
                                        "backend_port": "8080"
                                    }
                                ],
                                "domain_name": "localhost",
                                "http_check": false,
                                "check_url": "/"
                            }
                        ],
                        "ssl_context": {
                            "ssl_certificate_id": null,
                            "redirect_to_https": false
                        },
                        "node_list_type": "S",
                        "scaler_id": "",
                        "scaler_port": "",
                        "lb_reserve_ip": "",
                        "enable_bitninja": false,
                        "default_backend_name": "alpha",
                        "host_target": "164.52.192.128"
                    }
                }
            ],
            "status": "RUNNING",
            "data_monitor": {
                "status": false,
                "node_status_pair": [
                    {
                        "node_name": "E2E-LB-1-5555",
                        "node_status": "DOWN"
                    }
                ]
            },
            "scaler_id": null,
            "node_list_type": "S",
            "scaler_port": null,
            "created_at": "2022-03-07 08:38:51 AM UTC",
            "updated_at": "2022-03-07 08:38:51 AM UTC",
            "eos_enabled_status": false
        }
    ],
    "errors": {},
    "message": "Success"
}

Create a new Network Load Balancer

To Create a new Load Balancer to send a Post request

https://api.e2enetworks.net/myaccount/api/v1/appliances/load-balancers/?apikey={{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = {
            "client_timeout": "60",
            "connection_timeout": "60",
            "server_timeout": "60",
            "http_keep_alive_timeout": "60",
            "plan_name": "E2E-LB-Shubh-4GB",
            "lb_name": "LB-NLB-3598-3379",
            "lb_type": "external",
            "lb_mode": "HTTP",
            "lb_port": "80",
            "node_list_type": "S",
            "checkbox_enable": "",
            "lb_reserve_ip": "",
            "ssl_certificate_id": null,
            "default_backend": "",
            "is_ipv6_attached": false,
            "enable_bitninja": false,
            "ssl_context": {
                "redirect_to_https": false
            },
            "backends": [],
            "vpc_list": [],
            "tcp_backend": [
                {
                    "target": "tcpNetworkMappingNode",
                    "backend_name": "backend-server-1",
                    "port": "1080",
                    "balance": "leastconn",
                    "servers": [
                        {
                            "target": "backend",
                            "backend_name": "C2-5GB-Shubh-Ubuntu-261",
                            "backend_ip": "172.16.232.88",
                            "backend_port": "80"
                        }
                    ]
                }
            ],
            "acl_list": [],
            "acl_map": []
        }
headers = {
    'Authorization': 'API_Token ',
    'Content-Type': 'application/json',
    }
conn.request("POST", "/myaccount/api/v1/appliances/load-balancers/?apikey=API_Key&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "client_timeout": "60",
    "connection_timeout": "60",
    "server_timeout": "60",
    "http_keep_alive_timeout": "60",
    "plan_name": "E2E-LB-Shubh-4GB",
    "lb_name": "LB-NLB-3598-3379",
    "lb_type": "external",
    "lb_mode": "HTTP",
    "lb_port": "80",
    "node_list_type": "S",
    "checkbox_enable": "",
    "lb_reserve_ip": "",
    "ssl_certificate_id": null,
    "default_backend": "",
    "is_ipv6_attached": false,
    "enable_bitninja": false,
    "ssl_context": {
        "redirect_to_https": false
    },
    "backends": [],
    "vpc_list": [],
    "tcp_backend": [
        {
            "target": "tcpNetworkMappingNode",
            "backend_name": "backend-server-1",
            "port": "1080",
            "balance": "leastconn",
            "servers": [
                {
                    "target": "backend",
                    "backend_name": "C2-5GB-Shubh-Ubuntu-261",
                    "backend_ip": "172.16.232.88",
                    "backend_port": "80"
                }
            ]
        }
    ],
    "acl_list": [],
    "acl_map": []
}

Delete Network Load Balancer

To Delete a Load Balancer to send a Delete request

https://api.e2enetworks.com/myaccount/api/v1/appliances/{{applince_id}}/?apikey={{api_key}}
&contact_person_id=null&project_id={{project_id}}
import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
        'Authorization': 'API_Token ',
    }
conn.request("DELETE", "/myaccount/api/v1/appliances/{{applince_id}}/?apikey=API_Key&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {
        "appliance_id": 2449,
        "is_credit_sufficient": true,
        "IP": "164.52.192.128"
    },
    "errors": {},
    "message": "Success"
}

Edit your Load Balancer

To modify a Load Balancer to send a PUT request

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/{{applince_id}}
/?apikey={{api_key}}&contact_person_id=null&project_id={{project_id}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = {
"plan_name": "E2E-LB-1",
"lb_name": "E2E-LB-1-558",
"lb_type": "External",
"lb_mode": "HTTP",
"lb_port": "80",
"node_list_type": "S",
"lb_reserve_ip": "",
"ssl_certificate_id": null,
"ssl_context": {
    "redirect_to_https": false
},
"enable_bitninja": false,
"scaler_id": "",
"scaler_port": "",
"backends": [
    {
        "balance": "roundrobin",
        "domain_name": "localhost",
        "check_url": "/",
        "servers": [
            {
                "backend_name": "C2-12GB-CentOS-7-967",
                "backend_ip": "172.16.110.182",
                "backend_port": "9090"
            }
        ],
        "http_check": false
    }
],
"acl_list": [],
"acl_map": [],
"vpc_list": [],
"tcp_backend": []
}
headers = {
    'Authorization': 'API_Token' ,
    'Content-Type': 'application/json',
    }
conn.request("PUT", "/myaccount/api/v1/appliances/load-balancers/{{applince_id}}/?apikey=API_Key&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "plan_name": "E2E-LB-1",
    "lb_name": "E2E-LB-1-558",
    "lb_type": "External",
    "lb_mode": "HTTP",
    "lb_port": "80",
    "node_list_type": "S",
    "lb_reserve_ip": "",
    "ssl_certificate_id": null,
    "ssl_context": {
        "redirect_to_https": false
    },
    "enable_bitninja": false,
    "scaler_id": "",
    "scaler_port": "",
    "backends": [
        {
            "balance": "roundrobin",
            "domain_name": "localhost",
            "check_url": "/",
            "servers": [
                {
                    "backend_name": "C2-12GB-CentOS-7-967",
                    "backend_ip": "172.16.110.182",
                    "backend_port": "9090"
                }
            ],
            "http_check": false
        }
    ],
    "acl_list": [],
    "acl_map": [],
    "vpc_list": [],
    "tcp_backend": []
}

Create a new Application Load Balancer

To Create a new Load Balancer to send a Post request

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/?apikey={{api_key}}
&contact_person_id=null&project_id={{project_id}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({

            {
            "plan_name": "E2E-LB-1",
            "lb_name": "E2E-LB-1-233",
            "lb_type": "External",
            "lb_mode": "HTTP",
            "lb_port": "80",
            "node_list_type": "S",
            "checkbox_enable": "",
            "lb_reserve_ip": "",
            "ssl_certificate_id": "",
            "ssl_context": {
                "redirect_to_https": false
            },
            "enable_bitninja": false,
            "backends": [
                {
                    "name": "backend-server-1",
                    "balance": "source",
                    "checkbox_enable": null,
                    "domain_name": "localhost",
                    "check_url": "/",
                    "scaler_port": null,
                    "scaler_id": null,
                    "servers": [
                        {
                            "backend_name": "C2-12GB-CentOS-7-967",
                            "backend_ip": "172.16.110.182",
                            "backend_port": "22"
                        }
                    ],
                    "http_check": false
                }
            ],
            "acl_list": [
                {
                    "acl_name": "rule-1",
                    "acl_condition": "path -i",
                    "acl_matching_path": " /path"
                }
            ],
            "acl_map": [
                {
                    "acl_backend": "backend-server-1",
                    "acl_condition_state": "true",
                    "acl_name": "rule-1"
                }
            ],
            "vpc_list": [],
            "default_backend": "",
            "tcp_backend": []
        })

    headers = {
        'Authorization': 'API_Token ',
        'Content-Type': 'application/json',
        }
    conn.request("POST", "/myaccount/api/v1/appliances/load-balancers/?apikey=API_Key&project_id={{project_id}}", payload, headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "plan_name": "E2E-LB-1",
    "lb_name": "E2E-LB-1-233",
    "lb_type": "External",
    "lb_mode": "HTTP",
    "lb_port": "80",
    "node_list_type": "S",
    "checkbox_enable": "",
    "lb_reserve_ip": "",
    "ssl_certificate_id": "",
    "ssl_context": {
        "redirect_to_https": false
    },
    "enable_bitninja": false,
    "backends": [
        {
            "name": "backend-server-1",
            "balance": "source",
            "checkbox_enable": null,
            "domain_name": "localhost",
            "check_url": "/",
            "scaler_port": null,
            "scaler_id": null,
            "servers": [
                {
                    "backend_name": "C2-12GB-CentOS-7-967",
                    "backend_ip": "172.16.110.182",
                    "backend_port": "22"
                }
            ],
            "http_check": false
        }
    ],
    "acl_list": [
        {
            "acl_name": "rule-1",
            "acl_condition": "path -i",
            "acl_matching_path": " /path"
        }
    ],
    "acl_map": [
        {
            "acl_backend": "backend-server-1",
            "acl_condition_state": "true",
            "acl_name": "rule-1"
        }
    ],
    "vpc_list": [],
    "default_backend": "",
    "tcp_backend": []
}

Delete a Application Load Balancer

To Delete a Load Balancer to send a Delete request

https://api.e2enetworks.com/myaccount/api/v1/appliances/2447/?apikey={{api_key}}
&contact_person_id=null&project_id={{project_id}}
import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
        'Authorization': 'API_Token ',
    }
conn.request("DELETE", "/myaccount/api/v1/appliances/2447/?apikey=API_Key&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {
        "appliance_id": 2449,
        "is_credit_sufficient": true,
        "IP": "164.52.192.128"
    },
    "errors": {},
    "message": "Success"
}

Edit Application Load Balancer

To modify a Load Balancer to send a PUT request

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/{{id}}/?apikey={{api_key}}
&contact_person_id=null&project_id={{project_id}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = {
"plan_name": "E2E-LB-1",
"lb_name": "E2E-LB-1-233",
"lb_type": "External",
"lb_mode": "HTTP",
"lb_port": "80",
"node_list_type": "S",
"lb_reserve_ip": "",
"ssl_certificate_id": null,
"ssl_context": {
    "redirect_to_https": false
},
"enable_bitninja": false,
"scaler_id": null,
"scaler_port": null,
"backends": [
    {
        "name": "backend-server-1",
        "balance": "source",
        "domain_name": "localhost",
        "check_url": "/",
        "scaler_port": null,
        "scaler_id": null,
        "servers": [
            {
                "backend_name": "C2-12GB-CentOS-7-967",
                "backend_ip": "172.16.110.182",
                "backend_port": "2235"
            }
        ],
        "http_check": false
    }
],
"acl_list": [
    {
        "acl_name": "rule-1",
        "acl_condition": "path -i",
        "acl_matching_path": "/path"
    }
],
"acl_map": [
    {
        "acl_backend": "backend-server-1",
        "acl_condition_state": "true",
        "acl_name": "rule-1"
    }
],
"vpc_list": [],
"default_backend": "",
"tcp_backend": []
}

headers = {
    'Authorization': 'API_Token' ,
    'Content-Type': 'application/json',
    }
conn.request("PUT", "/myaccount/api/v1/appliances/load-balancers/2448/?apikey=API_Key&project_id{{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
        "plan_name": "E2E-LB-1",
        "lb_name": "E2E-LB-1-233",
        "lb_type": "External",
        "lb_mode": "HTTP",
        "lb_port": "80",
        "node_list_type": "S",
        "lb_reserve_ip": "",
        "ssl_certificate_id": null,
        "ssl_context": {
            "redirect_to_https": false
        },
        "enable_bitninja": false,
        "scaler_id": null,
        "scaler_port": null,
        "backends": [
            {
                "name": "backend-server-1",
                "balance": "source",
                "domain_name": "localhost",
                "check_url": "/",
                "scaler_port": null,
                "scaler_id": null,
                "servers": [
                    {
                        "backend_name": "C2-12GB-CentOS-7-967",
                        "backend_ip": "172.16.110.182",
                        "backend_port": "2235"
                    }
                ],
                "http_check": false
            }
        ],
        "acl_list": [
            {
                "acl_name": "rule-1",
                "acl_condition": "path -i",
                "acl_matching_path": "/path"
            }
        ],
        "acl_map": [
            {
                "acl_backend": "backend-server-1",
                "acl_condition_state": "true",
                "acl_name": "rule-1"
            }
        ],
        "vpc_list": [],
        "default_backend": "",
        "tcp_backend": []
}

Enable Access Log Load Balancer

To Enable Access Log on Load Balancer to send a put request

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey={{api_key}}
&contact_person_id=null&project_id={{project_id}}
import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
{
"appliance_id": 3262,
"access_key": "6JD33YMRN5TPD7SRQXSS",
"secret_key": "X6XFB9202IZ1IGEDIJXJ4L5PHR9GLQD7XHQYNZ07",
"bucket": "deployment1"
})
headers = {
        'Authorization': 'API_Token ',
    }
conn.request("PUT", "/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey=API_Key&project_id={{project_id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "appliance_id": 3262,
    "access_key": "6JD33YMRN5TPD7SRQXSS",
    "secret_key": "X6XFB9202IZ1IGEDIJXJ4L5PHR9GLQD7XHQYNZ07",
    "bucket": "deployment1"
    }

Disable Access Log Load Balancer

To Disable Access Log on Load Balancer to send a put request

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey={{api_key}}
&contact_person_id=null&project_id={{project_id}}
    import http.client

    conn = http.client.HTTPSConnection("api.e2enetworks.com")
    payload = json.dumps({
    {
    "appliance_id": 3262,
    "disable": true
})
    headers = {
            'Authorization': 'API_Token ',
        }
    conn.request("PUT", "/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey=API_Key&project_id={{project_id}}", payload, headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "appliance_id": 3262,
    "disable": true
}

Advanced Filter For LoadBalancer

To apply a advance filter in Load Balancer to send a get request

To search for Load Balancers based on their status code, users can use the predefined status codes among “Creating”, “Running”, “Error”, “Provisioning”,and “Deploying” as search filters. For example, if a user wants to find Load Balancers that are currently running, they can apply the filter “status=running” to their search query. Similarly, if a user wants to find Load Balancers that are in the process of being created, they can use the filter “status=creating”. By using these predefined status codes, users can quickly and easily search for Load Balancers based on their current status.

They can also search by Load Balancer name using “lbname” and by IP address using “privateip” or “public_ip”.

https://api.e2enetworks.com/myaccount/api/v1/appliances/?location=Delhi&
apikey={{api_key}}&contact_person_id=null&page_no=1&per_page=5&status=&lb_name=E2E-LB-1-428&project_id={{project_id}}&public_ip=&private_ip=
import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
        'Authorization': 'API_Token ',
    }
conn.request("GET", "/myaccount/api/v1/appliances/?location=Delhi&apikey={{api_key}}&contact_person_id=null&project_id={{project_id}}
            &page_no=1&per_page=5&status=&lb_name=E2E-LB-1-428&public_ip=&private_ip=", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [
        {
            "id": 3263,
            "name": "E2E-LB-1-428",
            "customer": 17976,
            "node_detail": {
                "node_id": 122714,
                "zabbix_host_id": 125059,
                "private_ip": "172.16.112.81",
                "vm_id": 135100,
                "ram": "3 GB",
                "disk": "10 GB",
                "public_ip": "164.52.192.75",
                "vcpu": 2,
                "price": "Rs. 1.0/Hour or Rs. 730.0 Monthly",
                "plan_name": "E2E-LB-1"
            },
            "appliance_instance": [
                {
                    "id": "8264",
                    "run": "2023-04-17 06:13:57.536258+00:00",
                    "context": {
                        "lb_port": "80",
                        "lb_type": "External",
                        "lb_name": "E2E-LB-1-428",
                        "lb_mode": "HTTP",
                        "plan_name": "E2E-LB-1",
                        "vpc_list": [
                            {
                                "network_id": "10660",
                                "vpc_name": "VPC-708",
                                "ipv4_cidr": "10.7.156.0/23"
                            }
                        ],
                        "acl_list": [
                            {
                                "acl_name": "rule-1",
                                "acl_condition": "path -i",
                                "acl_matching_path": "/test/path"
                            },
                            {
                                "acl_name": "rule-556",
                                "acl_condition": "path_beg -i",
                                "acl_matching_path": "/test/"
                            }
                        ],
                        "acl_map": [
                            {
                                "acl_name": "rule-1",
                                "acl_condition_state": true,
                                "acl_backend": "backend-server-1"
                            },
                            {
                                "acl_name": "rule-556",
                                "acl_condition_state": true,
                                "acl_backend": "backend-server-1"
                            }
                        ],
                        "backends": [
                            {
                                "balance": "roundrobin",
                                "name": "backend-server-1",
                                "backend_mode": "http",
                                "network_id": null,
                                "servers": [
                                    {
                                        "backend_name": "C2-12GB-CentOS-7-571",
                                        "backend_ip": "172.16.115.95",
                                        "backend_port": "8080"
                                    },
                                    {
                                        "backend_name": "C2-12GB-CentOS-7-848",
                                        "backend_ip": "172.16.65.71",
                                        "backend_port": "8080"
                                    }
                                ],
                                "domain_name": "localhost",
                                "http_check": false,
                                "check_url": "/"
                            },
                            {
                                "balance": "source",
                                "name": "backend-server-838",
                                "backend_mode": "http",
                                "network_id": null,
                                "servers": [
                                    {
                                        "backend_name": "C2-12GB-CentOS-7-571",
                                        "backend_ip": "172.16.115.95",
                                        "backend_port": "9090"
                                    }
                                ],
                                "domain_name": "localhost",
                                "http_check": false,
                                "check_url": "/"
                            }
                        ],
                        "ssl_context": {
                            "ssl_certificate_id": null,
                            "redirect_to_https": false
                        },
                        "node_list_type": "S",
                        "lb_reserve_ip": "",
                        "enable_bitninja": false,
                        "location": "",
                        "multi_acl_list": [
                            {
                                "acl_name": "rule-1",
                                "acl_condition_state": "",
                                "acl_backend": "backend-server-1",
                                "acl_condition": "path -i",
                                "acl_matching_path": "/test/path"
                            },
                            {
                                "acl_name": "rule-556",
                                "acl_condition_state": "",
                                "acl_backend": "backend-server-1",
                                "acl_condition": "path_beg -i",
                                "acl_matching_path": "/test/"
                            }
                        ],
                        "default_backend_name": "backend-server-1",
                        "host_target": "164.52.192.75",
                        "management_ip": "192.168.0.215"
                    }
                }
            ],
            "status": "RUNNING",
            "scaler_id": null,
            "node_list_type": "S",
            "scaler_port": null,
            "created_at": "2023-04-17 05:20:02 AM UTC",
            "updated_at": "2023-04-17 06:13:55 AM UTC",
            "eos_enabled_status": false
        }
    ],
    "errors": {},
    "message": "Success",
    "total_page_number": 1,
    "total_count": 1
}

Load Balancer Power Off

To Power Off a Load Balancer it send a Put Request.

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/3536/actions/
?apikey={{api_key}}&contact_person_id=null&location=Delhi&project_id={{project_id}}

Attributes and respective values required to send this PUT request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
type: "power_off",
type: "power_off"
}

Load Balancer Upgrade

To Upgrade a Load Balancer it send a Put Request.

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/3536/actions/
?apikey={{api_key}}&contact_person_id=null&location=Delhi&project_id={{project_id}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    type: "upgrade_plan",
    name: "E2E-LB-1-887"
    plan_name: "E2E-LB-2"
    type: "upgrade_plan"

}

Attach IPv6 to Load balancer

To attach IPv6 to a Load Balancer it send a Put Request.

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/4882/ipv6/?apikey=
{{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "action":"attach"

}

Detach IPv6 from Load balancer

To detach IPv6 from a Load Balancer it send a Put Request.

https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/4882/ipv6/?apikey=
{{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "action": "detach",
    "detach_ipv6": "2406:69c0:1000::38"

}

Get Billing log for a Load Balancer

To get the billing log for a Load Balancer it send a get Request.

https://api.e2enetworks.net/myaccount/api/v1/appliances/load-balancer-billinglog/907/?page_no=1&per_page=5&apikey=
{{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": [],
    "errors": {},
    "message": "Success",
    "total_page_number": 1,
    "total_count": 0
}

Get Action log of a Load Balancer

To get the Action log of a Load Balancer it send a get Request.

https://api.e2enetworks.net/myaccount/api/v1/appliances/load-balancer-actionlog/907/?page_no=1&per_page=5&apikey=
{{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
        "code": 200,
        "data": [
                {
                    "timestamp": "Jun 04, 2024 06:33:09 AM",
                    "event": "create",
                    "client_ip": "172.16.232.14",
                    "details": "",
                    "project_name": "default-project-1648",
                    "created_by_user_email": "vansh.gupta@e2enetworks.com"
                }
            ],
        "errors": {},
        "message": "Success",
        "total_page_number": 1,
        "total_count": 1
}

Get Monitoring Status of a Load Balancer

To get the Monitoring Status of a Load Balancer it send a get Request.

https://api.e2enetworks.net/myaccount/api/v1/nodes/6416/monitoring/monitoring_status/?apikey=
{{apikey}}&project_id={{apikey}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
            "code": 200,
            "data": {
                "is_zabbix_active": true,
                "message": "Connection with agent is successfull"
            },
            "errors": {},
            "message": "Success"
}

To enable BitNinja on a Load Balancer

To enable BitNinja on a a Load Balancer it send a POST Request.

https://api-loki.e2enetworks.net/myaccount/api/v1/license/bitninja/7414/lb/?apikey=
{{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
            "code": 200,
            "data": {
                "command_to_execute": "curl https://get.bitninja.io/install.sh | /bin/bash -s - --license_key=RSK__164_52_195_167__1XXHS7AERFZYYB3WKIQ58W6UOFRM4CPL"
            },
            "errors": {},
            "message": "Success"
}

To disable BitNinja on a Load Balancer

To disable BitNinja on a a Load Balancer it send a DELETE Request.

https://api.e2enetworks.com/myaccount/api/v1/appliances/?page_no=1&per_page=5&advance_search_string=false&apikey=
{{apikey}}&project_id={{project_id}}&location={{location}}

Attributes and respective values required to send this POST request are:

The request returns a JSON object that contains the following attributes:

Name

Type

Description

ip

Integer

Information regarding the network configuration.

appliance_id

Integer

A unique integer identifier created and assigned to the LB after its creation.

Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
            "code":200,
            "data":{},
            "errors":{},
            "message":"Success"
}