clibdocker  0.1.0-alpha.0
A Docker API for C
docker_volumes.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2018-2022 Abhishek Mishra
4  *
5  * This file is part of clibdocker.
6  *
7  * clibdocker is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation,
10  * either version 3 of the License, or (at your option)
11  * any later version.
12  *
13  * clibdocker is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with clibdocker.
20  * If not, see <https://www.gnu.org/licenses/>.
21  *
22  */
23 
29 #ifndef SRC_DOCKER_VOLUMES_H_
30 #define SRC_DOCKER_VOLUMES_H_
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <stdlib.h>
37 #include "docker_connection_util.h"
38 #include "docker_util.h"
39 
51 typedef json_object docker_volume;
52 
56 #define free_docker_volume(vol) json_object_put((json_object*) vol)
57 
64 #define docker_volume_name_get(vol) get_attr_str((json_object*)vol, "Name")
65 
72 #define docker_volume_driver_get(vol) get_attr_str((json_object*)vol, "Driver")
73 
80 #define docker_volume_mountpoint_vol_get(vol) get_attr_str((json_object*)vol, "Mountpoint")
81 
90 #define docker_volume_go_scope_get(vol) get_attr_str((json_object*)vol, "Scope")
91 
98 #define docker_volume_creation_time_get(vol) get_attr_time((json_object*)vol, "CreatedAt")
99 
109 #define docker_volume_labels_get(vol) get_attr_json_object((json_object*)vol, "Labels")
110 
119 #define docker_volume_labels_foreach(vol) json_object_object_foreach(docker_volume_labels_get(vol), key, val)
120 
130 #define docker_volume_options_get(vol) get_attr_json_object((json_object*)vol, "Options")
131 
140 #define docker_volume_options_foreach(vol) json_object_object_foreach(docker_volume_options_get(vol), key, val)
141 
145 typedef json_object docker_volume_list;
146 
152 #define free_docker_volume_list(volume_ls) json_object_put(volume_ls)
153 
160 #define docker_volume_list_length(volume_ls) json_object_array_length(volume_ls)
161 
169 #define docker_volume_list_get_idx(volume_ls, i) (docker_volume*) json_object_array_get_idx(volume_ls, i)
170 
176 typedef json_object docker_volume_warnings;
177 
183 #define free_docker_warnings(warnings) json_object_put(warnings)
184 
191 #define docker_warnings_length(warnings) json_object_array_length(warnings)
192 
200 #define docker_warnings_get_idx(warnings, i) (char*) json_object_array_get_idx(warnings, i)
201 
216  docker_volume_list** volumes, docker_volume_warnings** warnings,
217  int filter_dangling, char* filter_driver, char* filter_label,
218  char* filter_name);
219 
232  docker_volume** volume, char* name, char* driver, int num_labels,
233  ...);
234 
244  docker_volume** volume, char* name);
245 
255  const char* name, int force);
256 
268  arraylist** volumes_deleted,
269  unsigned long* space_reclaimed, int num_label_filters, ...);
270 
271 #ifdef __cplusplus
272 }
273 #endif
274 
275 #endif
Docker Connection Utils.
enum _config_error d_err_t
Definition: docker_result.h:60
Docker API utils.
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)
Definition: docker_volumes.c:31
json_object docker_volume_warnings
The Docker Volume Warnings list json object.
Definition: docker_volumes.h:176
json_object docker_volume
The Docker Volume object.
Definition: docker_volumes.h:51
d_err_t docker_volumes_delete_unused(docker_context *ctx, arraylist **volumes_deleted, unsigned long *space_reclaimed, int num_label_filters,...)
Definition: docker_volumes.c:138
d_err_t docker_volume_inspect(docker_context *ctx, docker_volume **volume, char *name)
Definition: docker_volumes.c:104
d_err_t docker_volume_delete(docker_context *ctx, const char *name, int force)
Definition: docker_volumes.c:119
d_err_t docker_volume_create(docker_context *ctx, docker_volume **volume, char *name, char *driver, int num_labels,...)
Definition: docker_volumes.c:68
json_object docker_volume_list
Represents Docker Volume List in json.
Definition: docker_volumes.h:145
A docker context for a specific docker server.
Definition: docker_connection_util.h:141