add_model() can accept just a model name
[osm/N2VC.git] / docs / narrative / create-model.rst
1 Creating and Destroying a Model
2 ===============================
3 Example of creating a new model and then destroying it. See
4 :meth:`juju.controller.Controller.add_model` and
5 :meth:`juju.controller.Controller.destroy_model` for more info.
6
7 .. code:: python
8
9   from juju.controller import Controller
10
11   controller = Controller()
12   await controller.connect_current()
13
14   # Create our new model
15   model = await controller.add_model(
16       'mymodel',  # name of your new model
17   )
18
19   # Do stuff with our model...
20
21   # Destroy the model
22   await model.disconnect()
23   await controller.destroy_model(model.info.uuid)