DBaas

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 DbaaS-

To find a list of DBaaS, send a GET request:

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

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

Name

Type

Description

public_ip_address

Integer

Information regarding the network configuration.

id

Integer

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

name

string

The name assigned to the databsase.

username

string

The username assigned to the databsase when it’s created.

created_at

Integer

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

status

string

A string that denotes the status of the Databsase.

private_ip_address

Integer

Information regarding the network configuration.

vm_id

Integer

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

node_id

Integer

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

cluster_id

Integer

A unique integer identifier created and assigned to the Databsase after its

creation

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
      'Authorization': 'api_token ',
  }
conn.request("GET", "/myaccount/api/v1/rds/cluster/?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...
{
"code": 200,
"data": [
    {
        "id": 775,
        "name": "name_of_DB",
        "status": "RUNNING",
        "status_title": "Running",
        "status_actions": [
            "delete",
            "stop",
            "restart",
            "manual-snapshot",
            "restore-snapshot"
        ],
        "num_instances": 1,
        "software": {
            "name": "MySQL",
            "version": "5.6",
            "engine": "Innodb"
        },
        "master_node": {
            "instance_id": 1443,
            "cluster_id": 775,
            "node_id": 91319,
            "vm_id": 102182,
            "port": "3306",
            "public_ip_address": "164.52.209.3",
            "private_ip_address": "172.16.119.199",
            "allowed_ip_address": {
                "whitelisted_ips": [],
                "temp_ips": [],
                "whitelisting_in_progress": false
            },
            "zabbix_host_id": 94885,
            "databsase": {
                "id": 775,
                "username": "Username",
                "databsase": "name_of_DB",
                "pg_detail": {}
            },
            "ram": "8 GB",
            "cpu": "2",
            "disk": "100 GB",
            "status": "Running",
            "db_status": "Running",
            "created_at": "05/Apr/2022 03:43 PM",
            "plan": {
                "name": "DBS.8GB_MySQL_56",
                "price": "Rs 4/Hour or Rs 2920 Monthly",
                "template_id": 27,
                "ram": "8",
                "cpu": "2",
                "disk": "100"
            }
        },
        "connectivity_detail": "{'read_end_point': [{'ip': '164.52.209.3', 'port': 3307}, {'ip': '172.16.119.199', 'port': 3307}], 'read_and_write_end_point': [{'ip': '164.52.209.3', 'port': 3306}, {'ip': '172.16.119.199', 'port': 3306}], 'status': 'updated', 'type': 1}"
    }
],
"errors": {},
"message": "Success"
}

Create a new DbaaS-

To create a DbaaS to send a Post request-

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

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

Name

Type

Description

Required

password

char

Assigned the password to the databsase.

True

Name

string

The name assigned to the Databsase.

True

user

string

Assign the user name to the databsase

True

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

Name

Type

Description

public_ip_address

Integer

Information regarding the network configuration.

id

Integer

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

name

string

The name assigned to the databsase.

username

string

The username assigned to the databsase when it’s created.

created_at

Integer

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

status

string

A string that denotes the status of the Databsase.

private_ip_address

Integer

Information regarding the network configuration.

vm_id

Integer

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

node_id

Integer

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

cluster_id

Integer

A unique integer identifier created and assigned to the Databsase after its

creation

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
    "databsase": {
        "name": "nameofdatabsase",
        "password": "Password123@",
        "user": "username"
    },
    "group": "Default",
    "name": "nameofdatabsase",
    "software_id": 2,
    "template_id": 27
})
headers = {
      'Authorization': 'API_Token ',
      'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/rds/cluster/?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...
{
   "databsase": {
       "name": "nameofdb",
       "password": "Password@123",
       "user": "provideusername"
   },
   "group": "Default",
   "name": "nameofdb",
   "software_id": 2,
   "template_id": 27
}

Delete a DbaaS -

To delete a DbaaS to send a DELETE request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/780/?apikey={api_key}
&project_id={{project-id}}

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

Name

Type

Description

name

string

The name assigned to the Databsase it’s time for creation.

cluster_id

integer

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

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_token ',
}
conn.request("DELETE", "/myaccount/api/v1/rds/cluster/{{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": {
       "cluster_id": "780",
       "name": "Name_of_DB"
   },
   "errors": {},
   "message": "Success"
}

Take a Snapshot -

To take snapshot of DbaaS to send a POST request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/snapshot?apikey={api_key}&project_id={{project-id}}

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

Name

Type

Description

Required

