Firewall
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 Firewall
To find the list of firewall, send a HTTP GET request :-
https://api.e2enetworks.com/myaccount/api/v1/fortigate/list/?
apikey={{apikey}}&location={{location}}&project_id={{project-id}}
import http.client
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
'Authorization': 'api_token',
}
conn.request("GET", "/myaccount/api/v1/fortigate/list?apikey={{api_key}}&location=Delhi&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "https://api.e2enetworks.com/myaccount/api/v1/fortigate/list?apikey={{api_key}}&location=Delhi&project_id={{project-id}}"
payload={}
headers = {
'Authorization': 'api_token'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"code": 200,
"data": [
{
"id": 97077,
"name": "Fortinet-7-01-Fortinet-408",
"created_at": "2022-06-20T06:28:53.620681Z",
"public_ip_address": "164.52.192.194",
"private_ip_address": "10.4.222.11",
"backup": false,
"disk": "20 GB",
"status": "Creating",
"vcpus": "1",
"memory": "9 GB",
"plan": "FTN.100V",
"region": null,
"is_locked": false,
"zabbix_host_id": null,
"gpu": "",
"price": "Rs 13/Hour or Rs 9490 Monthly",
"additional_ip": [],
"label": "Default",
"ssh_keys": [],
"is_active": true,
"scaler_id": null,
"os_info": {
"name": "Fortinet",
"version": "7.01",
"category": ""
},
"is_monitored": false,
"backup_status": {
"status": "backup_unsupported",
"detail": "Backup Unsupported"
},
"location": "Delhi",
"monitor_status": {
"status": "not_activated",
"reason": ""
},
"enable_bitninja_details": {
"show_bitninja": false,
"bitninja_cost": 0
},
"is_bitninja_license_active": false,
"any_license_attached": {
"is_license_attached": false,
"license_deletion_message": "",
"mssql_license_attached": false
},
"is_committed": true,
"audit_log_message": null,
"monitoring_tabs_enabled": true,
"cdp_tabs_enabled": true,
"alert_tabs_enabled": true,
"bitninja_discount_percentage": 0.0,
"is_image_deleted": false,
"vpc_enabled": true,
"is_snapshot_allowed": false,
"is_fortigate_vm": true,
"rescue_mode_status": "Disabled",
"is_upgradable": false,
"abuse_flag": false
},
],
"errors": {},
"message": "Success"
}
Create a new Firewall
To create a firewall , send a Post request :-
https://api.e2enetworks.com/myaccount/api/v1/fortigate/create/
?apikey={{apikey}}&location={{location}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"backups": False,
"cn_id": 1036,
"default_public_ip": False,
"disable_password": False,
"enable_bitninja": False,
"image": "Fortinet-7.01-Fortinet",
"is_ipv6_availed": False,
"is_saved_image": False,
"label": "Default",
"name": "Fortinet-7-01-Fortinet-408",
"ngc_container_id": None,
"plan": "FTN-1vCPU-9RAM-20DISK-FTN.100V",
"region": "ncr",
"reserve_ip": "164.52.192.194",
"saved_image_template_id": None,
"ssh_keys": [],
"vpc_id": "8299"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/fortigate/create?apikey=7{{api_key}}&location=Delhi&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/fortigate/create?apikey={{api_key}}&location=Delhi&project_id={{project-id}}"
payload = json.dumps({
"backups": False,
"cn_id": 1036,
"default_public_ip": False,
"disable_password": False,
"enable_bitninja": False,
"image": "Fortinet-7.01-Fortinet",
"is_ipv6_availed": False,
"is_saved_image": False,
"label": "Default",
"name": "Fortinet-7-01-Fortinet-408",
"ngc_container_id": None,
"plan": "FTN-1vCPU-9RAM-20DISK-FTN.100V",
"region": "ncr",
"reserve_ip": "164.52.192.194",
"saved_image_template_id": None,
"ssh_keys": [],
"vpc_id": "8299"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"backups": false,
"cn_id": 1036,
"default_public_ip": false,
"disable_password": false,
"enable_bitninja": false,
"image": "Fortinet-7.01-Fortinet",
"is_ipv6_availed": false,
"is_saved_image": false,
"label": "Default",
"name": "Fortinet-7-01-Fortinet-408",
"ngc_container_id": null,
"plan": "FTN-1vCPU-9RAM-20DISK-FTN.100V",
"region": "ncr",
"reserve_ip": "164.52.192.194",
"saved_image_template_id": null,
"ssh_keys": [],
"vpc_id": "8299"
}
{
"code": 200,
"data": {
"id": 97077,
"name": "Fortinet-7-01-Fortinet-408",
"created_at": "2022-06-20T06:28:53.620681Z",
"public_ip_address": "164.52.192.194",
"private_ip_address": "10.4.222.11",
"backup": false,
"disk": "20 GB",
"status": "Creating",
"vcpus": "1",
"memory": "9 GB",
"plan": "FTN.100V",
"region": null,
"is_locked": false,
"zabbix_host_id": null,
"gpu": "",
"price": "Rs 13/Hour or Rs 9490 Monthly",
"additional_ip": [],
"label": "Default",
"ssh_keys": [],
"is_active": true,
"scaler_id": null,
"os_info": {
"name": "Fortinet",
"version": "7.01",
"category": ""
},
"is_monitored": false,
"backup_status": {
"status": "backup_unsupported",
"detail": "Backup Unsupported"
},
"location": "Delhi",
"monitor_status": {
"status": "not_activated",
"reason": ""
},
"enable_bitninja_details": {
"show_bitninja": false,
"bitninja_cost": 0
},
"is_bitninja_license_active": false,
"any_license_attached": {
"is_license_attached": false,
"license_deletion_message": "",
"mssql_license_attached": false
},
"is_committed": true,
"audit_log_message": null,
"monitoring_tabs_enabled": true,
"cdp_tabs_enabled": true,
"alert_tabs_enabled": true,
"bitninja_discount_percentage": 0.0,
"is_image_deleted": false,
"vpc_enabled": true,
"is_snapshot_allowed": false,
"is_fortigate_vm": true,
"rescue_mode_status": "Disabled",
"is_upgradable": false,
"abuse_flag": false
},
"errors": {},
"message": "Success"
}
Delete a Firewall -
To delete a Firewall , send a DELETE request to firewall endpoint :-
https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/
?apikey={{apikey}}&project_id={{project-id}}&reserve_ip_required=
import http.client
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
'Authorization': 'api_token'
}
conn.request("DELETE", "/myaccount/api/v1/nodes/<<node_id>>/?apikey={{api_key}}&project_id={{project-id}}&reserve_ip_required=", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/?apikey={{api_key}}&project_id={{project-id}}&reserve_ip_required="
payload={}
headers = {
'Authorization': 'api_token'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"code": 200,
"data": {},
"errors": {},
"message": "Success"
}
Lock Firewall
To lock firewall , send a PUT request to firewall end point :-
https://api.e2enetworks.com/myaccount/api/v1/nodes/{{node_id}}/
actions/?apikey={{apikey}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "lock_vm"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/nodes/97072/actions/?apikey={{api_key}}&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}"
payload = json.dumps({
"type": "lock_vm"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"type": "lock_vm"
}
{
"code": 200,
"data": {
"id": 122605,
"created_at": "2022-06-20T06:47:47.579245Z",
"status": "done",
"action_type": "lock_vm",
"resource_id": "97072"
},
"errors": {},
"message": "Success"
}
Unlock Firewall
To unlock firewall , send a PUT request -
https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/
actions/?apikey={{apikey}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "unlock_vm"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}"
payload = json.dumps({
"type": "unlock_vm"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"type": "unlock_vm"
}
{
"code": 200,
"data": {
"id": 122606,
"created_at": "2022-06-20T06:48:01.999965Z",
"status": "done",
"action_type": "unlock_vm",
"resource_id": "97072"
},
"errors": {},
"message": "Success"
}
Power-On Firewall
To power-on firewall , send a PUT request-
https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/
actions/?apikey={{apikey}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "power_on"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}"
payload = json.dumps({
"type": "power_on"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"type": "power_on"
}
{
"code": 200,
"data": {
"id": 122622,
"created_at": "2022-06-20T07:39:09.066759Z",
"status": "done",
"action_type": "power_on",
"resource_id": "97072"
},
"errors": {},
"message": "Success"
}
Power -off Firewall
To power-off firewall , send a PUT request-
https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/
actions/?apikey={{apikey}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "power_off"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}"
payload = json.dumps({
"type": "power_off"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"type": "power_off"
}
{
"code": 200,
"data": {
"id": 122621,
"created_at": "2022-06-20T07:38:34.259238Z",
"status": "done",
"action_type": "power_off",
"resource_id": "97072"
},
"errors": {},
"message": "Success"
}
Reboot Firewall
To reboot firewall, send a PUT request :-
https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/
actions/?apikey={{apikey}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "reboot"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}"
payload = json.dumps({
"type": "reboot"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"type": "reboot"
}
{
"code": 200,
"data": {
"id": 122629,
"created_at": "2022-06-20T07:49:25.471551Z",
"status": "done",
"action_type": "reboot",
"resource_id": "97072"
},
"errors": {},
"message": "Success"
}
Reinstall Firewall
To reinstall firewall, send a PUT request-
https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/
actions/?apikey={{apikey}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"type": "reinstall"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/nodes/<<node_id>>/actions/?apikey={{api_key}}&project_id={{project-id}}"
payload = json.dumps({
"type": "reinstall"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"type": "reinstall"
}
{
"code": 200,
"data": {
"id": 122635,
"created_at": "2022-06-20T07:52:19.761953Z",
"status": "done",
"action_type": "reinstall",
"resource_id": "97072"
},
"errors": {},
"message": "Success"
}
Commited node setting
To update node to commited node, send a Post request:-
https://api.e2enetworks.com/myaccount/api/v1/update_committed_node_status/
?apikey={{apikey}}&location={{location}}&project_id={{project-id}}
import http.client
import json
conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"committed_plan": 1036,
"node_status": "auto_renew",
"vcn_id": 97072
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/update_committed_node_status/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
import json
url = "https://api.e2enetworks.com/myaccount/api/v1/update_committed_node_status/?apikey={{api_key}}&location=Delhi&project_id={{project-id}}"
payload = json.dumps({
"committed_plan": 1036,
"node_status": "auto_renew",
"vcn_id": 97072
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
content-type: application/json; charset=utf-8
status: 202 Accepted
{
"committed_plan": 1036,
"node_status": "auto_renew",
"vcn_id": 97072
}
{
"status": 200,
"message": "Updated Successfully"
}