libdeltacloud 0.9
Defines | Functions
src/bucket.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "curl_action.h"
#include "bucket.h"

Functions

int deltacloud_get_buckets (struct deltacloud_api *api, struct deltacloud_bucket **buckets)
int deltacloud_get_bucket_by_id (struct deltacloud_api *api, const char *id, struct deltacloud_bucket *bucket)
int deltacloud_create_bucket (struct deltacloud_api *api, const char *name, struct deltacloud_create_parameter *params, int params_length)
int deltacloud_bucket_create_blob_from_file (struct deltacloud_api *api, struct deltacloud_bucket *bucket, const char *blob_name, const char *filename, struct deltacloud_create_parameter *params, int params_length)
int deltacloud_bucket_get_blob_by_id (struct deltacloud_api *api, struct deltacloud_bucket *bucket, const char *name, struct deltacloud_bucket_blob *blob)
int deltacloud_bucket_blob_update_metadata (struct deltacloud_api *api, struct deltacloud_bucket_blob *blob, struct deltacloud_create_parameter *params, int params_length)
int deltacloud_bucket_blob_get_content (struct deltacloud_api *api, struct deltacloud_bucket_blob *blob, char **output)
int deltacloud_bucket_delete_blob (struct deltacloud_api *api, struct deltacloud_bucket_blob *blob)
void deltacloud_free_bucket_blob (struct deltacloud_bucket_blob *blob)
int deltacloud_bucket_destroy (struct deltacloud_api *api, struct deltacloud_bucket *bucket)
void deltacloud_free_bucket (struct deltacloud_bucket *bucket)
void deltacloud_free_bucket_list (struct deltacloud_bucket **buckets)

Detailed Description


Function Documentation

int deltacloud_bucket_blob_get_content ( struct deltacloud_api api,
struct deltacloud_bucket_blob blob,
char **  output 
)

A function to get the contents of a blob. It is the responsibility of the caller to free the memory returned in output.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]blobThe deltacloud_bucket_blob structure representing the blob
[out]outputA pointer to an memory location to store the blob contents
Returns:
0 on success, -1 on error
int deltacloud_bucket_blob_update_metadata ( struct deltacloud_api api,
struct deltacloud_bucket_blob blob,
struct deltacloud_create_parameter params,
int  params_length 
)

A function to update the metadata on a blob.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]blobThe deltacloud_bucket_blob structure representing the blob
[in]paramsAn array of deltacloud_create_parameter structures that represent the key/value pairs of metadata to update
[in]params_lengthAn integer describing the length of the params array
Returns:
0 on success, -1 on error
int deltacloud_bucket_create_blob_from_file ( struct deltacloud_api api,
struct deltacloud_bucket bucket,
const char *  blob_name,
const char *  filename,
struct deltacloud_create_parameter params,
int  params_length 
)

A function to create a new blob in a bucket.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]bucketThe deltacloud_bucket representing the bucket in which to create the blob
[in]blob_nameThe name to give to the new blob
[in]filenameThe filename from which to read the data for the blob
[in]paramsAn array of deltacloud_create_parameter structures that represent any optional parameters to pass into the create call
[in]params_lengthAn integer describing the length of the params array
Returns:
0 on success, -1 on error
int deltacloud_bucket_delete_blob ( struct deltacloud_api api,
struct deltacloud_bucket_blob blob 
)

A function to delete a blob.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]blobThe deltacloud_bucket_blob structure representing the blob
Returns:
0 on success, -1 on error
int deltacloud_bucket_destroy ( struct deltacloud_api api,
struct deltacloud_bucket bucket 
)

A function to destroy a bucket.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]bucketThe deltacloud_bucket structure representing the bucket
Returns:
0 on success, -1 on error
int deltacloud_bucket_get_blob_by_id ( struct deltacloud_api api,
struct deltacloud_bucket bucket,
const char *  name,
struct deltacloud_bucket_blob blob 
)

A function to lookup a blob by id. It is up to the caller to free the structure with deltacloud_free_bucket_blob().

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]bucketThe deltacloud_bucket representing the bucket in which to look for the blob
[in]nameThe name of the blob to lookup
[out]blobThe deltacloud_bucket_blob structure that will be filled in if the blob is found
Returns:
0 on success, -1 on error or if the blob could not be found
int deltacloud_create_bucket ( struct deltacloud_api api,
const char *  name,
struct deltacloud_create_parameter params,
int  params_length 
)

A function to create a new bucket.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]nameThe name to give to the new bucket
[in]paramsAn array of deltacloud_create_parameter structures that represent any optional parameters to pass into the create call
[in]params_lengthAn integer describing the length of the params array
Returns:
0 on success, -1 on error
void deltacloud_free_bucket ( struct deltacloud_bucket bucket)

A function to free a deltacloud_bucket structure initially allocated by deltacloud_get_bucket_by_id().

Parameters:
[in]bucketThe deltacloud_bucket structure representing the bucket
void deltacloud_free_bucket_blob ( struct deltacloud_bucket_blob blob)

A function to free a deltacloud_bucket_blob structure initially allocated through deltacloud_bucket_get_blob_by_id().

Parameters:
[in]blobThe deltacloud_bucket_blob structure representing the blob
void deltacloud_free_bucket_list ( struct deltacloud_bucket **  buckets)

A function to free a list of deltacloud_bucket structures initially allocated by deltacloud_get_buckets().

Parameters:
[in]bucketsThe pointer to the head of the deltacloud_bucket list
int deltacloud_get_bucket_by_id ( struct deltacloud_api api,
const char *  id,
struct deltacloud_bucket bucket 
)

A function to look up a particular bucket by id. The caller is expected to free the deltacloud_bucket structure using deltacloud_free_bucket().

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]idThe bucket ID to look for
[out]bucketThe deltacloud_bucket structure to fill in if the ID is found
Returns:
0 on success, -1 if the bucket cannot be found or on error
int deltacloud_get_buckets ( struct deltacloud_api api,
struct deltacloud_bucket **  buckets 
)

A function to get a linked list of all of the buckets defined. The caller is expected to free the list using deltacloud_free_bucket_list().

Parameters:
[in]apiThe deltacloud_api structure representing this connection
[out]bucketsA pointer to the deltacloud_bucket structure to hold the list of buckets
Returns:
0 on success, -1 on error
 All Data Structures Files Functions Variables