Name

string

Name is assigned to take a snapshot

True

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

Name

Type

Description

Name

string

The name assigned to the Databsase it’s time for creation.

cluster_id

integer

A unique integer identifier created and assigned to the Databsase after its

creation

snapshot_id

integer

A unique integer identified created and assigned when we take the snapshot

Date

integer

It represents the date and time when we take the snapshot.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
    "name": "sanap3"
})
headers = {
    'Authorization': 'api_token ',
    'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/snapshot?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...
{
    "name": "sanap3"
}

Reset a Password of Databsase-

To Reset a Password of DbaaS to send a PUT request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/reset-password/?apikey={api_key}&project_id={{project-id}}

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

Name

Type

Description

Required

password

char

Assign the password to the databsase

True

username

string

Provide username of the databsase

true

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

Name

Type

Description

Name

string

The name assigned to the Databsase it’s time for creation.

cluster_id

integer

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

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
    "password": "Password@123",
    "username": "username"
})
headers = {
    'Authorization': 'Api_token',
    'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/reset-password/?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...
{
    "password": "Password@123",
    "username": "provideUsername"
}

Stop Databsase

To stop a service of Databsase to send a PUT request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/shutdown?apikey={api_key}&project_id={{project-id}}

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

Name

Type

Description

Name

string

The name assigned to the Databsase it’s time for creation.

cluster_id

integer

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

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'Bearer ',
}
conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/shutdown?apikey={{api_key}}", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
    "code": 200,
    "data": {
        "message": "Shutdown process started.",
        "cluster_id": "775",
        "name": "shubha"
    },
    "errors": {},
    "message": "Success"
}

Start Databsase

To start a service of Databsase to send a PUT request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/resume?apikey={api_key}&project_id={{project-id}}

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

Name

Type

Description

Name

string

The name assigned to the Databsase it’s time for creation.

cluster_id

integer

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

PYTHON

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_tokrn ',
}
conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/resume?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": {
        "message": "Resume process started.",
        "cluster_id": "775",
        "name": "nameofDatabsase"
    },
    "errors": {},
    "message": "Success"
}

Restart Databsase -

To Restart a Databsase to send a PUT request

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/restart?apikey={api_key}&project_id={{project-id}}

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

Name

Type

Description

Name

string

The name assigned to the Databsase it’s time for creation.

cluster_id

integer

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

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_token ',
}
conn.request("PUT", "/myaccount/api/v1/rds/cluster/{{id}}/restart?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": {
        "message": "Reboot process started.",
        "cluster_id": "775",
        "name": "nameofdatabsase"
    },
    "errors": {},
    "message": "Success"
}

Attach Parameter group to Databsase

To Attach Parameter group to Databsase to send a POST request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/parameter-group/52/add?apikey={api_key}&project_id={{project-id}}

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_token',
}
conn.request("POST", "/myaccount/api/v1/rds/cluster/775/parameter-group/52/add?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": {},
    "errors": {},
    "message": "Success"
}

Detach Parameter group to Databsase

To Detach Parameter group to Databsase to send a POST request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/parameter-group/52/detach?apikey={api_key}&project_id={{project-id}}

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_token',
}
conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/parameter-group/52/detach?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": {},
    "errors": {},
    "message": "Success"
}

Attach VPC to Databsase

To Attach VPC to Databsase to send a POST request-

https://api.e2enetworks.com/myaccount/api/v1/rds/cluster/775/vpc-attach/?apikey={api_key}&location=Delhi&project_id={{project-id}}

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

Name

Type

Description

Required

action

string

A string that denotes the type: “Attach” or “Detach”

True

network_id

integer

A unique integer identifier created and assigned to the Vpc it’s time to create.

True

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

Name

Type

Description

vpc_id

Type

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({
    "action": "attach",
    "network_id": "7218"
})
headers = {
    'Authorization': 'api_token',
    'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/vpc-attach/?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...
{
    "code": 200,
    "data": {
        "vpc_id": 624,
        "vpc_name": "VPC-236"
    },
    "errors": {},
    "message": "VPC attach operation successfully done"
}

Detach VPC to Databsase

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
    "action": "detach",
    "network_id": 7218
})
headers = {
    'Authorization': 'api_token',
    'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/rds/cluster/{{id}}/vpc-detach/?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...
{
    "code": 200,
    "data": {
        "vpc_id": 624,
        "vpc_name": "VPC-236"
    },
    "errors": {},
    "message": "VPC detach operation successfully done"
}