clibdocker
0.1.0-alpha.0
A Docker API for C
|
Docker volumes API. More...
Go to the source code of this file.
Macros | |
#define | free_docker_volume(vol) json_object_put((json_object*) vol) |
free the docker volume object | |
#define | docker_volume_name_get(vol) get_attr_str((json_object*)vol, "Name") |
Get the name of the docker volume. More... | |
#define | docker_volume_driver_get(vol) get_attr_str((json_object*)vol, "Driver") |
Get the driver name of the docker volume. More... | |
#define | docker_volume_mountpoint_vol_get(vol) get_attr_str((json_object*)vol, "Mountpoint") |
Get the mount point of the docker volume. More... | |
#define | docker_volume_go_scope_get(vol) get_attr_str((json_object*)vol, "Scope") |
Get the scope of the docker volume. More... | |
#define | docker_volume_creation_time_get(vol) get_attr_time((json_object*)vol, "CreatedAt") |
Get the creation time of the docker volume. More... | |
#define | docker_volume_labels_get(vol) get_attr_json_object((json_object*)vol, "Labels") |
Get the volume labels array of the docker volume. More... | |
#define | docker_volume_labels_foreach(vol) json_object_object_foreach(docker_volume_labels_get(vol), key, val) |
Iterate over the volume labels with key and val. More... | |
#define | docker_volume_options_get(vol) get_attr_json_object((json_object*)vol, "Options") |
Get the options array of the docker volume. More... | |
#define | docker_volume_options_foreach(vol) json_object_object_foreach(docker_volume_options_get(vol), key, val) |
Iterate over the volume options with key and val. More... | |
#define | free_docker_volume_list(volume_ls) json_object_put(volume_ls) |
Free the docker volume list json object. More... | |
#define | docker_volume_list_length(volume_ls) json_object_array_length(volume_ls) |
Get the length of the docker volume list. More... | |
#define | docker_volume_list_get_idx(volume_ls, i) (docker_volume*) json_object_array_get_idx(volume_ls, i) |
Get the ith value of the docker volume list. More... | |
#define | free_docker_warnings(warnings) json_object_put(warnings) |
Free the docker warnings list. More... | |
#define | docker_warnings_length(warnings) json_object_array_length(warnings) |
Get the length of the docker volume warnings list. More... | |
#define | docker_warnings_get_idx(warnings, i) (char*) json_object_array_get_idx(warnings, i) |
Get the ith warning. More... | |
Typedefs | |
typedef json_object | docker_volume |
The Docker Volume object. More... | |
typedef json_object | docker_volume_list |
Represents Docker Volume List in json. | |
typedef json_object | docker_volume_warnings |
The Docker Volume Warnings list json object. More... | |
Functions | |
d_err_t | docker_volumes_list (docker_context *ctx, docker_volume_list **volumes, docker_volume_warnings **warnings, int filter_dangling, char *filter_driver, char *filter_label, char *filter_name) |
d_err_t | docker_volume_create (docker_context *ctx, docker_volume **volume, char *name, char *driver, int num_labels,...) |
d_err_t | docker_volume_inspect (docker_context *ctx, docker_volume **volume, char *name) |
d_err_t | docker_volume_delete (docker_context *ctx, const char *name, int force) |
d_err_t | docker_volumes_delete_unused (docker_context *ctx, arraylist **volumes_deleted, unsigned long *space_reclaimed, int num_label_filters,...) |
Docker volumes API.
#define docker_volume_creation_time_get | ( | vol | ) | get_attr_time((json_object*)vol, "CreatedAt") |
Get the creation time of the docker volume.
vol | docker volume |
#define docker_volume_driver_get | ( | vol | ) | get_attr_str((json_object*)vol, "Driver") |
Get the driver name of the docker volume.
vol | docker volume |
#define docker_volume_go_scope_get | ( | vol | ) | get_attr_str((json_object*)vol, "Scope") |
Get the scope of the docker volume.
For possible values of scope refer to the docker api docs.
vol | docker volume |
#define docker_volume_labels_foreach | ( | vol | ) | json_object_object_foreach(docker_volume_labels_get(vol), key, val) |
Iterate over the volume labels with key and val.
Iterate over every label, in every iteration, the key and val store the id and value of the label.
vol | docker volume |
#define docker_volume_labels_get | ( | vol | ) | get_attr_json_object((json_object*)vol, "Labels") |
Get the volume labels array of the docker volume.
The better was to get the volume labels is to use the helper funcitons for iteration over the volume labels.
vol | docker volume |
#define docker_volume_list_get_idx | ( | volume_ls, | |
i | |||
) | (docker_volume*) json_object_array_get_idx(volume_ls, i) |
Get the ith value of the docker volume list.
volume_ls | the volume list object |
i | index |
#define docker_volume_list_length | ( | volume_ls | ) | json_object_array_length(volume_ls) |
Get the length of the docker volume list.
volume_ls | the volume list object |
#define docker_volume_mountpoint_vol_get | ( | vol | ) | get_attr_str((json_object*)vol, "Mountpoint") |
Get the mount point of the docker volume.
vol | docker volume |
#define docker_volume_name_get | ( | vol | ) | get_attr_str((json_object*)vol, "Name") |
Get the name of the docker volume.
vol | docker volume |
#define docker_volume_options_foreach | ( | vol | ) | json_object_object_foreach(docker_volume_options_get(vol), key, val) |
Iterate over the volume options with key and val.
Iterate over every option, in every iteration, the key and val store the id and value of the option.
vol | docker volume |
#define docker_volume_options_get | ( | vol | ) | get_attr_json_object((json_object*)vol, "Options") |
Get the options array of the docker volume.
The better was to get the volume options is to use the helper funcitons for iteration over the volume options.
vol | docker volume |
#define docker_warnings_get_idx | ( | warnings, | |
i | |||
) | (char*) json_object_array_get_idx(warnings, i) |
Get the ith warning.
warnings | docker volume warnings list |
i | index |
#define docker_warnings_length | ( | warnings | ) | json_object_array_length(warnings) |
Get the length of the docker volume warnings list.
warnings | docker volume warnings list |
#define free_docker_volume_list | ( | volume_ls | ) | json_object_put(volume_ls) |
Free the docker volume list json object.
volume_ls | the volume list object |
#define free_docker_warnings | ( | warnings | ) | json_object_put(warnings) |
Free the docker warnings list.
warnings | docker volume warnings list |
typedef json_object docker_volume |
The Docker Volume object.
The docker volume object represents the JSON object, returned as part of a Docker API call.
To access members of the object use the getters of the form docker_volume_<member>_get(vol)
, where vol is the pointer to the volume object.
typedef json_object docker_volume_warnings |
The Docker Volume Warnings list json object.
Each warning is a string.
d_err_t docker_volume_create | ( | docker_context * | ctx, |
docker_volume ** | volume, | ||
char * | name, | ||
char * | driver, | ||
int | num_labels, | ||
... | |||
) |
Create a new volume by providing name, driver and an optional list of key/value pairs for labels
ctx | the docker context |
volume | the volume object to return |
name | name of the volume to create (cannot be NULL) |
driver | name of the driver to use |
num_labels | the number of labels to be attached. |
... | key/values char* key, char* value args pair for each label |
References docker_log_debug, make_docker_call(), and docker_context_t::url.
d_err_t docker_volume_delete | ( | docker_context * | ctx, |
const char * | name, | ||
int | force | ||
) |
Delete the given volume (identified by name).
ctx | the docker context |
name | name of the volume to delete |
force | force delete if this value is 1 |
References make_docker_call(), and docker_context_t::url.
d_err_t docker_volume_inspect | ( | docker_context * | ctx, |
docker_volume ** | volume, | ||
char * | name | ||
) |
Inspect an existing volume.
ctx | the docker context |
volume | the volume object to return |
name | name of the volume to inspect (cannot be NULL) |
d_err_t docker_volumes_delete_unused | ( | docker_context * | ctx, |
arraylist ** | volumes_deleted, | ||
unsigned long * | space_reclaimed, | ||
int | num_label_filters, | ||
... | |||
) |
Delete unused volumes.
ctx | the docker context |
volumes_deleted | array_list with names of volumes deleted |
space_reclaimed | num bytes freed. |
num_label_filters | how many label filters are there |
... | triples (int filter_not, char* label_name, char* label_value) |
References make_docker_call(), and docker_context_t::url.
d_err_t docker_volumes_list | ( | docker_context * | ctx, |
docker_volume_list ** | volumes, | ||
docker_volume_warnings ** | warnings, | ||
int | filter_dangling, | ||
char * | filter_driver, | ||
char * | filter_label, | ||
char * | filter_name | ||
) |
Get the list of volumes, matching the filters provided. (Any and all filters can be null/0.)
ctx | the docker context |
volumes | the list of docker_volume_item objects |
warnings | the list of warnings |
filter_dangling | 0 indicates false, anything else is true |
filter_driver | driver filter |
filter_label | filter label |
filter_name | filter name |
References make_docker_call(), and docker_context_t::url.