juju.controller

Summary

Controller

Methods:

Reference

class juju.controller.Controller(loop=None, max_frame_size=’default_frame_size’)[source]

Bases: object

coroutine add_model(model_name, cloud_name=None, credential_name=None, owner=None, config=None, region=None)[source]

Add a model to this controller.

Parameters:
  • model_name (str) – Name to give the new model.
  • cloud_name (str) – Name of the cloud in which to create the model, e.g. ‘aws’. Defaults to same cloud as controller.
  • credential_name (str) – Name of the credential to use when creating the model. Defaults to current credential. If you pass a credential_name, you must also pass a cloud_name, even if it’s the default cloud.
  • owner (str) – Username that will own the model. Defaults to the current user.
  • config (dict) – Model configuration.
  • region (str) – Region in which to create the model.
coroutine add_user(username, password=None, display_name=None)[source]

Add a user to this controller.

Parameters:
  • username (str) – Username
  • display_name (str) – Display name
  • acl (str) – Access control, e.g. ‘read’
  • models (list) – Models to which the user is granted access
coroutine change_user_password(username, password)[source]

Change the password for a user in this controller.

Parameters:
  • username (str) – Username
  • password (str) – New password
coroutine connect(endpoint, username, password, cacert=None, macaroons=None)[source]

Connect to an arbitrary Juju controller.

coroutine connect_controller(controller_name)[source]

Connect to a Juju controller by name.

coroutine connect_current()[source]

Connect to the current Juju controller.

coroutine destroy(destroy_all_models=False)[source]

Destroy this controller.

Parameters:destroy_all_models (bool) – Destroy all hosted models in the controller.
coroutine destroy_model(*uuids)

Destroy one or more models.

Parameters:*uuids (str) – UUIDs of models to destroy
coroutine destroy_models(*uuids)[source]

Destroy one or more models.

Parameters:*uuids (str) – UUIDs of models to destroy
coroutine disable_user(username)[source]

Disable a user.

Parameters:username (str) – Username
coroutine disconnect()[source]

Shut down the watcher task and close websockets.

coroutine enable_user(username)[source]

Re-enable a previously disabled user.

coroutine get_cloud()[source]

Get the name of the cloud that this controller lives on.

get_model(name)[source]

Get a model by name.

Parameters:name (str) – Model name
coroutine get_models(all_=False, username=None)[source]

Return list of available models on this controller.

Parameters:
  • all (bool) – List all models, regardless of user accessibilty (admin use only)
  • username (str) – User for which to list models (admin use only)
get_payloads(*patterns)[source]

Return list of known payloads.

Parameters:*patterns (str) – Patterns to match against

Each pattern will be checked against the following info in Juju:

- unit name
- machine id
- payload type
- payload class
- payload id
- payload tag
- payload status
coroutine get_user(username, include_disabled=False)[source]

Get a user by name.

Parameters:username (str) – Username
get_users(all_=False)[source]

Return list of users that can connect to this controller.

Parameters:all (bool) – Include disabled users
coroutine grant(username, acl=’login’)[source]

Set access level of the given user on the controller

Parameters:
  • username (str) – Username
  • acl (str) – Access control (‘login’, ‘add-model’ or ‘superuser’)
kill()[source]

Forcibly terminate all machines and other associated resources for this controller.

login()[source]

Log in to this controller.

logout(force=False)[source]

Log out of this controller.

Parameters:force (bool) – Don’t fail even if user not previously logged in with a password
coroutine revoke(username)[source]

Removes all access from a controller

Parameters:username (str) – username