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

Functions

int deltacloud_get_loadbalancers (struct deltacloud_api *api, struct deltacloud_loadbalancer **balancers)
int deltacloud_get_loadbalancer_by_id (struct deltacloud_api *api, const char *id, struct deltacloud_loadbalancer *balancer)
int deltacloud_create_loadbalancer (struct deltacloud_api *api, const char *name, const char *realm_id, const char *protocol, int balancer_port, int instance_port, struct deltacloud_create_parameter *params, int params_length)
int deltacloud_loadbalancer_register (struct deltacloud_api *api, struct deltacloud_loadbalancer *balancer, const char *instance_id, struct deltacloud_create_parameter *params, int params_length)
int deltacloud_loadbalancer_unregister (struct deltacloud_api *api, struct deltacloud_loadbalancer *balancer, const char *instance_id, struct deltacloud_create_parameter *params, int params_length)
int deltacloud_loadbalancer_destroy (struct deltacloud_api *api, struct deltacloud_loadbalancer *balancer)
void deltacloud_free_loadbalancer (struct deltacloud_loadbalancer *lb)
void deltacloud_free_loadbalancer_list (struct deltacloud_loadbalancer **lbs)

Detailed Description


Function Documentation

int deltacloud_create_loadbalancer ( struct deltacloud_api api,
const char *  name,
const char *  realm_id,
const char *  protocol,
int  balancer_port,
int  instance_port,
struct deltacloud_create_parameter params,
int  params_length 
)

A function to create a new load balancer.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]nameThe name to give to the new load balancer
[in]realm_idThe realm ID to put the new load balancer in
[in]protocolThe protocol to load balance
[in]balancer_portThe port the load balancer listens on
[in]instance_portThe port the load balancer balances to
[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_loadbalancer ( struct deltacloud_loadbalancer lb)

A function to free a deltacloud_loadbalancer structure initially allocated by deltacloud_get_loadbalancer_by_id().

Parameters:
[in]lbThe deltacloud_loadbalancer structure representing the load balancer
void deltacloud_free_loadbalancer_list ( struct deltacloud_loadbalancer **  lbs)

A function to free a list of deltacloud_loadbalancer structures initially allocated by deltacloud_get_loadbalancers().

Parameters:
[in]lbsThe pointer to the head of the deltacloud_loadbalancer list
int deltacloud_get_loadbalancer_by_id ( struct deltacloud_api api,
const char *  id,
struct deltacloud_loadbalancer balancer 
)

A function to look up a particular load balancer by id. The caller is expected to free the deltacloud_loadbalancer structure using deltacloud_free_loadbalancer().

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]idThe load balancer ID to look for
[out]balancerThe deltacloud_loadbalancer structure to fill in if the ID is found
Returns:
0 on success, -1 if the load balancer cannot be found or on error
int deltacloud_get_loadbalancers ( struct deltacloud_api api,
struct deltacloud_loadbalancer **  balancers 
)

A function to get a linked list of all of the load balancers. The caller is expected to free the list using deltacloud_free_loadbalancer_list().

Parameters:
[in]apiThe deltacloud_api structure representing this connection
[out]balancersA pointer to the deltacloud_loadbalancer structure to hold the list of load balancers
Returns:
0 on success, -1 on error
int deltacloud_loadbalancer_destroy ( struct deltacloud_api api,
struct deltacloud_loadbalancer balancer 
)

A function to destroy a load balancer.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]balancerThe deltacloud_loadbalancer structure representing the load balancer
Returns:
0 on success, -1 on error
int deltacloud_loadbalancer_register ( struct deltacloud_api api,
struct deltacloud_loadbalancer balancer,
const char *  instance_id,
struct deltacloud_create_parameter params,
int  params_length 
)

A function to register an instance to a load balancer.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]balancerThe deltacloud_loadbalancer structure representing the load balancer
[in]instance_idThe instance ID to add to the load balancer
[in]paramsAn array of deltacloud_create_parameter structures that represent any optional parameters to pass into the register call
[in]params_lengthAn integer describing the length of the params array
Returns:
0 on success, -1 on error
int deltacloud_loadbalancer_unregister ( struct deltacloud_api api,
struct deltacloud_loadbalancer balancer,
const char *  instance_id,
struct deltacloud_create_parameter params,
int  params_length 
)

A function to unregister an instance from a load balancer.

Parameters:
[in]apiThe deltacloud_api structure representing the connection
[in]balancerThe deltacloud_loadbalancer structure representing the load balancer
[in]instance_idThe instance ID to remove from the load balancer
[in]paramsAn array of deltacloud_create_parameter structures that represent any optional parameters to pass into the unregister call
[in]params_lengthAn integer describing the length of the params array
Returns:
0 on success, -1 on error
 All Data Structures Files Functions Variables