libdeltacloud 0.9
include/libdeltacloud/bucket.h
00001 /*
00002  * Copyright (C) 2011 Red Hat, Inc.
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00017  *
00018  * Author: Chris Lalancette <clalance@redhat.com>
00019  */
00020 
00021 #ifndef LIBDELTACLOUD_BUCKET_H
00022 #define LIBDELTACLOUD_BUCKET_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00031 struct deltacloud_bucket_blob_metadata {
00032   char *key; 
00033   char *value; 
00035   struct deltacloud_bucket_blob_metadata *next;
00036 };
00037 
00041 struct deltacloud_bucket_blob {
00042   char *href; 
00043   char *id; 
00044   char *bucket_id; 
00045   char *content_length; 
00046   char *content_type; 
00047   char *last_modified; 
00048   char *content_href; 
00049   struct deltacloud_bucket_blob_metadata *metadata; 
00051   struct deltacloud_bucket_blob *next;
00052 };
00053 
00057 struct deltacloud_bucket {
00058   char *href; 
00059   char *id; 
00060   char *name; 
00061   char *size; 
00062   struct deltacloud_bucket_blob *blobs; 
00064   struct deltacloud_bucket *next;
00065 };
00066 
00067 #define deltacloud_supports_buckets(api) deltacloud_has_link(api, "buckets")
00068 int deltacloud_get_buckets(struct deltacloud_api *api,
00069                            struct deltacloud_bucket **buckets);
00070 int deltacloud_get_bucket_by_id(struct deltacloud_api *api, const char *id,
00071                                 struct deltacloud_bucket *bucket);
00072 int deltacloud_create_bucket(struct deltacloud_api *api,
00073                              const char *name,
00074                              struct deltacloud_create_parameter *params,
00075                              int params_length);
00076 int deltacloud_bucket_create_blob_from_file(struct deltacloud_api *api,
00077                                             struct deltacloud_bucket *bucket,
00078                                             const char *blob_name,
00079                                             const char *filename,
00080                                             struct deltacloud_create_parameter *params,
00081                                             int params_length);
00082 int deltacloud_bucket_get_blob_by_id(struct deltacloud_api *api,
00083                                      struct deltacloud_bucket *bucket,
00084                                      const char *name,
00085                                      struct deltacloud_bucket_blob *blob);
00086 int deltacloud_bucket_blob_update_metadata(struct deltacloud_api *api,
00087                                            struct deltacloud_bucket_blob *blob,
00088                                            struct deltacloud_create_parameter *params,
00089                                            int params_length);
00090 int deltacloud_bucket_blob_get_content(struct deltacloud_api *api,
00091                                        struct deltacloud_bucket_blob *blob,
00092                                        char **output);
00093 int deltacloud_bucket_delete_blob(struct deltacloud_api *api,
00094                                   struct deltacloud_bucket_blob *blob);
00095 void deltacloud_free_bucket_blob(struct deltacloud_bucket_blob *blob);
00096 int deltacloud_bucket_destroy(struct deltacloud_api *api,
00097                               struct deltacloud_bucket *bucket);
00098 void deltacloud_free_bucket(struct deltacloud_bucket *bucket);
00099 void deltacloud_free_bucket_list(struct deltacloud_bucket **buckets);
00100 
00101 #ifdef __cplusplus
00102 }
00103 #endif
00104 
00105 #endif
 All Data Structures Files Functions Variables