libdeltacloud 0.9
include/libdeltacloud/libdeltacloud.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_H
00022 #define LIBDELTACLOUD_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00033 struct deltacloud_api {
00034   char *url; 
00035   char *user; 
00036   char *password; 
00037   char *driver; 
00038   char *version; 
00040   int initialized; 
00042   struct deltacloud_link *links; 
00043 };
00044 
00050 struct deltacloud_error {
00051   int error_num; 
00052   char *details; 
00053 };
00054 
00061 struct deltacloud_create_parameter {
00062   char *name; 
00063   char *value; 
00064 };
00065 
00066 #include "link.h"
00067 #include "instance.h"
00068 #include "realm.h"
00069 #include "image.h"
00070 #include "instance_state.h"
00071 #include "storage_volume.h"
00072 #include "storage_snapshot.h"
00073 #include "hardware_profile.h"
00074 #include "key.h"
00075 #include "driver.h"
00076 #include "loadbalancer.h"
00077 #include "bucket.h"
00078 
00079 int deltacloud_initialize(struct deltacloud_api *api, char *url, char *user,
00080                           char *password);
00081 
00082 int deltacloud_prepare_parameter(struct deltacloud_create_parameter *param,
00083                                  const char *name, const char *value);
00084 struct deltacloud_create_parameter *deltacloud_allocate_parameter(const char *name,
00085                                                                   const char *value);
00086 void deltacloud_free_parameter_value(struct deltacloud_create_parameter *param);
00087 void deltacloud_free_parameter(struct deltacloud_create_parameter *param);
00088 
00089 struct deltacloud_error *deltacloud_get_last_error(void);
00090 const char *deltacloud_get_last_error_string(void);
00091 
00092 int deltacloud_has_link(struct deltacloud_api *api, const char *name);
00093 
00094 void deltacloud_free(struct deltacloud_api *api);
00095 
00096 #define deltacloud_for_each(curr, list) for (curr = list; curr != NULL; curr = curr->next)
00097 
00098 /* Error codes */
00099 #define DELTACLOUD_UNKNOWN_ERROR -1
00100 /* ERROR codes -2, -3, and -4 are reserved for future use */
00101 #define DELTACLOUD_GET_URL_ERROR -5
00102 #define DELTACLOUD_POST_URL_ERROR -6
00103 #define DELTACLOUD_XML_ERROR -7
00104 #define DELTACLOUD_URL_DOES_NOT_EXIST_ERROR -8
00105 #define DELTACLOUD_OOM_ERROR -9
00106 #define DELTACLOUD_INVALID_ARGUMENT_ERROR -10
00107 #define DELTACLOUD_NAME_NOT_FOUND_ERROR -11
00108 #define DELTACLOUD_DELETE_URL_ERROR -12
00109 #define DELTACLOUD_MULTIPART_POST_URL_ERROR -13
00110 
00111 #ifdef __cplusplus
00112 }
00113 #endif
00114 
00115 #endif
 All Data Structures Files Functions Variables