a72533d43daba7fca764015fe05192e4e777d80c
4 class Application(model
.ModelEntity
):
5 def add_relation(self
, local_relation
, remote_relation
):
6 """Add a relation to another service.
8 :param str local_relation: Name of relation on this service
9 :param str remote_relation: Name of relation on the other service in
10 the form '<service>[:<relation_name>]'
15 def add_unit(self
, count
=1, to
=None):
16 """Add one or more units to this service.
18 :param int count: Number of units to add
19 :param str to: Placement directive, e.g.::
21 'lxc:7' - new lxc container on machine 7
22 '24/lxc/3' - lxc container 3 or machine 24
24 If None, a new machine is provisioned.
30 def allocate(self
, budget
, value
):
31 """Allocate budget to this service.
33 :param str budget: Name of budget
34 :param int value: Budget limit
39 def attach(self
, resource_name
, file_path
):
40 """Upload a file as a resource for this service.
42 :param str resource: Name of the resource
43 :param str file_path: Path to the file to upload
48 def collect_metrics(self
):
49 """Collect metrics on this service.
54 def destroy_relation(self
, local_relation
, remote_relation
):
55 """Remove a relation to another service.
57 :param str local_relation: Name of relation on this service
58 :param str remote_relation: Name of relation on the other service in
59 the form '<service>[:<relation_name>]'
63 remove_relation
= destroy_relation
66 """Remove this service from the model.
73 """Make this service publicly available over the network.
79 """Return the configuration settings for this service.
84 def get_constraints(self
):
85 """Return the machine constraints for this service.
90 def get_actions(self
, schema
=False):
91 """Get actions defined for this service.
93 :param bool schema: Return the full action schema
98 def get_resources(self
, details
=False):
99 """Return resources for this service.
101 :param bool details: Include detailed info about resources used by each
107 def run(self
, command
, timeout
=None):
108 """Run command on all units for this service.
110 :param str command: The command to run
111 :param int timeout: Time to wait before command is considered failed
116 def set_config(self
, to_default
=False, **config
):
117 """Set configuration options for this service.
119 :param bool to_default: Set service options to default values
120 :param \*\*config: Config key/values
125 def set_constraints(self
, constraints
):
126 """Set machine constraints for this service.
128 :param :class:`juju.Constraints` constraints: Machine constraints
133 def set_meter_status(self
, status
, info
=None):
134 """Set the meter status on this status.
136 :param str status: Meter status, e.g. 'RED', 'AMBER'
137 :param str info: Extra info message
142 def set_plan(self
, plan_name
):
143 """Set the plan for this service, effective immediately.
145 :param str plan_name: Name of plan
151 """Remove public availability over the network for this service.
156 def update_allocation(self
, allocation
):
157 """Update existing allocation for this service.
159 :param int allocation: The allocation to set
165 self
, channel
=None, force_series
=False, force_units
=False,
166 path
=None, resources
=None, revision
=-1, switch
=None):
167 """Upgrade the charm for this service.
169 :param str channel: Channel to use when getting the charm from the
170 charm store, e.g. 'development'
171 :param bool force_series: Upgrade even if series of deployed service
172 is not supported by the new charm
173 :param bool force_units: Upgrade all units immediately, even if in
175 :param str path: Uprade to a charm located at path
176 :param dict resources: Dictionary of resource name/filepath pairs
177 :param int revision: Explicit upgrade revision
178 :param str switch: Crossgrade charm url