clibdocker  0.1.0-alpha.0
A Docker API for C
lua_docker.h
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 
24 #ifndef SRC_LUA_DOCKER_H_
25 #define SRC_LUA_DOCKER_H_
26 
27 #ifdef LUA_ENABLED
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define LUA_LIB
34 #include "lua.h"
35 #include "lauxlib.h"
36 
37 #include "docker_all.h"
38 #include <json-c/json_object.h>
39 
40 #define DockerClient_metatable "DOCKER_CLIENT"
41 #define JsonObject_metatable "JSON_OBJECT"
42 
43 typedef struct {
44  docker_context* ctx;
45 } DockerClient;
46 
47 typedef struct {
48  json_object* obj;
49 } JsonObject;
50 
51 LUALIB_API int DockerClient_connect_url(lua_State* L);
52 
53 // DockerClient:new()
54 LUALIB_API int DockerClient_new(lua_State* L);
55 
56 // DockerClient:from_context
57 int DockerClient_from_context(lua_State* L, docker_context* ctx);
58 
59 // json utils
60 LUALIB_API int JsonObject_json_create(lua_State* L);
61 LUALIB_API int JsonObject_json_string(lua_State* L);
62 
63 // container APIs
64 LUALIB_API int DockerClient_container_list(lua_State* L);
65 LUALIB_API int DockerClient_create_container(lua_State* L);
66 LUALIB_API int DockerClient_inspect_container(lua_State* L);
67 LUALIB_API int DockerClient_process_list_container(lua_State* L);
68 LUALIB_API int DockerClient_container_logs(lua_State* L);
69 LUALIB_API int DockerClient_container_changes(lua_State* L);
70 LUALIB_API int DockerClient_container_stats(lua_State* L);
71 LUALIB_API int DockerClient_start_container(lua_State* L);
72 LUALIB_API int DockerClient_stop_container(lua_State* L);
73 LUALIB_API int DockerClient_restart_container(lua_State* L);
74 LUALIB_API int DockerClient_kill_container(lua_State* L);
75 LUALIB_API int DockerClient_rename_container(lua_State* L);
76 LUALIB_API int DockerClient_pause_container(lua_State* L);
77 LUALIB_API int DockerClient_unpause_container(lua_State* L);
78 LUALIB_API int DockerClient_wait_container(lua_State* L);
79 LUALIB_API int DockerClient_remove_container(lua_State* L);
80 
81 
82 LUALIB_API int luaopen_luaclibdocker(lua_State* L);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif //LUA_ENABLED
89 
90 #endif //SRC_LUA_DOCKER_H_
Includes all public API header files of clibdocker, thus exposing the entire public API via one heade...
A docker context for a specific docker server.
Definition: docker_connection_util.h:141