@codiac.io/codiac-cli 1.3.196 → 1.3.201
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 +376 -157
- package/dist/apis/codiac-api/common/api-client-base.js +7 -8
- package/dist/apis/codiac-api/common/api-client-base.js.map +1 -1
- package/dist/apis/codiac-api/gen/contracts/types.gen.d.ts +34 -2
- package/dist/apis/codiac-api/gen/contracts/types.gen.js +8 -1
- package/dist/apis/codiac-api/gen/contracts/types.gen.js.map +1 -1
- package/dist/apis/codiac-relay/common/api-client-base.js +7 -8
- package/dist/apis/codiac-relay/common/api-client-base.js.map +1 -1
- package/dist/commands/asset/create.js +37 -10
- package/dist/commands/asset/create.js.map +1 -1
- package/dist/commands/pvc/create.d.ts +42 -0
- package/dist/commands/pvc/create.js +213 -0
- package/dist/commands/pvc/create.js.map +1 -0
- package/dist/commands/pvc/delete.d.ts +32 -0
- package/dist/commands/pvc/delete.js +145 -0
- package/dist/commands/pvc/delete.js.map +1 -0
- package/dist/commands/pvc/get.d.ts +32 -0
- package/dist/commands/pvc/get.js +113 -0
- package/dist/commands/pvc/get.js.map +1 -0
- package/dist/commands/pvc/list.d.ts +33 -0
- package/dist/commands/pvc/list.js +138 -0
- package/dist/commands/pvc/list.js.map +1 -0
- package/dist/relay/relay-container.js +1 -1
- package/oclif.manifest.json +492 -1
- package/package.json +2 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const contracts_1 = require("../../apis/codiac-api/contracts");
|
|
6
|
+
const command_base_exec_1 = require("../../command-base-exec");
|
|
7
|
+
const prettify_1 = require("../../prettify");
|
|
8
|
+
/** Filestore types that this command will provision as a Kubernetes PersistentVolumeClaim. */
|
|
9
|
+
const PVC_TYPES = [
|
|
10
|
+
contracts_1.FileStoreTypeEnum.azureFileStorage,
|
|
11
|
+
contracts_1.FileStoreTypeEnum.azureDisk,
|
|
12
|
+
contracts_1.FileStoreTypeEnum.azureBlobStorage,
|
|
13
|
+
contracts_1.FileStoreTypeEnum.azureNetAppFiles,
|
|
14
|
+
];
|
|
15
|
+
class PvcCreate extends command_base_exec_1.CommandBaseExec {
|
|
16
|
+
captureArgs() {
|
|
17
|
+
var _a;
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const { flags } = yield this.parse(PvcCreate);
|
|
20
|
+
let partial = {};
|
|
21
|
+
if (flags.enterprise)
|
|
22
|
+
partial.enterprise = flags.enterprise;
|
|
23
|
+
if (flags.name)
|
|
24
|
+
partial.name = flags.name;
|
|
25
|
+
if (flags.provider)
|
|
26
|
+
partial.provider = flags.provider;
|
|
27
|
+
if (flags.type)
|
|
28
|
+
partial.type = flags.type;
|
|
29
|
+
if (flags["share-name"])
|
|
30
|
+
partial.shareName = flags["share-name"];
|
|
31
|
+
if (flags["storage-class"])
|
|
32
|
+
partial.storageClass = flags["storage-class"];
|
|
33
|
+
if (flags["access-modes"])
|
|
34
|
+
partial.accessModes = PvcCreate.parseAccessModes(flags["access-modes"]);
|
|
35
|
+
if (flags.size)
|
|
36
|
+
partial.storageRequest = flags.size;
|
|
37
|
+
if (flags["volume-name"])
|
|
38
|
+
partial.volumeName = flags["volume-name"];
|
|
39
|
+
const takeDefaults = (_a = flags['take-defaults']) !== null && _a !== void 0 ? _a : false;
|
|
40
|
+
return [partial, takeDefaults];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
buildCandidate_silently(partial, rootMap) {
|
|
44
|
+
var _a, _b;
|
|
45
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (!partial.name || partial.name.trim() == "")
|
|
47
|
+
throw new Error("--name is required.");
|
|
48
|
+
const provider = (_a = partial.provider) !== null && _a !== void 0 ? _a : contracts_1.CloudProviderEnum.azure;
|
|
49
|
+
if (provider !== contracts_1.CloudProviderEnum.azure) {
|
|
50
|
+
throw new Error("Only --provider azure is supported at this time.");
|
|
51
|
+
}
|
|
52
|
+
const type = (_b = partial.type) !== null && _b !== void 0 ? _b : contracts_1.FileStoreTypeEnum.azureFileStorage;
|
|
53
|
+
if (!PVC_TYPES.includes(type)) {
|
|
54
|
+
throw new Error(`--type must be one of: ${PVC_TYPES.join(", ")}.`);
|
|
55
|
+
}
|
|
56
|
+
return this.assemble(partial, provider, type);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
buildCandidate_interactively(partial, rootMap, takeDefaults) {
|
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
if (!partial.name || partial.name.trim() == "") {
|
|
62
|
+
partial.name = (yield this._ui.prompt("pvcName", "Name for this PVC filestore", true));
|
|
63
|
+
}
|
|
64
|
+
if (!partial.name || partial.name.trim() == "") {
|
|
65
|
+
this._ui.userMessage("Name is required.");
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
if (!partial.provider) {
|
|
69
|
+
partial.provider = contracts_1.CloudProviderEnum.azure;
|
|
70
|
+
}
|
|
71
|
+
if (partial.provider !== contracts_1.CloudProviderEnum.azure) {
|
|
72
|
+
this._ui.userMessage("Only Azure is supported for PVC creation at this time.");
|
|
73
|
+
this.exit(1);
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
if (!partial.type) {
|
|
77
|
+
const choices = PVC_TYPES.map(v => ({ name: v, value: v }));
|
|
78
|
+
partial.type = (yield this._ui.promptSelect("pvcType", "Select the file storage type", choices));
|
|
79
|
+
}
|
|
80
|
+
const candidate = this.assemble(partial, partial.provider, partial.type);
|
|
81
|
+
if (!candidate)
|
|
82
|
+
return undefined;
|
|
83
|
+
this._ui.userMessage((0, prettify_1.prettify)(candidate));
|
|
84
|
+
const confirmed = yield this._ui.promptConfirm("pvcConfirm", `Create PVC filestore [${candidate.name}] (type: ${candidate.type})?`, true);
|
|
85
|
+
return confirmed ? candidate : undefined;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
buildCommandString(candidate, cmd) {
|
|
89
|
+
cmd.push("--silent");
|
|
90
|
+
cmd.push("--enterprise", candidate.enterprise);
|
|
91
|
+
cmd.push("--name", candidate.name);
|
|
92
|
+
cmd.push("--provider", candidate.provider);
|
|
93
|
+
cmd.push("--type", candidate.type);
|
|
94
|
+
if (candidate.shareName && candidate.shareName !== candidate.name)
|
|
95
|
+
cmd.push("--share-name", candidate.shareName);
|
|
96
|
+
if (candidate.storageClass)
|
|
97
|
+
cmd.push("--storage-class", candidate.storageClass);
|
|
98
|
+
if (candidate.accessModes && candidate.accessModes.length > 0)
|
|
99
|
+
cmd.push("--access-modes", candidate.accessModes.join(","));
|
|
100
|
+
if (candidate.storageRequest)
|
|
101
|
+
cmd.push("--size", candidate.storageRequest);
|
|
102
|
+
if (candidate.volumeName)
|
|
103
|
+
cmd.push("--volume-name", candidate.volumeName);
|
|
104
|
+
return cmd;
|
|
105
|
+
}
|
|
106
|
+
executeTask(candidate) {
|
|
107
|
+
var _a, _b;
|
|
108
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
try {
|
|
110
|
+
const result = yield this._codiacApi.FileStoreDef.tryCreate(candidate);
|
|
111
|
+
if (result.error)
|
|
112
|
+
throw result.error;
|
|
113
|
+
if (!result.success || !result.output)
|
|
114
|
+
throw new Error(`Failed without error writing FileStoreDef record [${candidate.name}]: ${result.message}.`);
|
|
115
|
+
const msg = `${this._styler.colorGood("SUCCESS!")} Created PVC filestore ${this._styler.bold(this._styler.hilite(candidate.name))} (type: ${candidate.type}).`;
|
|
116
|
+
this.logger.notice(msg, result.output);
|
|
117
|
+
this._ui.userMessage(msg);
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
this.logger.error((_b = (_a = err.message) !== null && _a !== void 0 ? _a : err.stack) !== null && _b !== void 0 ? _b : err, candidate);
|
|
121
|
+
throw err;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/** Builds the FileStoreDef-shaped candidate from the resolved partial. */
|
|
126
|
+
assemble(partial, provider, type) {
|
|
127
|
+
var _a;
|
|
128
|
+
const name = partial.name;
|
|
129
|
+
const shareName = (_a = partial.shareName) !== null && _a !== void 0 ? _a : name;
|
|
130
|
+
const audit = this.createAuditable();
|
|
131
|
+
const candidate = Object.assign({ name,
|
|
132
|
+
shareName,
|
|
133
|
+
provider,
|
|
134
|
+
type,
|
|
135
|
+
// Sentinel value to signify "this filestore is not bound to a CSP subscription".
|
|
136
|
+
// The PVC path doesn't use the CSP subscription, but the field is required by FileStoreDef.
|
|
137
|
+
providerSubscriptionId: "pvc", instance: undefined, enterprise: partial.enterprise }, audit);
|
|
138
|
+
if (partial.storageClass)
|
|
139
|
+
candidate.storageClass = partial.storageClass;
|
|
140
|
+
if (partial.accessModes && partial.accessModes.length > 0)
|
|
141
|
+
candidate.accessModes = partial.accessModes;
|
|
142
|
+
if (partial.storageRequest)
|
|
143
|
+
candidate.storageRequest = partial.storageRequest;
|
|
144
|
+
if (partial.volumeName)
|
|
145
|
+
candidate.volumeName = partial.volumeName;
|
|
146
|
+
return candidate;
|
|
147
|
+
}
|
|
148
|
+
/** Parses a comma-separated string of access modes into the typed enum array.
|
|
149
|
+
* Throws on any unrecognized value to fail loudly rather than silently dropping. */
|
|
150
|
+
static parseAccessModes(raw) {
|
|
151
|
+
const allowed = new Set(Object.values(contracts_1.K8sAccessModeEnum));
|
|
152
|
+
const tokens = raw.split(",").map(s => s.trim()).filter(s => s.length > 0);
|
|
153
|
+
const out = [];
|
|
154
|
+
for (const t of tokens) {
|
|
155
|
+
if (!allowed.has(t)) {
|
|
156
|
+
throw new Error(`Invalid access mode '${t}'. Allowed values: ${Object.values(contracts_1.K8sAccessModeEnum).join(", ")}.`);
|
|
157
|
+
}
|
|
158
|
+
out.push(t);
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.default = PvcCreate;
|
|
164
|
+
PvcCreate.description = 'Defines a new PersistentVolumeClaim-backed filestore for the given enterprise. The filestore is realized as a PVC in the target cabinet at deploy time, using either a Kubernetes StorageClass for dynamic provisioning or a pre-existing PersistentVolume for static binding.';
|
|
165
|
+
PvcCreate.aliases = ['pvc:create'];
|
|
166
|
+
PvcCreate.dependsOn = ["enterprise", "name"];
|
|
167
|
+
PvcCreate.examples = [
|
|
168
|
+
{
|
|
169
|
+
description: 'Azure File share, dynamic provisioning, default size.',
|
|
170
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name shared-files --type AzureFileStorage',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
description: 'Azure Disk per-asset (block storage), 50Gi.',
|
|
174
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name app-disk --type AzureDisk --size 50Gi',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
description: 'Azure Blob (fuse), 100Gi, statically bound to a pre-existing PV.',
|
|
178
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name pvc-blob --type AzureBlobStorage --size 100Gi --volume-name pv-blob-ingestion',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
description: 'Azure NetApp Files, statically bound, 700Gi.',
|
|
182
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name pvc-nfs41-document-vault --type AzureNetAppFiles --size 700Gi --volume-name pv-nfs41-document-vault',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
description: 'Override the default storage class (e.g., the in-tree azurefile class) on a non-prefixed PVC name.',
|
|
186
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name app-documents-share --type AzureFileStorage --size 700Gi --storage-class azurefile --access-modes ReadWriteMany',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
description: 'Non-interactive (scripted) invocation.',
|
|
190
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name shared-files --type AzureFileStorage --silent',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
description: 'Renders the equivalent silent command and then executes.',
|
|
194
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name shared-files --type AzureFileStorage --echo',
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
PvcCreate.flags = {
|
|
198
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
199
|
+
enterprise: core_1.Flags.string({ char: 'e', required: false, description: 'Code name identifying the enterprise that will own this filestore reference.' }),
|
|
200
|
+
name: core_1.Flags.string({ char: 'n', required: false, description: 'Name by which this filestore is identified within the enterprise. Used to derive the PVC name.' }),
|
|
201
|
+
provider: core_1.Flags.string({ required: false, options: Object.values(contracts_1.CloudProviderEnum), description: `Cloud provider hosting the underlying storage (defaults to ${contracts_1.CloudProviderEnum.azure}; only Azure is supported at this time).` }),
|
|
202
|
+
type: core_1.Flags.string({ char: 't', required: false, options: PVC_TYPES, description: `Storage technology backing the PVC (defaults to ${contracts_1.FileStoreTypeEnum.azureFileStorage}).` }),
|
|
203
|
+
"share-name": core_1.Flags.string({ required: false, description: "Underlying physical share name (used by the legacy AzureFileStorage path; ignored for native PVC types). Defaults to the value of --name." }),
|
|
204
|
+
"storage-class": core_1.Flags.string({ required: false, description: "Kubernetes StorageClass to bind to (e.g. 'azurefile', 'azureblob-fuse-premium', 'azure-netapp-files', 'managed-csi'). Defaults to a sensible per-type class when omitted." }),
|
|
205
|
+
"access-modes": core_1.Flags.string({ required: false, description: `Comma-separated PVC access modes (e.g. 'ReadWriteMany' or 'ReadWriteOnce,ReadOnlyMany'). Defaults to RWO for block storage, RWM for file/object/NAS storage. Allowed values: ${Object.values(contracts_1.K8sAccessModeEnum).join(", ")}.` }),
|
|
206
|
+
size: core_1.Flags.string({ required: false, description: "Storage capacity request as a Kubernetes quantity (e.g. '5Gi', '100Gi', '700Gi'). Defaults to 500Mi." }),
|
|
207
|
+
"volume-name": core_1.Flags.string({ required: false, description: "Name of a pre-existing PersistentVolume to bind to. When set, the PVC binds statically to that PV instead of triggering dynamic provisioning." }),
|
|
208
|
+
silent: core_1.Flags.boolean({ dependsOn: PvcCreate.dependsOn, required: false, exclusive: ["echo", "to-script"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
|
|
209
|
+
echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
|
|
210
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
211
|
+
"take-defaults": core_1.Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode)." }),
|
|
212
|
+
};
|
|
213
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/pvc/create.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AAEpC,+DAAiI;AACjI,+DAA0D;AAC1D,6CAA0C;AAQ1C,8FAA8F;AAC9F,MAAM,SAAS,GAAwB;IACnC,6BAAiB,CAAC,gBAAgB;IAClC,6BAAiB,CAAC,SAAS;IAC3B,6BAAiB,CAAC,gBAAgB;IAClC,6BAAiB,CAAC,gBAAgB;CACrC,CAAC;AAGF,MAAqB,SAAU,SAAQ,mCAAiC;IAyDvD,WAAW;;;YACpB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAE9C,IAAI,OAAO,GAA8B,EAAE,CAAC;YAC5C,IAAI,KAAK,CAAC,UAAU;gBAAE,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAC5D,IAAI,KAAK,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,GAAG,K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QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAC5J,aAAa,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,+IAA+I,EAAE,CAAC;IAE9M,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IACvO,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,uKAAuK,EAAE,CAAC;CAClP,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AtLeast } from "@codiac.io/codiac-common/contracts";
|
|
2
|
+
import { RootMap } from '../../apis/codiac-api/contracts';
|
|
3
|
+
import { CommandBaseExec } from '../../command-base-exec';
|
|
4
|
+
type IPvcDelete = {
|
|
5
|
+
enterprise: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
export default class PvcDelete extends CommandBaseExec<IPvcDelete> {
|
|
10
|
+
static description: string;
|
|
11
|
+
static aliases: string[];
|
|
12
|
+
static examples: {
|
|
13
|
+
description: string;
|
|
14
|
+
command: string;
|
|
15
|
+
}[];
|
|
16
|
+
static flags: {
|
|
17
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
18
|
+
enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
+
id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
21
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
25
|
+
};
|
|
26
|
+
captureArgs(): Promise<[Partial<IPvcDelete>, boolean]>;
|
|
27
|
+
buildCandidate_silently(partial: AtLeast<IPvcDelete, 'enterprise'>, rootMap: RootMap): Promise<IPvcDelete | undefined>;
|
|
28
|
+
buildCandidate_interactively(partial: AtLeast<IPvcDelete, 'enterprise'>, rootMap: RootMap, takeDefaults: boolean): Promise<IPvcDelete | undefined>;
|
|
29
|
+
buildCommandString(candidate: IPvcDelete, cmd: string[]): string[];
|
|
30
|
+
executeTask(candidate: IPvcDelete): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const command_base_exec_1 = require("../../command-base-exec");
|
|
7
|
+
const list_1 = require("../filestore/list");
|
|
8
|
+
const list_2 = require("./list");
|
|
9
|
+
class PvcDelete extends command_base_exec_1.CommandBaseExec {
|
|
10
|
+
captureArgs() {
|
|
11
|
+
var _a;
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const { flags } = yield this.parse(PvcDelete);
|
|
14
|
+
const partial = {};
|
|
15
|
+
if (flags.enterprise)
|
|
16
|
+
partial.enterprise = flags.enterprise;
|
|
17
|
+
if (flags.name)
|
|
18
|
+
partial.name = flags.name;
|
|
19
|
+
if (flags.id)
|
|
20
|
+
partial.id = flags.id;
|
|
21
|
+
const takeDefaults = (_a = flags['take-defaults']) !== null && _a !== void 0 ? _a : false;
|
|
22
|
+
return [partial, takeDefaults];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
buildCandidate_silently(partial, rootMap) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (_.isEmpty(partial.id) && _.isEmpty(partial.name)) {
|
|
28
|
+
throw new Error("Provide either --name or --id.");
|
|
29
|
+
}
|
|
30
|
+
if (!partial.id) {
|
|
31
|
+
const found = yield this._codiacApi.FileStoreDef.readMany({ name: { $eq: partial.name } }, { throwNotFound: false });
|
|
32
|
+
const pvcMatches = found.filter(list_2.isPvcFileStore);
|
|
33
|
+
if (pvcMatches.length === 0) {
|
|
34
|
+
this._ui.userMessage(`No PVC filestore named [${partial.name}] was found; no work to do.`);
|
|
35
|
+
this.exit(0);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (pvcMatches.length > 1) {
|
|
39
|
+
throw new Error(`Multiple PVC filestores match name [${partial.name}]. Resolve with --id.`);
|
|
40
|
+
}
|
|
41
|
+
partial.id = pvcMatches[0].id;
|
|
42
|
+
}
|
|
43
|
+
const candidate = {
|
|
44
|
+
enterprise: partial.enterprise,
|
|
45
|
+
id: partial.id,
|
|
46
|
+
};
|
|
47
|
+
if (partial.name)
|
|
48
|
+
candidate.name = partial.name;
|
|
49
|
+
return candidate;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
buildCandidate_interactively(partial, rootMap, takeDefaults) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const all = yield this._codiacApi.FileStoreDef.readMany({ all: true });
|
|
55
|
+
const pvcList = all.filter(list_2.isPvcFileStore);
|
|
56
|
+
if (pvcList.length === 0) {
|
|
57
|
+
this._ui.userMessage("There are no PVC filestores defined. No work to do.");
|
|
58
|
+
this.exit(0);
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
let selected;
|
|
62
|
+
const matched = pvcList.filter(fs => fs.id === partial.id || fs.name === partial.name);
|
|
63
|
+
if (matched.length === 1) {
|
|
64
|
+
selected = matched[0];
|
|
65
|
+
}
|
|
66
|
+
else if (pvcList.length === 1) {
|
|
67
|
+
selected = pvcList[0];
|
|
68
|
+
}
|
|
69
|
+
let keep = false;
|
|
70
|
+
if (selected) {
|
|
71
|
+
keep = yield this._ui.promptConfirm("confirmPvc", "Delete: ".concat(list_1.FileStoreUiLogic.displayNameFor(selected, this._styler)), false);
|
|
72
|
+
}
|
|
73
|
+
if (!selected || !keep) {
|
|
74
|
+
if (pvcList.length === 1) {
|
|
75
|
+
this._ui.userMessage("There are no other PVC filestores. No work was done.");
|
|
76
|
+
this.exit(0);
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const choices = pvcList.map(x => ({ name: list_1.FileStoreUiLogic.displayNameFor(x, this._styler, false), value: x.id }));
|
|
80
|
+
partial.id = (yield this._ui.promptSelect("pvc", "Delete: ", choices, false, false));
|
|
81
|
+
selected = pvcList.find(x => x.id === partial.id);
|
|
82
|
+
}
|
|
83
|
+
const candidate = {
|
|
84
|
+
enterprise: partial.enterprise,
|
|
85
|
+
id: selected.id,
|
|
86
|
+
name: selected.name,
|
|
87
|
+
};
|
|
88
|
+
return candidate;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
buildCommandString(candidate, cmd) {
|
|
92
|
+
if (candidate.enterprise)
|
|
93
|
+
cmd.push("--enterprise", candidate.enterprise);
|
|
94
|
+
if (candidate.name) {
|
|
95
|
+
cmd.push("--name", candidate.name);
|
|
96
|
+
}
|
|
97
|
+
else if (candidate.id) {
|
|
98
|
+
cmd.push("--id", candidate.id);
|
|
99
|
+
}
|
|
100
|
+
cmd.push("--silent");
|
|
101
|
+
return cmd;
|
|
102
|
+
}
|
|
103
|
+
executeTask(candidate) {
|
|
104
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const result = yield this._codiacApi.FileStoreDef.tryDelete({ id: candidate.id });
|
|
106
|
+
if (result.error)
|
|
107
|
+
throw result.error;
|
|
108
|
+
if (result.success !== true) {
|
|
109
|
+
this._ui.userMessage("Item not found; no work to do.");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (result.output) {
|
|
113
|
+
this._ui.userMessage(`${this._styler.colorGood("SUCCESS")}: removed PVC filestore [${result.output.name}].`);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.default = PvcDelete;
|
|
119
|
+
PvcDelete.description = 'Deletes a PersistentVolumeClaim-backed filestore definition. Removes the FileStoreDef record in Codiac; physical PVCs in cabinets are reaped on the next deploy.';
|
|
120
|
+
PvcDelete.aliases = ['pvc:delete'];
|
|
121
|
+
PvcDelete.examples = [
|
|
122
|
+
{
|
|
123
|
+
description: 'Delete by name (interactive enterprise resolution).',
|
|
124
|
+
command: '<%= config.bin %> <%= command.id %> --name shared-files',
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
description: 'Delete by name in a specific enterprise.',
|
|
128
|
+
command: '<%= config.bin %> <%= command.id %> -e myEnt --name shared-files --silent',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
description: 'Delete by id (when name is ambiguous).',
|
|
132
|
+
command: '<%= config.bin %> <%= command.id %> --id <fileStoreDefId> --silent',
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
PvcDelete.flags = {
|
|
136
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
137
|
+
enterprise: core_1.Flags.string({ char: 'e', description: 'Code name identifying the enterprise that owns this filestore (optional if there is only one).' }),
|
|
138
|
+
name: core_1.Flags.string({ char: 'n', required: false, exclusive: ["id"], description: 'Name of the PVC filestore to delete.' }),
|
|
139
|
+
id: core_1.Flags.string({ required: false, exclusive: ["name"], description: 'System id of the FileStoreDef record. Use this when --name is ambiguous.' }),
|
|
140
|
+
silent: core_1.Flags.boolean({ exclusive: ["echo", "to-script"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
|
|
141
|
+
echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
|
|
142
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
143
|
+
"take-defaults": core_1.Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode)." }),
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/pvc/delete.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AAEpC,4BAA6B;AAE7B,+DAA0D;AAC1D,4CAAqD;AACrD,iCAAwC;AAUxC,MAAqB,SAAU,SAAQ,mCAA2B;IAgCjD,WAAW;;;YACpB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAE9C,MAAM,OAAO,GAAwB,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,UAAU;gBAAE,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAC5D,IAAI,KAAK,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAC1C,I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IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,gGAAgG,EAAE,CAAC;IACtJ,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;IAC1H,EAAE,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0EAA0E,EAAE,CAAC;IAEnJ,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,4GAA4G,EAAE,CAAC;IACtL,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,kHAAkH,EAAE,CAAC;IAC5L,WAAW,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,sGAAsG,EAAE,CAAC;IAClL,eAAe,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,uKAAuK,EAAE,CAAC;CAClP,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AtLeast } from "@codiac.io/codiac-common/contracts";
|
|
2
|
+
import { RootMap } from '../../apis/codiac-api/contracts';
|
|
3
|
+
import { CommandBaseExec } from '../../command-base-exec';
|
|
4
|
+
import { OutputFormatEnum } from '../../cli-entities/output-format-enum';
|
|
5
|
+
type IPvcGetRequest = {
|
|
6
|
+
enterprise: string;
|
|
7
|
+
name: string;
|
|
8
|
+
outputFormat: OutputFormatEnum;
|
|
9
|
+
};
|
|
10
|
+
export default class PvcGet extends CommandBaseExec<IPvcGetRequest> {
|
|
11
|
+
static description: string;
|
|
12
|
+
static aliases: string[];
|
|
13
|
+
static dependsOn: string[];
|
|
14
|
+
static examples: string[];
|
|
15
|
+
static flags: {
|
|
16
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
17
|
+
enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
19
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
21
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
};
|
|
25
|
+
captureArgs(): Promise<[Partial<IPvcGetRequest>, boolean]>;
|
|
26
|
+
buildCandidate_silently(partial: AtLeast<IPvcGetRequest, "enterprise">, rootMap: RootMap): Promise<IPvcGetRequest | undefined>;
|
|
27
|
+
buildCandidate_interactively(partial: AtLeast<IPvcGetRequest, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<IPvcGetRequest | undefined>;
|
|
28
|
+
buildCommandString(candidate: IPvcGetRequest, cmd: string[]): string[];
|
|
29
|
+
executeTask(candidate: IPvcGetRequest): Promise<void>;
|
|
30
|
+
private renderAs;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const YAML = require("yaml");
|
|
6
|
+
const command_base_exec_1 = require("../../command-base-exec");
|
|
7
|
+
const output_format_enum_1 = require("../../cli-entities/output-format-enum");
|
|
8
|
+
const type_safety_utils_1 = require("../../uilogic/type-safety-utils");
|
|
9
|
+
const prettify_1 = require("../../prettify");
|
|
10
|
+
const list_1 = require("../filestore/list");
|
|
11
|
+
const list_2 = require("./list");
|
|
12
|
+
class PvcGet extends command_base_exec_1.CommandBaseExec {
|
|
13
|
+
captureArgs() {
|
|
14
|
+
var _a;
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const { flags } = yield this.parse(PvcGet);
|
|
17
|
+
const partial = {};
|
|
18
|
+
if (flags.enterprise)
|
|
19
|
+
partial.enterprise = flags.enterprise;
|
|
20
|
+
if (flags.name)
|
|
21
|
+
partial.name = flags.name;
|
|
22
|
+
if (flags.output)
|
|
23
|
+
partial.outputFormat = type_safety_utils_1.TypeSafetyUtils.toEnum(output_format_enum_1.OutputFormatEnum, flags.output);
|
|
24
|
+
const takeDefaults = (_a = flags['take-defaults']) !== null && _a !== void 0 ? _a : false;
|
|
25
|
+
return [partial, takeDefaults];
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
buildCandidate_silently(partial, rootMap) {
|
|
29
|
+
var _a;
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (!partial.name || partial.name.trim() === "")
|
|
32
|
+
throw new Error("--name is required.");
|
|
33
|
+
return {
|
|
34
|
+
enterprise: partial.enterprise,
|
|
35
|
+
name: partial.name,
|
|
36
|
+
outputFormat: (_a = partial.outputFormat) !== null && _a !== void 0 ? _a : output_format_enum_1.OutputFormatEnum.auto,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
buildCandidate_interactively(partial, rootMap, takeDefaults) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (!partial.name || partial.name.trim() === "") {
|
|
43
|
+
const all = yield this._codiacApi.FileStoreDef.readMany({ all: true });
|
|
44
|
+
const pvcList = all.filter(list_2.isPvcFileStore);
|
|
45
|
+
if (pvcList.length === 0) {
|
|
46
|
+
this._ui.userMessage("There are no PVC filestores defined.");
|
|
47
|
+
this.exit(0);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const choices = pvcList.map(x => ({ name: list_1.FileStoreUiLogic.displayNameFor(x, this._styler, false), value: x.name }));
|
|
51
|
+
partial.name = (yield this._ui.promptSelect("pvc", "Select a PVC filestore:", choices, false, false));
|
|
52
|
+
}
|
|
53
|
+
return this.buildCandidate_silently(partial, rootMap);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
buildCommandString(candidate, cmd) {
|
|
57
|
+
if (candidate.enterprise)
|
|
58
|
+
cmd.push("--enterprise", candidate.enterprise);
|
|
59
|
+
cmd.push("--name", candidate.name);
|
|
60
|
+
if (candidate.outputFormat)
|
|
61
|
+
cmd.push("-o", candidate.outputFormat);
|
|
62
|
+
cmd.push("--silent");
|
|
63
|
+
return cmd;
|
|
64
|
+
}
|
|
65
|
+
executeTask(candidate) {
|
|
66
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const matches = yield this._codiacApi.FileStoreDef.readMany({ name: { $eq: candidate.name } }, { throwNotFound: false });
|
|
68
|
+
const pvcMatches = matches.filter(list_2.isPvcFileStore);
|
|
69
|
+
if (pvcMatches.length === 0) {
|
|
70
|
+
this._ui.userMessage(`No PVC filestore named [${candidate.name}] was found.`);
|
|
71
|
+
this.exit(1);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (pvcMatches.length > 1) {
|
|
75
|
+
this._ui.userMessage(this._styler.colorWarning(`Multiple PVC filestores match name [${candidate.name}]; rendering all matches.`));
|
|
76
|
+
}
|
|
77
|
+
const output = this.renderAs(pvcMatches, candidate.outputFormat);
|
|
78
|
+
console.log(output);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
renderAs(list, format) {
|
|
82
|
+
switch (format) {
|
|
83
|
+
case output_format_enum_1.OutputFormatEnum.json:
|
|
84
|
+
return JSON.stringify(list.length === 1 ? list[0] : list, undefined, 2);
|
|
85
|
+
case output_format_enum_1.OutputFormatEnum.yaml:
|
|
86
|
+
return YAML.stringify(list.length === 1 ? list[0] : list, { indent: 2 });
|
|
87
|
+
case output_format_enum_1.OutputFormatEnum.pretty:
|
|
88
|
+
case output_format_enum_1.OutputFormatEnum.auto:
|
|
89
|
+
default:
|
|
90
|
+
return (0, prettify_1.prettify)(list.length === 1 ? list[0] : list);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.default = PvcGet;
|
|
95
|
+
PvcGet.description = 'Renders the FileStoreDef record for a single PVC-backed filestore. Useful for inspecting how a PVC will be provisioned (storage class, access modes, size, static vs dynamic binding).';
|
|
96
|
+
PvcGet.aliases = ['pvc:get'];
|
|
97
|
+
PvcGet.dependsOn = ["enterprise", "name"];
|
|
98
|
+
PvcGet.examples = [
|
|
99
|
+
'<%= config.bin %> <%= command.id %> --name shared-files',
|
|
100
|
+
'<%= config.bin %> <%= command.id %> --name pvc-blob -o yaml',
|
|
101
|
+
'<%= config.bin %> <%= command.id %> --name app-documents-share --silent -o json',
|
|
102
|
+
];
|
|
103
|
+
PvcGet.flags = {
|
|
104
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
105
|
+
enterprise: core_1.Flags.string({ char: 'e', required: false, description: 'Code name identifying the enterprise (optional if there is only one).' }),
|
|
106
|
+
name: core_1.Flags.string({ char: 'n', required: false, description: 'Name of the PVC filestore to look up.' }),
|
|
107
|
+
output: core_1.Flags.string({ char: 'o', default: output_format_enum_1.OutputFormatEnum.auto, description: 'Format in which to render the data.', options: [output_format_enum_1.OutputFormatEnum.json, output_format_enum_1.OutputFormatEnum.yaml, output_format_enum_1.OutputFormatEnum.auto] }),
|
|
108
|
+
silent: core_1.Flags.boolean({ dependsOn: PvcGet.dependsOn, exclusive: ["echo", "to-script"], description: 'Non-Interactive mode; executes without any user interaction and fails on any missing or invalid arguments.' }),
|
|
109
|
+
echo: core_1.Flags.boolean({ exclusive: ["to-script", "silent"], description: 'Echo interaction mode; renders the equivalent non-interactive cli command for future use before final execution.' }),
|
|
110
|
+
"to-script": core_1.Flags.boolean({ exclusive: ["echo", "silent"], description: 'Toscript interaction mode; renders the equivalent non-interactive cli command WITHOUT any execution.' }),
|
|
111
|
+
"take-defaults": core_1.Flags.boolean({ exclusive: ["silent"], description: "Setting this to true prevents prompting for confirmation on parameters that were passed in or were automatically set to default values (Irrelevant in --silent mode)." }),
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/pvc/get.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AACpC,6BAA6B;AAG7B,+DAA0D;AAC1D,8EAAyE;AACzE,uEAAkE;AAClE,6CAA0C;AAC1C,4CAAqD;AACrD,iCAAwC;AAUxC,MAAqB,MAAO,SAAQ,mCAA+B;IAyBlD,WAAW;;;YACpB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAE3C,MAAM,OAAO,GAA4B,EAAE,CAAC;YAC5C,IAAI,KAAK,CAAC,UAAU;gBAAE,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAC5D,IAAI,KAAK,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YAC1C,IAAI,KAAK,CAAC,MAAM;gBAAE,OAAO,CAAC,YAAY,GAAG,mCAAe,CAAC,MAAM,CAAmB,qCAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAElH,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,eAAe,CAAC,mCAAI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is/codiac-api/contracts';
|
|
3
|
+
import { CommandBaseExec } from '../../command-base-exec';
|
|
4
|
+
import { OutputFormatEnum } from '../../cli-entities/output-format-enum';
|
|
5
|
+
export type IPvcListQuery = FileStoreDefCriteria & {
|
|
6
|
+
enterprise: string;
|
|
7
|
+
outputFormat: OutputFormatEnum;
|
|
8
|
+
};
|
|
9
|
+
/** Returns true when the FileStoreDef is provisioned via PersistentVolumeClaim
|
|
10
|
+
* (vs the legacy inline CSI path). Mirrors K8sFileStoreRouter.isPvcFilestore on
|
|
11
|
+
* the relay side. */
|
|
12
|
+
export declare function isPvcFileStore(fs: FileStoreDef): boolean;
|
|
13
|
+
export default class PvcList extends CommandBaseExec<IPvcListQuery> {
|
|
14
|
+
static description: string;
|
|
15
|
+
static aliases: string[];
|
|
16
|
+
static examples: string[];
|
|
17
|
+
static flags: {
|
|
18
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
19
|
+
enterprise: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
20
|
+
type: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
21
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
|
+
silent: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
23
|
+
echo: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
24
|
+
"to-script": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
25
|
+
"take-defaults": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
|
+
};
|
|
27
|
+
captureArgs(): Promise<[Partial<IPvcListQuery>, boolean]>;
|
|
28
|
+
buildCandidate_silently(partial: AtLeast<IPvcListQuery, "enterprise">, rootMap: RootMap): Promise<IPvcListQuery | undefined>;
|
|
29
|
+
buildCandidate_interactively(partial: AtLeast<IPvcListQuery, "enterprise">, rootMap: RootMap, takeDefaults: boolean): Promise<IPvcListQuery | undefined>;
|
|
30
|
+
buildCommandString(candidate: IPvcListQuery, cmd: string[]): string[];
|
|
31
|
+
executeTask(candidate: IPvcListQuery): Promise<void>;
|
|
32
|
+
private renderAs;
|
|
33
|
+
}
|