VPC

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 VPC

To find a list of VPC to send a GET request

https://api.e2enetworks.com/myaccount/api/v1/vpc/list/?apikey={{API_Key}}&page_no=1&per_page=5&location=Delhi&project_id={{project-id}}

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

Name

Type

Description

ip_address_private

Integer

Information regarding the network configuration.

network_id

string

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

gateway_ip

Integer

Information regarding the network configuration.

name

string

The name assigned to the VPC.

created_at

integer

A string represents both the date and time when the reserve ip is created.

state

string

A string that denotes the state of the Reserve ip.

ip_address_private

integer

Information regarding the network configuration.

dns

integer

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

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
        'Authorization': 'API_token ',
      }
conn.request("GET", "/myaccount/api/v1/vpc/list/?apikey=API_key&page_no=1&per_page=5&location=Delhi&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": [
      {
          "name": "VPC-765",
          "network_id": 7140,
          "is_active": true,
          "created_at": "2022-03-30T12:33:15.052911Z",
          "network_mask": "255.255.254.0",
          "ipv4_cidr": "10.3.234.0/23",
          "vm_count": 0,
          "dns": "8.8.8.8 8.8.4.4",
          "gateway_ip": "10.3.234.1",
          "pool_size": 512,
          "gateway_node": {
              "node_name": "VPC-765-gateway",
              "node_id": 90966,
              "ip_address_public": "164.52.208.56",
              "ip_address_private": "10.3.234.1",
              "state": "Creating"
          },
          "state": "Creating"
      }
  ],
  "errors": {},
  "message": "Success",
  "total_page_number": 1
}

Create a new VPC

To create a VPC to send a Post request

https://api.e2enetworks.com/myaccount/api/v1/vpc/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}

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

Name

Type

Description

Required

network_size

Integer

A unique integer that provide the size of VPC.

True

vpc_name

string

The name assigned to the VPC.

True

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

Name

Type

Description

vpc_id

Integer

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

vpc_name

string

The name was assigned to the VPC after its creation.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
      "network_size": 512,
      "vpc_name": "VPC-769"
      })
  headers = {
        'Authorization': 'API_token ',
        'Content-Type': 'application/json',
        }
  conn.request("POST", "/myaccount/api/v1/vpc/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}}", payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{

  "network_size": 512,
  "vpc_name": "VPC-765"

}

Delete a VPC

To delete a VPC to send a DELETE request

https://api.e2enetworks.com/myaccount/api/v1/vpc/7146/?apikey={{API_Key}}&project_id={{project-id}}

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

Name

Type

Description

vpc_id

Integer

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

vpc_name

string

The name was assigned to the VPC after its creation.

import http.client

  conn = http.client.HTTPSConnection("api.e2enetworks.com")
  payload = ''
  headers = {
          'Authorization': 'API_Token ',
        }
  conn.request("DELETE", "/myaccount/api/v1/vpc/{{network_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": {
        "vpc_id": 614,
        "vpc_name": "VPC-768"
    },
    "errors": {},
    "message": "Success"
}