Object 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 Bucket

To find the list of bucket(s), send a HTTP GET request to the eos endpoint

https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/?apikey={{API_Key}}&project_id={{project_id}}

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

Name

Type

Description

versioning_status

string

A string denotes the versioning state of the bucket. ‘on’ for enable and‘off’ for disable.

id

Integer

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

name

String

The name assigned to the bucket.

bucket_size

integer

An integer denotes the size of the bucket in <>.

created_at

Integer

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

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
          'Authorization': 'api_token'
    }
conn.request("GET", "/myaccount/api/v1/storage/buckets/?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": [
      {
          "id": 2277,
          "name": "realtest4",
          "created_by": 5652,
          "status": "NEW",
          "created_at": "2022-04-14T16:28:12.929591Z",
          "updated_at": "2022-04-14T16:28:12.929704Z",
          "bucket_size": "233.87 KB",
          "versioning_status": "Off",
          "lifecycle_configuration_status": "Not-Configured"
      },
                  {
          "id": 2292,
          "name": "bucket112",
          "created_by": 5652,
          "status": "NEW",
          "created_at": "2022-04-18T04:24:18.302700Z",
          "updated_at": "2022-04-18T04:24:18.302794Z",
          "bucket_size": "95.46 MB",
          "versioning_status": "Off",
          "lifecycle_configuration_status": "Not-Configured"
      }
  ],
  "errors": {},
  "message": "Success"
}

Create a new Bucket-

To create a Bucket , send a Post request eos end point:-

https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}&project_id={{project_id}}

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

Name

Type

Description

versioning_status

string

A string denotes the versioning state of the bucket. ‘on’ for enable and‘off’ for disable.

id

Integer

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

name

String

The name assigned to the bucket.

bucket_size

integer

An integer denotes the size of the bucket in <>.

created_at

Integer

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

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
        'Authorization': 'api_token'
    }
conn.request("POST", "/myaccount/api/v1/storage/buckets/{{bucket_name}}/?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": {
      "id": 2308,
      "name": "shubh111",
      "created_by": 5652,
      "status": "NEW",
      "used_MB": null,
      "created_at": "2022-04-21T10:27:42.572422Z",
      "updated_at": "2022-04-21T10:27:42.572525Z",
      "versioning_status": "Off",
      "lifecycle_configuration_status": "Not-Configured"
  },
  "errors": {},
  "message": "Success"
}

Delete a Bucket -

To delete a Bucket , send a DELETE request to eos end point:-

https://api.e2enetworks.com/myaccount/api/v1/storage/buckets/{{bucket_name}}/?apikey={{api_key}}&project_id={{project_id}}

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
            'Authorization': 'api_token'
      }
conn.request("DELETE", "/myaccount/api/v1/storage/buckets/{{bucket_name}}/?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"
}

Enable Bucket Versioning

To enable Bucket versioning , send a Post request eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}

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

Name

Type

Description

Required

bucket_name

char

Provide the name of the bucket on which versioning is to be appiled.

True

new_versioning_state

String

Provide the versioning_state enable if you want to enable the versioning.

True

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
      "bucket_name": "bucket_name",
      "new_versioning_state": "Enabled"
        })
headers = {
        'Authorization': 'api_token',
        'Content-Type': 'application/json',
      }
conn.request("POST", "/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?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...
{
  "bucket_name": "bucket_name",
  "new_versioning_state": "Enabled"
}

Disable Bucket Versioning

To Disable Bucket versioning , send a Post request-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_versioning/bucket_name/?apikey={{api_key}}&location=Delhi&project_id={{project_id}}

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

Name

Type

Description

Required

bucket_name

char

Provide the name of the bucket on which versioning is to be appiled.

True

new_versioning_state

String

Provide the versioning_state enable if you want to enable the versioning.

True

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"bucket_name": "bucketname",
"new_versioning_state": "Disabled"
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("POST", "/myaccount/api/v1/storage/bucket_versioning/{{bucket_name}}/?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...
{
  "bucket_name": "bucket_name",
  "new_versioning_state": "Disabled"
}

Applied Life Cycle rule

To Applied a life cycle rule in bucket to send a Post request-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_lifecycle/{{bucket_name}}/?apikey={{api_key}}&project_id={{project_id}}

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

Name

Type

Description

Required

bucket_name

char

Give the name of the Bucket

True

expiration_days

integer

Specifies the expiration for the lifecycle of the object in the form of date days and whether the object has a delete marker

True

new_status

string

If Enabled the rule is currently being applied. If Disabled the rule is not currently being applied.

True

Prefix

string

Prefix identifying one or more objects to which the rule applies.

True

rule_id

string

Unique identifier for the rule The value cannot be longer than 255 characters.

True

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

Name

Type

Description

id

Integer

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

created_at

Integer

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

Prefix

string

Prefix identifying one or more objects to which the rule applies.

rule_id

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

expiration_days

integer

Specifies the expiration for the lifecycle of the object in the form of date | days and whether the object has a delete marker.

updated_at

integer

A string represents both the date and time when the bucket is updated

storage_class

string

The storage class to which you want the object to transition.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"bucket_name": "bucketname",
"lifecycle_rules": [
  {
    "expiration_days": 1,
    "new_status": "Enabled",
    "noncurrent_version_expiration_date_or_days": 1,
    "prefix": "",
    "rule_id": 0
  }
]
})
headers = {
  'Authorization': 'api_token',
  'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/storage/bucket_lifecycle/{{bucket_name}}/?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...
{
  "bucket_name": "bucketname",
  "lifecycle_rules": [
      {
          "expiration_days": 1,
          "new_status": "Enabled",
          "noncurrent_version_expiration_date_or_days": 1,
          "prefix": "",
          "rule_id": 0
      }
  ]
}

List of all Access Key

To find the list of all access key , send a Get request-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/list/users/?apikey={{api_key}}&project_id={{project_id}}

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

Name

Type

Description

id

Integer

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

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_token',
}
conn.request("GET", "/myaccount/api/v1/storage/core/list/users/?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": [
      {
          "id": 5792,
          "my_account_id": null,
          "user_name": "{{username}}",
          "email": "",
          "access_key": "9TN9PJNQ3K3LPEDGGIYU",
          "secret_key": null,
          "is_default": false,
          "disabled": false,
          "tag": "key1"
      },
                    ],
  "errors": {},
  "message": "Success"
}

