How to manage models

> See also: juju:model

Add a model

To add a model, on a connected controller, call the add_model function. For example, below we’re adding a model called test-model on the controller:

await controller.add_model("test-model")

> See more: Controller.add_model(), juju_model (module), juju_controller (module)

View all the models available on a controller

To view all the models available on a controller, call the Controller.list_models() function:

await controller.list_models()

> See more: Controller.list_models()

Switch to a different model

In python-libjuju, switching to a different model means simply connecting to the model you want to work with, which is done by calling connect on the Model object:

from juju.model import Model

model = Model()
await model.connect() # will connect to the "current" model

await model.connect(model_name="test-model") # will connect to the model named "test-model"

Note that if the model object is already connected to a model, then that connection will be closed before making the new connection.

> See more: Model.connect()

View the status of a model

TBA

View details about a model

TBA

Configure a model

> See also: juju:model-configuration, juju:list-of-model-configuration-keys

TBA

Manage constraints for a model

> See also: juju-constraint

TBA

Destroy a model

To destroy a model, with a connected controller object, call the Controller.destroy_model() function. For example:

await controller.destroy_model("test-model")

> See more: Controller.destroy_model()