SlipStream Python API documentation

Contents:

class slipstream.api.Api(endpoint=None, cookie_file=None, insecure=False)[source]

This class is a Python wrapper&helper of the native SlipStream REST API

build_component(path, cloud=None)[source]
Parameters:
  • path (str) – The path to a component
  • cloud (str) – The Cloud on which to build the component. If None, the user default Cloud will be used.
create_user(username, password, email, first_name, last_name, organization=None, roles='', privileged=False, default_cloud=None, default_keep_running='never', ssh_public_keys=None, log_verbosity=1, execution_timeout=30, usage_email='never', cloud_parameters=None)[source]

Create a new user into SlipStream.

Parameters:
  • username (str) – The user’s username (need to be unique)
  • password (str) – The user’s password
  • email (str) – The user’s email address
  • first_name (str) – The user’s first name
  • last_name (str) – The user’s last name
  • organization (str) – The user’s organization/company
  • roles (list) – The user’s roles
  • privileged (bool) – true to create a privileged user, false otherwise
  • default_cloud (str) – The user’s default Cloud
  • default_keep_running ('always' or 'never' or 'on-success' or 'on-error') – The user’s default setting for keep-running.
  • ssh_public_keys (str) – The SSH public keys to inject into deployed instances. One key per line.
  • log_verbosity (0 or 1 or 2 or 3) – The verbosity level of the logging inside instances. 0: Actions, 1: Steps, 2: Details, 3: Debugging
  • execution_timeout (int) – If a deployment stays in a transitionnal state for more than this value (in minutes) it will be forcefully terminated.
  • usage_email ('never' or 'daily') – Set it to ‘daily’ if you want to receive daily email with a summary of your Cloud usage of the previous day.
  • cloud_parameters (dict) – To add Cloud specific parameters (like credentials). A dict with the cloud name as the key and a dict of parameter as the value.
delete_element(path)[source]

Delete a project, a component or an application

Parameters:path – The path to a component or an application
deploy(path, cloud=None, parameters=None, tags=None, keep_running=None, scalable=False, multiplicity=None, tolerate_failures=None, check_ssh_key=False, raw_params=None)[source]

Run a component or an application

Parameters:
  • path (str) – The path of the component/application to deploy
  • cloud (str or dict) – A string or a dict to specify on which Cloud(s) to deploy the component/application. To deploy a component simply specify the Cloud name as a string. To deploy a deployment specify a dict with the nodenames as keys and Cloud names as values. If not specified the user default cloud will be used.
  • parameters (dict) – A dict of parameters to redefine for this deployment. To redefine a parameter of a node use “<nodename>” as keys and dict of parameters as values. To redefine a parameter of a component or a global parameter use “<parametername>” as the key.
  • tags (str or list) – List of tags that can be used to identify or annotate a deployment
  • keep_running ('always' or 'never' or 'on-success' or 'on-error') – [Only apply to applications] Define when to terminate or not a deployment when it reach the ‘Ready’ state. Possibles values: ‘always’, ‘never’, ‘on-success’, ‘on-error’. If scalable is set to True, this value is ignored and it will behave as if it was set to ‘always’. If not specified the user default will be used.
  • scalable (bool) – [Only apply to applications] True to start a scalable deployment. Default: False
  • multiplicity (bool) – [Only apply to applications] A dict to specify how many instances to start per node. Nodenames as keys and number of instances to start as values.
  • tolerate_failures (dict) – [Only apply to applications] A dict to specify how many failures to tolerate per node. Nodenames as keys and number of failure to tolerate as values.
  • check_ssh_key (bool) – Set it to True if you want the SlipStream server to check if you have a public ssh key defined in your user profile. Useful if you want to ensure you will have access to VMs.
  • raw_params (dict) – This allows you to pass parameters directly in the request to the SlipStream server. Keys must be formatted in the format understood by the SlipStream server.
Returns:

The deployment UUID of the newly created deployment

Return type:

uuid.UUID

get_deployment(deployment_id)[source]

Get a deployment

Parameters:deployment_id (str or UUID) – The deployment UUID of the deployment to get
get_element(path)[source]

Get details about a project, a component or an application

Parameters:path (str) – The path of an element (project/component/application)
list_applications()[source]

List apps in the appstore

list_deployments(inactive=False)[source]

List deployments

Parameters:inactive – Include inactive deployments. Default to False
list_project_content(path=None, recurse=False)[source]

List the content of a project

Parameters:
  • path (str) – The path of a project. If None, list the root project.
  • recurse (bool) – Get project content recursively
list_virtualmachines(deployment_id=None, offset=0, limit=20)[source]

List virtual machines

Parameters:
  • deployment_id (str or UUID) – Retrieve only virtual machines about the specified run_id. Default to None
  • offset – Retrieve virtual machines starting by the offset<exp>th</exp> one. Default to 0
  • limit – Retrieve at most ‘limit’ virtual machines. Default to 20
login(username, password)[source]
Parameters:
  • username
  • password
logout()[source]
publish(path)[source]

Publish a component or an application to the appstore

Parameters:path – The path to a component or an application
terminate(deployment_id)[source]

Terminate a deployment

Parameters:deployment_id (str or uuid.UUID) – The UUID of the deployment to terminate
unpublish(path)[source]

Unpublish a component or an application from the appstore

Parameters:path – The path to a component or an application
usage()[source]

Get current usage and quota by cloud service.

Indices and tables