More work on params, docstrings
[osm/N2VC.git] / juju / model.py
1 class Model(object):
2 def add_machine(
3 self, spec=None, constraints=None, disks=None, series=None,
4 count=1):
5 """Start a new, empty machine and optionally a container, or add a
6 container to a machine.
7
8 :param str spec: Machine specification
9 Examples::
10 (None) - starts a new machine
11 'lxc' - starts a new machine with on lxc container
12 'lxc:4' - starts a new lxc container on machine 4
13 'ssh:user@10.10.0.3' - manually provisions a machine with ssh
14 'zone=us-east-1a' - starts a machine in zone us-east-1s on AWS
15 'maas2.name' - acquire machine maas2.name on MAAS
16 :param :class:`juju.Constraints` constraints: Machine constraints
17 :param list disks: List of disk :class:`constraints <juju.Constraints>`
18 :param str series: Series
19 :param int count: Number of machines to deploy
20
21 Supported container types are: lxc, lxd, kvm
22
23 When deploying a container to an existing machine, constraints cannot
24 be used.
25
26 """
27 pass
28 add_machines = add_machine
29
30 def add_relation(self, relation1, relation2):
31 """Add a relation between two services.
32
33 :param str relation1: '<service>[:<relation_name>]'
34 :param str relation2: '<service>[:<relation_name>]'
35
36 """
37 pass
38
39 def add_space(self, name, *cidrs):
40 """Add a new network space.
41
42 Adds a new space with the given name and associates the given
43 (optional) list of existing subnet CIDRs with it.
44
45 :param str name: Name of the space
46 :param \*cidrs: Optional list of existing subnet CIDRs
47
48 """
49 pass
50
51 def add_ssh_key(self, key):
52 """Add a public SSH key to this model.
53
54 :param str key: The public ssh key
55
56 """
57 pass
58 add_ssh_keys = add_ssh_key
59
60 def add_subnet(self, cidr_or_id, space, *zones):
61 """Add an existing subnet to this model.
62
63 :param str cidr_or_id: CIDR or provider ID of the existing subnet
64 :param str space: Network space with which to associate
65 :param str \*zones: Zone(s) in which the subnet resides
66
67 """
68 pass
69
70 def get_backups(self):
71 """Retrieve metadata for backups in this model.
72
73 """
74 pass
75
76 def block(self, *commands):
77 """Add a new block to this model.
78
79 :param str \*commands: The commands to block. Valid values are
80 'all-changes', 'destroy-model', 'remove-object'
81
82 """
83 pass
84
85 def get_blocks(self):
86 """List blocks for this model.
87
88 """
89 pass
90
91 def get_cached_images(self, arch=None, kind=None, series=None):
92 """Return a list of cached OS images.
93
94 :param str arch: Filter by image architecture
95 :param str kind: Filter by image kind, e.g. 'lxd'
96 :param str series: Filter by image series, e.g. 'xenial'
97
98 """
99 pass
100
101 def create_backup(self, note=None, no_download=False):
102 """Create a backup of this model.
103
104 :param str note: A note to store with the backup
105 :param bool no_download: Do not download the backup archive
106 :return str: Path to downloaded archive
107
108 """
109 pass
110
111 def create_storage_pool(self, name, provider_type, **pool_config):
112 """Create or define a storage pool.
113
114 :param str name: Name to give the storage pool
115 :param str provider_type: Pool provider type
116 :param \*\*pool_config: key/value pool configuration pairs
117
118 """
119 pass
120
121 def debug_log(
122 self, no_tail=False, exclude_module=None, include_module=None,
123 include=None, level=None, limit=0, lines=10, replay=False,
124 exclude=None):
125 """Get log messages for this model.
126
127 :param bool no_tail: Stop after returning existing log messages
128 :param list exclude_module: Do not show log messages for these logging
129 modules
130 :param list include_module: Only show log messages for these logging
131 modules
132 :param list include: Only show log messages for these entities
133 :param str level: Log level to show, valid options are 'TRACE',
134 'DEBUG', 'INFO', 'WARNING', 'ERROR,
135 :param int limit: Return this many of the most recent (possibly
136 filtered) lines are shown
137 :param int lines: Yield this many of the most recent lines, and keep
138 yielding
139 :param bool replay: Yield the entire log, and keep yielding
140 :param list exclude: Do not show log messages for these entities
141
142 """
143 pass
144
145 def deploy(
146 self, entity_url, service_name=None, bind=None, budget=None,
147 channel=None, config=None, constraints=None, force=False,
148 num_units=1, plan=None, resource=None, series=None, storage=None,
149 to=None):
150 """Deploy a new service or bundle.
151
152 :param str entity_url: Charm or bundle url
153 :param str service_name: Name to give the service
154 :param dict bind: <charm endpoint>:<network space> pairs
155 :param dict budget: <budget name>:<limit> pairs
156 :param str channel: Charm store channel from which to retrieve
157 the charm or bundle, e.g. 'development'
158 :param dict config: Charm configuration dictionary
159 :param :class:`juju.Constraints` constraints: Service constraints
160 :param bool force: Allow charm to be deployed to a machine running
161 an unsupported series
162 :param int num_units: Number of units to deploy
163 :param str plan: Plan under which to deploy charm
164 :param dict resource: <resource name>:<file path> pairs
165 :param str series: Series on which to deploy
166 :param dict storage: Storage constraints TODO how do these look?
167 :param str to: Placement directive, e.g.::
168 '23' - machine 23
169 'lxc:7' - new lxc container on machine 7
170 '24/lxc/3' - lxc container 3 or machine 24
171
172 If None, a new machine is provisioned.
173
174 """
175 pass
176
177 def destroy(self):
178 """Terminate all machines and resources for this model.
179
180 """
181 pass
182
183 def get_backup(self, archive_id):
184 """Download a backup archive file.
185
186 :param str archive_id: The id of the archive to download
187 :return str: Path to the archive file
188
189 """
190 pass
191
192 def enable_ha(
193 self, num_controllers=0, constraints=None, series=None, to=None):
194 """Ensure sufficient controllers exist to provide redundancy.
195
196 :param int num_controllers: Number of controllers to make available
197 :param :class:`juju.Constraints` constraints: Constraints to apply
198 to the controller machines
199 :param str series: Series of the controller machines
200 :param list to: Placement directives for controller machines, e.g.::
201 '23' - machine 23
202 'lxc:7' - new lxc container on machine 7
203 '24/lxc/3' - lxc container 3 or machine 24
204
205 If None, a new machine is provisioned.
206
207 """
208 pass
209
210 def get_config(self):
211 """Return the configuration settings for this model.
212
213 """
214 pass
215
216 def get_constraints(self):
217 """Return the machine constraints for this model.
218
219 """
220 pass
221
222 def grant(self, username, acl='read'):
223 """Grant a user access to this model.
224
225 :param str username: Username
226 :param str acl: Access control ('read' or 'write')
227
228 """
229 pass
230
231 def import_ssh_key(self, identity):
232 """Add a public SSH key from a trusted indentity source to this model.
233
234 :param str identity: User identity in the form <lp|gh>:<username>
235
236 """
237 pass
238 import_ssh_keys = import_ssh_key
239
240 def get_machines(self, utc=False):
241 """Return list of machines in this model.
242
243 :param bool utc: Display time as UTC in RFC3339 format
244
245 """
246 pass
247
248 def get_shares(self):
249 """Return list of all users with access to this model.
250
251 """
252 pass
253
254 def get_spaces(self):
255 """Return list of all known spaces, including associated subnets.
256
257 """
258 pass
259
260 def get_ssh_key(self):
261 """Return known SSH keys for this model.
262
263 """
264 pass
265 get_ssh_keys = get_ssh_key
266
267 def get_storage(self, filesystem=False, volume=False):
268 """Return details of storage instances.
269
270 :param bool filesystem: Include filesystem storage
271 :param bool volume: Include volume storage
272
273 """
274 pass
275
276 def get_storage_pools(self, names=None, providers=None):
277 """Return list of storage pools.
278
279 :param list names: Only include pools with these names
280 :param list providers: Only include pools for these providers
281
282 """
283 pass
284
285 def get_subnets(self, space=None, zone=None):
286 """Return list of known subnets.
287
288 :param str space: Only include subnets in this space
289 :param str zone: Only include subnets in this zone
290
291 """
292 pass
293
294 def remove_blocks(self):
295 """Remove all blocks from this model.
296
297 """
298 pass
299
300 def remove_backup(self, backup_id):
301 """Delete a backup.
302
303 :param str backup_id: The id of the backup to remove
304
305 """
306 pass
307
308 def remove_cached_images(self, arch=None, kind=None, series=None):
309 """Remove cached OS images.
310
311 :param str arch: Architecture of the images to remove
312 :param str kind: Image kind to remove, e.g. 'lxd'
313 :param str series: Image series to remove, e.g. 'xenial'
314
315 """
316 pass
317
318 def remove_machine(self, *machine_ids):
319 """Remove a machine from this model.
320
321 :param str \*machine_ids: Ids of the machines to remove
322
323 """
324 pass
325 remove_machines = remove_machine
326
327 def remove_ssh_key(self, *keys):
328 """Remove a public SSH key(s) from this model.
329
330 :param str \*keys: Keys to remove
331
332 """
333 pass
334 remove_ssh_keys = remove_ssh_key
335
336 def restore_backup(self):
337 """Restore a backup archive to a new controller.
338
339 """
340 pass
341
342 def retry_provisioning(self):
343 """Retry provisioning for failed machines.
344
345 """
346 pass
347
348 def revoke(self):
349 """Revoke a user's access to this model.
350
351 """
352 pass
353
354 def run(self):
355 """Run command on all machines in this model.
356
357 """
358 pass
359
360 def set_config(self):
361 """Set configuration keys on this model.
362
363 """
364 pass
365
366 def set_constraints(self):
367 """Set machine constraints on this model.
368
369 """
370 pass
371
372 def get_action_output(self, action_uuid):
373 """Get the results of an action by ID.
374
375 """
376 pass
377
378 def get_action_status(self, uuid_or_prefix):
379 """Get the status of all actions, filtered by ID or prefix.
380
381 """
382 pass
383
384 def get_budget(self, budget_name):
385 """Get budget by name.
386
387 """
388 pass
389
390 def get_status(self):
391 """Return the status of the model.
392
393 """
394 pass
395 status = get_status
396
397 def sync_tools(self):
398 """Copy Juju tools into this model.
399
400 """
401 pass
402
403 def unblock(self, operation):
404 """Unblock an operation that would alter this model.
405
406 """
407 pass
408
409 def unset_config(self):
410 """Unset configuration on this model.
411
412 """
413 pass
414
415 def upgrade_gui(self):
416 """Upgrade the Juju GUI for this model.
417
418 """
419 pass
420
421 def upload_backup(self):
422 """Store a backup archive remotely in Juju.
423
424 """
425 pass