Create Access Key

To create a access key, send a Post request to eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}&project_id={{project_id}}

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

Name

Type

Description

Required

tag

char

Provide the name of the access key.

True

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

Name

Type

Description

id

Integer

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

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
  payload = json.dumps({
    "tag": "uni4"
    })
  headers = {
    'Authorization': 'api_token'
    'Content-Type': 'application/json',
  }
  conn.request("POST", "/myaccount/api/v1/storage/core/users/?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...
{
  "bucket_name": "bucketname",
  "lifecycle_rules": [
      {
          "expiration_days": 1,
          "new_status": "Enabled",
          "noncurrent_version_expiration_date_or_days": 1,
          "prefix": "",
          "rule_id": 0
      }
  ]
}

Delete Access Key

To Delete a access key, send a Delete request-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?access_key={{access_key}}&apikey={{api_key}}&project_id={{project_id}}

import http.client

  conn = http.client.HTTPSConnection("api.e2enetworks.com")
  payload = ''
  headers = {
  'Authorization': 'api_token'
  }
  conn.request("DELETE", "/myaccount/api/v1/storage/core/users/?access_key={{access_key}}&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": "The delete operation is successful"
}

Lock Access Key

To Lock a access key, send a Put request eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}&project_id={{project_id}}

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

Name

Type

Description

Required

disabled

string

Provide disabled is true when you want to lock the access key

True

id

Integer

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

True

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

Name

Type

Description

id

Integer

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

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"disabled": True,
"id": 6069
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/storage/core/users/?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...
{
  "disabled": true,
  "id": 6069
}

Unlock Access Key

To Unlock a access key, send a Put request-

https://api.e2enetworks.com/myaccount/api/v1/storage/core/users/?apikey={{api_key}}&project_id={{project_id}}

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

Name

Type

Description

Required

disabled

string

Provide disabled is true when you want to lock the access key

True

id

Integer

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

True

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

Name

Type

Description

id

Integer

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

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"disabled": False,
"id": 6069
})
headers = {
'Authorization': 'api_token',
'Content-Type': 'application/json',
}
conn.request("PUT", "/myaccount/api/v1/storage/core/users/?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...
{
  "disabled": false,
  "id": 6069
}

Attach Permission

To attach permission in the bucket , send a Put request-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_perms/?apikey={{api_key}}&bucket_name={{nameofbucket}}&project_id={{project_id}}

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

Name

Type

Description

Required

disabled

string

Provide disabled is false when you want to unlock the access key

True

id

Integer

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

True

user_name

string

Show the name of the user.

True

tag

char

Char shows the name of the access key.

true

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

role_name

string

Provide the role of the bucket. Three type of rule is define:- 1. Bucket admin 2. Bucket writer 3. Bucket reader

True

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

Name

Type

Description

id

Integer

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

user_name

string

Show the name of the user.

tag

char

Char shows the name of the access key.

access_key

string

Unique identifier for the rule. The value can’t be longer than 255 characters.

secret_key

string

An unique identifier for the rule.

import http.client
import json

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = json.dumps({
"role_name": "Bucket Admin",
"users": [
  {
    "access_key": "L3A8MZCUORF0FYJ8GGCP",
    "disabled": False,
    "email": "",
    "id": 6068,
    "is_default": False,
    "my_account_id": None,
    "secret_key": None,
    "tag": "uni2",
    "user_name": "username"
  }
]
})
  headers = {
    'Authorization': 'Bearer ',
    'Content-Type': 'application/json',
  }
conn.request("PUT", "/myaccount/api/v1/storage/bucket_perms/?apikey={{api_key}}&bucket_name={{bucket}}&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/storage/bucket_perms/?apikey={{api_key}}&bucket_name={{bucketname}}&project_id={{project_id}}"

payload = json.dumps({
"role_name": "Bucket Admin",
"users": [
  {
    "access_key": "L3A8MZCUORF0FYJ8GGCP",
    "disabled": False,
    "email": "",
    "id": 6068,
    "is_default": False,
    "my_account_id": None,
    "secret_key": None,
    "tag": "uni2",
    "user_name": "username"
  }
]
})
headers = {
    'Authorization': 'Bearer ',
      'Content-Type': 'application/json',
  }

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...
{
  "role_name": "Bucket Admin",
  "users": [
      {
          "access_key": "L3A8MZCUORF0FYJ8GGCP",
          "disabled": false,
          "email": "",
          "id": 6068,
          "is_default": false,
          "my_account_id": null,
          "secret_key": null,
          "tag": "uni2",
          "user_name": "{{username}}"
      }
  ]
}

Delete Permission

To delete permission of the bucket, send a Delete request to the eos end point :-

https://api.e2enetworks.com/myaccount/api/v1/storage/bucket_perm/2437/?apikey={{api_key}}&bucket_name=bucket11&project_id={{project_id}}

import http.client

conn = http.client.HTTPSConnection("api.e2enetworks.com")
payload = ''
headers = {
    'Authorization': 'api_token',
}
conn.request("DELETE", "/myaccount/api/v1/storage/bucket_perm/2437/?apikey={{api_key}}&bucket_name={{bucket_name}}&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"
}