From 596ccbe375a3a45e1625b798bb42da3df284ed09 Mon Sep 17 00:00:00 2001 From: Tim Van Steenburgh Date: Thu, 19 May 2016 10:48:06 -0400 Subject: [PATCH] Remainder of params/docstrings --- juju/cloud.py | 8 +++- juju/controller.py | 6 ++- juju/juju.py | 14 +++++-- juju/machine.py | 29 +++++++++++++-- juju/model.py | 92 ++++++++++++++++++++++++++++++++++++++-------- juju/service.py | 42 +++++++++++++++++---- juju/unit.py | 34 ++++++++++++++--- 7 files changed, 188 insertions(+), 37 deletions(-) diff --git a/juju/cloud.py b/juju/cloud.py index f569af1..6baa943 100644 --- a/juju/cloud.py +++ b/juju/cloud.py @@ -63,14 +63,18 @@ class Cloud(object): """ pass - def set_default_credential(self): + def set_default_credential(self, credential_name): """Set the default credentials for this cloud. + :param str credential_name: Credential to make default + """ pass - def set_default_region(self): + def set_default_region(self, region): """Set the default region for this cloud. + :param str region: Name of region to make default + """ pass diff --git a/juju/controller.py b/juju/controller.py index b15c687..e0f8066 100644 --- a/juju/controller.py +++ b/juju/controller.py @@ -114,11 +114,15 @@ class Controller(object): def get_model(self, name): """Get a model by name. + :param str name: Model name + """ pass - def get_user(self, name): + def get_user(self, username): """Get a user by name. + :param str username: Username + """ pass diff --git a/juju/juju.py b/juju/juju.py index b2c6152..fe3ce92 100644 --- a/juju/juju.py +++ b/juju/juju.py @@ -78,8 +78,11 @@ class Juju(object): """ pass - def set_budget(self, name, amount): - """Set a budget limit. + def set_budget(self, name, limit): + """Set a monthly budget limit. + + :param str name: Name of budget + :param int limit: Monthly limit """ pass @@ -87,12 +90,17 @@ class Juju(object): def get_cloud(self, name): """Get a cloud by name. + :param str name: Name of cloud + """ pass - def get_controller(self): + def get_controller(self, name, include_passwords=False): """Get a controller by name. + :param str name: Name of controller + :param bool include_passwords: Include passwords for accounts + (maybe move this to Cloud?) """ pass diff --git a/juju/machine.py b/juju/machine.py index 8c9a40b..4bc8ff6 100644 --- a/juju/machine.py +++ b/juju/machine.py @@ -1,24 +1,45 @@ class Machine(object): - def run(self): + def run(self, command, timeout=None): """Run command on this machine. + :param str command: The command to run + :param int timeout: Time to wait before command is considered failed + """ pass - def scp(self): + def scp( + self, source_path, user=None, destination_path=None, proxy=False, + scp_opts=None): """Transfer files to this machine. + :param str source_path: Path of file(s) to transfer + :param str user: Remote username + :param str destination_path: Destination of transferred files on + remote machine + :param bool proxy: Proxy through the Juju API server + :param str scp_opts: Additional options to the `scp` command + """ pass - def ssh(self): + def ssh( + self, command, user=None, proxy=False, ssh_opts=None): """Execute a command over SSH on this machine. + :param str command: Command to execute + :param str user: Remote username + :param bool proxy: Proxy through the Juju API server + :param str ssh_opts: Additional options to the `ssh` command + """ pass - def status_history(self): + def status_history(self, num=20, utc=False): """Get status history for this machine. + :param int num: Size of history backlog + :param bool utc: Display time as UTC in RFC3339 format + """ pass diff --git a/juju/model.py b/juju/model.py index 83f9511..c3d9e56 100644 --- a/juju/model.py +++ b/juju/model.py @@ -237,9 +237,10 @@ class Model(object): pass import_ssh_keys = import_ssh_key - def get_machines(self, utc=False): + def get_machines(self, machine, utc=False): """Return list of machines in this model. + :param str machine: Machine id, e.g. '0' :param bool utc: Display time as UTC in RFC3339 format """ @@ -333,9 +334,17 @@ class Model(object): pass remove_ssh_keys = remove_ssh_key - def restore_backup(self): + def restore_backup( + self, bootstrap=False, constraints=None, archive=None, + backup_id=None, upload_tools=False): """Restore a backup archive to a new controller. + :param bool bootstrap: Bootstrap a new state machine + :param :class:`juju.Constraints` constraints: Model constraints + :param str archive: Path to backup archive to restore + :param str backup_id: Id of backup to restore + :param bool upload_tools: Upload tools if bootstrapping a new machine + """ pass @@ -345,70 +354,107 @@ class Model(object): """ pass - def revoke(self): + def revoke(self, username, acl='read'): """Revoke a user's access to this model. + :param str username: Username to revoke + :param str acl: Access control ('read' or 'write') + """ pass - def run(self): + def run(self, command, timeout=None): """Run command on all machines in this model. + :param str command: The command to run + :param int timeout: Time to wait before command is considered failed + """ pass - def set_config(self): + def set_config(self, **config): """Set configuration keys on this model. + :param \*\*config: Config key/values + """ pass - def set_constraints(self): + def set_constraints(self, constraints): """Set machine constraints on this model. + :param :class:`juju.Constraints` constraints: Machine constraints + """ pass - def get_action_output(self, action_uuid): + def get_action_output(self, action_uuid, wait=-1): """Get the results of an action by ID. + :param str action_uuid: Id of the action + :param int wait: Time in seconds to wait for action to complete + """ pass - def get_action_status(self, uuid_or_prefix): - """Get the status of all actions, filtered by ID or prefix. + def get_action_status(self, uuid_or_prefix=None, name=None): + """Get the status of all actions, filtered by ID, ID prefix, or action name. + + :param str uuid_or_prefix: Filter by action uuid or prefix + :param str name: Filter by action name """ pass def get_budget(self, budget_name): - """Get budget by name. + """Get budget usage info. + + :param str budget_name: Name of budget """ pass - def get_status(self): + def get_status(self, filter_=None, utc=False): """Return the status of the model. + :param str filter_: Service or unit name or wildcard ('*') + :param bool utc: Display time as UTC in RFC3339 format + """ pass status = get_status - def sync_tools(self): + def sync_tools( + self, all_=False, destination=None, dry_run=False, public=False, + source=None, stream=None, version=None): """Copy Juju tools into this model. + :param bool all_: Copy all versions, not just the latest + :param str destination: Path to local destination directory + :param bool dry_run: Don't do the actual copy + :param bool public: Tools are for a public cloud, so generate mirrors + information + :param str source: Path to local source directory + :param str stream: Simplestreams stream for which to sync metadata + :param str version: Copy a specific major.minor version + """ pass - def unblock(self, operation): + def unblock(self, *commands): """Unblock an operation that would alter this model. + :param str \*commands: The commands to unblock. Valid values are + 'all-changes', 'destroy-model', 'remove-object' + """ pass - def unset_config(self): + def unset_config(self, *keys): """Unset configuration on this model. + :param str \*keys: The keys to unset + """ pass @@ -418,8 +464,24 @@ class Model(object): """ pass - def upload_backup(self): + def upgrade_juju( + self, dry_run=False, reset_previous_upgrade=False, + upload_tools=False, version=None): + """Upgrade Juju on all machines in a model. + + :param bool dry_run: Don't do the actual upgrade + :param bool reset_previous_upgrade: Clear the previous (incomplete) + upgrade status + :param bool upload_tools: Upload local version of tools + :param str version: Upgrade to a specific version + + """ + pass + + def upload_backup(self, archive_path): """Store a backup archive remotely in Juju. + :param str archive_path: Path to local archive + """ pass diff --git a/juju/service.py b/juju/service.py index 007306a..39570b8 100644 --- a/juju/service.py +++ b/juju/service.py @@ -101,33 +101,46 @@ class Service(object): """ pass - def run(self): + def run(self, command, timeout=None): """Run command on all units for this service. + :param str command: The command to run + :param int timeout: Time to wait before command is considered failed + """ pass - def set_config(self): + def set_config(self, to_default=False, **config): """Set configuration options for this service. + :param bool to_default: Set service options to default values + :param \*\*config: Config key/values + """ pass - def set_constraints(self): + def set_constraints(self, constraints): """Set machine constraints for this service. + :param :class:`juju.Constraints` constraints: Machine constraints + """ pass - def set_meter_status(self): + def set_meter_status(self, status, info=None): """Set the meter status on this status. + :param str status: Meter status, e.g. 'RED', 'AMBER' + :param str info: Extra info message + """ pass - def set_plan(self): + def set_plan(self, plan_name): """Set the plan for this service, effective immediately. + :param str plan_name: Name of plan + """ pass @@ -137,14 +150,29 @@ class Service(object): """ pass - def update_allocation(self): + def update_allocation(self, allocation): """Update existing allocation for this service. + :param int allocation: The allocation to set + """ pass - def upgrade_charm(self): + def upgrade_charm( + self, channel=None, force_series=False, force_units=False, + path=None, resources=None, revision=-1, switch=None): """Upgrade the charm for this service. + :param str channel: Channel to use when getting the charm from the + charm store, e.g. 'development' + :param bool force_series: Upgrade even if series of deployed service + is not supported by the new charm + :param bool force_units: Upgrade all units immediately, even if in + error state + :param str path: Uprade to a charm located at path + :param dict resources: Dictionary of resource name/filepath pairs + :param int revision: Explicit upgrade revision + :param str switch: Crossgrade charm url + """ pass diff --git a/juju/unit.py b/juju/unit.py index 0e031e2..900ade9 100644 --- a/juju/unit.py +++ b/juju/unit.py @@ -39,21 +39,36 @@ class Unit(object): """ pass - def run(self): + def run(self, command, timeout=None): """Run command on this unit. + :param str command: The command to run + :param int timeout: Time to wait before command is considered failed + """ pass - def run_action(self): + def run_action(self, action_name, **params): """Run action on this unit. + :param str action_name: Name of action to run + :param \*\*params: Action parameters + """ pass - def scp(self): + def scp( + self, source_path, user=None, destination_path=None, proxy=False, + scp_opts=None): """Transfer files to this unit. + :param str source_path: Path of file(s) to transfer + :param str user: Remote username + :param str destination_path: Destination of transferred files on + remote machine + :param bool proxy: Proxy through the Juju API server + :param str scp_opts: Additional options to the `scp` command + """ pass @@ -63,14 +78,23 @@ class Unit(object): """ pass - def ssh(self): + def ssh( + self, command, user=None, proxy=False, ssh_opts=None): """Execute a command over SSH on this unit. + :param str command: Command to execute + :param str user: Remote username + :param bool proxy: Proxy through the Juju API server + :param str ssh_opts: Additional options to the `ssh` command + """ pass - def status_history(self): + def status_history(self, num=20, utc=False): """Get status history for this unit. + :param int num: Size of history backlog + :param bool utc: Display time as UTC in RFC3339 format + """ pass -- 2.25.1