libdeltacloud 0.9
include/libdeltacloud/instance.h
00001 /*
00002  * Copyright (C) 2010,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_INSTANCE_H
00022 #define LIBDELTACLOUD_INSTANCE_H
00023 
00024 #include "hardware_profile.h"
00025 #include "action.h"
00026 #include "address.h"
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00037 struct deltacloud_instance_auth {
00038   char *type; 
00040   char *keyname; 
00042   char *username; 
00043   char *password; 
00044 };
00045 
00049 struct deltacloud_instance {
00050   char *href; 
00051   char *id; 
00052   char *name; 
00053   char *owner_id; 
00054   char *image_id; 
00055   char *image_href; 
00056   char *realm_id; 
00057   char *realm_href; 
00058   char *state; 
00059   char *launch_time; 
00060   struct deltacloud_hardware_profile hwp; 
00061   struct deltacloud_action *actions; 
00062   struct deltacloud_address *public_addresses; 
00063   struct deltacloud_address *private_addresses; 
00064   struct deltacloud_instance_auth auth; 
00066   struct deltacloud_instance *next;
00067 };
00068 
00069 #define deltacloud_supports_instances(api) deltacloud_has_link(api, "instances")
00070 int deltacloud_get_instances(struct deltacloud_api *api,
00071                              struct deltacloud_instance **instances);
00072 int deltacloud_get_instance_by_id(struct deltacloud_api *api, const char *id,
00073                                   struct deltacloud_instance *instance);
00074 int deltacloud_get_instance_by_name(struct deltacloud_api *api,
00075                                     const char *name,
00076                                     struct deltacloud_instance *instance);
00077 int deltacloud_create_instance(struct deltacloud_api *api, const char *image_id,
00078                                struct deltacloud_create_parameter *params,
00079                                int params_length, char **instance_id);
00080 int deltacloud_instance_stop(struct deltacloud_api *api,
00081                              struct deltacloud_instance *instance);
00082 int deltacloud_instance_reboot(struct deltacloud_api *api,
00083                                struct deltacloud_instance *instance);
00084 int deltacloud_instance_start(struct deltacloud_api *api,
00085                               struct deltacloud_instance *instance);
00086 int deltacloud_instance_destroy(struct deltacloud_api *api,
00087                                 struct deltacloud_instance *instance);
00088 void deltacloud_free_instance(struct deltacloud_instance *instance);
00089 void deltacloud_free_instance_list(struct deltacloud_instance **instances);
00090 
00091 #ifdef __cplusplus
00092 }
00093 #endif
00094 
00095 #endif
 All Data Structures Files Functions Variables