======= Volumes ======= E2E Networks Block storage API will help you to create, update and Delete Block storage 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 Block Storages:- ======================== To find a list of **Block Storages** to send a **GET** request:- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/?apikey={{API_Key}}&location=Delhi&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 * - name - string - The name assigned to the block storage. * - vm_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. * - vm_name - string - The name assigned to the block storage. * - block_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. * - created_on - integer - A string represents both the date and time when the block storage is created. * - status - string - A string that denotes the type: “Attached” or “Detached” * - size - integer - An integer denotes the size of block storage. .. 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": [ { "block_id": 7966, "name": "BS_250GB_446", "size": 256000, "status": "Attached", "template": { "DEV_PREFIX": "vd", "DRIVER": "raw", "TOTAL_IOPS_SEC": "3750" }, "vm_detail": { "vm_id": 100157, "vm_name": "SDC-8-45GB-CentOS-8-0-390", "all_action_disabled": false }, "created_on": "2022-03-07T10:01:04Z" } ], "errors": {}, "message": "Success" } Create a Block Storage ---------------------- To Create a new **Block Storage** to send a **Post** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/?apikey={{API_Key}}b&location=Delhi&project_id={{project-id}} Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - name - string - The name assigned to the block storage. - True * - iops - integer - A unique integer identifier assigned to the block storage its creation. - True * - size - Integer - An integer denotes the size of block storage. - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - image_name - string - The name assigned to the block storage after its creation. * - block_storage_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. .. 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 { "iops": 3750, "name": "BS_250GB_343", "size": 250 } .. code-tab:: python Response Body { "code": 200, "data": { "block_storage_id": 7971, "image_name": "BS_250GB_343" }, "errors": {}, "message": "Success" } Delete a Block Storage ----------------------- To Delete a **Block Storage** to send a **Delete** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/7966/?apikey={{API_Key}}&location=Delhi&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 * - image_name - string - The name assigned to the block storage after its creation. * - image_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. .. 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": { "image_id": 7971, "image_name": "BS_250GB_343" }, "errors": {}, "message": "Block Storage Deleted." } Attach Block Storage from Node ------------------------------- To Attach a **Block Storage** from Node to send a **Post** request:- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/7966/vm/attach/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}} Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - vm_id - Integer - A unique integer identifier created and assigned to the node after its creation. - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - vm_id - integer - A unique integer identifier created and assigned to the node after its creation. * - image_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. .. 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 { "vm_id": 100157 } .. code-tab:: python Response Body { "code": 200, "data": { "image_id": 7966, "vm_id": 100157 }, "errors": {}, "message": "Block Storage is Attached to VM." } Detach Block Storage from Node ------------------------------ To Detach a **Block Storage** from Node to send a **Post** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/7966/vm/detach/?apikey={{API_Key}}&project_id={{project-id}} Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - vm_id - Integer - A unique integer identifier created and assigned to the node after its creation. - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - vm_id - integer - A unique integer identifier created and assigned to the node after its creation. * - image_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. .. 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 { "vm_id": 100157 } .. code-tab:: python Response Body { "code": 200, "data": { "image_id": 7966, "vm_id": 100157 }, "errors": {}, "message": "Block Storage Detach Process is Started." } Create a Snapshots ------------------ To Create a **snapshots** to send a **Post** request:- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/7966/snapshot/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}} Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - name - string - A string provides the name. - True The request returns a JSON object that contains the following attributes: .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - snapshort_id - integer - A unique integer identifier created and assigned to the block storage after its taking the snapshot. * - image_id - Integer - A unique integer identifier created and assigned to the block storage after its creation. .. 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 { "name": "snapshot-884" } .. code-tab:: python Response Body { "code": 200, "data": { "image_id": 7972, "snapshot_id": 3 }, "errors": {}, "message": "Snapshot in process." } Create a Block Storage through Snapshots ---------------------------------------- To Create a **Block storage** to send a **Post** request:- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/<>/restore/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}} Attributes and respective values required to send this POST request are: .. list-table:: :widths: 25 25 60 10 :header-rows: 1 * - Name - Type - Description - Required * - vm_id - Integer - A unique integer identifier created and assigned to the node after its creation. - True * - name - string - The name assigned to the block storage. - True * - iops - integer - A unique integer identifier assigned to the block storage its creation. - True * - snapshort_id - integer - A unique integer identifier created and assigned to the block storage after its taking the snapshot. - True .. 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 { "iops": 3750, "name": "Block_Storage_191", "snapshot_id": 0, "vm_id": 100157 } .. code-tab:: python Response Body { "code": 200, "data": {}, "errors": {}, "message": "Block Storage Snapshot Restore in Process." } List of Snapshots ------------------ To find a list of **snapshots** to send a **Post** request:- .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/<>/snapshot/?apikey={{API_Key}}&location=Delhi&project_id={{project-id}} .. list-table:: :widths: 25 25 50 :header-rows: 1 * - Name - Type - Description * - snapshort_id - integer - A unique integer identifier created and assigned to the block storage after its taking the snapshot. * - snapshot_name - string - The name assigned to the snapshot when its created. * - size - integer - An integer denotes the size of block storage. * - created_date - integer - A string represents both the date and time when the block storage is created. .. 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": [ { "snapshot_id": 0, "snapshot_name": "snapshot-537", "size": 256000, "create_date": "2022-03-07T12:02:53Z" }, { "snapshot_id": 1, "snapshot_name": "snapshot-479", "size": 256000, "create_date": "2022-03-07T12:03:20Z" }, ], "errors": {}, "message": "Success" } Delete Snapshots ----------------- To Delete a **snapshots** to send a **Delete** request .. code-block:: bash https://api.e2enetworks.com/myaccount/api/v1/block_storage/<>/snapshot/2?apikey={{API_Key}}&location=Delhi&project_id={{project-id}} .. 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": { "image_id": 7972, "snapshot_id": 2 }, "errors": {}, "message": "Snapshot Deletion in process." }