Repository navigation
Expand file tree
/
Copy pathwsjcpp_docker_api.h
More file actions
71 lines (57 loc) · 2.01 KB
/
Copy pathwsjcpp_docker_api.h
File metadata and controls
71 lines (57 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef WSJCPP_DOCKER_API_H
#define WSJCPP_DOCKER_API_H
#include <string>
#include <vector>
#include <json.hpp>
// ---------------------------------------------------------------------
class WsjcppDockerContainer {
};
// ---------------------------------------------------------------------
class WsjcppDockerImage {
public:
WsjcppDockerImage();
bool fillFromJson(const nlohmann::json &);
nlohmann::json getJsonOriginal();
std::string getId();
std::string getParentId();
long getCreated();
std::map<std::string, std::string> getLabels();
std::vector<std::string> getRepoDigests();
std::vector<std::string> getRepoTags();
long getSharedSize();
long getSize();
long getVirtualSize();
long getContainers();
private:
std::string TAG;
nlohmann::json m_jsonOriginal;
std::string m_sId;
std::string m_sParentId;
long m_nCreated;
std::map<std::string, std::string> m_mapLabels;
std::vector<std::string> m_vRepoDigests;
std::vector<std::string> m_vRepoTags;
long m_nSharedSize;
long m_nSize;
long m_nVirtualSize;
long m_nContainers;
};
// ---------------------------------------------------------------------
class WsjcppDockerApi {
public:
WsjcppDockerApi();
std::string getDefaultUnixSocketPath();
bool isConnected();
bool doConnectUnixSocketPath(const std::string &sDockerUnixSocketPath);
// bool getContainers(std::vector<WsjcppDockerContainer> &vContainers, std::string &sError);
bool getImages(std::vector<WsjcppDockerImage> &vImages, std::string &sError);
protected:
std::string TAG;
std::string makeUrl(const std::string &sPath);
bool requestGet(const std::string &sPath, std::string &sResponse);
private:
std::string m_sApiVersionPrefix;
std::string m_sDockerUnixSocketPath;
bool m_bConneted;
};
#endif // WSJCPP_DOCKER_API_H