Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LIBCLOUD-1037] Add Azurite support for Azure Blob Storage driver
This requires the following main changes: - Protect against a missing content md5 since the Azurite emulator doesn't set this value. - Protect against a missing metadata tag since the Azurite emulator doesn't set this value. - Implement routing to a specific account via URL prefix (e.g. /someaccount) instead of hostname (e.g. someaccount.blob.core.windows.net).
- Loading branch information
Showing
11 changed files
with
231 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from libcloud.storage.types import Provider | ||
from libcloud.storage.providers import get_driver | ||
|
||
cls = get_driver(Provider.AZURE_BLOBS) | ||
|
||
driver = cls(key='devstoreaccount1', | ||
secret='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6' | ||
'IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==', | ||
host='localhost', | ||
port=10000, | ||
secure=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
libcloud/test/storage/fixtures/azurite_blobs/list_containers_1.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EnumerationResults ServiceEndpoint="http://localhost:10000/account"> | ||
<MaxResults>2</MaxResults> | ||
<Containers> | ||
<Container> | ||
<Name>container1</Name> | ||
<Properties> | ||
<Last-Modified>Mon, 07 Jan 2013 06:31:06 GMT</Last-Modified> | ||
<Etag>"0x8CFBAB7B4F23346"</Etag> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
</Container> | ||
<Container> | ||
<Name>container2</Name> | ||
<Properties> | ||
<Last-Modified>Mon, 07 Jan 2013 06:31:07 GMT</Last-Modified> | ||
<Etag>"0x8CFBAB7B5B82D8E"</Etag> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
</Container> | ||
</Containers> | ||
<NextMarker>/account/container3</NextMarker> | ||
</EnumerationResults> |
26 changes: 26 additions & 0 deletions
26
libcloud/test/storage/fixtures/azurite_blobs/list_containers_2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EnumerationResults ServiceEndpoint="http://localhost:10000/account"> | ||
<Marker>/account/container3</Marker> | ||
<MaxResults>2</MaxResults> | ||
<Containers> | ||
<Container> | ||
<Name>container3</Name> | ||
<Properties> | ||
<Last-Modified>Mon, 07 Jan 2013 06:31:08 GMT</Last-Modified> | ||
<Etag>"0x8CFBAB7B6452A71"</Etag> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
</Container> | ||
<Container> | ||
<Name>container4</Name> | ||
<Properties> | ||
<Last-Modified>Fri, 04 Jan 2013 08:32:41 GMT</Last-Modified> | ||
<Etag>"0x8CFB86D32305484"</Etag> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
</Container> | ||
</Containers> | ||
<NextMarker /> | ||
</EnumerationResults> |
8 changes: 8 additions & 0 deletions
8
libcloud/test/storage/fixtures/azurite_blobs/list_containers_empty.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EnumerationResults ServiceEndpoint="http://localhost:10000/account"> | ||
<Prefix></Prefix> | ||
<Marker></Marker> | ||
<MaxResults>100</MaxResults> | ||
<Containers /> | ||
<NextMarker /> | ||
</EnumerationResults> |
45 changes: 45 additions & 0 deletions
45
libcloud/test/storage/fixtures/azurite_blobs/list_objects_1.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EnumerationResults ContainerName="test_container" ServiceEndpoint="http://localhost:10000/account"> | ||
<MaxResults>2</MaxResults> | ||
<Blobs> | ||
<Blob> | ||
<Name>object1.txt</Name> | ||
<Properties> | ||
<Last-Modified>Fri, 04 Jan 2013 09:48:06 GMT</Last-Modified> | ||
<Etag>0x8CFB877BB56A6FB</Etag> | ||
<Content-Length>0</Content-Length> | ||
<Content-Type>application/octet-stream</Content-Type> | ||
<Content-Encoding /> | ||
<Content-Language /> | ||
<Cache-Control /> | ||
<BlobType>BlockBlob</BlobType> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
<Metadata> | ||
<meta1>value1</meta1> | ||
<meta2>value2</meta2> | ||
</Metadata> | ||
</Blob> | ||
<Blob> | ||
<Name>object2.txt</Name> | ||
<Properties> | ||
<Last-Modified>Sat, 05 Jan 2013 03:51:42 GMT</Last-Modified> | ||
<Etag>0x8CFB90F1BA8CD8F</Etag> | ||
<Content-Length>1048576</Content-Length> | ||
<Content-Type>application/octet-stream</Content-Type> | ||
<Content-Encoding /> | ||
<Content-Language /> | ||
<Cache-Control /> | ||
<BlobType>BlockBlob</BlobType> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
<Metadata> | ||
<meta1>value1</meta1> | ||
<meta2>value2</meta2> | ||
</Metadata> | ||
</Blob> | ||
</Blobs> | ||
<NextMarker>2!76!MDAwMDExIXNvbWUxMTcudHh0ITAwMDAyOCE5OTk5LTEyLTMxVDIzOjU5OjU5Ljk5OTk5OTlaIQ--</NextMarker> | ||
</EnumerationResults> |
37 changes: 37 additions & 0 deletions
37
libcloud/test/storage/fixtures/azurite_blobs/list_objects_2.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EnumerationResults ContainerName="test_container" ServiceEndpoint="http://localhost:10000/account"> | ||
<Marker>object3.txt</Marker> | ||
<MaxResults>2</MaxResults> | ||
<Blobs> | ||
<Blob> | ||
<Name>object3.txt</Name> | ||
<Properties> | ||
<Last-Modified>Sat, 05 Jan 2013 03:52:08 GMT</Last-Modified> | ||
<Etag>0x8CFB90F2B6FC022</Etag> | ||
<Content-Length>1048576</Content-Length> | ||
<Content-Type>application/octet-stream</Content-Type> | ||
<Content-Encoding /> | ||
<Content-Language /> | ||
<Cache-Control /> | ||
<BlobType>BlockBlob</BlobType> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
</Blob> | ||
<Blob> | ||
<Name>object4.txt</Name> | ||
<Properties> | ||
<Last-Modified>Fri, 04 Jan 2013 10:20:14 GMT</Last-Modified> | ||
<Etag>0x8CFB87C38717450</Etag> | ||
<Content-Length>0</Content-Length> | ||
<Content-Type>application/octet-stream</Content-Type> | ||
<Content-Encoding /><Content-Language /> | ||
<Cache-Control /> | ||
<BlobType>BlockBlob</BlobType> | ||
<LeaseStatus>unlocked</LeaseStatus> | ||
<LeaseState>available</LeaseState> | ||
</Properties> | ||
</Blob> | ||
</Blobs> | ||
<NextMarker /> | ||
</EnumerationResults> |
6 changes: 6 additions & 0 deletions
6
libcloud/test/storage/fixtures/azurite_blobs/list_objects_empty.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<EnumerationResults ContainerName="test_container" ServiceEndpoint="http://localhost:10000/account"> | ||
<MaxResults>2</MaxResults> | ||
<Blobs /> | ||
<NextMarker /> | ||
</EnumerationResults> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters