concepts.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Concepts and Organisation
  2. =========================
  3. Conceptually, CloudBridge consists of the following types of objects.
  4. 1. Providers - Represents a connection to a cloud provider, and is
  5. the gateway to using its services.
  6. 2. Services - Represents a service provided by a cloud provider,
  7. such as its compute service, block storage service, object storage etc.
  8. Services may in turn be divided into smaller services. Smaller services
  9. tend to have uniform methods, such as create, find and list. For example,
  10. InstanceService.list(), InstanceService.find() etc. which can be used
  11. to access cloud resources. Larger services tend to provide organisational
  12. structure only. For example, the block store service provides access to
  13. the VolumeService and SnapshotService.
  14. 3. Resources - resources are objects returned by a service,
  15. and represent a remote resource. For example, InstanceService.list()
  16. will return a list of Instance objects, which can be used to manipulate
  17. an instance. Similarly, VolumeService.create() will return a Volume object.
  18. .. image:: images/object_relationships_overview.svg
  19. The actual source code structure of CloudBridge also mirrors this organisation.
  20. Detailed class relationships
  21. ----------------------------
  22. The following diagram shows a typical provider object graph and the relationship
  23. between services.
  24. .. raw:: html
  25. <object data="_images/object_relationships_detailed.svg" type="image/svg+xml"></object>
  26. Some services are nested. For example, to access the instance service, you can
  27. use `provider.compute.instances`. Similarly, to get a list of all instances,
  28. you can use the following code.
  29. .. code-block:: python
  30. instances = provider.compute.instances.list()
  31. print(instances[0].name)