============= 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/ `_ List of Load Balancer --------------------- To find a list of **Load Balancer** to send a **GET** request .. code-block:: bash 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: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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 .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Requests import requests url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/?location=Delhi&apikey=API_key&project_id={{project_id}}" payload={} headers = { 'Authorization': 'API_Token ', 'Content-Type': 'application/json', } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Response Body { "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 Classic Load Balancer ---------------------------------- To Create a new **Load Balancer** to send a **Post** request .. code-block:: bash 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: .. csv-table:: :file: lb/lb1.csv :widths: 25, 25, 50, 10 :header-rows: 1 The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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. .. tabs:: .. code-tab:: python http client 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", "checkbox_enable": "", "lb_reserve_ip": "", "ssl_certificate_id": "", "ssl_context": { "redirect_to_https": false }, "enable_bitninja": false, "backends": [ { "balance": "roundrobin", "checkbox_enable": false, "domain_name": "localhost", "check_url": "/", "servers": [ { "backend_name": "C2-12GB-CentOS-7-967", "backend_ip": "172.16.110.182", "backend_port": "2020" } ], "http_check": false } ], "acl_list": [], "acl_map": [], "vpc_list": [], "scaler_id": "", "scaler_port": "", "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")) .. code-tab:: python Requests import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/?apikey=API_Key&project_id={{project_id}}" 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", "checkbox_enable": "", "lb_reserve_ip": "", "ssl_certificate_id": "", "ssl_context": { "redirect_to_https": false }, "enable_bitninja": false, "backends": [ { "balance": "roundrobin", "checkbox_enable": false, "domain_name": "localhost", "check_url": "/", "servers": [ { "backend_name": "C2-12GB-CentOS-7-967", "backend_ip": "172.16.110.182", "backend_port": "2020" } ], "http_check": false } ], "acl_list": [], "acl_map": [], "vpc_list": [], "scaler_id": "", "scaler_port": "", "tcp_backend": [] } headers = { 'Authorization': 'API_Token', 'Content-Type': 'application/json', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Request Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { "plan_name": "E2E-LB-1", "lb_name": "E2E-LB-1-558", "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": [ { "balance": "roundrobin", "checkbox_enable": false, "domain_name": "localhost", "check_url": "/", "servers": [ { "backend_name": "C2-12GB-CentOS-7-967", "backend_ip": "172.16.110.182", "backend_port": "2020" } ], "http_check": false } ], "acl_list": [], "acl_map": [], "vpc_list": [], "scaler_id": "", "scaler_port": "", "tcp_backend": [] } .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": 2449, "is_credit_sufficient": true, "IP": "164.52.192.128" }, "errors": {}, "message": "Success" } Delete Classic Load Balancer ---------------------------- To Delete a **Load Balancer** to send a **Delete** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/appliances/{{applince_id}}/?apikey={{api_key}} &contact_person_id=null&project_id={{project_id}} .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Request import requests url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/{{applince_id}}/?apikey=API_Key" payload={} headers = { 'Authorization': 'API_Token ', } response = requests.request("DELETE", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Request Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Response Body { "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 .. code-block:: bash 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: .. csv-table:: :file: lb/lb2.csv :widths: 25, 25, 50,10 :header-rows: 1 The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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. .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Request import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/{{applince_id}}/?apikey=API_Key&project_id={{project_id}}" 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', } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { "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": [] } .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": 2448, "is_credit_sufficient": true }, "errors": {}, "message": "Success" } Create a new Advanced Load Balancer ----------------------------------- To Create a new **Load Balancer** to send a **Post** request .. code-block:: bash 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: .. csv-table:: :file: lb/lb1.csv :widths: 25, 25, 50,10 :header-rows: 1 The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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. .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Request import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/?apikey=API_Key&project_id={{project_id}}" 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', } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Request Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { "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": [] } .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": 2449, "is_credit_sufficient": true, "IP": "164.52.192.128" }, "errors": {}, "message": "Success" } Delete a Advanced Load Balancer ------------------------------- To Delete a **Load Balancer** to send a **Delete** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/appliances/2447/?apikey={{api_key}} &contact_person_id=null&project_id={{project_id}} .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python http client import requests url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/2447/?apikey=API_Key&project_id={{project_id}}" payload={} headers = { 'Authorization': 'API_Token ', } response = requests.request("DELETE", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Request Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": 2449, "is_credit_sufficient": true, "IP": "164.52.192.128" }, "errors": {}, "message": "Success" } Edit Advanced Load Balancer ---------------------------- To modify a **Load Balancer** to send a **PUT** request .. code-block:: bash 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: .. csv-table:: :file: lb/lb2.csv :widths: 25, 25, 50,10 :header-rows: 1 The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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. .. tabs:: .. code-tab:: python http.client 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")) .. code-tab:: python Request import requests import json url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/2448/?apikey=API_Key&project_id={{project_id}}" 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', } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { "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": [] } .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": 2448, "is_credit_sufficient": true }, "errors": {}, "message": "Success" } Enable Access Log Load Balancer ------------------------------- To Enable Access Log on **Load Balancer** to send a **put** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey={{api_key}} &contact_person_id=null&project_id={{project_id}} .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Request import requests url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey=API_Key&project_id={{project_id}}" payload = json.dumps({ { "appliance_id": 3262, "access_key": "6JD33YMRN5TPD7SRQXSS", "secret_key": "X6XFB9202IZ1IGEDIJXJ4L5PHR9GLQD7XHQYNZ07", "bucket": "deployment1" }) headers = { 'Authorization': 'API_Token ', } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { "appliance_id": 3262, "access_key": "6JD33YMRN5TPD7SRQXSS", "secret_key": "X6XFB9202IZ1IGEDIJXJ4L5PHR9GLQD7XHQYNZ07", "bucket": "deployment1" } .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": 2449, "is_credit_sufficient": true, "IP": "164.52.192.128" }, "errors": {}, "message": "Success" } Disable Access Log Load Balancer -------------------------------- To Disable Access Log on **Load Balancer** to send a **put** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey={{api_key}} &contact_person_id=null&project_id={{project_id}} .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Request import requests url = "https://api.e2enetworks.com/myaccount/api/v1/appliances/load-balancers/log-migrate/?apikey=API_Key&project_id={{project_id}}" payload = json.dumps({ { "appliance_id": 3262, "disable": true }) headers = { 'Authorization': 'API_Token ', } response = requests.request("PUT", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { "appliance_id": 3262, "disable": true } .. code-tab:: python Response Body { "code": 200, "data": { "appliance_id": "3262" }, "errors": {}, "message": "Success" } 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". .. code-block:: bash 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= .. tabs:: .. code-tab:: python http client 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")) .. code-tab:: python Request import requests url = "https://api.e2enetworks.com/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 = { 'Authorization': 'API_Token ', } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Response Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Response Body { "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. .. code-block:: bash 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: .. csv-table:: :file: lb/lb1.csv :widths: 25, 25, 50,10 :header-rows: 1 The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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. .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Request Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { type: "power_off", type: "power_off" } .. code-tab:: python Response Body { "code":200, "data":"Appliance Powering Off", "Errors":{}, "message":"Success" } Load Balancer Upgrade:- ----------------------- To Upgrade a Load Balancer it send a Put Request. .. code-block:: bash 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: .. csv-table:: :file: lb/lb1.csv :widths: 25, 25, 50,10 :header-rows: 1 The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - 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. .. tabs:: .. code-tab:: python Request Headers Content-Type: application/json Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi... .. code-tab:: python Request Headers content-type: application/json; charset=utf-8 status: 202 Accepted .. tabs:: .. code-tab:: python Request Body { type: "upgrade_plan", name: "E2E-LB-1-887" plan_name: "E2E-LB-2" type: "upgrade_plan" } .. code-tab:: python Response Body { "code":200, "Data":"lb node upgrading", "Errors":{}, "message":"Success" }