libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From quent...@apache.org
Subject [2/5] libcloud git commit: Add docs for DigitalOcean Spaces.
Date Mon, 16 Oct 2017 06:28:31 GMT
Add docs for DigitalOcean Spaces.

Signed-off-by: Quentin Pradet <quentinp@apache.org>


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

Branch: refs/heads/trunk
Commit: 24584e6d6aff0a8edbda39e47a75d038669c8dc1
Parents: 1bb5bed
Author: Andrew Starr-Bochicchio <a.starr.b@gmail.com>
Authored: Mon Oct 16 10:21:04 2017 +0400
Committer: Quentin Pradet <quentinp@apache.org>
Committed: Mon Oct 16 10:24:58 2017 +0400

----------------------------------------------------------------------
 .../storage/digitalocean_spaces/__init__.py     |  0
 .../storage/digitalocean_spaces/instantiate.py  |  6 +++
 .../digitalocean_spaces/upload_object_acls.py   | 19 ++++++++
 docs/storage/_supported_methods_main.rst        |  2 +
 docs/storage/_supported_providers.rst           |  2 +
 docs/storage/drivers/digitalocean_spaces.rst    | 49 ++++++++++++++++++++
 6 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/24584e6d/docs/examples/storage/digitalocean_spaces/__init__.py
----------------------------------------------------------------------
diff --git a/docs/examples/storage/digitalocean_spaces/__init__.py b/docs/examples/storage/digitalocean_spaces/__init__.py
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/libcloud/blob/24584e6d/docs/examples/storage/digitalocean_spaces/instantiate.py
----------------------------------------------------------------------
diff --git a/docs/examples/storage/digitalocean_spaces/instantiate.py b/docs/examples/storage/digitalocean_spaces/instantiate.py
new file mode 100644
index 0000000..c882596
--- /dev/null
+++ b/docs/examples/storage/digitalocean_spaces/instantiate.py
@@ -0,0 +1,6 @@
+from libcloud.storage.types import Provider
+from libcloud.storage.providers import get_driver
+
+cls = get_driver(Provider.DIGITALOCEAN_SPACES)
+
+driver = cls(key='DO_ACCESS_KEY', secret='DO_SECRET_KEY')

http://git-wip-us.apache.org/repos/asf/libcloud/blob/24584e6d/docs/examples/storage/digitalocean_spaces/upload_object_acls.py
----------------------------------------------------------------------
diff --git a/docs/examples/storage/digitalocean_spaces/upload_object_acls.py b/docs/examples/storage/digitalocean_spaces/upload_object_acls.py
new file mode 100644
index 0000000..e5fe0bd
--- /dev/null
+++ b/docs/examples/storage/digitalocean_spaces/upload_object_acls.py
@@ -0,0 +1,19 @@
+from libcloud.storage.types import Provider
+from libcloud.storage.providers import get_driver
+
+FILE_PATH = '/home/user/myfile.tar.gz'
+
+cls = get_driver(Provider.DIGITALOCEAN_SPACES)
+driver = cls('api key', 'api secret key')
+
+container = driver.get_container(container_name='my-backups-12345')
+
+# This method blocks until all the parts have been uploaded.
+extra = {'content_type': 'application/octet-stream',
+         'acl': 'public-read'}
+
+with open(FILE_PATH, 'rb') as iterator:
+    obj = driver.upload_object_via_stream(iterator=iterator,
+                                          container=container,
+                                          object_name='backup.tar.gz',
+                                          extra=extra)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/24584e6d/docs/storage/_supported_methods_main.rst
----------------------------------------------------------------------
diff --git a/docs/storage/_supported_methods_main.rst b/docs/storage/_supported_methods_main.rst
index 4f7eb96..0e377a2 100644
--- a/docs/storage/_supported_methods_main.rst
+++ b/docs/storage/_supported_methods_main.rst
@@ -8,6 +8,7 @@ Provider                      list containers list objects create container
dele
 `Microsoft Azure (blobs)`_    yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
 `Backblaze B2`_               yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
 `CloudFiles`_                 yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
+`DigitalOcean Spaces`_        yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
 `Google Cloud Storage`_       yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
 `KTUCloud Storage`_           yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
 `Local Storage`_              yes             yes          yes              yes         
    yes           yes                     yes             yes                       yes  
       
@@ -40,6 +41,7 @@ Provider                      list containers list objects create container
dele
 .. _`Microsoft Azure (blobs)`: http://windows.azure.com/
 .. _`Backblaze B2`: https://www.backblaze.com/b2/
 .. _`CloudFiles`: http://www.rackspace.com/
+.. _`DigitalOcean Spaces`: https://www.digitalocean.com/products/object-storage/
 .. _`Google Cloud Storage`: http://cloud.google.com/storage
 .. _`KTUCloud Storage`: http://www.rackspace.com/
 .. _`Local Storage`: http://example.com

