libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [2/2] git commit: Add an example of how to purchase a subscription.
Date Sun, 02 Feb 2014 13:14:55 GMT
Add an example of how to purchase a subscription.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f7560b20
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f7560b20
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f7560b20

Branch: refs/heads/trunk
Commit: f7560b202dcd5a9fc3a8f474dafd1ed018a245e6
Parents: 8e914b7
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Sun Feb 2 13:42:04 2014 +0100
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Sun Feb 2 13:42:04 2014 +0100

----------------------------------------------------------------------
 docs/compute/drivers/cloudsigma.rst             | 23 ++++++++++++++++++++
 .../cloudsigma/create_vlan_subscription.py      |  9 ++++++++
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/f7560b20/docs/compute/drivers/cloudsigma.rst
----------------------------------------------------------------------
diff --git a/docs/compute/drivers/cloudsigma.rst b/docs/compute/drivers/cloudsigma.rst
index 7472723..b7cc6bb 100644
--- a/docs/compute/drivers/cloudsigma.rst
+++ b/docs/compute/drivers/cloudsigma.rst
@@ -277,6 +277,29 @@ method as displayed bellow.
 Both of those methods return a ``list``. Servers and drives which share the same
 physical host will be stored under the same index in the returned list.
 
+Purchasing a subscription
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A lot of resources such as SSDs, VLANs, IPs and others are created by
+purchasing a subscription.
+
+When you purchase a subscription you need to supply the following arguments:
+
+* ``amount`` - Subscription amount. Unit depends on the purchased resource.
+  For example, if you are purchasing a ``vlan`` resource, ``amount`` represents
+  a number of VLAN networks you want to purchase.
+* ``period`` - For how long to purchase the subscription. Example values:
+  ``1 month``, ``30 days``, etc.
+* ``resource`` - Resource to purchase the subscription for. Valid values:
+  ``cpu``, ``mem``, ``tx``, ``ip``, ``vlan``
+* ``auto_renew`` - ``True`` to auto renew the subscription when it expires.
+
+The example bellow shows how to purchase a single VLAN for a duration of
+30 days which will be automatically renewed when it expires.
+
+.. literalinclude:: /examples/compute/cloudsigma/create_vlan_subscription.py
+   :language: python
+
 Retrieving the account balance
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/f7560b20/docs/examples/compute/cloudsigma/create_vlan_subscription.py
----------------------------------------------------------------------
diff --git a/docs/examples/compute/cloudsigma/create_vlan_subscription.py b/docs/examples/compute/cloudsigma/create_vlan_subscription.py
new file mode 100644
index 0000000..a29e239
--- /dev/null
+++ b/docs/examples/compute/cloudsigma/create_vlan_subscription.py
@@ -0,0 +1,9 @@
+from libcloud.compute.types import Provider
+from libcloud.compute.providers import get_driver
+
+cls = get_driver(Provider.CLOUDSIGMA)
+driver = cls('username', 'password', region='zrh', api_version='2.0')
+
+subscription = driver.ex_create_subscription(amount=1, period='30 days',
+                                             resource='vlan', auto_renew=True)
+print(subscription)


Mime
View raw message