getting_started.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. Getting Started
  2. ===============
  3. This getting started guide will provide a quick tour of some cloud bridge
  4. features. You should reach the conceptual structure section to get a quick
  5. idea of the main types of objects that cloudbridge provides.
  6. Creating a provider
  7. -------------------
  8. To initialize a connection to a cloud and get a provider object, you will
  9. need to provide the cloud's access credentials to cloudbridge. These may
  10. be provided in one of two ways.
  11. 1. Environment variables
  12. 2. A dictionary
  13. Providing access credentials through environment variables
  14. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. When initializing a provider through environment variables, you can
  16. create a connection as follows.
  17. .. code-block:: python
  18. from cloudbridge.cloud.factory import CloudProviderFactory, ProviderList
  19. provider = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, {})
  20. The following environment variables must be set, depending on the provider in use.
  21. **Amazon**
  22. *Mandatory variables*::
  23. AWS_ACCESS_KEY
  24. AWS_SECRET_KEY
  25. **Openstack**
  26. *Mandatory variables*::
  27. OS_AUTH_URL
  28. OS_USERNAME
  29. OS_PASSWORD
  30. OS_TENANT_NAME
  31. OS_REGION_NAME
  32. *Optional variables*::
  33. NOVA_SERVICE_NAME
  34. OS_COMPUTE_API_VERSION
  35. OS_VOLUME_API_VERSION
  36. Providing access credentials through a dictionary
  37. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  38. You can initialize a simple config as follows. The key names are the same
  39. as the environment variables, in lower case. Note that the config dictionary
  40. will override environment values.
  41. .. code-block:: python
  42. from cloudbridge.cloud.factory import CloudProviderFactory, ProviderList
  43. config = {'aws_access_key' : '<your_access_key>',
  44. 'aws_secret_key' : '<your_secret_key>'}
  45. provider = CloudProviderFactory().create_provider(ProviderList.AWS, config)
  46. Launching a new instance
  47. ________________________
  48. Common methods
  49. ______________
  50. create
  51. list
  52. find
  53. delete