From: Tim Van Steenburgh Date: Wed, 18 May 2016 00:05:32 +0000 (-0400) Subject: Square one. X-Git-Tag: 0.1.0~106 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=3817609d3a0889b444f3cd4ffd3a72bbb21d0c9d;p=osm%2FN2VC.git Square one. A simple usage example in the readme, more needed. The beginnings of the OO interface are here, though it isn't complete. --- 3817609d3a0889b444f3cd4ffd3a72bbb21d0c9d diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/README.md b/README.md new file mode 100644 index 0000000..35151ce --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Getting Started + +```python +from juju import Juju + +juju = Juju() +lxd = juju.get_cloud('lxd') +controller = lxd.bootstrap('lxd-test') +model = controller.get_model('default') + +# We might want an async and blocking version of deploy()? +model.deploy('mediawiki-single') + +mediawiki = model.get_service('mediawiki') +mediawiki.expose() +``` + + diff --git a/juju/__init__.py b/juju/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/juju/cloud.py b/juju/cloud.py new file mode 100644 index 0000000..474d5a6 --- /dev/null +++ b/juju/cloud.py @@ -0,0 +1,36 @@ +class Cloud(object): + def add_credential(self): + """Add or replaces credentials for this cloud. + + """ + pass + + def get_credentials(self): + """Return list of all credentials for this cloud. + + """ + pass + + def remove_credential(self): + """Remove a credential for this cloud. + + """ + pass + + def bootstrap(self): + """Initialize a cloud environment. + + """ + pass + + def set_default_credential(self): + """Set the default credentials for this cloud. + + """ + pass + + def set_default_region(self): + """Set the default region for this cloud. + + """ + pass diff --git a/juju/controller.py b/juju/controller.py new file mode 100644 index 0000000..632b98e --- /dev/null +++ b/juju/controller.py @@ -0,0 +1,85 @@ +class Controller(object): + def add_model(self): + """Add a model to this controller. + + """ + pass + + def add_user(self): + """Add a user to this controller. + + """ + pass + + def change_user_password(self): + """Change the password for a user in this controller. + + """ + pass + + def destroy(self): + """Destroy this controller. + + """ + pass + + def disable_user(self): + """Disable a user. + + """ + pass + + def enable_user(self): + """Re-enable a previously disabled user. + + """ + pass + + def kill(self): + """Forcibly terminate all machines and other associated resources for + this controller. + + """ + pass + + def get_models(self): + """Return list of available models on this controller. + + """ + pass + + def get_payloads(self): + """Return list of known payloads. + + """ + pass + + def get_users(self): + """Return list of users that can connect to this controller. + + """ + pass + + def login(self): + """Log in to this controller. + + """ + pass + + def logout(self): + """Log out of this controller. + + """ + pass + + def get_model(self, name): + """Get a model by name. + + """ + pass + + def get_user(self, name): + """Get a user by name. + + """ + pass diff --git a/juju/juju.py b/juju/juju.py new file mode 100644 index 0000000..b1dcabd --- /dev/null +++ b/juju/juju.py @@ -0,0 +1,93 @@ +class Juju(object): + def add_cloud(self): + """Add a user-defined cloud to Juju from among known cloud types. + + """ + pass + + def agree(self): + """Agree to the terms of a charm. + + """ + pass + + def autoload_credentials(self): + """Finds cloud credentials and caches them for use by Juju when + bootstrapping. + + """ + pass + + def create_budget(self): + """Create a new budget. + + """ + pass + + def get_agreements(self): + """Return list of terms to which the current user has agreed. + + """ + pass + + def get_budgets(self): + """Return list of available budgets. + + """ + pass + + def get_clouds(self): + """Return list of all available clouds. + + """ + pass + + def get_controllers(self): + """Return list of all available controllers. + + (maybe move this to Cloud?) + """ + pass + + def get_plans(self, charm_name): + """Return list of plans available for the specified charm. + + """ + pass + + def register(self, registration_string): + """Register a user to a controller. + + """ + pass + + def set_budget(self, name, amount): + """Set a budget limit. + + """ + pass + + def get_cloud(self, name): + """Get a cloud by name. + + """ + pass + + def get_controller(self): + """Get a controller by name. + + (maybe move this to Cloud?) + """ + pass + + def update_clouds(self): + """Update public cloud info available to Juju. + + """ + pass + + def version(self): + """Return the Juju version. + + """ + pass diff --git a/juju/machine.py b/juju/machine.py new file mode 100644 index 0000000..8c9a40b --- /dev/null +++ b/juju/machine.py @@ -0,0 +1,24 @@ +class Machine(object): + def run(self): + """Run command on this machine. + + """ + pass + + def scp(self): + """Transfer files to this machine. + + """ + pass + + def ssh(self): + """Execute a command over SSH on this machine. + + """ + pass + + def status_history(self): + """Get status history for this machine. + + """ + pass diff --git a/juju/model.py b/juju/model.py new file mode 100644 index 0000000..32295d5 --- /dev/null +++ b/juju/model.py @@ -0,0 +1,302 @@ +class Model(object): + def add_machine(self): + """Start a new, empty machine and optionally a container, or add a + container to a machine. + + """ + pass + add_machines = add_machine + + def add_relation(self): + """Add a relation between two services. + + """ + pass + + def add_space(self): + """Add a new network space. + + """ + pass + + def add_ssh_key(self): + """Add a public SSH key to this model. + + """ + pass + add_ssh_keys = add_ssh_key + + def add_subnet(self): + """Add an existing subnet to this model. + + """ + pass + + def get_backups(self): + """Retrieve metadata for backups in this model. + + """ + pass + + def block(self): + """Add a new block to this model. + + """ + pass + + def get_blocks(self): + """List blocks for this model. + + """ + pass + + def get_cached_images(self): + """Return a list of cached OS images. + + """ + pass + + def create_backup(self): + """Create a backup of this model. + + """ + pass + + def create_storage_pool(self): + """Create or define a storage pool. + + """ + pass + + def debug_log(self): + """Get log messages for this model. + + """ + pass + + def deploy(self): + """Deploy a new service or bundle. + + """ + pass + + def destroy(self): + """Terminate all machines and resources for this model. + + """ + pass + + def get_backup(self): + """Download a backup archive file. + + """ + pass + + def enable_ha(self): + """Ensure sufficient controllers exist to provide redundancy. + + """ + pass + + def get_config(self): + """Return the configuration settings for this model. + + """ + pass + + def get_constraints(self): + """Return the machine constraints for this model. + + """ + pass + + def grant(self): + """Grant a user access to this model. + + """ + pass + + def import_ssh_key(self): + """Add a public SSH key from a trusted indentity source to this model. + + """ + pass + import_ssh_keys = import_ssh_key + + def get_machine(self, machine_id): + """Get a machine by id. + + """ + pass + + def get_machines(self): + """Return list of machines in this model. + + """ + pass + + def get_shares(self): + """Return list of all users with access to this model. + + """ + pass + + def get_spaces(self): + """Return list of all known spaces, including associated subnets. + + """ + pass + + def get_ssh_key(self): + """Return known SSH keys for this model. + + """ + pass + get_ssh_keys = get_ssh_key + + def get_storage(self): + """Return details of storage instances. + + """ + pass + + def get_storage_pools(self): + """Return list of storage pools. + + """ + pass + + def get_subnets(self): + """Return list of known subnets. + + """ + pass + + def remove_blocks(self): + """Remove all blocks from this model. + + """ + pass + + def remove_backup(self): + """Delete a backup. + + """ + pass + + def remove_cached_images(self): + """Remove cached OS images. + + """ + pass + + def remove_machine(self): + """Remove a machine from this model. + + """ + pass + remove_machines = remove_machine + + def remove_ssh_key(self): + """Remove a public SSH key(s) from this model. + + """ + pass + remove_ssh_keys = remove_ssh_key + + def resolved(self): + """Mark unit errors resolved. + + """ + pass + + def restore_backup(self): + """Restore a backup archive to a new controller. + + """ + pass + + def retry_provisioning(self): + """Retry provisioning for failed machines. + + """ + pass + + def revoke(self): + """Revoke a user's access to this model. + + """ + pass + + def run(self): + """Run command on all machines in this model. + + """ + pass + + def set_config(self): + """Set configuration keys on this model. + + """ + pass + + def set_constraints(self): + """Set machine constraints on this model. + + """ + pass + + def get_action_output(self, action_uuid): + """Get the results of an action by ID. + + """ + pass + + def get_action_status(self, uuid_or_prefix): + """Get the status of all actions, filtered by ID or prefix. + + """ + pass + + def get_budget(self, budget_name): + """Get budget by name. + + """ + pass + + def get_status(self): + """Return the status of the model. + + """ + pass + status = get_status + + def sync_tools(self): + """Copy Juju tools into this model. + + """ + pass + + def unblock(self, operation): + """Unblock an operation that would alter this model. + + """ + pass + + def unset_config(self): + """Unset configuration on this model. + + """ + pass + + def upgrade_gui(self): + """Upgrade the Juju GUI for this model. + + """ + pass + + def upload_backup(self): + """Store a backup archive remotely in Juju. + + """ + pass diff --git a/juju/service.py b/juju/service.py new file mode 100644 index 0000000..08324bd --- /dev/null +++ b/juju/service.py @@ -0,0 +1,123 @@ +class Service(object): + def add_relation(self): + """Add a relation to another service. + + """ + pass + + def add_unit(self): + """Add one or more units to this service. + + """ + pass + add_units = add_unit + + def allocate(self): + """Allocate budget to this service. + + """ + pass + + def attach(self): + """Upload a file as a resource for this service. + + """ + pass + + def collect_metrics(self): + """Collect metrics on this service. + + """ + pass + + def destroy_relation(self): + """Remove a relation to another service. + + """ + pass + remove_relation = destroy_relation + + def destroy(self): + """Remove this service from the model. + + """ + pass + remove = destroy + + def expose(self): + """Make this service publicly available over the network. + + """ + pass + + def get_config(self): + """Return the configuration settings for this service. + + """ + pass + + def get_constraints(self): + """Return the machine constraints for this service. + + """ + pass + + def get_actions(self): + """Get actions defined for this service. + + """ + pass + + def get_resources(self): + """Return resources for this service. + + """ + pass + + def run(self): + """Run command on all units for this service. + + """ + pass + + def set_config(self): + """Set configuration options for this service. + + """ + pass + + def set_constraints(self): + """Set machine constraints for this service. + + """ + pass + + def set_meter_status(self): + """Set the meter status on this status. + + """ + pass + + def set_plan(self): + """Set the plan for this service, effective immediately. + + """ + pass + + def unexpose(self): + """Remove public availability over the network for this service. + + """ + pass + + def update_allocation(self): + """Update existing allocation for this service. + + """ + pass + + def upgrade_charm(self): + """Upgrade the charm for this service. + + """ + pass diff --git a/juju/unit.py b/juju/unit.py new file mode 100644 index 0000000..1a26a55 --- /dev/null +++ b/juju/unit.py @@ -0,0 +1,61 @@ +class Unit(object): + def add_storage(self): + """Add unit storage dynamically. + + """ + pass + + def collect_metrics(self): + """Collect metrics on this unit. + + """ + pass + + def destroy(self): + """Destroy this unit. + + """ + pass + remove = destroy + + def get_resources(self): + """Return resources for this unit. + + """ + pass + + def run(self): + """Run command on this unit. + + """ + pass + + def run_action(self): + """Run action on this unit. + + """ + pass + + def scp(self): + """Transfer files to this unit. + + """ + pass + + def set_meter_status(self): + """Set the meter status on this unit. + + """ + pass + + def ssh(self): + """Execute a command over SSH on this unit. + + """ + pass + + def status_history(self): + """Get status history for this unit. + + """ + pass