Skip to content

slipstream/SlipStreamPythonAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SlipStreamPythonAPI

Python client for the SlipStream CIMI API.

Installation

$ pip install slipstream-api

or

$ yum install slipstream-python-api

Usage

  from slipstream.api import Api
  
  api = Api('https://nuv.la')
  
  # Login with username & password
  api.login_internal('username', 'password')
  # or
  # Login with api-key & secret
  api.login_apikey('credential/uuid', 'secret')
  
  # List available applications from the App Store
  api.list_applications()
  
  # Deploy an application and get its deployment ID
  deployment_id = api.deploy('apps/WordPress/wordpress', cloud='exoscale-ch-gva')

  # Terminate the deployment started above
  api.terminate(deployment_id)

  # Logout
  api.logout()

Contribute

Development helper

git clone https://github.com/slipstream/SlipStreamPythonAPI.git
cd SlipStreamPythonAPI/api/
pip install --editable .

Push version to pypi

Configure ~/.pypirc with pypi repo credentials. This file should look like as following:

[distutils]
index-servers=pypi

[pypi]
username = <username>
password = <password>

From repo root directory, launch following commands:

git checkout <release-version>
mvn clean install -P release

Documentation

Simple docstring based documentation

You can get the full documentation by typing:

Python shell/code

from slipstream.api import Api
help(Api)

Shell

pydoc slipstream.api.Api

Or for a specific function:

Python shell/code

from slipstream.api import Api
help(Api.deploy)

Shell

pydoc slipstream.api.Api.deploy

Or to get only the docstring:

Python shell/code

from slipstream.api import Api
print Api.deploy.__doc__

Currently there is no HTML version of the documentation, only docstring inside the code but the documentation can be generated by the user.

To run a local webserver with the documentation you can run:

pydoc -p 8080 slipstream.api.Api

and then http://localhost/slipstream.api.api.html#Api

Sphinx documentation

There is a Sphinx documentation available at http://slipstream.github.io/SlipStreamPythonAPI

Generate and publish the Sphinx documentation to GitHub Pages

You can use the provided makefile (in the doc directory or in the root directory):

make gh-pages