Remainder of 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, machine, utc=False):
241 """Return list of machines in this model.
242
243 :param str machine: Machine id, e.g. '0'
244 :param bool utc: Display time as UTC in RFC3339 format
245
246 """
247 pass
248
249 def get_shares(self):
250 """Return list of all users with access to this model.
251
252 """
253 pass
254
255 def get_spaces(self):
256 """Return list of all known spaces, including associated subnets.
257
258 """
259 pass
260
261 def get_ssh_key(self):
262 """Return known SSH keys for this model.
263
264 """
265 pass
266 get_ssh_keys = get_ssh_key
267
268 def get_storage(self, filesystem=False, volume=False):
269 """Return details of storage instances.
270
271 :param bool filesystem: Include filesystem storage
272 :param bool volume: Include volume storage
273
274 """
275 pass
276
277 def get_storage_pools(self, names=None, providers=None):
278 """Return list of storage pools.
279
280 :param list names: Only include pools with these names
281 :param list providers: Only include pools for these providers
282
283 """
284 pass
285
286 def get_subnets(self, space=None, zone=None):
287 """Return list of known subnets.
288
289 :param str space: Only include subnets in this space
290 :param str zone: Only include subnets in this zone
291
292 """
293 pass
294
295 def remove_blocks(self):
296 """Remove all blocks from this model.
297
298 """
299 pass
300
301 def remove_backup(self, backup_id):
302 """Delete a backup.
303
304 :param str backup_id: The id of the backup to remove
305
306 """
307 pass
308
309 def remove_cached_images(self, arch=None, kind=None, series=None):
310 """Remove cached OS images.
311
312 :param str arch: Architecture of the images to remove
313 :param str kind: Image kind to remove, e.g. 'lxd'
314 :param str series: Image series to remove, e.g. 'xenial'
315
316 """
317 pass
318
319 def remove_machine(self, *machine_ids):
320 """Remove a machine from this model.
321
322 :param str \*machine_ids: Ids of the machines to remove
323
324 """
325 pass
326 remove_machines = remove_machine
327
328 def remove_ssh_key(self, *keys):
329 """Remove a public SSH key(s) from this model.
330
331 :param str \*keys: Keys to remove
332
333 """
334 pass
335 remove_ssh_keys = remove_ssh_key
336
337 def restore_backup(
338 self, bootstrap=False, constraints=None, archive=None,
339 backup_id=None, upload_tools=False):
340 """Restore a backup archive to a new controller.
341
342 :param bool bootstrap: Bootstrap a new state machine
343 :param :class:`juju.Constraints` constraints: Model constraints
344 :param str archive: Path to backup archive to restore
345 :param str backup_id: Id of backup to restore
346 :param bool upload_tools: Upload tools if bootstrapping a new machine
347
348 """
349 pass
350
351 def retry_provisioning(self):
352 """Retry provisioning for failed machines.
353
354 """
355 pass
356
357 def revoke(self, username, acl='read'):
358 """Revoke a user's access to this model.
359
360 :param str username: Username to revoke
361 :param str acl: Access control ('read' or 'write')
362
363 """
364 pass
365
366 def run(self, command, timeout=None):
367 """Run command on all machines in this model.
368
369 :param str command: The command to run
370 :param int timeout: Time to wait before command is considered failed
371
372 """
373 pass
374
375 def set_config(self, **config):
376 """Set configuration keys on this model.
377
378 :param \*\*config: Config key/values
379
380 """
381 pass
382
383 def set_constraints(self, constraints):
384 """Set machine constraints on this model.
385
386 :param :class:`juju.Constraints` constraints: Machine constraints
387
388 """
389 pass
390
391 def get_action_output(self, action_uuid, wait=-1):
392 """Get the results of an action by ID.
393
394 :param str action_uuid: Id of the action
395 :param int wait: Time in seconds to wait for action to complete
396
397 """
398 pass
399
400 def get_action_status(self, uuid_or_prefix=None, name=None):
401 """Get the status of all actions, filtered by ID, ID prefix, or action name.
402
403 :param str uuid_or_prefix: Filter by action uuid or prefix
404 :param str name: Filter by action name
405
406 """
407 pass
408
409 def get_budget(self, budget_name):
410 """Get budget usage info.
411
412 :param str budget_name: Name of budget
413
414 """
415 pass
416
417 def get_status(self, filter_=None, utc=False):
418 """Return the status of the model.
419
420 :param str filter_: Service or unit name or wildcard ('*')
421 :param bool utc: Display time as UTC in RFC3339 format
422
423 """
424 pass
425 status = get_status
426
427 def sync_tools(
428 self, all_=False, destination=None, dry_run=False, public=False,
429 source=None, stream=None, version=None):
430 """Copy Juju tools into this model.
431
432 :param bool all_: Copy all versions, not just the latest
433 :param str destination: Path to local destination directory
434 :param bool dry_run: Don't do the actual copy
435 :param bool public: Tools are for a public cloud, so generate mirrors
436 information
437 :param str source: Path to local source directory
438 :param str stream: Simplestreams stream for which to sync metadata
439 :param str version: Copy a specific major.minor version
440
441 """
442 pass
443
444 def unblock(self, *commands):
445 """Unblock an operation that would alter this model.
446
447 :param str \*commands: The commands to unblock. Valid values are
448 'all-changes', 'destroy-model', 'remove-object'
449
450 """
451 pass
452
453 def unset_config(self, *keys):
454 """Unset configuration on this model.
455
456 :param str \*keys: The keys to unset
457
458 """
459 pass
460
461 def upgrade_gui(self):
462 """Upgrade the Juju GUI for this model.
463
464 """
465 pass
466
467 def upgrade_juju(
468 self, dry_run=False, reset_previous_upgrade=False,
469 upload_tools=False, version=None):
470 """Upgrade Juju on all machines in a model.
471
472 :param bool dry_run: Don't do the actual upgrade
473 :param bool reset_previous_upgrade: Clear the previous (incomplete)
474 upgrade status
475 :param bool upload_tools: Upload local version of tools
476 :param str version: Upgrade to a specific version
477
478 """
479 pass
480
481 def upload_backup(self, archive_path):
482 """Store a backup archive remotely in Juju.
483
484 :param str archive_path: Path to local archive
485
486 """
487 pass