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