@ostanin/podman 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +432 -0
- package/esm/_dnt.polyfills.d.ts +7 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +1 -0
- package/esm/api/artifacts.d.ts +25 -0
- package/esm/api/artifacts.d.ts.map +1 -0
- package/esm/api/artifacts.js +89 -0
- package/esm/api/containers.d.ts +71 -0
- package/esm/api/containers.d.ts.map +1 -0
- package/esm/api/containers.js +234 -0
- package/esm/api/exec.d.ts +15 -0
- package/esm/api/exec.d.ts.map +1 -0
- package/esm/api/exec.js +45 -0
- package/esm/api/generate.d.ts +11 -0
- package/esm/api/generate.d.ts.map +1 -0
- package/esm/api/generate.js +24 -0
- package/esm/api/images.d.ts +55 -0
- package/esm/api/images.d.ts.map +1 -0
- package/esm/api/images.js +212 -0
- package/esm/api/kube.d.ts +13 -0
- package/esm/api/kube.d.ts.map +1 -0
- package/esm/api/kube.js +38 -0
- package/esm/api/manifests.d.ts +19 -0
- package/esm/api/manifests.d.ts.map +1 -0
- package/esm/api/manifests.js +60 -0
- package/esm/api/networks.d.ts +25 -0
- package/esm/api/networks.d.ts.map +1 -0
- package/esm/api/networks.js +95 -0
- package/esm/api/pods.d.ts +35 -0
- package/esm/api/pods.d.ts.map +1 -0
- package/esm/api/pods.js +120 -0
- package/esm/api/quadlets.d.ts +23 -0
- package/esm/api/quadlets.d.ts.map +1 -0
- package/esm/api/quadlets.js +56 -0
- package/esm/api/secrets.d.ts +17 -0
- package/esm/api/secrets.d.ts.map +1 -0
- package/esm/api/secrets.js +49 -0
- package/esm/api/system.d.ts +23 -0
- package/esm/api/system.d.ts.map +1 -0
- package/esm/api/system.js +98 -0
- package/esm/api/volumes.d.ts +23 -0
- package/esm/api/volumes.d.ts.map +1 -0
- package/esm/api/volumes.js +69 -0
- package/esm/client.d.ts +56 -0
- package/esm/client.d.ts.map +1 -0
- package/esm/client.js +63 -0
- package/esm/internal/query.d.ts +2 -0
- package/esm/internal/query.d.ts.map +1 -0
- package/esm/internal/query.js +24 -0
- package/esm/mod.d.ts +22 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +18 -0
- package/esm/package.json +3 -0
- package/esm/ssh_transport.d.ts +14 -0
- package/esm/ssh_transport.d.ts.map +1 -0
- package/esm/ssh_transport.js +85 -0
- package/esm/transport.d.ts +23 -0
- package/esm/transport.d.ts.map +1 -0
- package/esm/transport.js +112 -0
- package/esm/transport_core.d.ts +31 -0
- package/esm/transport_core.d.ts.map +1 -0
- package/esm/transport_core.js +75 -0
- package/esm/types/api.d.ts +61 -0
- package/esm/types/api.d.ts.map +1 -0
- package/esm/types/api.js +5 -0
- package/esm/types/errors.d.ts +21 -0
- package/esm/types/errors.d.ts.map +1 -0
- package/esm/types/errors.js +47 -0
- package/esm/types/openapi.d.ts +19552 -0
- package/esm/types/openapi.d.ts.map +1 -0
- package/esm/types/openapi.js +5 -0
- package/package.json +36 -0
- package/script/_dnt.polyfills.d.ts +7 -0
- package/script/_dnt.polyfills.d.ts.map +1 -0
- package/script/_dnt.polyfills.js +2 -0
- package/script/api/artifacts.d.ts +25 -0
- package/script/api/artifacts.d.ts.map +1 -0
- package/script/api/artifacts.js +93 -0
- package/script/api/containers.d.ts +71 -0
- package/script/api/containers.d.ts.map +1 -0
- package/script/api/containers.js +238 -0
- package/script/api/exec.d.ts +15 -0
- package/script/api/exec.d.ts.map +1 -0
- package/script/api/exec.js +49 -0
- package/script/api/generate.d.ts +11 -0
- package/script/api/generate.d.ts.map +1 -0
- package/script/api/generate.js +28 -0
- package/script/api/images.d.ts +55 -0
- package/script/api/images.d.ts.map +1 -0
- package/script/api/images.js +216 -0
- package/script/api/kube.d.ts +13 -0
- package/script/api/kube.d.ts.map +1 -0
- package/script/api/kube.js +42 -0
- package/script/api/manifests.d.ts +19 -0
- package/script/api/manifests.d.ts.map +1 -0
- package/script/api/manifests.js +64 -0
- package/script/api/networks.d.ts +25 -0
- package/script/api/networks.d.ts.map +1 -0
- package/script/api/networks.js +99 -0
- package/script/api/pods.d.ts +35 -0
- package/script/api/pods.d.ts.map +1 -0
- package/script/api/pods.js +124 -0
- package/script/api/quadlets.d.ts +23 -0
- package/script/api/quadlets.d.ts.map +1 -0
- package/script/api/quadlets.js +60 -0
- package/script/api/secrets.d.ts +17 -0
- package/script/api/secrets.d.ts.map +1 -0
- package/script/api/secrets.js +53 -0
- package/script/api/system.d.ts +23 -0
- package/script/api/system.d.ts.map +1 -0
- package/script/api/system.js +102 -0
- package/script/api/volumes.d.ts +23 -0
- package/script/api/volumes.d.ts.map +1 -0
- package/script/api/volumes.js +73 -0
- package/script/client.d.ts +56 -0
- package/script/client.d.ts.map +1 -0
- package/script/client.js +67 -0
- package/script/internal/query.d.ts +2 -0
- package/script/internal/query.d.ts.map +1 -0
- package/script/internal/query.js +27 -0
- package/script/mod.d.ts +22 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +42 -0
- package/script/package.json +3 -0
- package/script/ssh_transport.d.ts +14 -0
- package/script/ssh_transport.d.ts.map +1 -0
- package/script/ssh_transport.js +121 -0
- package/script/transport.d.ts +23 -0
- package/script/transport.d.ts.map +1 -0
- package/script/transport.js +149 -0
- package/script/transport_core.d.ts +31 -0
- package/script/transport_core.d.ts.map +1 -0
- package/script/transport_core.js +78 -0
- package/script/types/api.d.ts +61 -0
- package/script/types/api.d.ts.map +1 -0
- package/script/types/api.js +6 -0
- package/script/types/errors.d.ts +21 -0
- package/script/types/errors.d.ts.map +1 -0
- package/script/types/errors.js +54 -0
- package/script/types/openapi.d.ts +19552 -0
- package/script/types/openapi.d.ts.map +1 -0
- package/script/types/openapi.js +6 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PodsApi = void 0;
|
|
4
|
+
const errors_js_1 = require("../types/errors.js");
|
|
5
|
+
const query_js_1 = require("../internal/query.js");
|
|
6
|
+
class PodsApi {
|
|
7
|
+
#t;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.#t = transport;
|
|
10
|
+
}
|
|
11
|
+
/** Create a new pod from the given spec. */
|
|
12
|
+
async create(spec) {
|
|
13
|
+
const path = "/pods/create";
|
|
14
|
+
const { status, json } = await this.#t.request("POST", path, spec);
|
|
15
|
+
if (status !== 201)
|
|
16
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
17
|
+
return json;
|
|
18
|
+
}
|
|
19
|
+
/** Inspect a pod. Returns `null` if the pod is not found. */
|
|
20
|
+
async inspect(nameOrId) {
|
|
21
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/json`;
|
|
22
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
23
|
+
if (status === 404)
|
|
24
|
+
return null;
|
|
25
|
+
if (status !== 200)
|
|
26
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
27
|
+
return json;
|
|
28
|
+
}
|
|
29
|
+
/** List pods, optionally filtered by the given query. */
|
|
30
|
+
async list(query) {
|
|
31
|
+
const path = `/pods/json${(0, query_js_1.buildQuery)(query)}`;
|
|
32
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
33
|
+
if (status !== 200)
|
|
34
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
35
|
+
return (json ?? []);
|
|
36
|
+
}
|
|
37
|
+
/** Remove a pod and optionally its containers. */
|
|
38
|
+
async remove(nameOrId, query) {
|
|
39
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}${(0, query_js_1.buildQuery)(query)}`;
|
|
40
|
+
const { status, json } = await this.#t.request("DELETE", path);
|
|
41
|
+
if (status !== 200)
|
|
42
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
|
|
43
|
+
return json;
|
|
44
|
+
}
|
|
45
|
+
/** Start all containers in a pod. */
|
|
46
|
+
async start(nameOrId) {
|
|
47
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/start`;
|
|
48
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
49
|
+
if (status !== 200 && status !== 304)
|
|
50
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
51
|
+
return json;
|
|
52
|
+
}
|
|
53
|
+
/** Stop all containers in a pod with an optional timeout. */
|
|
54
|
+
async stop(nameOrId, query) {
|
|
55
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/stop${(0, query_js_1.buildQuery)(query)}`;
|
|
56
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
57
|
+
if (status !== 200 && status !== 304)
|
|
58
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
59
|
+
return json;
|
|
60
|
+
}
|
|
61
|
+
/** Restart all containers in a pod. */
|
|
62
|
+
async restart(nameOrId) {
|
|
63
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/restart`;
|
|
64
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
65
|
+
if (status !== 200)
|
|
66
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
67
|
+
return json;
|
|
68
|
+
}
|
|
69
|
+
/** Send a signal to all containers in a pod. */
|
|
70
|
+
async kill(nameOrId, query) {
|
|
71
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/kill${(0, query_js_1.buildQuery)(query)}`;
|
|
72
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
73
|
+
if (status !== 200)
|
|
74
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
75
|
+
return json;
|
|
76
|
+
}
|
|
77
|
+
/** Pause all containers in a pod. */
|
|
78
|
+
async pause(nameOrId) {
|
|
79
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/pause`;
|
|
80
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
81
|
+
if (status !== 200)
|
|
82
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
83
|
+
return json;
|
|
84
|
+
}
|
|
85
|
+
/** Unpause all containers in a pod. */
|
|
86
|
+
async unpause(nameOrId) {
|
|
87
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/unpause`;
|
|
88
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
89
|
+
if (status !== 200)
|
|
90
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
91
|
+
return json;
|
|
92
|
+
}
|
|
93
|
+
/** List processes running in the pod's containers. */
|
|
94
|
+
async top(nameOrId, query) {
|
|
95
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/top${(0, query_js_1.buildQuery)(query)}`;
|
|
96
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
97
|
+
if (status !== 200)
|
|
98
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
99
|
+
return json;
|
|
100
|
+
}
|
|
101
|
+
/** Check if a pod exists. Returns `true` on 204, `false` otherwise. */
|
|
102
|
+
async exists(nameOrId) {
|
|
103
|
+
const path = `/pods/${encodeURIComponent(nameOrId)}/exists`;
|
|
104
|
+
const { status } = await this.#t.request("GET", path);
|
|
105
|
+
return status === 204;
|
|
106
|
+
}
|
|
107
|
+
/** Get resource usage statistics for the pod's containers. */
|
|
108
|
+
async stats(query) {
|
|
109
|
+
const path = `/pods/stats${(0, query_js_1.buildQuery)(query)}`;
|
|
110
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
111
|
+
if (status !== 200)
|
|
112
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
113
|
+
return (json ?? []);
|
|
114
|
+
}
|
|
115
|
+
/** Remove all stopped pods. */
|
|
116
|
+
async prune() {
|
|
117
|
+
const path = "/pods/prune";
|
|
118
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
119
|
+
if (status !== 200)
|
|
120
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
121
|
+
return json;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.PodsApi = PodsApi;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Transport } from "../transport.js";
|
|
2
|
+
import type { ListQuadlet, QuadletRemoveAllQuery, QuadletRemoveQuery, QuadletInstallQuery, QuadletListQuery, QuadletRemoveReport } from "../types/api.js";
|
|
3
|
+
export type QuadletInstallReport = {
|
|
4
|
+
InstalledQuadlets?: Record<string, string>;
|
|
5
|
+
QuadletErrors?: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
export declare class QuadletsApi {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(transport: Transport);
|
|
10
|
+
/** Install quadlet files from a tar archive. */
|
|
11
|
+
install(body: ReadableStream<Uint8Array>, query?: QuadletInstallQuery): Promise<QuadletInstallReport>;
|
|
12
|
+
/** Remove one or more quadlets. */
|
|
13
|
+
removeAll(query?: QuadletRemoveAllQuery): Promise<QuadletRemoveReport>;
|
|
14
|
+
/** Remove a quadlet by name. */
|
|
15
|
+
remove(name: string, query?: QuadletRemoveQuery): Promise<QuadletRemoveReport>;
|
|
16
|
+
/** Check if a quadlet exists. Returns `true` on 204, `false` otherwise. */
|
|
17
|
+
exists(name: string): Promise<boolean>;
|
|
18
|
+
/** Get the contents of a quadlet file. */
|
|
19
|
+
file(name: string): Promise<string>;
|
|
20
|
+
/** List all quadlets. */
|
|
21
|
+
list(query?: QuadletListQuery): Promise<ListQuadlet[]>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=quadlets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quadlets.d.ts","sourceRoot":"","sources":["../../src/api/quadlets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAGF,qBAAa,WAAW;;gBAEV,SAAS,EAAE,SAAS;IAIhC,gDAAgD;IAC1C,OAAO,CACX,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,KAAK,CAAC,EAAE,mBAAmB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IAShC,mCAAmC;IAC7B,SAAS,CAAC,KAAK,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO5E,gCAAgC;IAC1B,MAAM,CACV,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,mBAAmB,CAAC;IAQ/B,2EAA2E;IACrE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM5C,0CAA0C;IACpC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOzC,yBAAyB;IACnB,IAAI,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAM7D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuadletsApi = void 0;
|
|
4
|
+
const errors_js_1 = require("../types/errors.js");
|
|
5
|
+
const query_js_1 = require("../internal/query.js");
|
|
6
|
+
class QuadletsApi {
|
|
7
|
+
#t;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.#t = transport;
|
|
10
|
+
}
|
|
11
|
+
/** Install quadlet files from a tar archive. */
|
|
12
|
+
async install(body, query) {
|
|
13
|
+
const path = `/quadlets${(0, query_js_1.buildQuery)(query)}`;
|
|
14
|
+
const res = await this.#t.requestRaw("POST", path, body, {
|
|
15
|
+
"Content-Type": "application/x-tar",
|
|
16
|
+
});
|
|
17
|
+
if (res.status !== 200)
|
|
18
|
+
await (0, errors_js_1.throwRawError)(res, "POST", path);
|
|
19
|
+
return (await res.json());
|
|
20
|
+
}
|
|
21
|
+
/** Remove one or more quadlets. */
|
|
22
|
+
async removeAll(query) {
|
|
23
|
+
const path = `/quadlets${(0, query_js_1.buildQuery)(query)}`;
|
|
24
|
+
const { status, json } = await this.#t.request("DELETE", path);
|
|
25
|
+
if (status !== 200)
|
|
26
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
|
|
27
|
+
return json;
|
|
28
|
+
}
|
|
29
|
+
/** Remove a quadlet by name. */
|
|
30
|
+
async remove(name, query) {
|
|
31
|
+
const path = `/quadlets/${encodeURIComponent(name)}${(0, query_js_1.buildQuery)(query)}`;
|
|
32
|
+
const { status, json } = await this.#t.request("DELETE", path);
|
|
33
|
+
if (status !== 200)
|
|
34
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
|
|
35
|
+
return json;
|
|
36
|
+
}
|
|
37
|
+
/** Check if a quadlet exists. Returns `true` on 204, `false` otherwise. */
|
|
38
|
+
async exists(name) {
|
|
39
|
+
const path = `/quadlets/${encodeURIComponent(name)}/exists`;
|
|
40
|
+
const { status } = await this.#t.request("GET", path);
|
|
41
|
+
return status === 204;
|
|
42
|
+
}
|
|
43
|
+
/** Get the contents of a quadlet file. */
|
|
44
|
+
async file(name) {
|
|
45
|
+
const path = `/quadlets/${encodeURIComponent(name)}/file`;
|
|
46
|
+
const res = await this.#t.requestRaw("GET", path);
|
|
47
|
+
if (res.status !== 200)
|
|
48
|
+
await (0, errors_js_1.throwRawError)(res, "GET", path);
|
|
49
|
+
return await res.text();
|
|
50
|
+
}
|
|
51
|
+
/** List all quadlets. */
|
|
52
|
+
async list(query) {
|
|
53
|
+
const path = `/quadlets/json${(0, query_js_1.buildQuery)(query)}`;
|
|
54
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
55
|
+
if (status !== 200)
|
|
56
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
57
|
+
return (json ?? []);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.QuadletsApi = QuadletsApi;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Transport } from "../transport.js";
|
|
2
|
+
import type { SecretCreateQuery, SecretCreateReport, SecretRemoveQuery, SecretInfoReport, SecretInspectQuery, SecretListQuery } from "../types/api.js";
|
|
3
|
+
export declare class SecretsApi {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(transport: Transport);
|
|
6
|
+
/** Create a new secret from the given data string. */
|
|
7
|
+
create(data: string, query: SecretCreateQuery): Promise<SecretCreateReport>;
|
|
8
|
+
/** Inspect a secret. Returns `null` if the secret is not found. */
|
|
9
|
+
inspect(nameOrId: string, query?: SecretInspectQuery): Promise<SecretInfoReport | null>;
|
|
10
|
+
/** List secrets, optionally filtered by the given query. */
|
|
11
|
+
list(query?: SecretListQuery): Promise<SecretInfoReport[]>;
|
|
12
|
+
/** Remove a secret. */
|
|
13
|
+
remove(nameOrId: string, query?: SecretRemoveQuery): Promise<void>;
|
|
14
|
+
/** Check if a secret exists. Returns `true` on 204, `false` otherwise. */
|
|
15
|
+
exists(nameOrId: string): Promise<boolean>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../src/api/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,UAAU;;gBAET,SAAS,EAAE,SAAS;IAIhC,sDAAsD;IAChD,MAAM,CACV,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,kBAAkB,CAAC;IAS9B,mEAAmE;IAC7D,OAAO,CACX,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IASnC,4DAA4D;IACtD,IAAI,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAOhE,uBAAuB;IACjB,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC;IAOhB,0EAA0E;IACpE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAKjD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SecretsApi = void 0;
|
|
4
|
+
const errors_js_1 = require("../types/errors.js");
|
|
5
|
+
const query_js_1 = require("../internal/query.js");
|
|
6
|
+
class SecretsApi {
|
|
7
|
+
#t;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.#t = transport;
|
|
10
|
+
}
|
|
11
|
+
/** Create a new secret from the given data string. */
|
|
12
|
+
async create(data, query) {
|
|
13
|
+
const path = `/secrets/create${(0, query_js_1.buildQuery)(query)}`;
|
|
14
|
+
const res = await this.#t.requestRaw("POST", path, data, {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
});
|
|
17
|
+
if (res.status !== 200 && res.status !== 201)
|
|
18
|
+
await (0, errors_js_1.throwRawError)(res, "POST", path);
|
|
19
|
+
return (await res.json());
|
|
20
|
+
}
|
|
21
|
+
/** Inspect a secret. Returns `null` if the secret is not found. */
|
|
22
|
+
async inspect(nameOrId, query) {
|
|
23
|
+
const path = `/secrets/${encodeURIComponent(nameOrId)}/json${(0, query_js_1.buildQuery)(query)}`;
|
|
24
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
25
|
+
if (status === 404)
|
|
26
|
+
return null;
|
|
27
|
+
if (status !== 200)
|
|
28
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
29
|
+
return json;
|
|
30
|
+
}
|
|
31
|
+
/** List secrets, optionally filtered by the given query. */
|
|
32
|
+
async list(query) {
|
|
33
|
+
const path = `/secrets/json${(0, query_js_1.buildQuery)(query)}`;
|
|
34
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
35
|
+
if (status !== 200)
|
|
36
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
37
|
+
return (json ?? []);
|
|
38
|
+
}
|
|
39
|
+
/** Remove a secret. */
|
|
40
|
+
async remove(nameOrId, query) {
|
|
41
|
+
const path = `/secrets/${encodeURIComponent(nameOrId)}${(0, query_js_1.buildQuery)(query)}`;
|
|
42
|
+
const { status, json } = await this.#t.request("DELETE", path);
|
|
43
|
+
if (status !== 204)
|
|
44
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
|
|
45
|
+
}
|
|
46
|
+
/** Check if a secret exists. Returns `true` on 204, `false` otherwise. */
|
|
47
|
+
async exists(nameOrId) {
|
|
48
|
+
const path = `/secrets/${encodeURIComponent(nameOrId)}/exists`;
|
|
49
|
+
const { status } = await this.#t.request("GET", path);
|
|
50
|
+
return status === 204;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.SecretsApi = SecretsApi;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Transport } from "../transport.js";
|
|
2
|
+
import type { LibpodInfo, SystemComponentVersion, SystemDfReport, SystemCheckQuery, SystemCheckReport, SystemEventsQuery, SystemPruneReport } from "../types/api.js";
|
|
3
|
+
export declare class SystemApi {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(transport: Transport);
|
|
6
|
+
/** Return information about the Podman host. */
|
|
7
|
+
info(): Promise<LibpodInfo>;
|
|
8
|
+
/** Return component version information for the Podman service. */
|
|
9
|
+
version(): Promise<SystemComponentVersion>;
|
|
10
|
+
/** Ping the Podman service. Returns `true` if reachable. */
|
|
11
|
+
ping(): Promise<boolean>;
|
|
12
|
+
/** Prune unused data (containers, images, volumes, networks). */
|
|
13
|
+
prune(): Promise<SystemPruneReport>;
|
|
14
|
+
/** Return disk usage information (containers, images, volumes). */
|
|
15
|
+
df(): Promise<SystemDfReport>;
|
|
16
|
+
/** Stream system events as raw bytes. */
|
|
17
|
+
events(query?: SystemEventsQuery): Promise<ReadableStream<Uint8Array>>;
|
|
18
|
+
/** Stream system events as parsed JSON objects. */
|
|
19
|
+
parsedEvents(query?: SystemEventsQuery): AsyncGenerator<Record<string, unknown>>;
|
|
20
|
+
/** Run a consistency check on container storage. */
|
|
21
|
+
check(query?: SystemCheckQuery): Promise<SystemCheckReport>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/api/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAGzB,qBAAa,SAAS;;gBAER,SAAS,EAAE,SAAS;IAIhC,gDAAgD;IAC1C,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IAOjC,mEAAmE;IAC7D,OAAO,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAOhD,4DAA4D;IACtD,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IAO9B,iEAAiE;IAC3D,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAOzC,mEAAmE;IAC7D,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC;IAOnC,yCAAyC;IACnC,MAAM,CACV,KAAK,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAKtC,mDAAmD;IAC5C,YAAY,CACjB,KAAK,CAAC,EAAE,iBAAiB,GACxB,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAkC1C,oDAAoD;IAC9C,KAAK,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAMlE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SystemApi = void 0;
|
|
4
|
+
const errors_js_1 = require("../types/errors.js");
|
|
5
|
+
const query_js_1 = require("../internal/query.js");
|
|
6
|
+
class SystemApi {
|
|
7
|
+
#t;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.#t = transport;
|
|
10
|
+
}
|
|
11
|
+
/** Return information about the Podman host. */
|
|
12
|
+
async info() {
|
|
13
|
+
const path = "/info";
|
|
14
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
15
|
+
if (status !== 200)
|
|
16
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
17
|
+
return json;
|
|
18
|
+
}
|
|
19
|
+
/** Return component version information for the Podman service. */
|
|
20
|
+
async version() {
|
|
21
|
+
const path = "/version";
|
|
22
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
23
|
+
if (status !== 200)
|
|
24
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
25
|
+
return json;
|
|
26
|
+
}
|
|
27
|
+
/** Ping the Podman service. Returns `true` if reachable. */
|
|
28
|
+
async ping() {
|
|
29
|
+
// /_ping returns plain text "OK", not JSON — use requestRaw
|
|
30
|
+
const res = await this.#t.requestRaw("GET", "/_ping");
|
|
31
|
+
await res.body?.cancel();
|
|
32
|
+
return res.status === 200;
|
|
33
|
+
}
|
|
34
|
+
/** Prune unused data (containers, images, volumes, networks). */
|
|
35
|
+
async prune() {
|
|
36
|
+
const path = "/system/prune";
|
|
37
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
38
|
+
if (status !== 200)
|
|
39
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
40
|
+
return json;
|
|
41
|
+
}
|
|
42
|
+
/** Return disk usage information (containers, images, volumes). */
|
|
43
|
+
async df() {
|
|
44
|
+
const path = "/system/df";
|
|
45
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
46
|
+
if (status !== 200)
|
|
47
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
48
|
+
return json;
|
|
49
|
+
}
|
|
50
|
+
/** Stream system events as raw bytes. */
|
|
51
|
+
async events(query) {
|
|
52
|
+
const path = `/events${(0, query_js_1.buildQuery)(query)}`;
|
|
53
|
+
return await this.#t.requestStream("GET", path);
|
|
54
|
+
}
|
|
55
|
+
/** Stream system events as parsed JSON objects. */
|
|
56
|
+
async *parsedEvents(query) {
|
|
57
|
+
const stream = await this.events(query);
|
|
58
|
+
const reader = stream.pipeThrough(new TextDecoderStream()).getReader();
|
|
59
|
+
let buffer = "";
|
|
60
|
+
try {
|
|
61
|
+
while (true) {
|
|
62
|
+
const { done, value } = await reader.read();
|
|
63
|
+
if (done)
|
|
64
|
+
break;
|
|
65
|
+
buffer += value;
|
|
66
|
+
const lines = buffer.split("\n");
|
|
67
|
+
buffer = lines.pop() ?? "";
|
|
68
|
+
for (const line of lines) {
|
|
69
|
+
const trimmed = line.trim();
|
|
70
|
+
if (trimmed) {
|
|
71
|
+
try {
|
|
72
|
+
yield JSON.parse(trimmed);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Skip malformed JSON lines (e.g. truncated stream)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (buffer.trim()) {
|
|
81
|
+
try {
|
|
82
|
+
yield JSON.parse(buffer.trim());
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Skip malformed trailing data
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
reader.releaseLock();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Run a consistency check on container storage. */
|
|
94
|
+
async check(query) {
|
|
95
|
+
const path = `/system/check${(0, query_js_1.buildQuery)(query)}`;
|
|
96
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
97
|
+
if (status !== 200)
|
|
98
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
99
|
+
return json;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.SystemApi = SystemApi;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Transport } from "../transport.js";
|
|
2
|
+
import type { VolumeConfigResponse, VolumeCreateOptions, VolumeRemoveQuery, VolumeListQuery, VolumePruneQuery, VolumePruneReport } from "../types/api.js";
|
|
3
|
+
export declare class VolumesApi {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(transport: Transport);
|
|
6
|
+
/** Create a new volume. */
|
|
7
|
+
create(opts: VolumeCreateOptions): Promise<VolumeConfigResponse>;
|
|
8
|
+
/** Inspect a volume. Returns `null` if the volume is not found. */
|
|
9
|
+
inspect(nameOrId: string): Promise<VolumeConfigResponse | null>;
|
|
10
|
+
/** List volumes, optionally filtered by the given query. */
|
|
11
|
+
list(query?: VolumeListQuery): Promise<VolumeConfigResponse[]>;
|
|
12
|
+
/** Remove a volume. */
|
|
13
|
+
remove(nameOrId: string, query?: VolumeRemoveQuery): Promise<void>;
|
|
14
|
+
/** Check if a volume exists. Returns `true` on 204, `false` otherwise. */
|
|
15
|
+
exists(nameOrId: string): Promise<boolean>;
|
|
16
|
+
/** Remove unused volumes. Returns a list of pruned volumes. */
|
|
17
|
+
prune(query?: VolumePruneQuery): Promise<VolumePruneReport[]>;
|
|
18
|
+
/** Export a volume as a tar archive stream. */
|
|
19
|
+
export(nameOrId: string): Promise<ReadableStream<Uint8Array>>;
|
|
20
|
+
/** Import a tar archive into a volume. */
|
|
21
|
+
import(nameOrId: string, body: ReadableStream<Uint8Array>): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=volumes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"volumes.d.ts","sourceRoot":"","sources":["../../src/api/volumes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,UAAU;;gBAET,SAAS,EAAE,SAAS;IAIhC,2BAA2B;IACrB,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOtE,mEAAmE;IAC7D,OAAO,CACX,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAQvC,4DAA4D;IACtD,IAAI,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAOpE,uBAAuB;IACjB,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC;IAOhB,0EAA0E;IACpE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMhD,+DAA+D;IACzD,KAAK,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAOnE,+CAA+C;IACzC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAKnE,0CAA0C;IACpC,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC;CAOjB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolumesApi = void 0;
|
|
4
|
+
const errors_js_1 = require("../types/errors.js");
|
|
5
|
+
const query_js_1 = require("../internal/query.js");
|
|
6
|
+
class VolumesApi {
|
|
7
|
+
#t;
|
|
8
|
+
constructor(transport) {
|
|
9
|
+
this.#t = transport;
|
|
10
|
+
}
|
|
11
|
+
/** Create a new volume. */
|
|
12
|
+
async create(opts) {
|
|
13
|
+
const path = "/volumes/create";
|
|
14
|
+
const { status, json } = await this.#t.request("POST", path, opts);
|
|
15
|
+
if (status !== 201)
|
|
16
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
17
|
+
return json;
|
|
18
|
+
}
|
|
19
|
+
/** Inspect a volume. Returns `null` if the volume is not found. */
|
|
20
|
+
async inspect(nameOrId) {
|
|
21
|
+
const path = `/volumes/${encodeURIComponent(nameOrId)}/json`;
|
|
22
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
23
|
+
if (status === 404)
|
|
24
|
+
return null;
|
|
25
|
+
if (status !== 200)
|
|
26
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
27
|
+
return json;
|
|
28
|
+
}
|
|
29
|
+
/** List volumes, optionally filtered by the given query. */
|
|
30
|
+
async list(query) {
|
|
31
|
+
const path = `/volumes/json${(0, query_js_1.buildQuery)(query)}`;
|
|
32
|
+
const { status, json } = await this.#t.request("GET", path);
|
|
33
|
+
if (status !== 200)
|
|
34
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
|
|
35
|
+
return (json ?? []);
|
|
36
|
+
}
|
|
37
|
+
/** Remove a volume. */
|
|
38
|
+
async remove(nameOrId, query) {
|
|
39
|
+
const path = `/volumes/${encodeURIComponent(nameOrId)}${(0, query_js_1.buildQuery)(query)}`;
|
|
40
|
+
const { status, json } = await this.#t.request("DELETE", path);
|
|
41
|
+
if (status !== 204)
|
|
42
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
|
|
43
|
+
}
|
|
44
|
+
/** Check if a volume exists. Returns `true` on 204, `false` otherwise. */
|
|
45
|
+
async exists(nameOrId) {
|
|
46
|
+
const path = `/volumes/${encodeURIComponent(nameOrId)}/exists`;
|
|
47
|
+
const { status } = await this.#t.request("GET", path);
|
|
48
|
+
return status === 204;
|
|
49
|
+
}
|
|
50
|
+
/** Remove unused volumes. Returns a list of pruned volumes. */
|
|
51
|
+
async prune(query) {
|
|
52
|
+
const path = `/volumes/prune${(0, query_js_1.buildQuery)(query)}`;
|
|
53
|
+
const { status, json } = await this.#t.request("POST", path);
|
|
54
|
+
if (status !== 200)
|
|
55
|
+
throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
|
|
56
|
+
return (json ?? []);
|
|
57
|
+
}
|
|
58
|
+
/** Export a volume as a tar archive stream. */
|
|
59
|
+
async export(nameOrId) {
|
|
60
|
+
const path = `/volumes/${encodeURIComponent(nameOrId)}/export`;
|
|
61
|
+
return await this.#t.requestStream("GET", path);
|
|
62
|
+
}
|
|
63
|
+
/** Import a tar archive into a volume. */
|
|
64
|
+
async import(nameOrId, body) {
|
|
65
|
+
const path = `/volumes/${encodeURIComponent(nameOrId)}/import`;
|
|
66
|
+
const res = await this.#t.requestRaw("POST", path, body, {
|
|
67
|
+
"Content-Type": "application/x-tar",
|
|
68
|
+
});
|
|
69
|
+
if (res.status !== 204)
|
|
70
|
+
await (0, errors_js_1.throwRawError)(res, "POST", path);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.VolumesApi = VolumesApi;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type TlsOptions } from "./transport.js";
|
|
2
|
+
import { type SshTransportOptions } from "./ssh_transport.js";
|
|
3
|
+
import type { AuthOption } from "./transport_core.js";
|
|
4
|
+
import { ContainersApi } from "./api/containers.js";
|
|
5
|
+
import { ImagesApi } from "./api/images.js";
|
|
6
|
+
import { NetworksApi } from "./api/networks.js";
|
|
7
|
+
import { VolumesApi } from "./api/volumes.js";
|
|
8
|
+
import { PodsApi } from "./api/pods.js";
|
|
9
|
+
import { SecretsApi } from "./api/secrets.js";
|
|
10
|
+
import { SystemApi } from "./api/system.js";
|
|
11
|
+
import { ExecApi } from "./api/exec.js";
|
|
12
|
+
import { GenerateApi } from "./api/generate.js";
|
|
13
|
+
import { ManifestsApi } from "./api/manifests.js";
|
|
14
|
+
import { KubeApi } from "./api/kube.js";
|
|
15
|
+
import { ArtifactsApi } from "./api/artifacts.js";
|
|
16
|
+
import { QuadletsApi } from "./api/quadlets.js";
|
|
17
|
+
/** Options for connecting to Podman via a Unix socket. */
|
|
18
|
+
export interface UnixClientOptions {
|
|
19
|
+
socketPath: string;
|
|
20
|
+
apiVersion?: string;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
auth?: AuthOption;
|
|
23
|
+
}
|
|
24
|
+
/** Options for connecting to Podman via TCP or TLS. */
|
|
25
|
+
export interface TcpClientOptions {
|
|
26
|
+
uri: string;
|
|
27
|
+
apiVersion?: string;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
auth?: AuthOption;
|
|
30
|
+
tls?: TlsOptions;
|
|
31
|
+
}
|
|
32
|
+
/** Union of all client connection options (Unix socket or TCP/TLS). */
|
|
33
|
+
export type ClientOptions = UnixClientOptions | TcpClientOptions;
|
|
34
|
+
export type SshClientOptions = SshTransportOptions;
|
|
35
|
+
/** Client interface exposing all 13 Podman libpod API modules. */
|
|
36
|
+
export interface PodmanClient {
|
|
37
|
+
containers: ContainersApi;
|
|
38
|
+
images: ImagesApi;
|
|
39
|
+
networks: NetworksApi;
|
|
40
|
+
volumes: VolumesApi;
|
|
41
|
+
pods: PodsApi;
|
|
42
|
+
secrets: SecretsApi;
|
|
43
|
+
system: SystemApi;
|
|
44
|
+
exec: ExecApi;
|
|
45
|
+
generate: GenerateApi;
|
|
46
|
+
manifests: ManifestsApi;
|
|
47
|
+
kube: KubeApi;
|
|
48
|
+
artifacts: ArtifactsApi;
|
|
49
|
+
quadlets: QuadletsApi;
|
|
50
|
+
close(): void;
|
|
51
|
+
}
|
|
52
|
+
/** Create a Podman client using a Unix socket or TCP/TLS connection. */
|
|
53
|
+
export declare function createClient(opts: ClientOptions): PodmanClient;
|
|
54
|
+
/** Create a Podman client tunneled over SSH. Requires `ssh` on the local machine. */
|
|
55
|
+
export declare function createSshClient(opts: SshClientOptions): Promise<PodmanClient>;
|
|
56
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,GAAG,CAAC,EAAE,UAAU,CAAC;CAClB;AAED,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAEnD,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,WAAW,CAAC;IACtB,OAAO,EAAE,UAAU,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,YAAY,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,YAAY,CAAC;IACxB,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,IAAI,IAAI,CAAC;CACf;AAuBD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CAsB9D;AAED,qFAAqF;AACrF,wBAAsB,eAAe,CACnC,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,YAAY,CAAC,CAGvB"}
|
package/script/client.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createClient = createClient;
|
|
4
|
+
exports.createSshClient = createSshClient;
|
|
5
|
+
const transport_js_1 = require("./transport.js");
|
|
6
|
+
const ssh_transport_js_1 = require("./ssh_transport.js");
|
|
7
|
+
const containers_js_1 = require("./api/containers.js");
|
|
8
|
+
const images_js_1 = require("./api/images.js");
|
|
9
|
+
const networks_js_1 = require("./api/networks.js");
|
|
10
|
+
const volumes_js_1 = require("./api/volumes.js");
|
|
11
|
+
const pods_js_1 = require("./api/pods.js");
|
|
12
|
+
const secrets_js_1 = require("./api/secrets.js");
|
|
13
|
+
const system_js_1 = require("./api/system.js");
|
|
14
|
+
const exec_js_1 = require("./api/exec.js");
|
|
15
|
+
const generate_js_1 = require("./api/generate.js");
|
|
16
|
+
const manifests_js_1 = require("./api/manifests.js");
|
|
17
|
+
const kube_js_1 = require("./api/kube.js");
|
|
18
|
+
const artifacts_js_1 = require("./api/artifacts.js");
|
|
19
|
+
const quadlets_js_1 = require("./api/quadlets.js");
|
|
20
|
+
function buildPodmanClient(transport) {
|
|
21
|
+
return {
|
|
22
|
+
containers: new containers_js_1.ContainersApi(transport),
|
|
23
|
+
images: new images_js_1.ImagesApi(transport),
|
|
24
|
+
networks: new networks_js_1.NetworksApi(transport),
|
|
25
|
+
volumes: new volumes_js_1.VolumesApi(transport),
|
|
26
|
+
pods: new pods_js_1.PodsApi(transport),
|
|
27
|
+
secrets: new secrets_js_1.SecretsApi(transport),
|
|
28
|
+
system: new system_js_1.SystemApi(transport),
|
|
29
|
+
exec: new exec_js_1.ExecApi(transport),
|
|
30
|
+
generate: new generate_js_1.GenerateApi(transport),
|
|
31
|
+
manifests: new manifests_js_1.ManifestsApi(transport),
|
|
32
|
+
kube: new kube_js_1.KubeApi(transport),
|
|
33
|
+
artifacts: new artifacts_js_1.ArtifactsApi(transport),
|
|
34
|
+
quadlets: new quadlets_js_1.QuadletsApi(transport),
|
|
35
|
+
close() {
|
|
36
|
+
transport.close();
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Create a Podman client using a Unix socket or TCP/TLS connection. */
|
|
41
|
+
function createClient(opts) {
|
|
42
|
+
let transport;
|
|
43
|
+
if ("socketPath" in opts) {
|
|
44
|
+
const transportOpts = {
|
|
45
|
+
socketPath: opts.socketPath,
|
|
46
|
+
apiVersion: opts.apiVersion,
|
|
47
|
+
timeout: opts.timeout,
|
|
48
|
+
auth: opts.auth,
|
|
49
|
+
};
|
|
50
|
+
transport = (0, transport_js_1.createTransport)(transportOpts);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
transport = (0, transport_js_1.createTcpTransport)({
|
|
54
|
+
uri: opts.uri,
|
|
55
|
+
apiVersion: opts.apiVersion,
|
|
56
|
+
timeout: opts.timeout,
|
|
57
|
+
auth: opts.auth,
|
|
58
|
+
tls: opts.tls,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return buildPodmanClient(transport);
|
|
62
|
+
}
|
|
63
|
+
/** Create a Podman client tunneled over SSH. Requires `ssh` on the local machine. */
|
|
64
|
+
async function createSshClient(opts) {
|
|
65
|
+
const transport = await (0, ssh_transport_js_1.createSshTransport)(opts);
|
|
66
|
+
return buildPodmanClient(transport);
|
|
67
|
+
}
|