juju.application¶
Summary
Reference
-
class
juju.application.
Application
(entity_id, model, history_index=-1, connected=True)[source]¶ Bases:
juju.model.ModelEntity
-
coroutine
add_relation
(local_relation, remote_relation)[source]¶ Add a relation to another application.
Parameters: - local_relation (str) – Name of relation on this application
- remote_relation (str) – Name of relation on the other application in the form ‘<application>[:<relation_name>]’
-
coroutine
add_unit
(count=1, to=None)[source]¶ Add one or more units to this application.
Parameters: - count (int) – Number of units to add
- to (str) –
Placement directive, e.g.:: ‘23’ - machine 23 ‘lxc:7’ - new lxc container on machine 7 ‘24/lxc/3’ - lxc container 3 or machine 24
If None, a new machine is provisioned.
-
coroutine
add_units
(count=1, to=None)¶ Add one or more units to this application.
Parameters: - count (int) – Number of units to add
- to (str) –
Placement directive, e.g.:: ‘23’ - machine 23 ‘lxc:7’ - new lxc container on machine 7 ‘24/lxc/3’ - lxc container 3 or machine 24
If None, a new machine is provisioned.
-
allocate
(budget, value)[source]¶ Allocate budget to this application.
Parameters: - budget (str) – Name of budget
- value (int) – Budget limit
-
attach
(resource_name, file_path)[source]¶ Upload a file as a resource for this application.
Parameters: - resource (str) – Name of the resource
- file_path (str) – Path to the file to upload
-
coroutine
destroy_relation
(local_relation, remote_relation)[source]¶ Remove a relation to another application.
Parameters: - local_relation (str) – Name of relation on this application
- remote_relation (str) – Name of relation on the other application in the form ‘<application>[:<relation_name>]’
-
coroutine
destroy_units
(*unit_names)¶ Destroy units by name.
-
get_actions
(schema=False)[source]¶ Get actions defined for this application.
Parameters: schema (bool) – Return the full action schema
-
coroutine
get_metrics
()[source]¶ Get metrics for this application’s units.
Returns: Dictionary of unit_name:metrics
-
get_resources
(details=False)[source]¶ Return resources for this application.
Parameters: details (bool) – Include detailed info about resources used by each unit
-
on_unit_add
(callable_)[source]¶ Add a “unit added” observer to this entity, which will be called whenever a unit is added to this application.
-
on_unit_remove
(callable_)[source]¶ Add a “unit removed” observer to this entity, which will be called whenever a unit is removed from this application.
-
coroutine
remove
()¶ Remove this application from the model.
-
coroutine
remove_relation
(local_relation, remote_relation)¶ Remove a relation to another application.
Parameters: - local_relation (str) – Name of relation on this application
- remote_relation (str) – Name of relation on the other application in the form ‘<application>[:<relation_name>]’
-
coroutine
run
(command, timeout=None)[source]¶ Run command on all units for this application.
Parameters: - command (str) – The command to run
- timeout (int) – Time to wait before command is considered failed
-
coroutine
set_annotations
(annotations)[source]¶ Set annotations on this application.
Parameters: map[string]string (annotations) – the annotations as key/value pairs.
-
coroutine
set_config
(config, to_default=False)[source]¶ Set configuration options for this application.
Parameters: - config – Dict of configuration to set
- to_default (bool) – Set application options to default values
-
coroutine
set_constraints
(constraints)[source]¶ Set machine constraints for this application.
Parameters: constraints (dict) – Dict of machine constraints
-
set_meter_status
(status, info=None)[source]¶ Set the meter status on this status.
Parameters: - status (str) – Meter status, e.g. ‘RED’, ‘AMBER’
- info (str) – Extra info message
-
set_plan
(plan_name)[source]¶ Set the plan for this application, effective immediately.
Parameters: plan_name (str) – Name of plan
-
status
¶ Get the application status, as set by the charm’s leader.
-
status_message
¶ Get the application status message, as set by the charm’s leader.
-
tag
¶
-
units
¶
-
update_allocation
(allocation)[source]¶ Update existing allocation for this application.
Parameters: allocation (int) – The allocation to set
-
coroutine
upgrade_charm
(channel=None, force_series=False, force_units=False, path=None, resources=None, revision=None, switch=None)[source]¶ Upgrade the charm for this application.
Parameters: - channel (str) – Channel to use when getting the charm from the charm store, e.g. ‘development’
- force_series (bool) – Upgrade even if series of deployed application is not supported by the new charm
- force_units (bool) – Upgrade all units immediately, even if in error state
- path (str) – Uprade to a charm located at path
- resources (dict) – Dictionary of resource name/filepath pairs
- revision (int) – Explicit upgrade revision
- switch (str) – Crossgrade charm url
-
coroutine