@effortless-aws/cli 0.10.0 → 0.10.1
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/dist/cli/index.js +30 -13
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -7702,6 +7702,12 @@ To inspect: ls ${layerDir}`);
|
|
|
7702
7702
|
import { Args as Args3, Command as Command6 } from "@effect/cli";
|
|
7703
7703
|
import { Prompt } from "@effect/cli";
|
|
7704
7704
|
import { Effect as Effect44, Console as Console8, Logger as Logger5, LogLevel as LogLevel5, Option as Option5 } from "effect";
|
|
7705
|
+
var ssmTags = (project, stage, handlerName) => toAwsTagList({
|
|
7706
|
+
"effortless:project": project,
|
|
7707
|
+
"effortless:stage": stage,
|
|
7708
|
+
"effortless:handler": handlerName,
|
|
7709
|
+
"effortless:type": "ssm-parameter"
|
|
7710
|
+
});
|
|
7705
7711
|
var loadRequiredParams = (projectOpt, stage, region) => Effect44.gen(function* () {
|
|
7706
7712
|
const { config, projectDir } = yield* ProjectConfig;
|
|
7707
7713
|
const project = Option5.getOrElse(projectOpt, () => config?.name ?? "");
|
|
@@ -7767,26 +7773,36 @@ var setCommand = Command6.make(
|
|
|
7767
7773
|
"set",
|
|
7768
7774
|
{ key: setKeyArg, project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption },
|
|
7769
7775
|
({ key, project: projectOpt, stage, region, verbose }) => Effect44.gen(function* () {
|
|
7770
|
-
const
|
|
7771
|
-
const
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7776
|
+
const ctx = yield* loadRequiredParams(projectOpt, stage, region);
|
|
7777
|
+
const { params } = ctx;
|
|
7778
|
+
const match = params.find((p) => p.ssmKey === key);
|
|
7779
|
+
if (!match) {
|
|
7780
|
+
const available = [...new Set(params.map((p) => p.ssmKey))].sort();
|
|
7781
|
+
yield* Console8.error(`Error: "${key}" is not declared in any handler.`);
|
|
7782
|
+
if (available.length > 0) {
|
|
7783
|
+
yield* Console8.error(`
|
|
7784
|
+
Available keys:
|
|
7785
|
+
${available.map((k) => ` - ${k}`).join("\n")}`);
|
|
7786
|
+
}
|
|
7787
|
+
return yield* Effect44.fail(new Error(`Unknown config key: ${key}`));
|
|
7775
7788
|
}
|
|
7776
|
-
const finalStage = config?.stage ?? stage;
|
|
7777
|
-
const finalRegion = config?.region ?? region;
|
|
7778
|
-
const ssmPath = `/${project}/${finalStage}/${key}`;
|
|
7779
7789
|
const value = yield* Prompt.text({
|
|
7780
|
-
message: `Value for ${c.cyan(ssmPath)}`
|
|
7790
|
+
message: `Value for ${c.cyan(match.ssmPath)}`
|
|
7781
7791
|
});
|
|
7792
|
+
const ssmLayer = clients_exports.makeClients({ ssm: { region: ctx.region } });
|
|
7782
7793
|
yield* ssm_exports.make("put_parameter", {
|
|
7783
|
-
Name: ssmPath,
|
|
7794
|
+
Name: match.ssmPath,
|
|
7784
7795
|
Value: value,
|
|
7785
7796
|
Type: "SecureString",
|
|
7786
7797
|
Overwrite: true
|
|
7787
|
-
}).pipe(Effect44.provide(
|
|
7798
|
+
}).pipe(Effect44.provide(ssmLayer));
|
|
7799
|
+
yield* ssm_exports.make("add_tags_to_resource", {
|
|
7800
|
+
ResourceType: "Parameter",
|
|
7801
|
+
ResourceId: match.ssmPath,
|
|
7802
|
+
Tags: ssmTags(ctx.project, ctx.stage, match.handlerName)
|
|
7803
|
+
}).pipe(Effect44.provide(ssmLayer));
|
|
7788
7804
|
yield* Console8.log(`
|
|
7789
|
-
${c.green("\u2713")} ${c.cyan(ssmPath)} ${c.dim("(SecureString)")}`);
|
|
7805
|
+
${c.green("\u2713")} ${c.cyan(match.ssmPath)} ${c.dim("(SecureString)")}`);
|
|
7790
7806
|
}).pipe(
|
|
7791
7807
|
Effect44.provide(ProjectConfig.Live),
|
|
7792
7808
|
Logger5.withMinimumLogLevel(LogLevel5.Warning)
|
|
@@ -7827,7 +7843,8 @@ ${c.bold("Missing parameters")} ${c.dim(`(${ctx.project} / ${ctx.stage})`)}
|
|
|
7827
7843
|
Name: p.ssmPath,
|
|
7828
7844
|
Value: value,
|
|
7829
7845
|
Type: "SecureString",
|
|
7830
|
-
Overwrite: false
|
|
7846
|
+
Overwrite: false,
|
|
7847
|
+
Tags: ssmTags(ctx.project, ctx.stage, p.handlerName)
|
|
7831
7848
|
}).pipe(Effect44.provide(clients_exports.makeClients({ ssm: { region: ctx.region } })));
|
|
7832
7849
|
yield* Console8.log(` ${c.green("\u2713")} created`);
|
|
7833
7850
|
created++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effortless-aws/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "CLI and deploy tooling for effortless-aws",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"esbuild": "^0.25.0",
|
|
40
40
|
"glob": "^13.0.0",
|
|
41
41
|
"ts-morph": "^27.0.2",
|
|
42
|
-
"effortless-aws": "0.27.
|
|
42
|
+
"effortless-aws": "0.27.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@effect-ak/aws-sdk": "1.0.0-rc.3",
|