@dsmrt/axiom-cli 0.1.2 → 0.2.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/CHANGELOG.md +12 -0
- package/dist/bin/axiom.d.mts +1 -0
- package/dist/bin/axiom.d.ts +1 -0
- package/dist/bin/axiom.js +403 -0
- package/dist/bin/axiom.mjs +2 -0
- package/dist/chunk-FKMXG4JE.mjs +395 -0
- package/dist/index.d.mts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +426 -0
- package/dist/index.mjs +18 -0
- package/package.json +3 -3
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
// src/bin/axiom.ts
|
|
2
|
+
import yargs from "yargs";
|
|
3
|
+
|
|
4
|
+
// src/commands/config.ts
|
|
5
|
+
import { loadConfig } from "@dsmrt/axiom-config";
|
|
6
|
+
var Config = class {
|
|
7
|
+
command = "config";
|
|
8
|
+
describe = "print the config";
|
|
9
|
+
builder = (args) => {
|
|
10
|
+
args.option("env", {
|
|
11
|
+
type: "string"
|
|
12
|
+
});
|
|
13
|
+
return args;
|
|
14
|
+
};
|
|
15
|
+
handler = async (args) => {
|
|
16
|
+
console.log(await this.loadConfig(args));
|
|
17
|
+
};
|
|
18
|
+
loadConfig = async (args) => {
|
|
19
|
+
return loadConfig(args);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/commands/params/base.ts
|
|
24
|
+
var ParamsCommand = class {
|
|
25
|
+
command = "params";
|
|
26
|
+
describe = "Manage SSM parameters";
|
|
27
|
+
builder = (args) => {
|
|
28
|
+
args.demandCommand().command(new GetCommand()).command(new SetCommand()).command(new DeleteCommand());
|
|
29
|
+
return args;
|
|
30
|
+
};
|
|
31
|
+
handler = async () => {
|
|
32
|
+
console.log("\u{1F44D}");
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/commands/params/get.ts
|
|
37
|
+
import { loadConfig as loadConfig2 } from "@dsmrt/axiom-config";
|
|
38
|
+
import { ParameterCollection } from "@dsmrt/axiom-aws-sdk";
|
|
39
|
+
import { SSMClient } from "@aws-sdk/client-ssm";
|
|
40
|
+
|
|
41
|
+
// src/aws/credentials-provider.ts
|
|
42
|
+
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
|
|
43
|
+
import {
|
|
44
|
+
AssumeRoleCommand,
|
|
45
|
+
STSClient
|
|
46
|
+
} from "@aws-sdk/client-sts";
|
|
47
|
+
import inquirer from "inquirer";
|
|
48
|
+
|
|
49
|
+
// src/cache.ts
|
|
50
|
+
import os from "os";
|
|
51
|
+
import fs from "fs";
|
|
52
|
+
var DEFAULT_DIRECTORY = `${os.homedir()}/.axiom/cache`;
|
|
53
|
+
var cache_default = class {
|
|
54
|
+
constructor(cacheDir = DEFAULT_DIRECTORY) {
|
|
55
|
+
this.cacheDir = cacheDir;
|
|
56
|
+
}
|
|
57
|
+
get(name) {
|
|
58
|
+
const file = `${this.cacheDir}/${name}`;
|
|
59
|
+
if (!fs.existsSync(file)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const buffer = fs.readFileSync(file);
|
|
63
|
+
const item = JSON.parse(buffer.toString());
|
|
64
|
+
if (item.expires === void 0) {
|
|
65
|
+
return item.data;
|
|
66
|
+
}
|
|
67
|
+
item.expires = new Date(item.expires);
|
|
68
|
+
if (item.expires < /* @__PURE__ */ new Date()) {
|
|
69
|
+
this.delete(name);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
return item.data;
|
|
73
|
+
}
|
|
74
|
+
delete(name) {
|
|
75
|
+
fs.unlinkSync(`${this.cacheDir}/${name}`);
|
|
76
|
+
}
|
|
77
|
+
set(name, value, expires) {
|
|
78
|
+
if (!fs.existsSync(this.cacheDir)) {
|
|
79
|
+
fs.mkdirSync(this.cacheDir, {
|
|
80
|
+
recursive: true,
|
|
81
|
+
mode: 448
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
fs.writeFileSync(
|
|
85
|
+
`${this.cacheDir}/${name}`,
|
|
86
|
+
JSON.stringify({
|
|
87
|
+
expires,
|
|
88
|
+
data: value
|
|
89
|
+
}),
|
|
90
|
+
{
|
|
91
|
+
mode: 384
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/aws/credentials-provider.ts
|
|
98
|
+
var CACHE_KEY_PREFIX = "axiom#aws-credentials";
|
|
99
|
+
var cache = new cache_default();
|
|
100
|
+
var returnCredentialsFromAssumerole = (creds) => {
|
|
101
|
+
return {
|
|
102
|
+
accessKeyId: `${creds.AccessKeyId}`,
|
|
103
|
+
secretAccessKey: `${creds.SecretAccessKey}`,
|
|
104
|
+
sessionToken: `${creds.SessionToken}`
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
var CachedCredentialViaProfileAndRegion = async (profile, region) => {
|
|
108
|
+
const cacheKeyName = `${CACHE_KEY_PREFIX}#${profile}`;
|
|
109
|
+
const creds = cache.get(cacheKeyName);
|
|
110
|
+
if (creds !== void 0) {
|
|
111
|
+
return async () => returnCredentialsFromAssumerole(creds);
|
|
112
|
+
}
|
|
113
|
+
return fromNodeProviderChain({
|
|
114
|
+
profile,
|
|
115
|
+
roleAssumer: roleAssumerCallable({
|
|
116
|
+
region: region ?? "us-east-1",
|
|
117
|
+
cacheKeyName
|
|
118
|
+
}),
|
|
119
|
+
mfaCodeProvider
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
var roleAssumerCallable = (config) => {
|
|
123
|
+
return async (sourceCreds, params) => {
|
|
124
|
+
const command = new AssumeRoleCommand(params);
|
|
125
|
+
const client = new STSClient({
|
|
126
|
+
region: config.region,
|
|
127
|
+
credentials: sourceCreds
|
|
128
|
+
});
|
|
129
|
+
const result = await client.send(command);
|
|
130
|
+
const creds = result.Credentials;
|
|
131
|
+
if (creds === void 0 || creds?.AccessKeyId === void 0 || creds?.SecretAccessKey === void 0 || creds?.SessionToken === void 0) {
|
|
132
|
+
throw new Error("Unable to fetch credentials.");
|
|
133
|
+
}
|
|
134
|
+
cache.set(config.cacheKeyName, creds, creds.Expiration);
|
|
135
|
+
return returnCredentialsFromAssumerole(creds);
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
var mfaCodeProvider = async (mfaSerial) => {
|
|
139
|
+
const mfaCode = await inquirer.prompt({
|
|
140
|
+
name: "code",
|
|
141
|
+
message: `Enter MFA code for ${mfaSerial}: `,
|
|
142
|
+
type: "password"
|
|
143
|
+
});
|
|
144
|
+
return mfaCode.code;
|
|
145
|
+
};
|
|
146
|
+
var CachedCredentialProvider = (config) => {
|
|
147
|
+
return CachedCredentialViaProfileAndRegion(config.profile, config.region);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// src/options.ts
|
|
151
|
+
var commonOptions = () => {
|
|
152
|
+
return {
|
|
153
|
+
env: {
|
|
154
|
+
string: true,
|
|
155
|
+
desc: "Environment name like, prod, staging, dev, etc."
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
var awsOptions = () => {
|
|
160
|
+
return {
|
|
161
|
+
account: {
|
|
162
|
+
string: true,
|
|
163
|
+
desc: "AWS Account number like, 1243944546"
|
|
164
|
+
},
|
|
165
|
+
region: {
|
|
166
|
+
string: true,
|
|
167
|
+
desc: "AWS region like, us-east-1"
|
|
168
|
+
},
|
|
169
|
+
profile: {
|
|
170
|
+
string: true,
|
|
171
|
+
desc: "AWS configured profile"
|
|
172
|
+
},
|
|
173
|
+
baseParameterPath: {
|
|
174
|
+
string: true,
|
|
175
|
+
desc: "SSM parameter path base where configs like secrets and infrastucture managed items are set"
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/commands/params/utils.ts
|
|
181
|
+
var buildPath = (config, path) => {
|
|
182
|
+
if (path === void 0) {
|
|
183
|
+
return config.aws?.baseParameterPath;
|
|
184
|
+
}
|
|
185
|
+
if (/^\//.test(path)) {
|
|
186
|
+
return path;
|
|
187
|
+
}
|
|
188
|
+
return `${config.aws?.baseParameterPath.replace(/\/$/, "")}/${path}`;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// src/commands/params/get.ts
|
|
192
|
+
import chalk from "chalk";
|
|
193
|
+
var GetCommand = class {
|
|
194
|
+
command = "get [path]";
|
|
195
|
+
describe = "Get all parameters under the base path";
|
|
196
|
+
builder = (args) => {
|
|
197
|
+
const config = loadConfig2();
|
|
198
|
+
args.options({ ...commonOptions(), ...awsOptions() });
|
|
199
|
+
args.positional("path", {
|
|
200
|
+
type: "string",
|
|
201
|
+
describe: `OPTIONAL path to parameter. Supports absolute and relative paths.
|
|
202
|
+
Example:
|
|
203
|
+
"/root/myParam" or "service/secret" (which translates to, "${buildPath(
|
|
204
|
+
config,
|
|
205
|
+
"service/secret"
|
|
206
|
+
)})`
|
|
207
|
+
});
|
|
208
|
+
return args;
|
|
209
|
+
};
|
|
210
|
+
handler = async (args) => {
|
|
211
|
+
const config = loadConfig2({ env: args.env });
|
|
212
|
+
const collection = new ParameterCollection(
|
|
213
|
+
config.aws?.baseParameterPath,
|
|
214
|
+
new SSMClient({
|
|
215
|
+
region: config.aws.region,
|
|
216
|
+
credentials: await CachedCredentialProvider({
|
|
217
|
+
profile: config.aws.profile,
|
|
218
|
+
region: config.aws.region,
|
|
219
|
+
baseParameterPath: config.aws.baseParameterPath,
|
|
220
|
+
account: config.aws.account
|
|
221
|
+
})
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
|
+
const params = await collection.get();
|
|
225
|
+
params.forEach((parameter) => {
|
|
226
|
+
console.log(
|
|
227
|
+
chalk.gray(
|
|
228
|
+
parameter.Name?.replace(/\/([^/]+)$/, "/" + chalk.bold.green("$1"))
|
|
229
|
+
),
|
|
230
|
+
chalk.bold.white(parameter.Value)
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// src/commands/params/set.ts
|
|
237
|
+
import { loadConfig as loadConfig3 } from "@dsmrt/axiom-config";
|
|
238
|
+
import inquirer2 from "inquirer";
|
|
239
|
+
import {
|
|
240
|
+
SSMClient as SSMClient2,
|
|
241
|
+
PutParameterCommand,
|
|
242
|
+
ParameterType
|
|
243
|
+
} from "@aws-sdk/client-ssm";
|
|
244
|
+
import chalk2 from "chalk";
|
|
245
|
+
var SetCommand = class {
|
|
246
|
+
command = "set <path> <value>";
|
|
247
|
+
describe = "Set all parameters under the base path";
|
|
248
|
+
builder = (args) => {
|
|
249
|
+
const config = loadConfig3();
|
|
250
|
+
args.positional("path", {
|
|
251
|
+
type: "string",
|
|
252
|
+
describe: `Path to parameter. Supports absolute and relative paths.
|
|
253
|
+
Example: "/root/myParam" or "service/secret" (which translates to, "${buildPath(
|
|
254
|
+
config,
|
|
255
|
+
"service/secret"
|
|
256
|
+
)})`
|
|
257
|
+
});
|
|
258
|
+
args.demandOption("path", "Path is required");
|
|
259
|
+
args.positional("value", {
|
|
260
|
+
type: "string"
|
|
261
|
+
});
|
|
262
|
+
args.demandOption("value", "Value is required");
|
|
263
|
+
args.option("force", {
|
|
264
|
+
boolean: true,
|
|
265
|
+
default: false,
|
|
266
|
+
describe: "force set parameter without prompt",
|
|
267
|
+
alias: "f"
|
|
268
|
+
});
|
|
269
|
+
args.option("secure", {
|
|
270
|
+
boolean: true,
|
|
271
|
+
default: true,
|
|
272
|
+
describe: "Save parameter as a secure string"
|
|
273
|
+
});
|
|
274
|
+
args.option("overwrite", {
|
|
275
|
+
boolean: true,
|
|
276
|
+
default: true,
|
|
277
|
+
describe: "Overwrite parameter if it already exists"
|
|
278
|
+
});
|
|
279
|
+
return args.options({
|
|
280
|
+
...commonOptions(),
|
|
281
|
+
...awsOptions()
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
handler = async (args) => {
|
|
285
|
+
const config = loadConfig3({ env: args.env });
|
|
286
|
+
if (args.force !== true) {
|
|
287
|
+
const res = await inquirer2.prompt({
|
|
288
|
+
type: "confirm",
|
|
289
|
+
name: "setParam",
|
|
290
|
+
message: `Are you sure you want to set '${args.path}'?`
|
|
291
|
+
});
|
|
292
|
+
if (!res.setParam) {
|
|
293
|
+
console.log("Doing nothing.");
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const client = new SSMClient2({
|
|
298
|
+
region: config.aws.region,
|
|
299
|
+
credentials: await CachedCredentialProvider(config.aws)
|
|
300
|
+
});
|
|
301
|
+
const params = await client.send(
|
|
302
|
+
new PutParameterCommand({
|
|
303
|
+
Name: buildPath(config, args.path),
|
|
304
|
+
Value: args.value,
|
|
305
|
+
Type: args.secure ? ParameterType.SECURE_STRING : ParameterType.STRING,
|
|
306
|
+
Overwrite: args.overwrite
|
|
307
|
+
})
|
|
308
|
+
);
|
|
309
|
+
console.log(chalk2.green("Version: "), chalk2.white.bold(params.Version));
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
// src/commands/params/delete.ts
|
|
314
|
+
import { loadConfig as loadConfig4 } from "@dsmrt/axiom-config";
|
|
315
|
+
import inquirer3 from "inquirer";
|
|
316
|
+
import { SSMClient as SSMClient3, DeleteParameterCommand } from "@aws-sdk/client-ssm";
|
|
317
|
+
var log = console.log;
|
|
318
|
+
var DeleteCommand = class {
|
|
319
|
+
command = "delete <path>";
|
|
320
|
+
describe = "Delete SSM parameters";
|
|
321
|
+
client;
|
|
322
|
+
builder = (args) => {
|
|
323
|
+
const config = loadConfig4();
|
|
324
|
+
args.positional("path", {
|
|
325
|
+
type: "string",
|
|
326
|
+
describe: `Path to parameter. Supports absolute and relative paths.
|
|
327
|
+
Example: "/root/myParam" or "service/secret" (which translates to, "${buildPath(
|
|
328
|
+
config,
|
|
329
|
+
"service/secret"
|
|
330
|
+
)})`,
|
|
331
|
+
default: config.aws?.baseParameterPath,
|
|
332
|
+
demandOption: true
|
|
333
|
+
}).demandOption("path", "Path is required");
|
|
334
|
+
args.option("force", {
|
|
335
|
+
boolean: true,
|
|
336
|
+
default: false,
|
|
337
|
+
describe: "force delete parameter without prompt",
|
|
338
|
+
alias: "f"
|
|
339
|
+
});
|
|
340
|
+
return args;
|
|
341
|
+
};
|
|
342
|
+
handler = async (args) => {
|
|
343
|
+
const config = loadConfig4({ env: args.env });
|
|
344
|
+
const path = buildPath(args, args.path);
|
|
345
|
+
const client = new SSMClient3({
|
|
346
|
+
region: config.aws?.region,
|
|
347
|
+
credentials: await CachedCredentialProvider(config.aws)
|
|
348
|
+
});
|
|
349
|
+
if (path === args.aws.baseParameterPath) {
|
|
350
|
+
throw new Error(
|
|
351
|
+
`Deleting the path (path: ${path}) that matches the base path (awsSsmParameterPath: ${args.awsSsmParameterPath}) is prohibited.`
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
if (args.force !== true) {
|
|
355
|
+
const res = await inquirer3.prompt({
|
|
356
|
+
type: "confirm",
|
|
357
|
+
name: "delete",
|
|
358
|
+
message: `Are you sure you want to delete '${path}'?`
|
|
359
|
+
});
|
|
360
|
+
if (!res.delete) {
|
|
361
|
+
log("Doing nothing.");
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
await client.send(
|
|
366
|
+
new DeleteParameterCommand({
|
|
367
|
+
Name: path
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
log("\u{1F44D}");
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// src/bin/axiom.ts
|
|
375
|
+
yargs(process.argv.slice(2)).env("AXIOM").scriptName("axiom").option("config", {
|
|
376
|
+
alias: "c",
|
|
377
|
+
string: true
|
|
378
|
+
}).command(new Config()).command(new ParamsCommand()).strict().usage(
|
|
379
|
+
`
|
|
380
|
+
Axiom - an AWS focused config cli
|
|
381
|
+
|
|
382
|
+
USAGE:
|
|
383
|
+
$0 [options] <command>
|
|
384
|
+
`
|
|
385
|
+
).demandCommand(1, "").alias("h", "help").argv;
|
|
386
|
+
|
|
387
|
+
export {
|
|
388
|
+
Config,
|
|
389
|
+
ParamsCommand,
|
|
390
|
+
commonOptions,
|
|
391
|
+
awsOptions,
|
|
392
|
+
GetCommand,
|
|
393
|
+
SetCommand,
|
|
394
|
+
DeleteCommand
|
|
395
|
+
};
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Options as Options$1, CommandModule, CommandBuilder, ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
+
import * as _dsmrt_axiom_config from '@dsmrt/axiom-config';
|
|
3
|
+
import { AwsConfigs, Config as Config$1 } from '@dsmrt/axiom-config';
|
|
4
|
+
import { SSMClient } from '@aws-sdk/client-ssm';
|
|
5
|
+
|
|
6
|
+
interface Item {
|
|
7
|
+
expires?: Date;
|
|
8
|
+
data: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const commonOptions: () => {
|
|
12
|
+
[key: string]: Options$1;
|
|
13
|
+
};
|
|
14
|
+
declare const awsOptions: () => {
|
|
15
|
+
[key: string]: Options$1;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
interface ConfigOptions {
|
|
19
|
+
env: string;
|
|
20
|
+
}
|
|
21
|
+
declare class Config<U extends ConfigOptions> implements CommandModule<object, U> {
|
|
22
|
+
command: string;
|
|
23
|
+
describe: string;
|
|
24
|
+
builder?: CommandBuilder<object, U> | undefined;
|
|
25
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
26
|
+
loadConfig: (args: ConfigOptions) => Promise<_dsmrt_axiom_config.ConfigContainer<object>>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Options {
|
|
30
|
+
}
|
|
31
|
+
declare class ParamsCommand<U extends Options> implements CommandModule<object, U> {
|
|
32
|
+
command: string;
|
|
33
|
+
describe: string;
|
|
34
|
+
builder: (args: Argv) => Argv<U>;
|
|
35
|
+
handler: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface GetOptions {
|
|
39
|
+
env: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}
|
|
42
|
+
declare class GetCommand<U extends GetOptions> implements CommandModule<object, U> {
|
|
43
|
+
command: string;
|
|
44
|
+
describe: string;
|
|
45
|
+
builder: (args: Argv) => Argv<U>;
|
|
46
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface SetOptions extends AwsConfigs {
|
|
50
|
+
env: string;
|
|
51
|
+
path: string;
|
|
52
|
+
value: string;
|
|
53
|
+
force: boolean;
|
|
54
|
+
secure: boolean;
|
|
55
|
+
overwrite: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare class SetCommand<U extends SetOptions> implements CommandModule<object, U> {
|
|
58
|
+
command: string;
|
|
59
|
+
describe: string;
|
|
60
|
+
builder: (args: Argv) => Argv<U>;
|
|
61
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type Path = string;
|
|
65
|
+
interface DeleteOptions {
|
|
66
|
+
path?: Path;
|
|
67
|
+
force: boolean;
|
|
68
|
+
}
|
|
69
|
+
type config = Config$1 & DeleteOptions;
|
|
70
|
+
declare class DeleteCommand<U extends config> implements CommandModule<object, U> {
|
|
71
|
+
command: string;
|
|
72
|
+
describe: string;
|
|
73
|
+
protected client: SSMClient | undefined;
|
|
74
|
+
builder: (args: Argv) => Argv<U>;
|
|
75
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { Config, DeleteCommand, type DeleteOptions, GetCommand, type GetOptions, type Item, ParamsCommand, SetCommand, type SetOptions, awsOptions, commonOptions };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Options as Options$1, CommandModule, CommandBuilder, ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
+
import * as _dsmrt_axiom_config from '@dsmrt/axiom-config';
|
|
3
|
+
import { AwsConfigs, Config as Config$1 } from '@dsmrt/axiom-config';
|
|
4
|
+
import { SSMClient } from '@aws-sdk/client-ssm';
|
|
5
|
+
|
|
6
|
+
interface Item {
|
|
7
|
+
expires?: Date;
|
|
8
|
+
data: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const commonOptions: () => {
|
|
12
|
+
[key: string]: Options$1;
|
|
13
|
+
};
|
|
14
|
+
declare const awsOptions: () => {
|
|
15
|
+
[key: string]: Options$1;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
interface ConfigOptions {
|
|
19
|
+
env: string;
|
|
20
|
+
}
|
|
21
|
+
declare class Config<U extends ConfigOptions> implements CommandModule<object, U> {
|
|
22
|
+
command: string;
|
|
23
|
+
describe: string;
|
|
24
|
+
builder?: CommandBuilder<object, U> | undefined;
|
|
25
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
26
|
+
loadConfig: (args: ConfigOptions) => Promise<_dsmrt_axiom_config.ConfigContainer<object>>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Options {
|
|
30
|
+
}
|
|
31
|
+
declare class ParamsCommand<U extends Options> implements CommandModule<object, U> {
|
|
32
|
+
command: string;
|
|
33
|
+
describe: string;
|
|
34
|
+
builder: (args: Argv) => Argv<U>;
|
|
35
|
+
handler: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface GetOptions {
|
|
39
|
+
env: string;
|
|
40
|
+
path: string;
|
|
41
|
+
}
|
|
42
|
+
declare class GetCommand<U extends GetOptions> implements CommandModule<object, U> {
|
|
43
|
+
command: string;
|
|
44
|
+
describe: string;
|
|
45
|
+
builder: (args: Argv) => Argv<U>;
|
|
46
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface SetOptions extends AwsConfigs {
|
|
50
|
+
env: string;
|
|
51
|
+
path: string;
|
|
52
|
+
value: string;
|
|
53
|
+
force: boolean;
|
|
54
|
+
secure: boolean;
|
|
55
|
+
overwrite: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare class SetCommand<U extends SetOptions> implements CommandModule<object, U> {
|
|
58
|
+
command: string;
|
|
59
|
+
describe: string;
|
|
60
|
+
builder: (args: Argv) => Argv<U>;
|
|
61
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type Path = string;
|
|
65
|
+
interface DeleteOptions {
|
|
66
|
+
path?: Path;
|
|
67
|
+
force: boolean;
|
|
68
|
+
}
|
|
69
|
+
type config = Config$1 & DeleteOptions;
|
|
70
|
+
declare class DeleteCommand<U extends config> implements CommandModule<object, U> {
|
|
71
|
+
command: string;
|
|
72
|
+
describe: string;
|
|
73
|
+
protected client: SSMClient | undefined;
|
|
74
|
+
builder: (args: Argv) => Argv<U>;
|
|
75
|
+
handler: (args: ArgumentsCamelCase<U>) => Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { Config, DeleteCommand, type DeleteOptions, GetCommand, type GetOptions, type Item, ParamsCommand, SetCommand, type SetOptions, awsOptions, commonOptions };
|