http://git-wip-us.apache.org/repos/asf/libcloud/blob/24584e6d/docs/storage/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/storage/_supported_providers.rst b/docs/storage/_supported_providers.rst
index 482d49a..7c8687b 100644
--- a/docs/storage/_supported_providers.rst
+++ b/docs/storage/_supported_providers.rst
@@ -8,6 +8,7 @@ Provider                      Documentation
 `Microsoft Azure (blobs)`_    :doc:`Click </storage/drivers/azure_blobs>`         AZURE_BLOBS
        single region driver         :mod:`libcloud.storage.drivers.azure_blobs`         :class:`AzureBlobsStorageDriver`
       
 `Backblaze B2`_               :doc:`Click </storage/drivers/backblaze_b2>`        BACKBLAZE_B2
       single region driver         :mod:`libcloud.storage.drivers.backblaze_b2`        :class:`BackblazeB2StorageDriver`
      
 `CloudFiles`_                                                                     CLOUDFILES
         dfw, hkg, iad, lon, ord, syd :mod:`libcloud.storage.drivers.cloudfiles`         
:class:`CloudFilesStorageDriver`        
+`DigitalOcean Spaces`_        :doc:`Click </storage/drivers/digitalocean_spaces>` DIGITALOCEAN_SPACES
single region driver         :mod:`libcloud.storage.drivers.digitalocean_spaces` :class:`DigitalOceanSpacesStorageDriver`
 `Google Cloud Storage`_       :doc:`Click </storage/drivers/google_storage>`      GOOGLE_STORAGE
     single region driver         :mod:`libcloud.storage.drivers.google_storage`      :class:`GoogleStorageDriver`
           
 `KTUCloud Storage`_                                                               KTUCLOUD
           dfw, hkg, iad, lon, ord, syd :mod:`libcloud.storage.drivers.ktucloud`         
  :class:`KTUCloudStorageDriver`          
 `Local Storage`_                                                                  LOCAL 
             single region driver         :mod:`libcloud.storage.drivers.local`          
    :class:`LocalStorageDriver`             
@@ -40,6 +41,7 @@ Provider                      Documentation
 .. _`Microsoft Azure (blobs)`: http://windows.azure.com/
 .. _`Backblaze B2`: https://www.backblaze.com/b2/
 .. _`CloudFiles`: http://www.rackspace.com/
+.. _`DigitalOcean Spaces`: https://www.digitalocean.com/products/object-storage/
 .. _`Google Cloud Storage`: http://cloud.google.com/storage
 .. _`KTUCloud Storage`: http://www.rackspace.com/
 .. _`Local Storage`: http://example.com

http://git-wip-us.apache.org/repos/asf/libcloud/blob/24584e6d/docs/storage/drivers/digitalocean_spaces.rst
----------------------------------------------------------------------
diff --git a/docs/storage/drivers/digitalocean_spaces.rst b/docs/storage/drivers/digitalocean_spaces.rst
new file mode 100644
index 0000000..919cdc8
--- /dev/null
+++ b/docs/storage/drivers/digitalocean_spaces.rst
@@ -0,0 +1,49 @@
+DigitalOcean Spaces Storage Driver Documentation
+================================================
+
+`Spaces`_ is an `S3-interoperable`_ object storage service from cloud provider
+DigitalOcean.
+
+Connecting to Spaces
+--------------------
+
+To connect to DigitalOcean Spaces you need an access key and secret key. These
+can be retrieved on the "`Applications & API`_" page of the DigitalOcean control
+panel.
+
+Instantiating a driver
+~~~~~~~~~~~~~~~~~~~~~~
+
+Once you have obtained your credentials you can instantiate the driver as shown
+below.
+
+.. literalinclude:: /examples/storage/digitalocean_spaces/instantiate.py
+   :language: python
+
+Specifying canned ACLs
+~~~~~~~~~~~~~~~~~~~~~~
+
+Spaces supports a limited set of canned ACLs. In order to specify an ACL when
+uploading an object, you can pass an ``extra`` argument with the ``acl``
+attribute to the upload methods.
+
+For example:
+
+.. literalinclude:: /examples/storage/digitalocean_spaces/upload_object_acls.py
+   :language: python
+
+At this time, valid values for this attribute are only:
+
+* ``private`` (default)
+* ``public-read``
+
+API Docs
+--------
+
+.. autoclass:: libcloud.storage.drivers.digitalocean_spaces.DigitalOceanSpacesStorageDriver
+    :members:
+    :inherited-members:
+
+.. _`Spaces`: https://www.digitalocean.com/products/object-storage/
+.. _`Applications & API`: https://cloud.digitalocean.com/settings/api/tokens
+.. _`S3-interoperable`: https://developers.digitalocean.com/documentation/spaces/
\ No newline at end of file


Mime
View raw message