libdeltacloud 0.9
Functions
src/instance.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include "common.h"
#include "instance.h"
#include "curl_action.h"

Functions

int deltacloud_create_instance (struct deltacloud_api *api, const char *image_id, struct deltacloud_create_parameter *params, int params_length, char **instance_id)
int deltacloud_instance_stop (struct deltacloud_api *api, struct deltacloud_instance *instance)
int deltacloud_instance_reboot (struct deltacloud_api *api, struct deltacloud_instance *instance)
int deltacloud_instance_start (struct deltacloud_api *api, struct deltacloud_instance *instance)
int deltacloud_instance_destroy (struct deltacloud_api *api, struct deltacloud_instance *instance)
int deltacloud_get_instances (struct deltacloud_api *api, struct deltacloud_instance **instances)
int deltacloud_get_instance_by_id (struct deltacloud_api *api, const char *id, struct deltacloud_instance *instance)
int deltacloud_get_instance_by_name (struct deltacloud_api *api, const char *name, struct deltacloud_instance *instance)
void deltacloud_free_instance (struct deltacloud_instance *instance)
void deltacloud_free_instance_list (struct deltacloud_instance **instances)

Detailed Description


Function Documentation

int deltacloud_create_instance ( struct deltacloud_api api,
const char *  image_id,
struct deltacloud_create_parameter params,
int  params_length,
char **  instance_id 
)

A function to create a new instance from an image.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]image_idThe image ID to create the instance from
[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
[out]instance_idThe instance ID returned by the create call
Returns:
0 on success, -1 on error
void deltacloud_free_instance ( struct deltacloud_instance instance)

A function to free a deltacloud_instance structure initially allocated by deltacloud_get_instance_by_id() or deltacloud_get_instance_by_name().

Parameters:
[in]instanceThe deltacloud_instance structure representing the instance
void deltacloud_free_instance_list ( struct deltacloud_instance **  instances)

A function to free a list of deltacloud_instance structures initially allocated by deltacloud_get_instances().

Parameters:
[in]instancesThe pointer to the head of the deltacloud_instance list
int deltacloud_get_instance_by_id ( struct deltacloud_api api,
const char *  id,
struct deltacloud_instance instance 
)

A function to look up a particular instance by id. The caller is expected to free the deltacloud_instance structure using deltacloud_free_instance().

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]idThe instance ID to look for
[out]instanceThe deltacloud_instance structure to fill in if the ID is found
Returns:
0 on success, -1 if the instance cannot be found or on error
int deltacloud_get_instance_by_name ( struct deltacloud_api api,
const char *  name,
struct deltacloud_instance instance 
)

A function to look up a particular instance by name. The caller is expected to free the deltacloud_instance structure using deltacloud_free_instance(). Note that deltacloud does not guarantee that instance names are unique; this function will only find and return the first instance with the desired name.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]nameThe instance name to look for
[out]instanceThe deltacloud_instance structure to fill in if the name is found
Returns:
0 on success, -1 if the instance cannot be found or on error
int deltacloud_get_instances ( struct deltacloud_api api,
struct deltacloud_instance **  instances 
)

A function to get a linked list of all of the instances. The caller is expected to free the list using deltacloud_free_instance_list().

Parameters:
[in]apiThe deltacloud_api structure representing this connection
[out]instancesA pointer to the deltacloud_instance structure to hold the list of instances
Returns:
0 on success, -1 on error
int deltacloud_instance_destroy ( struct deltacloud_api api,
struct deltacloud_instance instance 
)

A function to perform the destroy action on an instance.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]instanceThe deltacloud_instance structure representing the instance
Returns:
0 on success, -1 on error
int deltacloud_instance_reboot ( struct deltacloud_api api,
struct deltacloud_instance instance 
)

A function to perform the reboot action on an instance.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]instanceThe deltacloud_instance structure representing the instance
Returns:
0 on success, -1 on error
int deltacloud_instance_start ( struct deltacloud_api api,
struct deltacloud_instance instance 
)

A function to perform the start action on an instance.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]instanceThe deltacloud_instance structure representing the instance
Returns:
0 on success, -1 on error
int deltacloud_instance_stop ( struct deltacloud_api api,
struct deltacloud_instance instance 
)

A function to perform the stop action on an instance.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]instanceThe deltacloud_instance structure representing the instance
Returns:
0 on success, -1 on error
 All Data Structures Files Functions Variables