Merge tag 'upstream/3.3.1'
[debian/amanda] / device-src / s3.h
index dc5d052ea81383331b06a707c92a2031d35cbd2e..24ad9603fa70a237ba8fbb3d1209c4d7d1490969 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008,2009 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2008, 2009, 2010 Zmanda, Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -115,7 +115,7 @@ typedef curl_progress_callback s3_progress_func;
 /* This preprocessor magic will enumerate constants named S3_ERROR_XxxYyy for
  * each of the errors in parentheses.
  *
- * see http://docs.amazonwebservices.com/AmazonS3/2006-03-01/ErrorCodeList.html
+ * see http://docs.amazonwebservices.com/AmazonS3/latest/API/ErrorResponses.html
  * for Amazon's breakdown of error responses.
  */
 #define S3_ERROR_LIST \
@@ -153,6 +153,7 @@ typedef curl_progress_callback s3_progress_func;
     S3_ERROR(MissingSecurityHeader), \
     S3_ERROR(NoLoggingStatusForKey), \
     S3_ERROR(NoSuchBucket), \
+    S3_ERROR(NoSuchEntity), \
     S3_ERROR(NoSuchKey), \
     S3_ERROR(NotImplemented), \
     S3_ERROR(NotSignedUp), \
@@ -165,6 +166,11 @@ typedef curl_progress_callback s3_progress_func;
     S3_ERROR(UnexpectedContent), \
     S3_ERROR(UnresolvableGrantByEmailAddress), \
     S3_ERROR(Unknown), \
+    S3_ERROR(Unauthorized), \
+    S3_ERROR(Created), \
+    S3_ERROR(Accepted), \
+    S3_ERROR(Forbidden), \
+    S3_ERROR(Conflict), \
     S3_ERROR(END)
 
 typedef enum {
@@ -226,13 +232,20 @@ s3_init(void);
  * @param secret_key: the secret key for Amazon Web Services
  * @param user_token: the user token for Amazon DevPay
  * @param bucket_location: the location constraint for buckets
+ * @param storage_class: the storage class for new objects
  * @param ca_info: the path to pass to libcurl as the certificate authority.
  *                 see curl_easy_setopt() CURLOPT_CAINFO for more
  * @returns: the new S3Handle
  */
 S3Handle *
-s3_open(const char * access_key, const char *secret_key, const char * user_token,
-        const char * bucket_location, const char * ca_info);
+s3_open(const char * access_key, const char *secret_key,
+       const char *swift_account_id, const char *swift_access_key,
+       const char *host,
+        const char *service_path, gboolean use_subdomain,
+        const char * user_token,
+        const char * bucket_location, const char * storage_class,
+       const char * ca_info, const char * server_side_encryption,
+       const gboolean openstack_swift_api);
 
 /* Deallocate an S3Handle
  *
@@ -364,6 +377,7 @@ s3_upload(S3Handle *hdl,
  * @param prefix: the prefix
  * @param delimiter: delimiter (any length string)
  * @param list: (output) the list of files
+ * @param total_size: (output) sum of size of files 
  * @returns: FALSE if an error occurs
  */
 gboolean
@@ -371,7 +385,8 @@ s3_list_keys(S3Handle *hdl,
               const char *bucket,
               const char *prefix,
               const char *delimiter,
-              GSList **list);
+              GSList **list,
+              guint64 *total_size);
 
 /* Read an entire file, passing the contents to write_func buffer
  * by buffer.
@@ -418,6 +433,16 @@ gboolean
 s3_make_bucket(S3Handle *hdl,
                const char *bucket);
 
+/* Check if a bucket exists.
+ *
+ * @param hdl: the S3Handle object
+ * @param bucket: the bucket to create
+ * @returns: FALSE if an error occur
+ */
+gboolean
+s3_is_bucket_exists(S3Handle *hdl,
+                    const char *bucket);
+
 /* Delete a bucket
  *
  * @note A bucket can not be deleted if it still contains keys