/*
- * Copyright (c) 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved.
+ * Copyright (c) 2008-2012 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
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* Data types
*/
+typedef enum {
+ S3_API_S3,
+ S3_API_SWIFT_1,
+ S3_API_SWIFT_2,
+ S3_API_OAUTH2,
+ S3_API_CASTOR
+} S3_api;
+
/* An opaque handle. S3Handles should only be accessed from a single
* thread at any given time, although it is fine to use different handles
* in different threads simultaneously. */
/* 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 \
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(AuthenticationRequired), \
S3_ERROR(END)
typedef enum {
* @returns: the new S3Handle
*/
S3Handle *
-s3_open(const char * access_key, const char *secret_key, const char *host,
+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 * bucket_location, const char * storage_class,
+ const char * ca_info, const char * server_side_encryption,
+ const char *proxy,
+ const S3_api s3_api,
+ const char *username,
+ const char *password,
+ const char *tenant_id,
+ const char *tenant_name,
+ const char *client_id,
+ const char *client_secret,
+ const char *refresh_token,
+ const gboolean reuse_connection,
+ const char *reps,
+ const char *reps_bucket);
+
+/* latest step of setting up the S3Handle.
+ *
+ * Must be done after all properties are set.
+ *
+ * @param hdl: the S3Handle to set up.
+ * @returns: false if an error occured
+ */
+gboolean
+s3_open2(S3Handle *hdl);
/* Deallocate an S3Handle
*
const char *bucket,
const char *key);
+/* Delete multiple file.
+ *
+ * @param hdl: the S3Handle object
+ * @param bucket: the bucket to delete from
+ * @param key: the key array to delete
+ * @returns: 0 on sucess, 1 if multi_delete is not supported, 2 if an error
+ * occurs; a non-existent file is I{not} considered an error.
+ */
+int
+s3_multi_delete(S3Handle *hdl,
+ const char *bucket,
+ const char **key);
+
/* Create a bucket.
*
* @param hdl: the S3Handle object
*/
gboolean
s3_make_bucket(S3Handle *hdl,
- const char *bucket);
+ const char *bucket,
+ const char *project_id);
+
+/* 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,
+ const char *project_id);
/* Delete a bucket
*