Add relate example
[osm/N2VC.git] / juju / machine.py
1 import logging
2
3 from . import model
4 from .client import client
5
6 log = logging.getLogger(__name__)
7
8
9 class Machine(model.ModelEntity):
10 async def destroy(self, force=False):
11 """Remove this machine from the model.
12
13 """
14 facade = client.ClientFacade()
15 facade.connect(self.connection)
16
17 log.debug(
18 'Destroying machine %s', self.id)
19
20 return await facade.DestroyMachines(force, [self.id])
21 remove = destroy
22
23 def run(self, command, timeout=None):
24 """Run command on this machine.
25
26 :param str command: The command to run
27 :param int timeout: Time to wait before command is considered failed
28
29 """
30 pass
31
32 def scp(
33 self, source_path, user=None, destination_path=None, proxy=False,
34 scp_opts=None):
35 """Transfer files to this machine.
36
37 :param str source_path: Path of file(s) to transfer
38 :param str user: Remote username
39 :param str destination_path: Destination of transferred files on
40 remote machine
41 :param bool proxy: Proxy through the Juju API server
42 :param str scp_opts: Additional options to the `scp` command
43
44 """
45 pass
46
47 def ssh(
48 self, command, user=None, proxy=False, ssh_opts=None):
49 """Execute a command over SSH on this machine.
50
51 :param str command: Command to execute
52 :param str user: Remote username
53 :param bool proxy: Proxy through the Juju API server
54 :param str ssh_opts: Additional options to the `ssh` command
55
56 """
57 pass
58
59 def status_history(self, num=20, utc=False):
60 """Get status history for this machine.
61
62 :param int num: Size of history backlog
63 :param bool utc: Display time as UTC in RFC3339 format
64
65 """
66 pass