mirror of https://github.com/apache/jclouds.git
Update create-container to take more options.
* location is now optional, given through the :location keyword. * public-read? option, can be set to true to create a publically readable container.
This commit is contained in:
parent
793740b9be
commit
ee339e109b
|
@ -48,7 +48,7 @@ See http://code.google.com/p/jclouds for details."
|
|||
AsyncBlobStore domain.BlobBuilder BlobStore BlobStoreContext
|
||||
BlobStoreContextFactory domain.BlobMetadata domain.StorageMetadata
|
||||
domain.Blob domain.internal.BlobBuilderImpl
|
||||
options.ListContainerOptions]
|
||||
options.CreateContainerOptions options.ListContainerOptions]
|
||||
org.jclouds.io.Payloads
|
||||
java.util.Arrays
|
||||
[java.security DigestOutputStream MessageDigest]
|
||||
|
@ -182,10 +182,10 @@ Options can also be specified for extension modules
|
|||
|
||||
(defn create-container
|
||||
"Create a container."
|
||||
([blobstore container-name]
|
||||
(create-container blobstore container-name nil))
|
||||
([^BlobStore blobstore container-name location]
|
||||
(.createContainerInLocation blobstore location container-name)))
|
||||
[^BlobStore blobstore container-name & {:keys [location public-read?]}]
|
||||
(let [cco (CreateContainerOptions.)
|
||||
cco (if public-read? (.publicRead cco) cco)]
|
||||
(.createContainerInLocation blobstore location container-name cco)))
|
||||
|
||||
(defn clear-container
|
||||
"Clear a container."
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
|
||||
(deftest locations-test
|
||||
(is (not (empty? (locations *blobstore*))))
|
||||
(is (create-container *blobstore* "fred" (first (locations *blobstore*)))))
|
||||
(is (create-container *blobstore* "fred"
|
||||
:location (first (locations *blobstore*)))))
|
||||
|
||||
(deftest containers-test
|
||||
(is (empty? (containers *blobstore*)))
|
||||
|
|
Loading…
Reference in New Issue