@kensio/yulin 0.40.0 → 0.41.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 +1 -0
- package/dist/sdk/router/resolve-sim-sdk-command-router.d.ts.map +1 -1
- package/dist/sdk/router/resolve-sim-sdk-command-router.js +3 -0
- package/dist/sdk/router/resolve-sim-sdk-command-router.js.map +1 -1
- package/dist/service/aws/factory/sim-aws-service-factory.d.ts +8 -0
- package/dist/service/aws/factory/sim-aws-service-factory.d.ts.map +1 -1
- package/dist/service/aws/factory/sim-aws-service-factory.js +14 -0
- package/dist/service/aws/factory/sim-aws-service-factory.js.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.d.ts +5 -0
- package/dist/service/aws/sim-aws-account-region-scope.d.ts.map +1 -1
- package/dist/service/aws/sim-aws-account-region-scope.js +6 -0
- package/dist/service/aws/sim-aws-account-region-scope.js.map +1 -1
- package/dist/service/aws/sim-aws.d.ts +5 -0
- package/dist/service/aws/sim-aws.d.ts.map +1 -1
- package/dist/service/aws/sim-aws.js +6 -0
- package/dist/service/aws/sim-aws.js.map +1 -1
- package/dist/service/ssm/command/authorize/sim-ssm-authorizer.d.ts +44 -0
- package/dist/service/ssm/command/authorize/sim-ssm-authorizer.d.ts.map +1 -0
- package/dist/service/ssm/command/authorize/sim-ssm-authorizer.js +65 -0
- package/dist/service/ssm/command/authorize/sim-ssm-authorizer.js.map +1 -0
- package/dist/service/ssm/command/parameter/parameter.command.d.ts +98 -0
- package/dist/service/ssm/command/parameter/parameter.command.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/parameter.command.js +2 -0
- package/dist/service/ssm/command/parameter/parameter.command.js.map +1 -0
- package/dist/service/ssm/command/parameter/query.command.d.ts +85 -0
- package/dist/service/ssm/command/parameter/query.command.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/query.command.js +2 -0
- package/dist/service/ssm/command/parameter/query.command.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-delete-parameter-commands.d.ts +38 -0
- package/dist/service/ssm/command/parameter/sim-ssm-delete-parameter-commands.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-delete-parameter-commands.js +62 -0
- package/dist/service/ssm/command/parameter/sim-ssm-delete-parameter-commands.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-describe-parameters.d.ts +43 -0
- package/dist/service/ssm/command/parameter/sim-ssm-describe-parameters.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-describe-parameters.js +63 -0
- package/dist/service/ssm/command/parameter/sim-ssm-describe-parameters.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameter-commands.d.ts +37 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameter-commands.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameter-commands.js +59 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameter-commands.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameters-by-path.d.ts +34 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameters-by-path.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameters-by-path.js +50 -0
- package/dist/service/ssm/command/parameter/sim-ssm-get-parameters-by-path.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-names.d.ts +5 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-names.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-names.js +22 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-names.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-page.d.ts +35 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-page.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-page.js +51 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-page.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-reader.d.ts +49 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-reader.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-reader.js +55 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-reader.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-view.d.ts +33 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-view.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-view.js +55 -0
- package/dist/service/ssm/command/parameter/sim-ssm-parameter-view.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-put-parameter.d.ts +34 -0
- package/dist/service/ssm/command/parameter/sim-ssm-put-parameter.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-put-parameter.js +49 -0
- package/dist/service/ssm/command/parameter/sim-ssm-put-parameter.js.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-unsimulated-put-options.d.ts +19 -0
- package/dist/service/ssm/command/parameter/sim-ssm-unsimulated-put-options.d.ts.map +1 -0
- package/dist/service/ssm/command/parameter/sim-ssm-unsimulated-put-options.js +48 -0
- package/dist/service/ssm/command/parameter/sim-ssm-unsimulated-put-options.js.map +1 -0
- package/dist/service/ssm/command/sim-ssm-command.types.d.ts +6 -0
- package/dist/service/ssm/command/sim-ssm-command.types.d.ts.map +1 -0
- package/dist/service/ssm/command/sim-ssm-command.types.js +2 -0
- package/dist/service/ssm/command/sim-ssm-command.types.js.map +1 -0
- package/dist/service/ssm/error/sim-ssm.error.d.ts +88 -0
- package/dist/service/ssm/error/sim-ssm.error.d.ts.map +1 -0
- package/dist/service/ssm/error/sim-ssm.error.js +101 -0
- package/dist/service/ssm/error/sim-ssm.error.js.map +1 -0
- package/dist/service/ssm/index.d.ts +10 -0
- package/dist/service/ssm/index.d.ts.map +1 -0
- package/dist/service/ssm/index.js +10 -0
- package/dist/service/ssm/index.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-arn.d.ts +33 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-arn.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-arn.js +34 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-arn.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-name.d.ts +48 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-name.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-name.js +117 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-name.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-path.d.ts +36 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-path.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-path.js +56 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-path.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-selector.d.ts +34 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-selector.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-selector.js +63 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-selector.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-store.d.ts +46 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-store.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-store.js +66 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-store.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-type.d.ts +25 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-type.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-type.js +42 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-type.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-value.d.ts +14 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-value.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-value.js +36 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-value.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-version.d.ts +40 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-version.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-version.js +32 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-version.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-writer.d.ts +52 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-writer.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-writer.js +79 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter-writer.js.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter.d.ts +41 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter.d.ts.map +1 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter.js +57 -0
- package/dist/service/ssm/parameter/sim-ssm-parameter.js.map +1 -0
- package/dist/service/ssm/sdk/sim-ssm-sdk-command-router.d.ts +18 -0
- package/dist/service/ssm/sdk/sim-ssm-sdk-command-router.d.ts.map +1 -0
- package/dist/service/ssm/sdk/sim-ssm-sdk-command-router.js +52 -0
- package/dist/service/ssm/sdk/sim-ssm-sdk-command-router.js.map +1 -0
- package/dist/service/ssm/sim-ssm.d.ts +77 -0
- package/dist/service/ssm/sim-ssm.d.ts.map +1 -0
- package/dist/service/ssm/sim-ssm.js +129 -0
- package/dist/service/ssm/sim-ssm.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of a parameter ARN that comes before the parameter's own name.
|
|
3
|
+
*
|
|
4
|
+
* It ends in a slash, and the name follows it with its own leading slash
|
|
5
|
+
* dropped, so `/myapp/prod/db-host` becomes `...:parameter/myapp/prod/db-host`
|
|
6
|
+
* rather than `...:parameter//myapp/prod/db-host`.
|
|
7
|
+
*/
|
|
8
|
+
export function ssmParameterArnPrefix(accountRegionScope) {
|
|
9
|
+
const { regionName, accountId } = accountRegionScope;
|
|
10
|
+
return `arn:aws:ssm:${regionName}:${accountId}:parameter/`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The ARN of one simulated parameter.
|
|
14
|
+
*
|
|
15
|
+
* The single detail worth getting right here is the leading slash. A
|
|
16
|
+
* hierarchical parameter name starts with one and its ARN does not repeat it,
|
|
17
|
+
* so an IAM policy written as `...:parameter//myapp/prod/db-host` matches
|
|
18
|
+
* nothing. Building the ARN in one place is what makes a policy that works
|
|
19
|
+
* here one that would work on real AWS.
|
|
20
|
+
*/
|
|
21
|
+
export class SimSsmParameterArn {
|
|
22
|
+
/**
|
|
23
|
+
* The parameter name with its leading slash dropped, which is the part of
|
|
24
|
+
* the ARN after `parameter/`.
|
|
25
|
+
*/
|
|
26
|
+
resource;
|
|
27
|
+
value;
|
|
28
|
+
constructor(properties) {
|
|
29
|
+
this.resource = properties.resource;
|
|
30
|
+
this.value =
|
|
31
|
+
ssmParameterArnPrefix(properties.accountRegionScope) + this.resource;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=sim-ssm-parameter-arn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-arn.js","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-arn.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,kBAA4C;IAE5C,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC;IAErD,OAAO,eAAe,UAAU,IAAI,SAAS,aAAa,CAAC;AAC7D,CAAC;AAOD;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;;OAGG;IACa,QAAQ,CAAS;IAEjB,KAAK,CAAS;IAE9B,YAAY,UAAwC;QAClD,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACpC,IAAI,CAAC,KAAK;YACR,qBAAqB,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SimAwsAccountRegionScope } from "../../aws/sim-aws-account-region-scope.js";
|
|
2
|
+
interface SimSsmParameterNameProperties {
|
|
3
|
+
readonly name: string | undefined;
|
|
4
|
+
readonly accountRegionScope: SimAwsAccountRegionScope;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The name of one simulated parameter, validated as real Parameter Store
|
|
8
|
+
* validates it.
|
|
9
|
+
*
|
|
10
|
+
* The rules are worth applying in one place because they are a common
|
|
11
|
+
* deploy-time failure rather than an obscure edge: a hierarchy missing its
|
|
12
|
+
* leading slash, a name under the reserved `/aws` prefix, or a hierarchy
|
|
13
|
+
* sixteen levels deep all fail at PutParameter on real AWS.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SimSsmParameterName {
|
|
16
|
+
/**
|
|
17
|
+
* The name as Parameter Store stores and reports it, leading slash and all.
|
|
18
|
+
*/
|
|
19
|
+
readonly value: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name with any leading slash dropped, which is how it appears in the
|
|
22
|
+
* parameter's ARN and how this simulation keys it.
|
|
23
|
+
*/
|
|
24
|
+
readonly resource: string;
|
|
25
|
+
constructor(properties: SimSsmParameterNameProperties);
|
|
26
|
+
/**
|
|
27
|
+
* Normalize a name to the resource part of its ARN.
|
|
28
|
+
*
|
|
29
|
+
* A parameter put as `db-host` and one read as `/db-host` are the same
|
|
30
|
+
* parameter, because both name the same ARN. Keying on this form is what
|
|
31
|
+
* makes the two interchangeable.
|
|
32
|
+
*/
|
|
33
|
+
static resourceFor(name: string): string;
|
|
34
|
+
private static trimmed;
|
|
35
|
+
private requireAllowedCharacters;
|
|
36
|
+
/**
|
|
37
|
+
* Refuse a hierarchy that Parameter Store would refuse.
|
|
38
|
+
*
|
|
39
|
+
* The leading slash is the one people actually get wrong: a name written as
|
|
40
|
+
* `myapp/prod/db-host` looks fine and is rejected on real AWS, because a
|
|
41
|
+
* name containing a hierarchy has to be fully qualified.
|
|
42
|
+
*/
|
|
43
|
+
private requireWellFormedHierarchy;
|
|
44
|
+
private requireUnreservedPrefix;
|
|
45
|
+
private requireWithinArnLength;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=sim-ssm-parameter-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-name.d.ts","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAsB1F,UAAU,6BAA6B;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;CACvD;AAED;;;;;;;;GAQG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,SAAgB,KAAK,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC,YAAY,UAAU,EAAE,6BAA6B,EAUpD;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,MAAM,CAAC,OAAO;IAoBtB,OAAO,CAAC,wBAAwB;IAYhC;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IA6BlC,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,sBAAsB;CAgB/B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { SimSsmHierarchyLevelLimitExceededException, SimSsmParameterPatternMismatchException, SimSsmValidationException, } from "../error/sim-ssm.error.js";
|
|
2
|
+
import { ssmParameterArnPrefix } from "./sim-ssm-parameter-arn.js";
|
|
3
|
+
const allowedCharacters = /^[\w./-]+$/;
|
|
4
|
+
const maxHierarchyLevels = 15;
|
|
5
|
+
const reservedPrefixes = ["aws", "ssm"];
|
|
6
|
+
/**
|
|
7
|
+
* The longest a parameter name may be, counting the ARN that precedes it.
|
|
8
|
+
*
|
|
9
|
+
* Real Parameter Store reserves the rest of the 2048 character ARN for its own
|
|
10
|
+
* use, and counts the ARN prefix towards the 1011 characters left. That is why
|
|
11
|
+
* this limit needs the Account and Region: the same name is legal in one
|
|
12
|
+
* Region and too long in another.
|
|
13
|
+
*/
|
|
14
|
+
const maxArnLength = 1011;
|
|
15
|
+
/**
|
|
16
|
+
* The name of one simulated parameter, validated as real Parameter Store
|
|
17
|
+
* validates it.
|
|
18
|
+
*
|
|
19
|
+
* The rules are worth applying in one place because they are a common
|
|
20
|
+
* deploy-time failure rather than an obscure edge: a hierarchy missing its
|
|
21
|
+
* leading slash, a name under the reserved `/aws` prefix, or a hierarchy
|
|
22
|
+
* sixteen levels deep all fail at PutParameter on real AWS.
|
|
23
|
+
*/
|
|
24
|
+
export class SimSsmParameterName {
|
|
25
|
+
/**
|
|
26
|
+
* The name as Parameter Store stores and reports it, leading slash and all.
|
|
27
|
+
*/
|
|
28
|
+
value;
|
|
29
|
+
/**
|
|
30
|
+
* The name with any leading slash dropped, which is how it appears in the
|
|
31
|
+
* parameter's ARN and how this simulation keys it.
|
|
32
|
+
*/
|
|
33
|
+
resource;
|
|
34
|
+
constructor(properties) {
|
|
35
|
+
const name = SimSsmParameterName.trimmed(properties.name);
|
|
36
|
+
this.value = name;
|
|
37
|
+
this.resource = SimSsmParameterName.resourceFor(name);
|
|
38
|
+
this.requireAllowedCharacters(name);
|
|
39
|
+
this.requireWellFormedHierarchy(name);
|
|
40
|
+
this.requireUnreservedPrefix();
|
|
41
|
+
this.requireWithinArnLength(properties.accountRegionScope);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Normalize a name to the resource part of its ARN.
|
|
45
|
+
*
|
|
46
|
+
* A parameter put as `db-host` and one read as `/db-host` are the same
|
|
47
|
+
* parameter, because both name the same ARN. Keying on this form is what
|
|
48
|
+
* makes the two interchangeable.
|
|
49
|
+
*/
|
|
50
|
+
static resourceFor(name) {
|
|
51
|
+
return name.trim().replace(/^\//, "");
|
|
52
|
+
}
|
|
53
|
+
static trimmed(name) {
|
|
54
|
+
if (name === undefined || name.trim() === "") {
|
|
55
|
+
throw new SimSsmValidationException("A parameter name is required and cannot be empty");
|
|
56
|
+
}
|
|
57
|
+
// Real Parameter Store strips surrounding spaces and refuses inner ones.
|
|
58
|
+
const trimmed = name.trim();
|
|
59
|
+
if (trimmed.includes(" ")) {
|
|
60
|
+
throw new SimSsmValidationException(`Parameter name '${trimmed}' contains spaces, which Parameter Store ` +
|
|
61
|
+
`does not allow between characters`);
|
|
62
|
+
}
|
|
63
|
+
return trimmed;
|
|
64
|
+
}
|
|
65
|
+
requireAllowedCharacters(name) {
|
|
66
|
+
if (allowedCharacters.test(name)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
throw new SimSsmParameterPatternMismatchException(`Parameter name '${name}' contains characters Parameter Store does not ` +
|
|
70
|
+
`allow: only letters, digits, the characters _.- and the / hierarchy ` +
|
|
71
|
+
`separator are permitted`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Refuse a hierarchy that Parameter Store would refuse.
|
|
75
|
+
*
|
|
76
|
+
* The leading slash is the one people actually get wrong: a name written as
|
|
77
|
+
* `myapp/prod/db-host` looks fine and is rejected on real AWS, because a
|
|
78
|
+
* name containing a hierarchy has to be fully qualified.
|
|
79
|
+
*/
|
|
80
|
+
requireWellFormedHierarchy(name) {
|
|
81
|
+
if (!name.includes("/")) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!name.startsWith("/")) {
|
|
85
|
+
throw new SimSsmParameterPatternMismatchException(`Parameter name '${name}' is hierarchical, so it must start with a ` +
|
|
86
|
+
`forward slash: '/${name}'`);
|
|
87
|
+
}
|
|
88
|
+
const levels = this.resource.split("/");
|
|
89
|
+
if (levels.includes("")) {
|
|
90
|
+
throw new SimSsmParameterPatternMismatchException(`Parameter name '${name}' has an empty hierarchy level`);
|
|
91
|
+
}
|
|
92
|
+
if (levels.length > maxHierarchyLevels) {
|
|
93
|
+
throw new SimSsmHierarchyLevelLimitExceededException(`Parameter name '${name}' has ${String(levels.length)} hierarchy ` +
|
|
94
|
+
`levels; a hierarchy can have a maximum of ` +
|
|
95
|
+
`${String(maxHierarchyLevels)} levels`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
requireUnreservedPrefix() {
|
|
99
|
+
const lowerCased = this.resource.toLowerCase();
|
|
100
|
+
const reserved = reservedPrefixes.find((prefix) => lowerCased.startsWith(prefix));
|
|
101
|
+
if (reserved === undefined) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
throw new SimSsmParameterPatternMismatchException(`Parameter name '${this.value}' starts with '${reserved}', which ` +
|
|
105
|
+
`Parameter Store reserves for its own parameters`);
|
|
106
|
+
}
|
|
107
|
+
requireWithinArnLength(accountRegionScope) {
|
|
108
|
+
const arnLength = ssmParameterArnPrefix(accountRegionScope).length + this.resource.length;
|
|
109
|
+
if (arnLength <= maxArnLength) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
throw new SimSsmValidationException(`Parameter name '${this.value}' makes an ARN of ${String(arnLength)} ` +
|
|
113
|
+
`characters; Parameter Store allows ${String(maxArnLength)} ` +
|
|
114
|
+
`including the ARN prefix for this Account and Region`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=sim-ssm-parameter-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-name.js","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-name.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SimAwsAccountRegionScope } from "../../aws/sim-aws-account-region-scope.js";
|
|
2
|
+
import type { SimSsmParameter } from "./sim-ssm-parameter.js";
|
|
3
|
+
interface SimSsmParameterPathProperties {
|
|
4
|
+
readonly path: string | undefined;
|
|
5
|
+
readonly accountRegionScope: SimAwsAccountRegionScope;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A level of the parameter hierarchy, as GetParametersByPath names one.
|
|
9
|
+
*
|
|
10
|
+
* The path is also the resource GetParametersByPath authorizes against, which
|
|
11
|
+
* is the part worth modelling: real Parameter Store grants access to a whole
|
|
12
|
+
* subtree through its path, so a caller allowed `/myapp` can read `/myapp/prod`
|
|
13
|
+
* recursively even where an explicit deny names the parameter itself.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SimSsmParameterPath {
|
|
16
|
+
/**
|
|
17
|
+
* The path as the request wrote it.
|
|
18
|
+
*/
|
|
19
|
+
readonly value: string;
|
|
20
|
+
/**
|
|
21
|
+
* The ARN of the path, which is what an IAM policy names.
|
|
22
|
+
*/
|
|
23
|
+
readonly arn: string;
|
|
24
|
+
private readonly prefix;
|
|
25
|
+
constructor(properties: SimSsmParameterPathProperties);
|
|
26
|
+
private static validated;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a parameter lies under this path.
|
|
29
|
+
*
|
|
30
|
+
* Without `recursive` only the level immediately below the path counts, so
|
|
31
|
+
* `/myapp/db-host` is under `/myapp` and `/myapp/prod/db-host` is not.
|
|
32
|
+
*/
|
|
33
|
+
contains(parameter: SimSsmParameter, recursive: boolean): boolean;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=sim-ssm-parameter-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-path.d.ts","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAE1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,UAAU,6BAA6B;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;CACvD;AAED;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,SAAgB,KAAK,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,SAAgB,GAAG,EAAE,MAAM,CAAC;IAE5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,YAAY,UAAU,EAAE,6BAA6B,EAQpD;IAED,OAAO,CAAC,MAAM,CAAC,SAAS;IAmBxB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAYhE;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { SimSsmValidationException } from "../error/sim-ssm.error.js";
|
|
2
|
+
import { ssmParameterArnPrefix } from "./sim-ssm-parameter-arn.js";
|
|
3
|
+
/**
|
|
4
|
+
* A level of the parameter hierarchy, as GetParametersByPath names one.
|
|
5
|
+
*
|
|
6
|
+
* The path is also the resource GetParametersByPath authorizes against, which
|
|
7
|
+
* is the part worth modelling: real Parameter Store grants access to a whole
|
|
8
|
+
* subtree through its path, so a caller allowed `/myapp` can read `/myapp/prod`
|
|
9
|
+
* recursively even where an explicit deny names the parameter itself.
|
|
10
|
+
*/
|
|
11
|
+
export class SimSsmParameterPath {
|
|
12
|
+
/**
|
|
13
|
+
* The path as the request wrote it.
|
|
14
|
+
*/
|
|
15
|
+
value;
|
|
16
|
+
/**
|
|
17
|
+
* The ARN of the path, which is what an IAM policy names.
|
|
18
|
+
*/
|
|
19
|
+
arn;
|
|
20
|
+
prefix;
|
|
21
|
+
constructor(properties) {
|
|
22
|
+
this.value = SimSsmParameterPath.validated(properties.path);
|
|
23
|
+
// A trailing slash is optional in the request and never part of the ARN.
|
|
24
|
+
const resource = this.value.replace(/^\//, "").replace(/\/$/, "");
|
|
25
|
+
this.arn = ssmParameterArnPrefix(properties.accountRegionScope) + resource;
|
|
26
|
+
this.prefix = resource === "" ? "" : `${resource}/`;
|
|
27
|
+
}
|
|
28
|
+
static validated(path) {
|
|
29
|
+
if (path === undefined || path.trim() === "") {
|
|
30
|
+
throw new SimSsmValidationException("A Path is required for GetParametersByPath");
|
|
31
|
+
}
|
|
32
|
+
const trimmed = path.trim();
|
|
33
|
+
if (!trimmed.startsWith("/")) {
|
|
34
|
+
throw new SimSsmValidationException(`Path '${trimmed}' does not start with a forward slash: a parameter ` +
|
|
35
|
+
`hierarchy starts at '/'`);
|
|
36
|
+
}
|
|
37
|
+
return trimmed;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether a parameter lies under this path.
|
|
41
|
+
*
|
|
42
|
+
* Without `recursive` only the level immediately below the path counts, so
|
|
43
|
+
* `/myapp/db-host` is under `/myapp` and `/myapp/prod/db-host` is not.
|
|
44
|
+
*/
|
|
45
|
+
contains(parameter, recursive) {
|
|
46
|
+
const { resource } = parameter.arn;
|
|
47
|
+
if (!resource.startsWith(this.prefix)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (recursive) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return !resource.slice(this.prefix.length).includes("/");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=sim-ssm-parameter-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-path.js","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-path.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOnE;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACa,KAAK,CAAS;IAE9B;;OAEG;IACa,GAAG,CAAS;IAEX,MAAM,CAAS;IAEhC,YAAY,UAAyC;QACnD,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAE5D,yEAAyE;QACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAElE,IAAI,CAAC,GAAG,GAAG,qBAAqB,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,QAAQ,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC;IACtD,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,IAAwB;QAC/C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC7C,MAAM,IAAI,yBAAyB,CACjC,4CAA4C,CAC7C,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE5B,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,yBAAyB,CACjC,SAAS,OAAO,qDAAqD;gBACnE,yBAAyB,CAC5B,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,SAA0B,EAAE,SAAkB;QACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC;QAEnC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SimSsmParameter } from "./sim-ssm-parameter.js";
|
|
2
|
+
import type { SimSsmParameterVersion } from "./sim-ssm-parameter-version.js";
|
|
3
|
+
/**
|
|
4
|
+
* A parameter name as a request writes it, with an optional version or label
|
|
5
|
+
* selector after a colon.
|
|
6
|
+
*
|
|
7
|
+
* A parameter name cannot contain a colon, so the first one separates the name
|
|
8
|
+
* from the selector. `name:3` names a version and `name:release` names a
|
|
9
|
+
* label, which is how real Parameter Store tells the two apart: a label may
|
|
10
|
+
* not start with a digit.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SimSsmParameterSelector {
|
|
13
|
+
/**
|
|
14
|
+
* The parameter name, without the selector.
|
|
15
|
+
*/
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/**
|
|
18
|
+
* The selector as Parameter Store reports it back, such as `:3`.
|
|
19
|
+
*/
|
|
20
|
+
readonly selector: string | undefined;
|
|
21
|
+
private readonly version;
|
|
22
|
+
private readonly label;
|
|
23
|
+
constructor(requestedName: string);
|
|
24
|
+
/**
|
|
25
|
+
* The version of a parameter this selector names.
|
|
26
|
+
*
|
|
27
|
+
* Parameter labels are refused rather than looked up. Nothing in this
|
|
28
|
+
* simulation can create one, because LabelParameterVersion is not
|
|
29
|
+
* implemented, so a label selector could only ever fail. Saying why beats
|
|
30
|
+
* reporting the parameter as missing.
|
|
31
|
+
*/
|
|
32
|
+
versionOf(parameter: SimSsmParameter): SimSsmParameterVersion;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=sim-ssm-parameter-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-selector.d.ts","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-selector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAI7E;;;;;;;;GAQG;AACH,qBAAa,uBAAuB;IAClC;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,SAAgB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAE7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAE3C,YAAY,aAAa,EAAE,MAAM,EAyBhC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,SAAS,EAAE,eAAe,GAAG,sBAAsB,CAc5D;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SimSsmParameterNotFound, SimSsmValidationException, } from "../error/sim-ssm.error.js";
|
|
2
|
+
const versionNumberPattern = /^\d+$/;
|
|
3
|
+
/**
|
|
4
|
+
* A parameter name as a request writes it, with an optional version or label
|
|
5
|
+
* selector after a colon.
|
|
6
|
+
*
|
|
7
|
+
* A parameter name cannot contain a colon, so the first one separates the name
|
|
8
|
+
* from the selector. `name:3` names a version and `name:release` names a
|
|
9
|
+
* label, which is how real Parameter Store tells the two apart: a label may
|
|
10
|
+
* not start with a digit.
|
|
11
|
+
*/
|
|
12
|
+
export class SimSsmParameterSelector {
|
|
13
|
+
/**
|
|
14
|
+
* The parameter name, without the selector.
|
|
15
|
+
*/
|
|
16
|
+
name;
|
|
17
|
+
/**
|
|
18
|
+
* The selector as Parameter Store reports it back, such as `:3`.
|
|
19
|
+
*/
|
|
20
|
+
selector;
|
|
21
|
+
version;
|
|
22
|
+
label;
|
|
23
|
+
constructor(requestedName) {
|
|
24
|
+
const colonIndex = requestedName.indexOf(":");
|
|
25
|
+
if (colonIndex === -1) {
|
|
26
|
+
this.name = requestedName;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const selected = requestedName.slice(colonIndex + 1);
|
|
30
|
+
if (selected === "") {
|
|
31
|
+
throw new SimSsmValidationException(`Parameter name '${requestedName}' ends in a colon with no version ` +
|
|
32
|
+
`or label after it`);
|
|
33
|
+
}
|
|
34
|
+
this.name = requestedName.slice(0, colonIndex);
|
|
35
|
+
this.selector = `:${selected}`;
|
|
36
|
+
if (versionNumberPattern.test(selected)) {
|
|
37
|
+
this.version = Number(selected);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.label = selected;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The version of a parameter this selector names.
|
|
45
|
+
*
|
|
46
|
+
* Parameter labels are refused rather than looked up. Nothing in this
|
|
47
|
+
* simulation can create one, because LabelParameterVersion is not
|
|
48
|
+
* implemented, so a label selector could only ever fail. Saying why beats
|
|
49
|
+
* reporting the parameter as missing.
|
|
50
|
+
*/
|
|
51
|
+
versionOf(parameter) {
|
|
52
|
+
if (this.label !== undefined) {
|
|
53
|
+
throw new SimSsmParameterNotFound(`Parameter '${this.name}' has no label '${this.label}': parameter ` +
|
|
54
|
+
`labels are not simulated, because LabelParameterVersion is not ` +
|
|
55
|
+
`implemented. Select a version number instead.`);
|
|
56
|
+
}
|
|
57
|
+
if (this.version === undefined) {
|
|
58
|
+
return parameter.currentVersion;
|
|
59
|
+
}
|
|
60
|
+
return parameter.versionNumbered(this.version);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=sim-ssm-parameter-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-selector.js","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-selector.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAInC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAuB;IAClC;;OAEG;IACa,IAAI,CAAS;IAE7B;;OAEG;IACa,QAAQ,CAAqB;IAE5B,OAAO,CAAqB;IAC5B,KAAK,CAAqB;IAE3C,YAAY,aAAqB;QAC/B,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAE9C,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAErD,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;YACpB,MAAM,IAAI,yBAAyB,CACjC,mBAAmB,aAAa,oCAAoC;gBAClE,mBAAmB,CACtB,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE/B,IAAI,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;QACxB,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,SAA0B;QAClC,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,IAAI,uBAAuB,CAC/B,cAAc,IAAI,CAAC,IAAI,mBAAmB,IAAI,CAAC,KAAK,eAAe;gBACjE,iEAAiE;gBACjE,+CAA+C,CAClD,CAAC;QACJ,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAC,cAAc,CAAC;QAClC,CAAC;QAED,OAAO,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SimSsmParameter } from "./sim-ssm-parameter.js";
|
|
2
|
+
import type { SimSsmParameterPath } from "./sim-ssm-parameter-path.js";
|
|
3
|
+
/**
|
|
4
|
+
* The parameters of one simulated SSM scope, and how a requested name
|
|
5
|
+
* resolves to one of them.
|
|
6
|
+
*
|
|
7
|
+
* Parameters are keyed by the resource part of their ARN rather than by the
|
|
8
|
+
* name as written, so `/db-host` and `db-host` reach the same parameter. They
|
|
9
|
+
* have to: both name the same ARN, so no IAM policy could tell them apart.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SimSsmParameterStore {
|
|
12
|
+
private readonly parameters;
|
|
13
|
+
/**
|
|
14
|
+
* Every parameter in this scope, in creation order.
|
|
15
|
+
*/
|
|
16
|
+
get all(): readonly SimSsmParameter[];
|
|
17
|
+
/**
|
|
18
|
+
* Store a newly created parameter.
|
|
19
|
+
*/
|
|
20
|
+
add(parameter: SimSsmParameter): void;
|
|
21
|
+
/**
|
|
22
|
+
* Forget a deleted parameter.
|
|
23
|
+
*/
|
|
24
|
+
remove(parameter: SimSsmParameter): void;
|
|
25
|
+
/**
|
|
26
|
+
* Find a parameter by name, with or without its leading slash.
|
|
27
|
+
*/
|
|
28
|
+
find(name: string): SimSsmParameter | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a parameter by name, or refuse.
|
|
31
|
+
*/
|
|
32
|
+
require(name: string): SimSsmParameter;
|
|
33
|
+
/**
|
|
34
|
+
* The parameters under one level of the hierarchy, in name order.
|
|
35
|
+
*
|
|
36
|
+
* Real Parameter Store returns a path listing sorted by name rather than in
|
|
37
|
+
* creation order.
|
|
38
|
+
*/
|
|
39
|
+
under(path: SimSsmParameterPath, recursive: boolean): readonly SimSsmParameter[];
|
|
40
|
+
/**
|
|
41
|
+
* Every parameter in this scope, in name order.
|
|
42
|
+
*/
|
|
43
|
+
get allByName(): readonly SimSsmParameter[];
|
|
44
|
+
private sortedByName;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=sim-ssm-parameter-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-store.d.ts","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsC;IAEjE;;OAEG;IACH,IAAI,GAAG,IAAI,SAAS,eAAe,EAAE,CAEpC;IAED;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAEpC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAEvC;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAE9C;IAED;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAUrC;IAED;;;;;OAKG;IACH,KAAK,CACH,IAAI,EAAE,mBAAmB,EACzB,SAAS,EAAE,OAAO,GACjB,SAAS,eAAe,EAAE,CAI5B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,SAAS,eAAe,EAAE,CAE1C;IAED,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { SimSsmParameterNotFound } from "../error/sim-ssm.error.js";
|
|
2
|
+
import { SimSsmParameterName } from "./sim-ssm-parameter-name.js";
|
|
3
|
+
/**
|
|
4
|
+
* The parameters of one simulated SSM scope, and how a requested name
|
|
5
|
+
* resolves to one of them.
|
|
6
|
+
*
|
|
7
|
+
* Parameters are keyed by the resource part of their ARN rather than by the
|
|
8
|
+
* name as written, so `/db-host` and `db-host` reach the same parameter. They
|
|
9
|
+
* have to: both name the same ARN, so no IAM policy could tell them apart.
|
|
10
|
+
*/
|
|
11
|
+
export class SimSsmParameterStore {
|
|
12
|
+
parameters = new Map();
|
|
13
|
+
/**
|
|
14
|
+
* Every parameter in this scope, in creation order.
|
|
15
|
+
*/
|
|
16
|
+
get all() {
|
|
17
|
+
return this.parameters.values().toArray();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Store a newly created parameter.
|
|
21
|
+
*/
|
|
22
|
+
add(parameter) {
|
|
23
|
+
this.parameters.set(parameter.arn.resource, parameter);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Forget a deleted parameter.
|
|
27
|
+
*/
|
|
28
|
+
remove(parameter) {
|
|
29
|
+
this.parameters.delete(parameter.arn.resource);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find a parameter by name, with or without its leading slash.
|
|
33
|
+
*/
|
|
34
|
+
find(name) {
|
|
35
|
+
return this.parameters.get(SimSsmParameterName.resourceFor(name));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a parameter by name, or refuse.
|
|
39
|
+
*/
|
|
40
|
+
require(name) {
|
|
41
|
+
const found = this.find(name);
|
|
42
|
+
if (found === undefined) {
|
|
43
|
+
throw new SimSsmParameterNotFound(`Parameter '${name}' not found: verify the name and try again`);
|
|
44
|
+
}
|
|
45
|
+
return found;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The parameters under one level of the hierarchy, in name order.
|
|
49
|
+
*
|
|
50
|
+
* Real Parameter Store returns a path listing sorted by name rather than in
|
|
51
|
+
* creation order.
|
|
52
|
+
*/
|
|
53
|
+
under(path, recursive) {
|
|
54
|
+
return this.sortedByName(this.all.filter((parameter) => path.contains(parameter, recursive)));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Every parameter in this scope, in name order.
|
|
58
|
+
*/
|
|
59
|
+
get allByName() {
|
|
60
|
+
return this.sortedByName(this.all);
|
|
61
|
+
}
|
|
62
|
+
sortedByName(parameters) {
|
|
63
|
+
return parameters.toSorted((one, other) => one.name.value.localeCompare(other.name.value));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=sim-ssm-parameter-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-store.js","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IACd,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAC;IAEjE;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,SAA0B;QAC5B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAA0B;QAC/B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,IAAY;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,mBAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QAClB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,uBAAuB,CAC/B,cAAc,IAAI,4CAA4C,CAC/D,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,KAAK,CACH,IAAyB,EACzB,SAAkB;QAElB,OAAO,IAAI,CAAC,YAAY,CACtB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CACpE,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAEO,YAAY,CAClB,UAAsC;QAEtC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CACxC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAC/C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parameter types this simulation stores.
|
|
3
|
+
*/
|
|
4
|
+
export type SimSsmParameterTypeName = "String" | "StringList";
|
|
5
|
+
/**
|
|
6
|
+
* The type of one simulated parameter.
|
|
7
|
+
*
|
|
8
|
+
* `SecureString` is refused rather than stored. Nothing in this simulation
|
|
9
|
+
* would encrypt it, so accepting it would let a test pass while proving
|
|
10
|
+
* nothing about the KMS key, the `kms:Decrypt` permission or the
|
|
11
|
+
* `WithDecryption` flag a real deployment depends on.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SimSsmParameterType {
|
|
14
|
+
readonly value: SimSsmParameterTypeName;
|
|
15
|
+
constructor(type: string);
|
|
16
|
+
/**
|
|
17
|
+
* Read the type a new parameter is created with.
|
|
18
|
+
*
|
|
19
|
+
* Parameter Store requires a type when a parameter is created and allows it
|
|
20
|
+
* to be left out when one is updated.
|
|
21
|
+
*/
|
|
22
|
+
static forNewParameter(type: string | undefined): SimSsmParameterType;
|
|
23
|
+
private static validated;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sim-ssm-parameter-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-type.d.ts","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-type.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAI9D;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAC9B,SAAgB,KAAK,EAAE,uBAAuB,CAAC;IAE/C,YAAY,IAAI,EAAE,MAAM,EAEvB;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQpE;IAED,OAAO,CAAC,MAAM,CAAC,SAAS;CAmBzB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SimSsmUnsupportedParameterType, SimSsmValidationException, } from "../error/sim-ssm.error.js";
|
|
2
|
+
const simulatedTypes = new Set(["String", "StringList"]);
|
|
3
|
+
/**
|
|
4
|
+
* The type of one simulated parameter.
|
|
5
|
+
*
|
|
6
|
+
* `SecureString` is refused rather than stored. Nothing in this simulation
|
|
7
|
+
* would encrypt it, so accepting it would let a test pass while proving
|
|
8
|
+
* nothing about the KMS key, the `kms:Decrypt` permission or the
|
|
9
|
+
* `WithDecryption` flag a real deployment depends on.
|
|
10
|
+
*/
|
|
11
|
+
export class SimSsmParameterType {
|
|
12
|
+
value;
|
|
13
|
+
constructor(type) {
|
|
14
|
+
this.value = SimSsmParameterType.validated(type);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Read the type a new parameter is created with.
|
|
18
|
+
*
|
|
19
|
+
* Parameter Store requires a type when a parameter is created and allows it
|
|
20
|
+
* to be left out when one is updated.
|
|
21
|
+
*/
|
|
22
|
+
static forNewParameter(type) {
|
|
23
|
+
if (type === undefined) {
|
|
24
|
+
throw new SimSsmValidationException("A parameter Type is required when creating a parameter");
|
|
25
|
+
}
|
|
26
|
+
return new SimSsmParameterType(type);
|
|
27
|
+
}
|
|
28
|
+
static validated(type) {
|
|
29
|
+
if (type === "SecureString") {
|
|
30
|
+
throw new SimSsmUnsupportedParameterType("SecureString parameters are not simulated: nothing here would " +
|
|
31
|
+
"encrypt the value, so a passing test would say nothing about the " +
|
|
32
|
+
"KMS key or the kms:Decrypt permission the real parameter needs. " +
|
|
33
|
+
"Use String or StringList.");
|
|
34
|
+
}
|
|
35
|
+
if (!simulatedTypes.has(type)) {
|
|
36
|
+
throw new SimSsmUnsupportedParameterType(`Parameter type '${type}' is not a Parameter Store type: use String ` +
|
|
37
|
+
`or StringList`);
|
|
38
|
+
}
|
|
39
|
+
return type;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=sim-ssm-parameter-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-type.js","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-type.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAOnC,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IACd,KAAK,CAA0B;IAE/C,YAAY,IAAY;QACtB,IAAI,CAAC,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,IAAwB;QAC7C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,yBAAyB,CACjC,wDAAwD,CACzD,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,IAAY;QACnC,IAAI,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5B,MAAM,IAAI,8BAA8B,CACtC,gEAAgE;gBAC9D,mEAAmE;gBACnE,kEAAkE;gBAClE,2BAA2B,CAC9B,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,8BAA8B,CACtC,mBAAmB,IAAI,8CAA8C;gBACnE,eAAe,CAClB,CAAC;QACJ,CAAC;QAED,OAAO,IAA+B,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value held by one version of a simulated parameter.
|
|
3
|
+
*
|
|
4
|
+
* A `StringList` value is a single comma-separated string here, as it is on
|
|
5
|
+
* real Parameter Store. It is stored and returned that way rather than split
|
|
6
|
+
* into an array, so handler code that splits it on commas is exercising the
|
|
7
|
+
* same shape it would get from AWS.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SimSsmParameterValue {
|
|
10
|
+
readonly value: string;
|
|
11
|
+
constructor(value: string | undefined);
|
|
12
|
+
private static validated;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=sim-ssm-parameter-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-ssm-parameter-value.d.ts","sourceRoot":"","sources":["../../../../src/service/ssm/parameter/sim-ssm-parameter-value.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAC/B,SAAgB,KAAK,EAAE,MAAM,CAAC;IAE9B,YAAY,KAAK,EAAE,MAAM,GAAG,SAAS,EAEpC;IAED,OAAO,CAAC,MAAM,CAAC,SAAS;CAmBzB"}
|