c650f911e8e7b7edb370f93c9427f06332c822e7
[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.
4
5 .. code:: python
6
7   from juju.controller import Controller
8
9   controller = Controller()
10   await controller.connect_current()
11
12   # Create our new model
13   model = await controller.add_model(
14       'mymodel',  # name of your new model
15       'aws',      # name of the cloud to use
16       'aws-tim',  # name of the credential to use
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)