http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/LICENSE ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/LICENSE b/apache-libcloud-1.0.0rc2/LICENSE deleted file mode 100644 index d645695..0000000 --- a/apache-libcloud-1.0.0rc2/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License.
http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/MANIFEST.in ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/MANIFEST.in b/apache-libcloud-1.0.0rc2/MANIFEST.in deleted file mode 100644 index d06ca0c..0000000 --- a/apache-libcloud-1.0.0rc2/MANIFEST.in +++ /dev/null @@ -1,24 +0,0 @@ -include LICENSE -include NOTICE -include example_*.py -include CHANGES.rst -include README.rst -include tox.ini -include requirements-tests.txt -include libcloud/data/pricing.json -prune libcloud/test/secrets.py -include demos/* -include libcloud/test/*.py -include libcloud/test/pricing_test.json -include libcloud/test/secrets.py-dist -include libcloud/test/common/*.py -include libcloud/test/compute/*.py -include libcloud/test/storage/*.py -include libcloud/test/loadbalancer/*.py -include libcloud/test/dns/*.py -include libcloud/test/common/fixtures/*/* -include libcloud/test/compute/fixtures/*/* -include libcloud/test/compute/fixtures/*/*/* -include libcloud/test/storage/fixtures/*/* -include libcloud/test/loadbalancer/fixtures/*/* -include libcloud/test/dns/fixtures/*/* http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/NOTICE ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/NOTICE b/apache-libcloud-1.0.0rc2/NOTICE deleted file mode 100644 index 0422d1f..0000000 --- a/apache-libcloud-1.0.0rc2/NOTICE +++ /dev/null @@ -1,8 +0,0 @@ -Apache Libcloud -Copyright (c) 2010-2015 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -This product includes software developed by -Cloudkick (http://www.cloudkick.com/). http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/README.rst ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/README.rst b/apache-libcloud-1.0.0rc2/README.rst deleted file mode 100644 index d961077..0000000 --- a/apache-libcloud-1.0.0rc2/README.rst +++ /dev/null @@ -1,70 +0,0 @@ -Apache Libcloud - a unified interface into the cloud -==================================================== - -.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat - :target: https://libcloud.readthedocs.org - -.. image:: https://img.shields.io/pypi/v/apache-libcloud.svg - :target: https://pypi.python.org/pypi/apache-libcloud/ - -.. image:: https://img.shields.io/pypi/dm/apache-libcloud.svg - :target: https://pypi.python.org/pypi/apache-libcloud/ - -.. image:: https://img.shields.io/travis/apache/libcloud/trunk.svg - :target: http://travis-ci.org/apache/libcloud - -.. image:: https://img.shields.io/pypi/pyversions/apache-libcloud.svg - :target: https://pypi.python.org/pypi/apache-libcloud/ - -.. image:: https://img.shields.io/pypi/wheel/apache-libcloud.svg - :target: https://pypi.python.org/pypi/apache-libcloud/ - -.. image:: https://img.shields.io/github/license/apache/libcloud.svg - :target: https://github.com/apache/libcloud/blob/trunk/LICENSE - -.. image:: https://img.shields.io/irc/%23libcloud.png - :target: http://webchat.freenode.net/?channels=libcloud - -Apache Libcloud is a Python library which hides differences between different -cloud provider APIs and allows you to manage different cloud resources -through a unified and easy to use API. - -Resources you can manage with Libcloud are divided into the following categories: - -* **Compute** - Cloud Servers and Block Storage - services such as Amazon EC2 and Rackspace - Cloud Servers (``libcloud.compute.*``) -* **Storage** - Cloud Object Storage and CDN - services such as Amazon S3 and Rackspace - CloudFiles (``libcloud.storage.*``) -* **Load Balancers** - Load Balancers as a Service, LBaaS (``libcloud.loadbalancer.*``) -* **DNS** - DNS as a Service, DNSaaS (``libcloud.dns.*``) -* **Container** - Container virtualization services (``libcloud.container.*``) - - -Apache Libcloud is an Apache project, see <http://libcloud.apache.org> for -more information. - -Documentation -============= - -Documentation can be found at <https://libcloud.readthedocs.org>. - -Feedback -======== - -Please send feedback to the mailing list at <[email protected]>, -or the JIRA at <https://issues.apache.org/jira/browse/LIBCLOUD>. - -Contributing -============ - -For information on how to contribute, please see the Contributing -chapter in our documentation -<https://libcloud.readthedocs.org/en/latest/development.html#contributing> - -License -======= - -Apache Libcloud is licensed under the Apache 2.0 license. For more information, please see LICENSE_ and NOTICE_ file. - -.. _LICENSE: https://github.com/apache/libcloud/blob/trunk/LICENSE -.. _NOTICE: https://github.com/apache/libcloud/blob/trunk/NOTICE http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/demos/compute_demo.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/demos/compute_demo.py b/apache-libcloud-1.0.0rc2/demos/compute_demo.py deleted file mode 100644 index 983b713..0000000 --- a/apache-libcloud-1.0.0rc2/demos/compute_demo.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -# This example provides both a running script (invoke from command line) -# and an importable module one can play with in Interactive Mode. -# -# See docstrings for usage examples. -# - -try: - import secrets -except ImportError: - secrets = None - -import os.path -import sys - -# Add parent dir of this file's dir to sys.path (OS-agnostically) -sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), - os.path.pardir))) - -from libcloud.common.types import InvalidCredsError -from libcloud.compute.types import Provider -from libcloud.providers import get_driver - -from pprint import pprint - - -def get_demo_driver(provider_name='RACKSPACE', *args, **kwargs): - """An easy way to play with a driver interactively. - - # Load credentials from secrets.py: - >>> from compute_demo import get_demo_driver - >>> driver = get_demo_driver('RACKSPACE') - - # Or, provide credentials: - >>> from compute_demo import get_demo_driver - >>> driver = get_demo_driver('RACKSPACE', 'username', 'api_key') - # Note that these parameters vary by driver ^^^ - - # Do things like the demo: - >>> driver.load_nodes() - >>> images = driver.load_images() - >>> sizes = driver.load_sizes() - - # And maybe do more than that: - >>> node = driver.create_node( - ... name='my_first_node', - ... image=images[0], - ... size=sizes[0], - ... ) - >>> node.destroy() - """ - provider_name = provider_name.upper() - - DriverClass = get_driver(getattr(Provider, provider_name)) - - if not args: - args = getattr(secrets, provider_name + '_PARAMS', ()) - if not kwargs: - kwargs = getattr(secrets, provider_name + '_KEYWORD_PARAMS', {}) - - try: - return DriverClass(*args, **kwargs) - except InvalidCredsError: - raise InvalidCredsError( - 'valid values should be put in secrets.py') - - -def main(argv): - """Main Compute Demo - - When invoked from the command line, it will connect using secrets.py - (see secrets.py-dist for instructions and examples), and perform the - following tasks: - - - List current nodes - - List available images (up to 10) - - List available sizes (up to 10) - """ - try: - driver = get_demo_driver() - except InvalidCredsError: - e = sys.exc_info()[1] - print("Invalid Credentials: " + e.value) - return 1 - - try: - print(">> Loading nodes...") - pprint(driver.list_nodes()) - - print(">> Loading images... (showing up to 10)") - pprint(driver.list_images()[:10]) - - print(">> Loading sizes... (showing up to 10)") - pprint(driver.list_sizes()[:10]) - except Exception: - e = sys.exc_info()[1] - print("A fatal error occurred: " + e) - return 1 - -if __name__ == '__main__': - sys.exit(main(sys.argv)) http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/demos/gce_demo.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/demos/gce_demo.py b/apache-libcloud-1.0.0rc2/demos/gce_demo.py deleted file mode 100644 index aae7093..0000000 --- a/apache-libcloud-1.0.0rc2/demos/gce_demo.py +++ /dev/null @@ -1,706 +0,0 @@ -#!/usr/bin/env python -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# This example performs several tasks on Google Compute Platform. It can be -# run directly or can be imported into an interactive python session. This -# can also serve as live integration tests. -# -# To run directly, use python 2.7 or greater: -# - $ python gce_demo.py --help # to see the help screen -# - $ python gce_demo.py # to run all demos / tests -# -# To run interactively: -# - Make sure you have valid values in secrets.py -# (For more information about setting up your credentials, see the -# libcloud/common/google.py docstring) -# - Run 'python' in this directory, then: -# import gce_demo -# gce = gce_demo.get_gce_driver() -# gce.list_nodes() -# etc. -# - Or, to run the full demo from the interactive python shell: -# import gce_demo -# gce_demo.CLEANUP = False # optional -# gce_demo.MAX_NODES = 4 # optional -# gce_demo.DATACENTER = 'us-central1-a' # optional -# gce_demo.main_compute() # 'compute' only demo -# gce_demo.main_load_balancer() # 'load_balancer' only demo -# gce_demo.main_dns() # 'dns only demo -# gce_demo.main() # all demos / tests - -import os.path -import sys -import datetime -import time - -try: - import argparse -except: - print('This script uses the python "argparse" module. Please use Python ' - '2.7 or greater.') - raise - -try: - import secrets -except ImportError: - print('"demos/secrets.py" not found.\n\n' - 'Please copy secrets.py-dist to secrets.py and update the GCE* ' - 'values with appropriate authentication information.\n' - 'Additional information about setting these values can be found ' - 'in the docstring for:\n' - 'libcloud/common/google.py\n') - sys.exit(1) - -# Add parent dir of this file's dir to sys.path (OS-agnostically) -sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), - os.path.pardir))) - -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver -from libcloud.common.google import ResourceNotFoundError -from libcloud.loadbalancer.types import Provider as Provider_lb -from libcloud.loadbalancer.providers import get_driver as get_driver_lb -from libcloud.dns.types import Provider as Provider_dns -from libcloud.dns.providers import get_driver as get_driver_dns -from libcloud.dns.base import Record, Zone -from libcloud.utils.py3 import PY3 -if PY3: - import urllib.request as url_req -else: - import urllib2 as url_req - -# Maximum number of 1-CPU nodes to allow to run simultaneously -MAX_NODES = 5 - -# String that all resource names created by the demo will start with -# WARNING: Any resource that has a matching name will be destroyed. -DEMO_BASE_NAME = 'lct' - -# Datacenter to create resources in -DATACENTER = 'us-central1-f' - -# Clean up resources at the end (can be set to false in order to -# inspect resources at the end of the run). Resources will be cleaned -# at the beginning regardless. -CLEANUP = True - -args = getattr(secrets, 'GCE_PARAMS', ()) -kwargs = getattr(secrets, 'GCE_KEYWORD_PARAMS', {}) - -# Add datacenter to kwargs for Python 2.5 compatibility -kwargs = kwargs.copy() -kwargs['datacenter'] = DATACENTER - - -# ==== HELPER FUNCTIONS ==== -def get_gce_driver(): - driver = get_driver(Provider.GCE)(*args, **kwargs) - return driver - - -def get_gcelb_driver(gce_driver=None): - # The GCE Load Balancer driver uses the GCE Compute driver for all of its - # API calls. You can either provide the driver directly, or provide the - # same authentication information so the LB driver can get its own - # Compute driver. - if gce_driver: - driver = get_driver_lb(Provider_lb.GCE)(gce_driver=gce_driver) - else: - driver = get_driver_lb(Provider_lb.GCE)(*args, **kwargs) - return driver - - -def get_dns_driver(gce_driver=None): - # The Google DNS driver uses the GCE Compute driver for all of its - # API calls. You can either provide the driver directly, or provide the - # same authentication information so the LB driver can get its own - # Compute driver. - if gce_driver: - driver = get_driver_dns(Provider_dns.GOOGLE)(gce_driver=gce_driver) - else: - driver = get_driver_dns(Provider_dns.GOOGLE)(*args, **kwargs) - return driver - - -def display(title, resource_list=[]): - """ - Display a list of resources. - - :param title: String to be printed at the heading of the list. - :type title: ``str`` - - :param resource_list: List of resources to display - :type resource_list: Any ``object`` with a C{name} attribute - """ - print('=> %s' % title) - for item in resource_list: - if isinstance(item, Record): - if item.name.startswith(DEMO_BASE_NAME): - print('=> name=%s, type=%s' % (item.name, item.type)) - else: - print(' name=%s, type=%s' % (item.name, item.type)) - elif isinstance(item, Zone): - if item.domain.startswith(DEMO_BASE_NAME): - print('=> name=%s, dnsname=%s' % (item.id, item.domain)) - else: - print(' name=%s, dnsname=%s' % (item.id, item.domain)) - elif hasattr(item, 'name'): - if item.name.startswith(DEMO_BASE_NAME): - print('=> %s' % item.name) - else: - print(' %s' % item.name) - else: - if item.startswith(DEMO_BASE_NAME): - print('=> %s' % item) - else: - print(' %s' % item) - - -def cleanup_only(): - start_time = datetime.datetime.now() - display('Clean-up start time: %s' % str(start_time)) - gce = get_gce_driver() - # Get project info and print name - project = gce.ex_get_project() - display('Project: %s' % project.name) - - # == Get Lists of Everything and Display the lists (up to 10) == - # These can either just return values for the current datacenter (zone) - # or for everything. - all_nodes = gce.list_nodes(ex_zone='all') - display('Nodes:', all_nodes) - - all_addresses = gce.ex_list_addresses(region='all') - display('Addresses:', all_addresses) - - all_volumes = gce.list_volumes(ex_zone='all') - display('Volumes:', all_volumes) - - # This can return everything, but there is a large amount of overlap, - # so we'll just get the sizes from the current zone. - sizes = gce.list_sizes() - display('Sizes:', sizes) - - # These are global - firewalls = gce.ex_list_firewalls() - display('Firewalls:', firewalls) - - networks = gce.ex_list_networks() - display('Networks:', networks) - - images = gce.list_images() - display('Images:', images) - - locations = gce.list_locations() - display('Locations:', locations) - - zones = gce.ex_list_zones() - display('Zones:', zones) - - snapshots = gce.ex_list_snapshots() - display('Snapshots:', snapshots) - - # == Clean up any old demo resources == - display('Cleaning up any "%s" resources' % DEMO_BASE_NAME) - clean_up(gce, DEMO_BASE_NAME, all_nodes, - all_addresses + all_volumes + firewalls + networks + snapshots) - volumes = gce.list_volumes() - clean_up(gce, DEMO_BASE_NAME, None, volumes) - end_time = datetime.datetime.now() - display('Total runtime: %s' % str(end_time - start_time)) - - -def clean_up(gce, base_name, node_list=None, resource_list=None): - """ - Destroy all resources that have a name beginning with 'base_name'. - - :param base_name: String with the first part of the name of resources - to destroy - :type base_name: ``str`` - - :keyword node_list: List of nodes to consider for deletion - :type node_list: ``list`` of :class:`Node` - - :keyword resource_list: List of resources to consider for deletion - :type resource_list: ``list`` of I{Resource Objects} - """ - if node_list is None: - node_list = [] - if resource_list is None: - resource_list = [] - # Use ex_destroy_multiple_nodes to destroy nodes - del_nodes = [] - for node in node_list: - if node.name.startswith(base_name): - del_nodes.append(node) - - result = gce.ex_destroy_multiple_nodes(del_nodes) - for i, success in enumerate(result): - if success: - display(' Deleted %s' % del_nodes[i].name) - else: - display(' Failed to delete %s' % del_nodes[i].name) - - # Destroy everything else with just the destroy method - for resrc in resource_list: - if resrc.name.startswith(base_name): - try: - resrc.destroy() - except ResourceNotFoundError: - display(' Not found: %s (%s)' % (resrc.name, - resrc.__class__.__name__)) - except: - class_name = resrc.__class__.__name__ - display(' Failed to Delete %s (%s)' % (resrc.name, - class_name)) - raise - - -# ==== COMPUTE CODE STARTS HERE ==== -def main_compute(): - start_time = datetime.datetime.now() - display('Compute demo/test start time: %s' % str(start_time)) - gce = get_gce_driver() - # Get project info and print name - project = gce.ex_get_project() - display('Project: %s' % project.name) - - # == Get Lists of Everything and Display the lists (up to 10) == - # These can either just return values for the current datacenter (zone) - # or for everything. - all_nodes = gce.list_nodes(ex_zone='all') - display('Nodes:', all_nodes) - - all_addresses = gce.ex_list_addresses(region='all') - display('Addresses:', all_addresses) - - all_volumes = gce.list_volumes(ex_zone='all') - display('Volumes:', all_volumes) - - # This can return everything, but there is a large amount of overlap, - # so we'll just get the sizes from the current zone. - sizes = gce.list_sizes() - display('Sizes:', sizes) - - # These are global - firewalls = gce.ex_list_firewalls() - display('Firewalls:', firewalls) - - networks = gce.ex_list_networks() - display('Networks:', networks) - - images = gce.list_images() - display('Images:', images) - - locations = gce.list_locations() - display('Locations:', locations) - - zones = gce.ex_list_zones() - display('Zones:', zones) - - snapshots = gce.ex_list_snapshots() - display('Snapshots:', snapshots) - - # == Clean up any old demo resources == - display('Cleaning up any "%s" resources' % DEMO_BASE_NAME) - clean_up(gce, DEMO_BASE_NAME, all_nodes, - all_addresses + all_volumes + firewalls + networks + snapshots) - - # == Create Node with disk auto-created == - if MAX_NODES > 1: - display('Creating a node with boot/local-ssd using GCE structure:') - name = '%s-gstruct' % DEMO_BASE_NAME - img_url = "projects/debian-cloud/global/images/" - img_url += "backports-debian-7-wheezy-v20141205" - disk_type_url = "projects/%s/zones/us-central1-f/" % project.name - disk_type_url += "diskTypes/local-ssd" - gce_disk_struct = [ - { - "type": "PERSISTENT", - "deviceName": '%s-gstruct' % DEMO_BASE_NAME, - "initializeParams": { - "diskName": '%s-gstruct' % DEMO_BASE_NAME, - "sourceImage": img_url - }, - "boot": True, - "autoDelete": True - }, - { - "type": "SCRATCH", - "deviceName": '%s-gstruct-lssd' % DEMO_BASE_NAME, - "initializeParams": { - "diskType": disk_type_url - }, - "autoDelete": True - } - ] - node_gstruct = gce.create_node(name, 'n1-standard-1', None, - 'us-central1-f', - ex_disks_gce_struct=gce_disk_struct) - num_disks = len(node_gstruct.extra['disks']) - display(' Node %s created with %d disks' % (node_gstruct.name, - num_disks)) - - display('Creating Node with auto-created SSD:') - name = '%s-np-node' % DEMO_BASE_NAME - node_1 = gce.create_node(name, 'n1-standard-1', 'debian-7', - ex_tags=['libcloud'], ex_disk_type='pd-ssd', - ex_disk_auto_delete=False) - display(' Node %s created' % name) - - # Stop the node and change to a custom machine type (e.g. size) - display('Stopping node, setting custom size, starting node:') - name = '%s-np-node' % DEMO_BASE_NAME - gce.ex_stop_node(node_1) - gce.ex_set_machine_type(node_1, 'custom-2-4096') # 2 vCPU, 4GB RAM - gce.ex_start_node(node_1) - node_1 = gce.ex_get_node(name) - display(' %s: state=%s, size=%s' % (name, node_1.extra['status'], - node_1.size)) - - # == Create, and attach a disk == - display('Creating a new disk:') - disk_name = '%s-attach-disk' % DEMO_BASE_NAME - volume = gce.create_volume(10, disk_name) - if gce.attach_volume(node_1, volume, ex_auto_delete=True): - display(' Attached %s to %s' % (volume.name, node_1.name)) - display(' Disabled auto-delete for %s on %s' % (volume.name, - node_1.name)) - gce.ex_set_volume_auto_delete(volume, node_1, auto_delete=False) - - if CLEANUP: - # == Detach the disk == - if gce.detach_volume(volume, ex_node=node_1): - display(' Detached %s from %s' % (volume.name, - node_1.name)) - - # == Create Snapshot == - display('Creating a snapshot from existing disk:') - # Create a disk to snapshot - vol_name = '%s-snap-template' % DEMO_BASE_NAME - image = gce.ex_get_image('debian-7') - vol = gce.create_volume(None, vol_name, image=image) - display('Created disk %s to shapshot:' % DEMO_BASE_NAME) - # Snapshot volume - snapshot = vol.snapshot('%s-snapshot' % DEMO_BASE_NAME) - display(' Snapshot %s created' % snapshot.name) - - # == Create Node with existing disk == - display('Creating Node with existing disk:') - name = '%s-persist-node' % DEMO_BASE_NAME - # Use objects this time instead of names - # Get latest Debian 7 image - image = gce.ex_get_image('debian-7') - # Get Machine Size - size = gce.ex_get_size('n1-standard-1') - # Create Disk from Snapshot created above - volume_name = '%s-boot-disk' % DEMO_BASE_NAME - volume = gce.create_volume(None, volume_name, snapshot=snapshot) - display(' Created %s from snapshot' % volume.name) - # Create Node with Disk - node_2 = gce.create_node(name, size, image, ex_tags=['libcloud'], - ex_boot_disk=volume, - ex_disk_auto_delete=False) - display(' Node %s created with attached disk %s' % (node_2.name, - volume.name)) - - # == Update Tags for Node == - display('Updating Tags for %s:' % node_2.name) - tags = node_2.extra['tags'] - tags.append('newtag') - if gce.ex_set_node_tags(node_2, tags): - display(' Tags updated for %s' % node_2.name) - check_node = gce.ex_get_node(node_2.name) - display(' New tags: %s' % check_node.extra['tags']) - - # == Setting Metadata for Node == - display('Setting Metadata for %s:' % node_2.name) - if gce.ex_set_node_metadata(node_2, {'foo': 'bar', 'baz': 'foobarbaz'}): - display(' Metadata updated for %s' % node_2.name) - check_node = gce.ex_get_node(node_2.name) - display(' New Metadata: %s' % check_node.extra['metadata']) - - # == Create Multiple nodes at once == - base_name = '%s-multiple-nodes' % DEMO_BASE_NAME - number = MAX_NODES - 2 - if number > 0: - display('Creating Multiple Nodes (%s):' % number) - multi_nodes = gce.ex_create_multiple_nodes(base_name, size, image, - number, - ex_tags=['libcloud'], - ex_disk_auto_delete=True) - for node in multi_nodes: - display(' Node %s created' % node.name) - - # == Create a Network == - display('Creating Network:') - name = '%s-network' % DEMO_BASE_NAME - cidr = '10.10.0.0/16' - network_1 = gce.ex_create_network(name, cidr) - display(' Network %s created' % network_1.name) - - # == Create a Firewall == - display('Creating a Firewall:') - name = '%s-firewall' % DEMO_BASE_NAME - allowed = [{'IPProtocol': 'tcp', - 'ports': ['3141']}] - firewall_1 = gce.ex_create_firewall(name, allowed, network=network_1, - source_tags=['libcloud']) - display(' Firewall %s created' % firewall_1.name) - - # == Create a Static Address == - display('Creating an Address:') - name = '%s-address' % DEMO_BASE_NAME - address_1 = gce.ex_create_address(name) - display(' Address %s created with IP %s' % (address_1.name, - address_1.address)) - - # == List Updated Resources in current zone/region == - display('Updated Resources in current zone/region') - nodes = gce.list_nodes() - display('Nodes:', nodes) - - addresses = gce.ex_list_addresses() - display('Addresses:', addresses) - - firewalls = gce.ex_list_firewalls() - display('Firewalls:', firewalls) - - networks = gce.ex_list_networks() - display('Networks:', networks) - - snapshots = gce.ex_list_snapshots() - display('Snapshots:', snapshots) - - if CLEANUP: - display('Cleaning up %s resources created' % DEMO_BASE_NAME) - clean_up(gce, DEMO_BASE_NAME, nodes, - addresses + firewalls + networks + snapshots) - volumes = gce.list_volumes() - clean_up(gce, DEMO_BASE_NAME, None, volumes) - end_time = datetime.datetime.now() - display('Total runtime: %s' % str(end_time - start_time)) - - -# ==== LOAD BALANCER CODE STARTS HERE ==== -def main_load_balancer(): - start_time = datetime.datetime.now() - display('Load-balancer demo/test start time: %s' % str(start_time)) - gce = get_gce_driver() - gcelb = get_gcelb_driver(gce) - - # Get project info and print name - project = gce.ex_get_project() - display('Project: %s' % project.name) - - # Existing Balancers - balancers = gcelb.list_balancers() - display('Load Balancers', balancers) - - # Protocols - protocols = gcelb.list_protocols() - display('Protocols', protocols) - - # Healthchecks - healthchecks = gcelb.ex_list_healthchecks() - display('Health Checks', healthchecks) - - # This demo is based on the GCE Load Balancing Quickstart described here: - # https://developers.google.com/compute/docs/load-balancing/lb-quickstart - - # == Clean-up and existing demo resources == - all_nodes = gce.list_nodes(ex_zone='all') - firewalls = gce.ex_list_firewalls() - display('Cleaning up any "%s" resources' % DEMO_BASE_NAME) - clean_up(gce, DEMO_BASE_NAME, all_nodes, - balancers + healthchecks + firewalls) - - # == Create 3 nodes to balance between == - startup_script = ('apt-get -y update && ' - 'apt-get -y install apache2 && ' - 'hostname > /var/www/index.html') - tag = '%s-www' % DEMO_BASE_NAME - base_name = '%s-www' % DEMO_BASE_NAME - image = gce.ex_get_image('debian-7') - size = gce.ex_get_size('n1-standard-1') - number = 3 - display('Creating %d nodes' % number) - metadata = {'items': [{'key': 'startup-script', - 'value': startup_script}]} - lb_nodes = gce.ex_create_multiple_nodes(base_name, size, image, - number, ex_tags=[tag], - ex_metadata=metadata, - ex_disk_auto_delete=True, - ignore_errors=False) - display('Created Nodes', lb_nodes) - - # == Create a Firewall for instances == - display('Creating a Firewall') - name = '%s-firewall' % DEMO_BASE_NAME - allowed = [{'IPProtocol': 'tcp', - 'ports': ['80']}] - firewall = gce.ex_create_firewall(name, allowed, source_tags=[tag]) - display(' Firewall %s created' % firewall.name) - - # == Create a Health Check == - display('Creating a HealthCheck') - name = '%s-healthcheck' % DEMO_BASE_NAME - - # These are all the default values, but listed here as an example. To - # create a healthcheck with the defaults, only name is required. - hc = gcelb.ex_create_healthcheck(name, host=None, path='/', port='80', - interval=5, timeout=5, - unhealthy_threshold=2, - healthy_threshold=2) - display('Healthcheck %s created' % hc.name) - - # == Create Load Balancer == - display('Creating Load Balancer') - name = '%s-lb' % DEMO_BASE_NAME - port = 80 - protocol = 'tcp' - algorithm = None - members = lb_nodes[:2] # Only attach the first two initially - healthchecks = [hc] - balancer = gcelb.create_balancer(name, port, protocol, algorithm, members, - ex_healthchecks=healthchecks) - display(' Load Balancer %s created' % balancer.name) - - # == Attach third Node == - display('Attaching additional node to Load Balancer') - member = balancer.attach_compute_node(lb_nodes[2]) - display(' Attached %s to %s' % (member.id, balancer.name)) - - # == Show Balancer Members == - members = balancer.list_members() - display('Load Balancer Members') - for member in members: - display(' ID: %s IP: %s' % (member.id, member.ip)) - - # == Remove a Member == - display('Removing a Member') - detached = members[0] - detach = balancer.detach_member(detached) - if detach: - display(' Member %s detached from %s' % (detached.id, - balancer.name)) - - # == Show Updated Balancer Members == - members = balancer.list_members() - display('Updated Load Balancer Members') - for member in members: - display(' ID: %s IP: %s' % (member.id, member.ip)) - - # == Reattach Member == - display('Reattaching Member') - member = balancer.attach_member(detached) - display(' Member %s attached to %s' % (member.id, balancer.name)) - - # == Test Load Balancer by connecting to it multiple times == - PAUSE = 60 - display('Sleeping for %d seconds for LB members to serve...' % PAUSE) - time.sleep(PAUSE) - rounds = 200 - url = 'http://%s/' % balancer.ip - line_length = 75 - display('Connecting to %s %s times' % (url, rounds)) - for x in range(rounds): - response = url_req.urlopen(url) - if PY3: - output = str(response.read(), encoding='utf-8').strip() - else: - output = response.read().strip() - if 'www-001' in output: - padded_output = output.center(line_length) - elif 'www-002' in output: - padded_output = output.rjust(line_length) - else: - padded_output = output.ljust(line_length) - sys.stdout.write('\r%s' % padded_output) - sys.stdout.flush() - time.sleep(.25) - - print "" - if CLEANUP: - balancers = gcelb.list_balancers() - healthchecks = gcelb.ex_list_healthchecks() - nodes = gce.list_nodes(ex_zone='all') - firewalls = gce.ex_list_firewalls() - - display('Cleaning up %s resources created' % DEMO_BASE_NAME) - clean_up(gce, DEMO_BASE_NAME, nodes, - balancers + healthchecks + firewalls) - - end_time = datetime.datetime.now() - display('Total runtime: %s' % str(end_time - start_time)) - - -# ==== GOOGLE DNS CODE STARTS HERE ==== -def main_dns(): - start_time = datetime.datetime.now() - display('DNS demo/test start time: %s' % str(start_time)) - gce = get_gce_driver() - gdns = get_dns_driver() - # Get project info and print name - project = gce.ex_get_project() - display('Project: %s' % project.name) - - # Get list of managed zones - zones = gdns.iterate_zones() - display('Zones', zones) - - # Get list of records - zones = gdns.iterate_zones() - for z in zones: - records = gdns.iterate_records(z) - display('Records for managed zone "%s"' % z.id, records) - - # TODO(erjohnso): Finish this DNS section. Challenging in that you need to - # own a domain, so testing will require user customization. Perhaps a new - # command-line required flag unless --skip-dns is supplied. Also, real - # e2e testing should try to do DNS lookups on new records, but DNS TTL - # and propagation delays will introduce limits on what can be tested. - - end_time = datetime.datetime.now() - display('Total runtime: %s' % str(end_time - start_time)) - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description='Google Cloud Platform Demo / Live Test Script') - parser.add_argument("--compute", - help="perform compute demo / live tests", - dest="compute", action="store_true") - parser.add_argument("--load-balancer", - help="perform load-balancer demo / live tests", - dest="lb", action="store_true") - parser.add_argument("--dns", - help="perform DNS demo / live tests", - dest="dns", action="store_true") - parser.add_argument("--cleanup-only", - help="perform clean-up (skips all tests)", - dest="cleanup", action="store_true") - cl_args = parser.parse_args() - - if cl_args.cleanup: - cleanup_only() - else: - if cl_args.compute: - main_compute() - if cl_args.lb: - main_load_balancer() - if cl_args.dns: - main_dns() http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/demos/secrets.py-dist ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/demos/secrets.py-dist b/apache-libcloud-1.0.0rc2/demos/secrets.py-dist deleted file mode 100644 index a4c52c5..0000000 --- a/apache-libcloud-1.0.0rc2/demos/secrets.py-dist +++ /dev/null @@ -1,38 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Make a copy of this file named 'secrets.py' and add your credentials there. -# Note you can run unit tests without setting your credentials. - -BLUEBOX_PARAMS = ('customer_id', 'api_key') -BRIGHTBOX_PARAMS = ('client_id', 'client_secret') -EC2_PARAMS = ('access_id', 'secret') -ECP_PARAMS = ('user_name', 'password') -GANDI_PARAMS = ('user',) -GCE_PARAMS = ('[email protected]', 'key') # Service Account Authentication -#GCE_PARAMS = ('client_id', 'client_secret') # Installed App Authentication -GCE_KEYWORD_PARAMS = {'project': 'project_name'} -HOSTINGCOM_PARAMS = ('user', 'secret') -IBM_PARAMS = ('user', 'secret') -# OPENSTACK_PARAMS = ('user_name', 'api_key', secure_bool, 'host', port_int) -OPENSTACK_PARAMS = ('user_name', 'api_key', False, 'host', 8774) -OPENNEBULA_PARAMS = ('user', 'key') -OPSOURCE_PARAMS = ('user', 'password') -RACKSPACE_PARAMS = ('user', 'key') -SLICEHOST_PARAMS = ('key',) -SOFTLAYER_PARAMS = ('user', 'api_key') -VCLOUD_PARAMS = ('user', 'secret') -VOXEL_PARAMS = ('key', 'secret') -VPSNET_PARAMS = ('user', 'key') http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_aliyun_ecs.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_aliyun_ecs.py b/apache-libcloud-1.0.0rc2/example_aliyun_ecs.py deleted file mode 100644 index bbaaf00..0000000 --- a/apache-libcloud-1.0.0rc2/example_aliyun_ecs.py +++ /dev/null @@ -1,79 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver -from libcloud.compute.base import NodeAuthPassword - -ECSDriver = get_driver(Provider.ALIYUN_ECS) - -region = 'cn-hangzhou' - -your_access_key_id = '' -your_access_key_secret = '' -ecs = ECSDriver(your_access_key_id, your_access_key_secret, region=region) - -sizes = ecs.list_sizes() -small = sizes[1] - -locations = ecs.list_locations() -location = None -for each in locations: - if each.id == region: - location = each - break -if location is None: - print('could not find cn-qingdao location') - sys.exit(-1) -print(location.name) - -images = ecs.list_images() -print('Found %d images' % len(images)) -for each in images: - if 'ubuntu' in each.id.lower(): - image = each - break -else: - image = images[0] -print('Use image %s' % image) - -sgs = ecs.ex_list_security_groups() -print('Found %d security groups' % len(sgs)) -sg = sgs[0] -print('Use security group %s' % sg) - -nodes = ecs.list_nodes() -print('Found %d nodes' % len(nodes)) -if len(nodes) == 0: - print('Starting create a new node') - data_disk = { - 'size': 5, - 'category': ecs.disk_categories.CLOUD, - 'disk_name': 'data_disk1', - 'delete_with_instance': True} - - auth = NodeAuthPassword('P@$$w0rd') - - node = ecs.create_node(image=image, size=small, name='test', - ex_security_group_id=sg.id, - ex_internet_charge_type=ecs.internet_charge_types.BY_TRAFFIC, - ex_internet_max_bandwidth_out=1, - ex_data_disk=data_disk, - auth=auth) - print('Created node %s' % node) - nodes = ecs.list_nodes() - -for each in nodes: - print('Found node %s' % each) http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_aliyun_oss.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_aliyun_oss.py b/apache-libcloud-1.0.0rc2/example_aliyun_oss.py deleted file mode 100644 index 6bda227..0000000 --- a/apache-libcloud-1.0.0rc2/example_aliyun_oss.py +++ /dev/null @@ -1,82 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.storage.types import Provider -from libcloud.storage.providers import get_driver - -OSSDriver = get_driver(Provider.ALIYUN_OSS) - -your_access_key_id = '' -your_access_key_secret = '' -oss = OSSDriver(your_access_key_id, your_access_key_secret) - -container_name = 'CONTAINER_NAME_FOR_TEST' -object_name = 'OBJECT_NAME_FOR_TEST' -local_file_path = 'LOCAL_FILE_FULL_PATH_TO_UPLOAD' -upload_object_name = 'OBJECT_NAME_FOR_UPLOAD_FILE' -for container in oss.iterate_containers(): - print('container: %s' % container) - -c1 = oss.get_container(container_name) -print('Got container %s:' % c1) - -objects = c1.list_objects() -count = len(objects) -print('Has %d objects' % count) - -objects = oss.list_container_objects(c1, ex_prefix='en') -print('Has %d objects with prefix "en"' % len(objects)) -for each in objects: - print(each) - -obj = oss.get_object(container_name, object_name) -print('Got object %s:' % obj) - -# Download object -oss.download_object(obj, object_name, overwrite_existing=True) -for trunk in oss.download_object_as_stream(obj): - print(trunk) - -# Upload object -obj = oss.upload_object(local_file_path, c1, upload_object_name) - -# Upload multipart -uploads = list(oss.ex_iterate_multipart_uploads(c1)) -print('Found %d incompleted uploads' % len(uploads)) -if len(uploads) > 0: - oss.ex_abort_all_multipart_uploads(c1) - print('Abort them all') - -def data_iter(limit): - i = 0 - while True: - yield i - i += 1 - if i >= limit: - break - -print('Starting to upload 1MB using multipart api') -one_mb = 1024*1024 -obj = oss.upload_object_via_stream(data_iter(one_mb), c1, upload_object_name) -print('Finish uploading') - -# Delete objects -print('Delete object %s' % obj) -oss.delete_object(obj) - -# Create container -#c2 = oss.create_container(container_name='20160117') -#c2 = oss.create_container(container_name='20160117', ex_location='oss-cn-beijing') -#c2_got = oss.get_container('20160117') http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_aliyun_slb.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_aliyun_slb.py b/apache-libcloud-1.0.0rc2/example_aliyun_slb.py deleted file mode 100644 index 0b41839..0000000 --- a/apache-libcloud-1.0.0rc2/example_aliyun_slb.py +++ /dev/null @@ -1,55 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.compute.types import Provider as NodeProvider -from libcloud.compute.providers import get_driver as get_node_driver -from libcloud.loadbalancer.providers import get_driver -from libcloud.loadbalancer.base import Algorithm, Member -from libcloud.loadbalancer.types import Provider - -SLBDriver = get_driver(Provider.ALIYUN_SLB) -ECSDriver = get_node_driver(NodeProvider.ALIYUN_ECS) - -region = 'cn-hangzhou' - -your_access_key_id = '' -your_access_key_secret = '' -slb = SLBDriver(your_access_key_id, your_access_key_secret, region=region) -ecs = ECSDriver(your_access_key_id, your_access_key_secret, region=region) - -protos = slb.list_protocols() -print('Found %d protocols: %s' % (len(protos), protos)) - -balancers = slb.list_balancers() -print('Found %d load balancers' % len(balancers)) -print(balancers) - -if len(balancers) > 0: - b1 = balancers[0] - print('Delete %s' % b1) - slb.destroy_balancer(b1) -else: - extra = {'AddressType': 'internet', - 'Bandwidth': 1, - 'StickySession': 'off', - 'HealthCheck': 'off'} - nodes = ecs.list_nodes() - print('Found %d nodes' % len(nodes)) - members = [Member(node.id, node.public_ips[0], 80, extra={'Weight': 50*(i+1)}) - for i, node in enumerate(nodes)] - new_b = slb.create_balancer('test-balancer', 80, 'http', - Algorithm.WEIGHTED_ROUND_ROBIN, members, - **extra) - print('Created balancer %s' % new_b) http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_compute.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_compute.py b/apache-libcloud-1.0.0rc2/example_compute.py deleted file mode 100644 index 346e7d4..0000000 --- a/apache-libcloud-1.0.0rc2/example_compute.py +++ /dev/null @@ -1,35 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver - -EC2 = get_driver(Provider.EC2) -Rackspace = get_driver(Provider.RACKSPACE) - -drivers = [EC2('access key id', 'secret key', region='us-east-1'), - Rackspace('username', 'api key', region='iad')] - -nodes = [driver.list_nodes() for driver in drivers] - -print(nodes) -# [ <Node: provider=Amazon, status=RUNNING, name=bob, ip=1.2.3.4.5>, -# <Node: provider=Rackspace, status=REBOOT, name=korine, ip=6.7.8.9.10>, ... ] - -# grab the node named "test" -node = [n for n in nodes if n.name == 'test'][0] - -# reboot "test" -node.reboot() http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_dns.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_dns.py b/apache-libcloud-1.0.0rc2/example_dns.py deleted file mode 100644 index b99756b..0000000 --- a/apache-libcloud-1.0.0rc2/example_dns.py +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from pprint import pprint - -from libcloud.dns.types import Provider -from libcloud.dns.providers import get_driver - -Zerigo = get_driver(Provider.ZERIGO) - -driver = Zerigo('email', 'key') - -zones = driver.list_zones() -pprint(zones) - -records = zones[0].list_records() -pprint(records) http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_loadbalancer.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_loadbalancer.py b/apache-libcloud-1.0.0rc2/example_loadbalancer.py deleted file mode 100644 index d47a0fe..0000000 --- a/apache-libcloud-1.0.0rc2/example_loadbalancer.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -import os -import time - -from libcloud.loadbalancer.base import Member, Algorithm -from libcloud.loadbalancer.types import Provider, State -from libcloud.loadbalancer.providers import get_driver - - -def main(): - cls = get_driver(Provider.RACKSPACE) - driver = cls('username', 'api key', region='ord') - - balancers = driver.list_balancers() - - print(balancers) - - # creating a balancer which balances traffic across two - # nodes: 192.168.86.1:80 and 192.168.86.2:8080. Balancer - # itself listens on port 80/tcp - new_balancer_name = 'testlb' + os.urandom(4).encode('hex') - members = (Member(None, '192.168.86.1', 80), - Member(None, '192.168.86.2', 8080)) - new_balancer = driver.create_balancer(name=new_balancer_name, - algorithm=Algorithm.ROUND_ROBIN, - port=80, - protocol='http', - members=members) - - print(new_balancer) - - # wait for balancer to become ready - # NOTE: in real life code add timeout to not end up in - # endless loop when things go wrong on provider side - while True: - balancer = driver.get_balancer(balancer_id=new_balancer.id) - - if balancer.state == State.RUNNING: - break - - print('sleeping for 30 seconds for balancers to become ready') - time.sleep(30) - - # fetch list of members - members = balancer.list_members() - print(members) - - # remove first member - balancer.detach_member(members[0]) - - # remove the balancer - driver.destroy_balancer(new_balancer) - -if __name__ == '__main__': - main() http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/example_storage.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/example_storage.py b/apache-libcloud-1.0.0rc2/example_storage.py deleted file mode 100644 index be3058c..0000000 --- a/apache-libcloud-1.0.0rc2/example_storage.py +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from pprint import pprint - -from libcloud.storage.types import Provider -from libcloud.storage.providers import get_driver - -CloudFiles = get_driver(Provider.CLOUDFILES) - -driver = CloudFiles('access key id', 'secret key', region='ord') - -containers = driver.list_containers() -container_objects = driver.list_container_objects(containers[0]) - -pprint(containers) -pprint(container_objects) http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/__init__.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/libcloud/__init__.py b/apache-libcloud-1.0.0rc2/libcloud/__init__.py deleted file mode 100644 index 1f90b1b..0000000 --- a/apache-libcloud-1.0.0rc2/libcloud/__init__.py +++ /dev/null @@ -1,77 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -libcloud provides a unified interface to the cloud computing resources. - -:var __version__: Current version of libcloud -""" - -__all__ = ['__version__', 'enable_debug'] -__version__ = '1.0.0-rc2' - -import os -import codecs - -try: - import paramiko - have_paramiko = True -except ImportError: - have_paramiko = False - - -def enable_debug(fo): - """ - Enable library wide debugging to a file-like object. - - :param fo: Where to append debugging information - :type fo: File like object, only write operations are used. - """ - from libcloud.common.base import (Connection, - LoggingHTTPConnection, - LoggingHTTPSConnection) - LoggingHTTPSConnection.log = fo - LoggingHTTPConnection.log = fo - Connection.conn_classes = (LoggingHTTPConnection, - LoggingHTTPSConnection) - - -def _init_once(): - """ - Utility function that is ran once on Library import. - - This checks for the LIBCLOUD_DEBUG environment variable, which if it exists - is where we will log debug information about the provider transports. - """ - path = os.getenv('LIBCLOUD_DEBUG') - if path: - mode = 'a' - - # Special case for /dev/stderr and /dev/stdout on Python 3. - from libcloud.utils.py3 import PY3 - - # Opening those files in append mode will throw "illegal seek" - # exception there. - # Late import to avoid setup.py related side affects - if path in ['/dev/stderr', '/dev/stdout'] and PY3: - mode = 'w' - - fo = codecs.open(path, mode, encoding='utf8') - enable_debug(fo) - - if have_paramiko: - paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG) - -_init_once() http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/backup/__init__.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/libcloud/backup/__init__.py b/apache-libcloud-1.0.0rc2/libcloud/backup/__init__.py deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/backup/base.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/libcloud/backup/base.py b/apache-libcloud-1.0.0rc2/libcloud/backup/base.py deleted file mode 100644 index 8d1c5a7..0000000 --- a/apache-libcloud-1.0.0rc2/libcloud/backup/base.py +++ /dev/null @@ -1,489 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from libcloud.common.base import ConnectionUserAndKey, BaseDriver -from libcloud.backup.types import BackupTargetType - -__all__ = [ - 'BackupTarget', - 'BackupDriver', - 'BackupTargetJob', - 'BackupTargetRecoveryPoint' -] - - -class BackupTarget(object): - """ - A backup target - """ - - def __init__(self, id, name, address, type, driver, extra=None): - """ - :param id: Target id - :type id: ``str`` - - :param name: Name of the target - :type name: ``str`` - - :param address: Hostname, FQDN, IP, file path etc. - :type address: ``str`` - - :param type: Backup target type (Physical, Virtual, ...). - :type type: :class:`.BackupTargetType` - - :param driver: BackupDriver instance. - :type driver: :class:`.BackupDriver` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - """ - self.id = str(id) if id else None - self.name = name - self.address = address - self.type = type - self.driver = driver - self.extra = extra or {} - - def update(self, name=None, address=None, extra=None): - return self.driver.update_target(target=self, - name=name, - address=address, - extra=extra) - - def delete(self): - return self.driver.delete_target(target=self) - - def _get_numeric_id(self): - target_id = self.id - - if target_id.isdigit(): - target_id = int(target_id) - - return target_id - - def __repr__(self): - return ('<Target: id=%s, name=%s, address=%s' - 'type=%s, provider=%s ...>' % - (self.id, self.name, self.address, - self.type, self.driver.name)) - - -class BackupTargetJob(object): - """ - A backup target job - """ - - def __init__(self, id, status, progress, target, driver, extra=None): - """ - :param id: Job id - :type id: ``str`` - - :param status: Status of the job - :type status: :class:`BackupTargetJobStatusType` - - :param progress: Progress of the job, as a percentage - :type progress: ``int`` - - :param target: BackupTarget instance. - :type target: :class:`.BackupTarget` - - :param driver: BackupDriver instance. - :type driver: :class:`.BackupDriver` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - """ - self.id = str(id) if id else None - self.status = status - self.progress = progress - self.target = target - self.driver = driver - self.extra = extra or {} - - def cancel(self): - return self.driver.cancel_target_job(job=self) - - def suspend(self): - return self.driver.suspend_target_job(job=self) - - def resume(self): - return self.driver.resume_target_job(job=self) - - def __repr__(self): - return ('<Job: id=%s, status=%s, progress=%s' - 'target=%s, provider=%s ...>' % - (self.id, self.status, self.progress, - self.target.id, self.driver.name)) - - -class BackupTargetRecoveryPoint(object): - """ - A backup target recovery point - """ - - def __init__(self, id, date, target, driver, extra=None): - """ - :param id: Job id - :type id: ``str`` - - :param date: The date taken - :type date: :class:`datetime.datetime` - - :param target: BackupTarget instance. - :type target: :class:`.BackupTarget` - - :param driver: BackupDriver instance. - :type driver: :class:`.BackupDriver` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - """ - self.id = str(id) if id else None - self.date = date - self.target = target - self.driver = driver - self.extra = extra or {} - - def recover(self, path=None): - """ - Recover this recovery point - - :param path: The part of the recovery point to recover (optional) - :type path: ``str`` - - :rtype: Instance of :class:`.BackupTargetJob` - """ - return self.driver.recover_target(target=self.target, - recovery_point=self, path=path) - - def recover_to(self, recovery_target, path=None): - """ - Recover this recovery point out of place - - :param recovery_target: Backup target with to recover the data to - :type recovery_target: Instance of :class:`.BackupTarget` - - :param path: The part of the recovery point to recover (optional) - :type path: ``str`` - - :rtype: Instance of :class:`.BackupTargetJob` - """ - return self.driver.recover_target_out_of_place( - target=self.target, - recovery_point=self, - recovery_target=recovery_target, - path=path) - - def __repr__(self): - return ('<RecoveryPoint: id=%s, date=%s, ' - 'target=%s, provider=%s ...>' % - (self.id, self.date, - self.target.id, self.driver.name)) - - -class BackupDriver(BaseDriver): - """ - A base BackupDriver class to derive from - - This class is always subclassed by a specific driver. - """ - connectionCls = ConnectionUserAndKey - name = None - website = None - - def __init__(self, key, secret=None, secure=True, host=None, port=None, - **kwargs): - """ - :param key: API key or username to used (required) - :type key: ``str`` - - :param secret: Secret password to be used (required) - :type secret: ``str`` - - :param secure: Whether to use HTTPS or HTTP. Note: Some providers - only support HTTPS, and it is on by default. - :type secure: ``bool`` - - :param host: Override hostname used for connections. - :type host: ``str`` - - :param port: Override port used for connections. - :type port: ``int`` - - :return: ``None`` - """ - super(BackupDriver, self).__init__(key=key, secret=secret, - secure=secure, host=host, port=port, - **kwargs) - - def get_supported_target_types(self): - """ - Get a list of backup target types this driver supports - - :return: ``list`` of :class:``BackupTargetType`` - """ - raise NotImplementedError( - 'get_supported_target_types not implemented for this driver') - - def list_targets(self): - """ - List all backuptargets - - :rtype: ``list`` of :class:`.BackupTarget` - """ - raise NotImplementedError( - 'list_targets not implemented for this driver') - - def create_target(self, name, address, - type=BackupTargetType.VIRTUAL, extra=None): - """ - Creates a new backup target - - :param name: Name of the target - :type name: ``str`` - - :param address: Hostname, FQDN, IP, file path etc. - :type address: ``str`` - - :param type: Backup target type (Physical, Virtual, ...). - :type type: :class:`BackupTargetType` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`.BackupTarget` - """ - raise NotImplementedError( - 'create_target not implemented for this driver') - - def create_target_from_node(self, node, type=BackupTargetType.VIRTUAL, - extra=None): - """ - Creates a new backup target from an existing node. - By default, this will use the first public IP of the node - - :param node: The Node to backup - :type node: ``Node`` - - :param type: Backup target type (Physical, Virtual, ...). - :type type: :class:`BackupTargetType` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`.BackupTarget` - """ - return self.create_target(name=node.name, - address=node.public_ips[0], - type=type, - extra=None) - - def create_target_from_storage_container(self, container, - type=BackupTargetType.OBJECT, - extra=None): - """ - Creates a new backup target from an existing storage container - - :param node: The Container to backup - :type node: ``Container`` - - :param type: Backup target type (Physical, Virtual, ...). - :type type: :class:`BackupTargetType` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`.BackupTarget` - """ - return self.create_target(name=container.name, - address=container.get_cdn_url(), - type=type, - extra=None) - - def update_target(self, target, name, address, extra): - """ - Update the properties of a backup target - - :param target: Backup target to update - :type target: Instance of :class:`.BackupTarget` - - :param name: Name of the target - :type name: ``str`` - - :param address: Hostname, FQDN, IP, file path etc. - :type address: ``str`` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`.BackupTarget` - """ - raise NotImplementedError( - 'update_target not implemented for this driver') - - def delete_target(self, target): - """ - Delete a backup target - - :param target: Backup target to delete - :type target: Instance of :class:`.BackupTarget` - """ - raise NotImplementedError( - 'delete_target not implemented for this driver') - - def list_recovery_points(self, target, start_date=None, end_date=None): - """ - List the recovery points available for a target - - :param target: Backup target to delete - :type target: Instance of :class:`.BackupTarget` - - :param start_date: The start date to show jobs between (optional) - :type start_date: :class:`datetime.datetime` - - :param end_date: The end date to show jobs between (optional) - :type end_date: :class:`datetime.datetime`` - - :rtype: ``list`` of :class:`.BackupTargetRecoveryPoint` - """ - raise NotImplementedError( - 'list_recovery_points not implemented for this driver') - - def recover_target(self, target, recovery_point, path=None): - """ - Recover a backup target to a recovery point - - :param target: Backup target to delete - :type target: Instance of :class:`.BackupTarget` - - :param recovery_point: Backup target with the backup data - :type recovery_point: Instance of :class:`.BackupTarget` - - :param path: The part of the recovery point to recover (optional) - :type path: ``str`` - - :rtype: Instance of :class:`.BackupTargetJob` - """ - raise NotImplementedError( - 'recover_target not implemented for this driver') - - def recover_target_out_of_place(self, target, recovery_point, - recovery_target, path=None): - """ - Recover a backup target to a recovery point out-of-place - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :param recovery_point: Backup target with the backup data - :type recovery_point: Instance of :class:`.BackupTarget` - - :param recovery_target: Backup target with to recover the data to - :type recovery_target: Instance of :class:`.BackupTarget` - - :param path: The part of the recovery point to recover (optional) - :type path: ``str`` - - :rtype: Instance of :class:`BackupTargetJob` - """ - raise NotImplementedError( - 'recover_target_out_of_place not implemented for this driver') - - def get_target_job(self, target, id): - """ - Get a specific backup job by ID - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :param id: Backup target with the backup data - :type id: Instance of :class:`.BackupTarget` - - :rtype: :class:`BackupTargetJob` - """ - jobs = self.list_target_jobs(target) - return list(filter(lambda x: x.id == id, jobs))[0] - - def list_target_jobs(self, target): - """ - List the backup jobs on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :rtype: ``list`` of :class:`.BackupTargetJob` - """ - raise NotImplementedError( - 'list_target_jobs not implemented for this driver') - - def create_target_job(self, target, extra=None): - """ - Create a new backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :param extra: (optional) Extra attributes (driver specific). - :type extra: ``dict`` - - :rtype: Instance of :class:`BackupTargetJob` - """ - raise NotImplementedError( - 'create_target_job not implemented for this driver') - - def resume_target_job(self, job): - """ - Resume a suspended backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :param job: Backup target job to resume - :type job: Instance of :class:`.BackupTargetJob` - - :rtype: ``bool`` - """ - raise NotImplementedError( - 'resume_target_job not implemented for this driver') - - def suspend_target_job(self, job): - """ - Suspend a running backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :param job: Backup target job to suspend - :type job: Instance of :class:`.BackupTargetJob` - - :rtype: ``bool`` - """ - raise NotImplementedError( - 'suspend_target_job not implemented for this driver') - - def cancel_target_job(self, job): - """ - Cancel a backup job on a target - - :param target: Backup target with the backup data - :type target: Instance of :class:`.BackupTarget` - - :param job: Backup target job to cancel - :type job: Instance of :class:`.BackupTargetJob` - - :rtype: ``bool`` - """ - raise NotImplementedError( - 'cancel_target_job not implemented for this driver') http://git-wip-us.apache.org/repos/asf/libcloud/blob/8afcda91/apache-libcloud-1.0.0rc2/libcloud/backup/drivers/__init__.py ---------------------------------------------------------------------- diff --git a/apache-libcloud-1.0.0rc2/libcloud/backup/drivers/__init__.py b/apache-libcloud-1.0.0rc2/libcloud/backup/drivers/__init__.py deleted file mode 100644 index e69de29..0000000
