Skip to main content

An SDK for building applications to work with ESI

Project description

esisdk

Unified SDK for ESI

Use the SDK in python scripts

Install ESI SDK:

python setup.py install

Create a connection to ESI SDK

There are several methods to establish a connection using the ESI SDK. Since the esi.connection.ESIConnection class inherits from openstack.connection.Connection, methods applicable for creating connections in the OpenStack SDK can also be used with the ESI SDK. Below are some common ways to create an ESIConnection:

Create a connection using only keyword arguments

from esi import connection

conn = connection.ESIConnection(
    region_name='example-region',
    auth={
        'auth_url': 'https://auth.example.com',
        'username': 'user',
        'password': 'password',
        'project_name': 'project_name',
        'user_domain_name': 'user_domain_name',
        'project_domain_name': 'project_domain_name'
    },
    interface='public'
)

Create a connection from existing CloudRegion

from esi import connection
import openstack.config

config = openstack.config.get_cloud_region(
    cloud='example',
    region_name='earth'
)
conn = connection.ESIConnectionn(config=config)

Make API calls

Detailed APIs can be found in the esi/lease/v1/_proxy.py file. Below are simple examples demonstrating lease resource CRUD operations.

import esi
import os

TEST_CLOUD = os.getenv('OS_TEST_CLOUD', 'devstack-admin')
conn = esi.connect(cloud=TEST_CLOUD)

# Create a lease
def lease_create(conn, resource_uuid, project_id, **kwargs):
    lease = conn.lease.create_lease(resource_uuid=resource_uuid,
                                    project_id=project_id,
                                    **kwargs)

# List leases
def lease_list(conn, **kwargs):
    leases = conn.lease.leases(**kwargs)

# Update a lease
def lease_update(conn, lease, **kwargs):
    lease_dict = conn.lease.update_lease(lease, **kwargs)

# Delete a lease
def lease_delete(conn, lease_id):
    leases = conn.lease.delete_lease(lease_id)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esisdk-0.2.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

esisdk-0.2.0-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file esisdk-0.2.0.tar.gz.

File metadata

  • Download URL: esisdk-0.2.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for esisdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8eab3757b03444f494a75b94982710874129f9051fedc4d636fbfe6760893837
MD5 fd653b9a1add7af8ab97577702a690a4
BLAKE2b-256 2f62d8ef011db63dd4ea86ced640177d3fe9fc8b31ebe1be00389720d3cefe25

See more details on using hashes here.

File details

Details for the file esisdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: esisdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 36.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for esisdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7df47d10123cbfa8398e4e6ace4fea4f1b92c211da9ab3a59983c1305a9463bc
MD5 1652ea8c06925c694fd3e666c3e1bcad
BLAKE2b-256 0ef26a17c04951980199f5a35d841fd56e8207019b601a462f9e6bb6d1238b9f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page