README.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. cloudbridge
  2. ===========
  3. cloudbridge provides a layer of abstraction over different cloud providers.
  4. It's a straightfoward implementation of the `bridge pattern`_. It is currently
  5. under development and is in a Pre-Alpha state.
  6. .. image:: https://codeclimate.com/github/gvlproject/cloudbridge/badges/gpa.svg
  7. :target: https://codeclimate.com/github/gvlproject/cloudbridge
  8. :alt: Code Climate
  9. .. image:: https://landscape.io/github/gvlproject/cloudbridge/master/landscape.svg?style=flat
  10. :target: https://landscape.io/github/gvlproject/cloudbridge/master
  11. :alt: Landscape Code Health
  12. .. image:: https://coveralls.io/repos/gvlproject/cloudbridge/badge.svg?branch=master&service=github
  13. :target: https://coveralls.io/github/gvlproject/cloudbridge?branch=master
  14. :alt: Code Coverage
  15. .. image:: https://travis-ci.org/gvlproject/cloudbridge.svg?branch=master
  16. :target: https://travis-ci.org/gvlproject/cloudbridge
  17. :alt: Travis Build Status
  18. .. image:: https://img.shields.io/pypi/status/cloudbridge.svg
  19. :target: https://pypi.python.org/pypi/cloudbridge/
  20. :alt: latest version available on PyPI
  21. Usage example
  22. ~~~~~~~~~~~~~
  23. The simplest possible example for doing something useful with cloudbridge would
  24. look like the following.
  25. .. code-block:: python
  26. from cloudbridge.providers.factory import CloudProviderFactory, ProviderList
  27. provider = CloudProviderFactory().create_provider(ProviderList.AWS, {})
  28. print(provider.security.key_pairs.list())
  29. In the example above, the AWS_ACCESS_KEY and AWS_SECRET_KEY environment variables
  30. must be set to your AWS credentials.
  31. Documentation
  32. ~~~~~~~~~~~~~
  33. Documentation can be found at https://cloudbridge.readthedocs.org.
  34. Contributing
  35. ~~~~~~~~~~~~
  36. Community contributions for any part of the project are welcome. If you have
  37. a completely new idea or would like to bounce your idea before moving forward
  38. with the implementation, feel free to create an issue to start a discussion.
  39. Contributions should come in the form or a pull request. We strive for 100%
  40. test coverage so code will only be accepted if it comes with appropriate tests
  41. and it does not break existing functionality. Further, the code needs to be
  42. well documented and all methods have docstrings.
  43. Conceptually, the library is laid out such that there is a factory used to
  44. create a reference to a cloud provider. Each provider offers a set of services
  45. and resources. Services typically perform actions while resources offer
  46. information (and can act on itself, when appropriate). The structure of each
  47. object is defined via an abstract interface (see
  48. ``cloudbridge/providers/interfaces``) and any object should implement the
  49. defined interface.
  50. Running tests
  51. ~~~~~~~~~~~~~
  52. To run the test suite locally, install `tox`_ with :code:`pip install tox`
  53. and run ``tox`` command. This will run all the tests for
  54. all the environments defined in file ``tox.ini``. In order to properly run the
  55. tests, you should have all the environment variables listed in
  56. ``tox.ini`` file (under ``passenv``) exported.
  57. If you’d like to run the tests on a specific environment only, use a command
  58. like such: ``tox -e py27`` (or ``python setup.py test`` directly). If you'd
  59. like to run the tests for a specific cloud only, you should export env var
  60. ``CB_TEST_PROVIDER`` and specify the desired provider name (e.g., ``aws`` or
  61. ``openstack``) and then run the ``tox`` command.
  62. Note that running the tests may create various cloud resources, for which you
  63. may incur costs. For the AWS cloud, there is also a mock provider that will
  64. simulate AWS resources. It is used by default when running the test suite. To
  65. disable it, set the following environment variable:
  66. ``export CB_USE_MOCK_DRIVERS=No``.
  67. .. _`bridge pattern`: https://en.wikipedia.org/wiki/Bridge_pattern
  68. .. _`tox`: https://tox.readthedocs.org/en/latest/