@kensio/yulin 1.21.5 → 1.21.7

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.
Files changed (99) hide show
  1. package/dist/service/cloudformation/resource/cfn/sim-cfn-default-resource-value-adapter.d.ts +8 -1
  2. package/dist/service/cloudformation/resource/cfn/sim-cfn-default-resource-value-adapter.js +9 -2
  3. package/dist/service/cloudformation/resource/cfn/sim-cfn-resource-value-adapter.d.ts +6 -1
  4. package/dist/service/cloudformation/resource/cfn/sim-cfn-resource-value-adapter.js +2 -1
  5. package/dist/service/cloudformation/resource/create/sim-cfn-resource-create-operation.d.ts +4 -0
  6. package/dist/service/cloudformation/resource/create/sim-cfn-resource-create-operation.js +6 -0
  7. package/dist/service/cloudformation/resource/sim-cfn-resource-record.d.ts +19 -0
  8. package/dist/service/cloudformation/resource/sim-cfn-resource-record.js +26 -0
  9. package/dist/service/cloudformation/resource/sim-cfn-resource.js +1 -0
  10. package/dist/service/cloudformation/resource/unsupported/sim-cfn-named-skip.d.ts +26 -0
  11. package/dist/service/cloudformation/resource/unsupported/sim-cfn-named-skip.js +31 -0
  12. package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.d.ts +5 -2
  13. package/dist/service/cloudfront/cfn/cache-policy/sim-cfn-cf-cache-policy-creator.js +10 -2
  14. package/dist/service/cloudfront/cfn/origin-access-control/sim-cfn-cf-oac-creator.d.ts +5 -2
  15. package/dist/service/cloudfront/cfn/origin-access-control/sim-cfn-cf-oac-creator.js +10 -2
  16. package/dist/service/cloudfront/cfn/origin-request-policy/sim-cfn-cf-orp-creator.d.ts +5 -2
  17. package/dist/service/cloudfront/cfn/origin-request-policy/sim-cfn-cf-orp-creator.js +10 -2
  18. package/dist/service/cloudfront/cfn/policy/sim-cfn-cf-policy-creators.d.ts +33 -0
  19. package/dist/service/cloudfront/cfn/policy/sim-cfn-cf-policy-creators.js +39 -0
  20. package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-creator.d.ts +5 -2
  21. package/dist/service/cloudfront/cfn/response-headers-policy/sim-cfn-cf-rh-policy-creator.js +10 -2
  22. package/dist/service/cloudfront/cfn/sim-cfn-cf-authorizer.d.ts +40 -0
  23. package/dist/service/cloudfront/cfn/sim-cfn-cf-authorizer.js +50 -0
  24. package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.d.ts +1 -4
  25. package/dist/service/cloudfront/cfn/sim-cfn-cloudfront-resource-factory.js +14 -46
  26. package/dist/service/cloudfront/sim-cloudfront-commands.d.ts +6 -0
  27. package/dist/service/cloudfront/sim-cloudfront-commands.js +7 -0
  28. package/dist/service/cloudfront/sim-cloudfront.d.ts +6 -0
  29. package/dist/service/cloudfront/sim-cloudfront.js +7 -0
  30. package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.d.ts +8 -0
  31. package/dist/service/dynamodb/document/sim-dynamodb-document-command-paths.js +62 -0
  32. package/dist/service/dynamodb/document/sim-dynamodb-document-routes.d.ts +1 -1
  33. package/dist/service/dynamodb/document/sim-dynamodb-document-routes.js +3 -1
  34. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-creator.js +1 -0
  35. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.d.ts +4 -0
  36. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.js +26 -1
  37. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-creator.js +3 -1
  38. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.d.ts +0 -7
  39. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-properties.js +0 -20
  40. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.d.ts +13 -0
  41. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-unsimulated-properties.js +59 -0
  42. package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.d.ts +1 -1
  43. package/dist/service/eventbridge/cfn/sim-cfn-event-bridge-resource-error.js +1 -1
  44. package/dist/service/iam/authorize/sim-iam-action-authorizer.d.ts +8 -3
  45. package/dist/service/iam/authorize/sim-iam-action-authorizer.js +13 -4
  46. package/dist/service/iam/cfn/role/sim-cfn-iam-role-creator.js +1 -0
  47. package/dist/service/iam/cfn/role/sim-cfn-iam-role-properties-parser.d.ts +1 -0
  48. package/dist/service/iam/cfn/role/sim-cfn-iam-role-properties-parser.js +21 -14
  49. package/dist/service/iam/cfn/{sim-cfn-iam-optional-string.d.ts → sim-cfn-iam-property.d.ts} +10 -2
  50. package/dist/service/iam/cfn/sim-cfn-iam-property.js +31 -0
  51. package/dist/service/iam/cfn/user/sim-cfn-iam-user-properties-parser.js +1 -1
  52. package/dist/service/iam/command/role/create-role/create-role-record-factory.js +3 -0
  53. package/dist/service/iam/command/role/create-role/create-role.command.d.ts +10 -0
  54. package/dist/service/iam/command/role/get-role/get-role.command.d.ts +2 -0
  55. package/dist/service/iam/command/role/get-role/get-role.handler.js +2 -0
  56. package/dist/service/iam/command/role/sim-iam-role-command-handlers.js +15 -1
  57. package/dist/service/iam/role/sim-iam-role-boundary.d.ts +24 -0
  58. package/dist/service/iam/role/sim-iam-role-boundary.js +24 -0
  59. package/dist/service/iam/role/sim-iam-role-with-policy.factory.d.ts +1 -0
  60. package/dist/service/iam/role/sim-iam-role.d.ts +10 -0
  61. package/dist/service/iam/serve/sim-iam-query-entity.d.ts +6 -1
  62. package/dist/service/iam/serve/sim-iam-query-entity.js +10 -4
  63. package/dist/service/iam/serve/sim-iam-query-role-operations.js +15 -3
  64. package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-properties.js +1 -1
  65. package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.d.ts +3 -2
  66. package/dist/service/lambda/cfn/event-source-mapping/sim-cfn-lambda-event-source-mapping-property-rules.js +25 -3
  67. package/dist/service/lambda/cfn/function/sim-cfn-lambda-runtime-skip.d.ts +6 -0
  68. package/dist/service/lambda/cfn/function/sim-cfn-lambda-runtime-skip.js +9 -2
  69. package/dist/service/route53/command/create-hosted-zone/sim-route53-zone-id.js +23 -1
  70. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-creator.js +1 -0
  71. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.d.ts +9 -4
  72. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-properties.js +18 -6
  73. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.d.ts +10 -0
  74. package/dist/service/sns/cfn/topic/sim-cfn-sns-topic-property-names.js +16 -1
  75. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-creator.js +1 -1
  76. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.d.ts +11 -6
  77. package/dist/service/ssm/cfn/parameter/sim-cfn-ssm-parameter-properties.js +18 -9
  78. package/docs/README.md +33 -4
  79. package/docs/ai-skill/README.md +52 -54
  80. package/docs/cli/README.md +84 -94
  81. package/docs/factories/README.md +42 -54
  82. package/docs/lint/README.md +41 -67
  83. package/docs/non-aws-dependencies/README.md +72 -168
  84. package/docs/sdk/README.md +97 -98
  85. package/docs/serve/README.md +192 -898
  86. package/docs/services/cloudformation/README.md +88 -23
  87. package/docs/services/cloudfront/README.md +109 -0
  88. package/docs/services/dynamodb/README.md +128 -8
  89. package/docs/services/eventbridge/README.md +10 -2
  90. package/docs/services/iam/README.md +125 -2
  91. package/docs/services/lambda/README.md +7 -1
  92. package/docs/services/route53/README.md +11 -0
  93. package/docs/services/sns/README.md +13 -7
  94. package/docs/services/ssm/README.md +6 -4
  95. package/docs/terraform/README.md +108 -126
  96. package/docs/time/README.md +80 -120
  97. package/llms.txt +1 -1
  98. package/package.json +1 -1
  99. package/dist/service/iam/cfn/sim-cfn-iam-optional-string.js +0 -17
@@ -2,6 +2,7 @@ import type { SimCfnTemplateValue } from "../../template/value/sim-cfn-template-
2
2
  import type { SimCfnResourceValueAdapter } from "./sim-cfn-resource-value-adapter.js";
3
3
  interface SimCfnDefaultResourceValueAdapterProperties {
4
4
  readonly logicalId: string;
5
+ readonly uncreatedPhysicalName?: string | undefined;
5
6
  }
6
7
  /**
7
8
  * Fallback CloudFormation-facing values for Resource types without specific
@@ -9,9 +10,15 @@ interface SimCfnDefaultResourceValueAdapterProperties {
9
10
  */
10
11
  export declare class SimCfnDefaultResourceValueAdapter implements SimCfnResourceValueAdapter {
11
12
  private readonly logicalId;
13
+ private readonly uncreatedPhysicalName;
12
14
  constructor(properties: SimCfnDefaultResourceValueAdapterProperties);
13
15
  /**
14
- * Default physical-ID stand-in.
16
+ * The physical ID this Resource would have had, or the logical-ID stand-in.
17
+ *
18
+ * A service that worked out the Resource's name before refusing to create it
19
+ * leaves the simulation holding the name real CloudFormation would have
20
+ * produced. That is what Ref answers with. The logical ID is left for a
21
+ * Resource nothing ever named.
15
22
  */
16
23
  refValue(): SimCfnTemplateValue;
17
24
  /**
@@ -5,14 +5,21 @@ import { simCfnUnansweredAttribute } from "./sim-cfn-unanswered-attribute.js";
5
5
  */
6
6
  export class SimCfnDefaultResourceValueAdapter {
7
7
  logicalId;
8
+ uncreatedPhysicalName;
8
9
  constructor(properties) {
9
10
  this.logicalId = properties.logicalId;
11
+ this.uncreatedPhysicalName = properties.uncreatedPhysicalName;
10
12
  }
11
13
  /**
12
- * Default physical-ID stand-in.
14
+ * The physical ID this Resource would have had, or the logical-ID stand-in.
15
+ *
16
+ * A service that worked out the Resource's name before refusing to create it
17
+ * leaves the simulation holding the name real CloudFormation would have
18
+ * produced. That is what Ref answers with. The logical ID is left for a
19
+ * Resource nothing ever named.
13
20
  */
14
21
  refValue() {
15
- return this.logicalId;
22
+ return this.uncreatedPhysicalName ?? this.logicalId;
16
23
  }
17
24
  /**
18
25
  * Default attribute stand-in.
@@ -7,6 +7,11 @@ export interface SimCfnResourceValueAdapterProperties {
7
7
  readonly logicalId: string;
8
8
  readonly type: string | undefined;
9
9
  readonly simResource: object | undefined;
10
+ /**
11
+ * The name real CloudFormation would have given the Resource, where the
12
+ * service knew it before deciding not to create it.
13
+ */
14
+ readonly uncreatedPhysicalName?: string | undefined;
10
15
  }
11
16
  /**
12
17
  * The adapter for a Resource type one service owns, or nothing when the
@@ -23,6 +28,6 @@ export type SimCfnServiceValueAdapter = SimCfnResourceValueAdapter | undefined;
23
28
  * Each service matches its own Resource types, beside that service's adapters,
24
29
  * so this registry stays a list of services. A Resource no service claims
25
30
  * falls through to the default adapter, which answers a Ref with the logical
26
- * ID.
31
+ * ID, or with the name a service worked out before refusing the Resource.
27
32
  */
28
33
  export declare function simCfnResourceValueAdapter(properties: SimCfnResourceValueAdapterProperties): SimCfnResourceValueAdapter;
@@ -10,7 +10,7 @@ import { simCfnServiceValueAdapters } from "./sim-cfn-service-value-adapters.js"
10
10
  * Each service matches its own Resource types, beside that service's adapters,
11
11
  * so this registry stays a list of services. A Resource no service claims
12
12
  * falls through to the default adapter, which answers a Ref with the logical
13
- * ID.
13
+ * ID, or with the name a service worked out before refusing the Resource.
14
14
  */
15
15
  export function simCfnResourceValueAdapter(properties) {
16
16
  for (const serviceAdapter of simCfnServiceValueAdapters) {
@@ -21,5 +21,6 @@ export function simCfnResourceValueAdapter(properties) {
21
21
  }
22
22
  return new SimCfnDefaultResourceValueAdapter({
23
23
  logicalId: properties.logicalId,
24
+ uncreatedPhysicalName: properties.uncreatedPhysicalName,
24
25
  });
25
26
  }
@@ -39,6 +39,10 @@ export declare class SimCfnResourceCreateOperation<T extends object = object> {
39
39
  * a gap and is skipped, unless nothing this simulator models could have told
40
40
  * it apart from one that was created, in which case saying it is missing
41
41
  * sends a reader after something that is not lost.
42
+ *
43
+ * Either way the Resource keeps whatever name the refusal carried. A
44
+ * template reading a Ref of it then gets the name real CloudFormation would
45
+ * have produced.
42
46
  */
43
47
  private recordUncreated;
44
48
  private resourceCreationError;
@@ -1,6 +1,7 @@
1
1
  import { SimCfnResourceCreator } from "./sim-cfn-resource-creator.js";
2
2
  import { simCfnInertResourceReason } from "../inert/sim-cfn-inert-resource.js";
3
3
  import { isSimCfnUnsupportedResourceError } from "../unsupported/sim-cfn-unsupported-resource.js";
4
+ import { simCfnSkippedPhysicalName } from "../unsupported/sim-cfn-named-skip.js";
4
5
  /**
5
6
  * Runs the asynchronous CloudFormation Resource creation lifecycle.
6
7
  *
@@ -63,8 +64,13 @@ export class SimCfnResourceCreateOperation {
63
64
  * a gap and is skipped, unless nothing this simulator models could have told
64
65
  * it apart from one that was created, in which case saying it is missing
65
66
  * sends a reader after something that is not lost.
67
+ *
68
+ * Either way the Resource keeps whatever name the refusal carried. A
69
+ * template reading a Ref of it then gets the name real CloudFormation would
70
+ * have produced.
66
71
  */
67
72
  recordUncreated(error, context) {
73
+ this.resource.recordUncreatedPhysicalName(simCfnSkippedPhysicalName(error));
68
74
  const inertReason = simCfnInertResourceReason(this.resource, context.resources);
69
75
  if (inertReason !== undefined) {
70
76
  this.resource.markCreateInert(inertReason);
@@ -18,6 +18,7 @@ import type { SimCfnResourceResolveContext, SimCloudFormationResourceProperties
18
18
  * be calling.
19
19
  */
20
20
  export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgnorer {
21
+ #private;
21
22
  readonly accountRegionScope: SimAwsAccountRegionScope;
22
23
  readonly logicalId: string;
23
24
  /** The Stack this Resource belongs to, where a generated name comes from. */
@@ -32,6 +33,14 @@ export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgno
32
33
  * The simulated AWS object created for this CloudFormation Resource.
33
34
  */
34
35
  abstract get simResource(): object | undefined;
36
+ /**
37
+ * The name real CloudFormation would have given this Resource, where a
38
+ * service worked it out before refusing to create it.
39
+ *
40
+ * A Resource with a name behind it answers Ref with that name. The
41
+ * logical-ID stand-in is left for a Resource nothing ever named.
42
+ */
43
+ get uncreatedPhysicalName(): string | undefined;
35
44
  /**
36
45
  * The properties this Resource was created without acting on.
37
46
  */
@@ -97,6 +106,12 @@ export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgno
97
106
  * only thing that knows whether a property changes behaviour it simulates.
98
107
  */
99
108
  ignoreProperty(path: string, reason: string): void;
109
+ /**
110
+ * Record the name a service worked out for this Resource before refusing to
111
+ * create it. Called by the creation operation, which is where a refusal
112
+ * carrying a name is read.
113
+ */
114
+ recordUncreatedPhysicalName(physicalName: string | undefined): void;
100
115
  /**
101
116
  * The value returned when this Resource is referenced via Fn::GetAtt.
102
117
  *
@@ -132,5 +147,9 @@ export declare abstract class SimCfnResourceRecord implements SimCfnPropertyIgno
132
147
  * again.
133
148
  */
134
149
  protected clearIgnoredProperties(): void;
150
+ /**
151
+ * Forget the name a refusal recorded, for a Resource being created again.
152
+ */
153
+ protected clearUncreatedPhysicalName(): void;
135
154
  private cfnValueAdapter;
136
155
  }
@@ -25,6 +25,7 @@ export class SimCfnResourceRecord {
25
25
  /** The Stack this Resource belongs to, where a generated name comes from. */
26
26
  stackName;
27
27
  template;
28
+ #uncreatedPhysicalName;
28
29
  ignoredPropertyList = new SimCfnIgnoredProperties();
29
30
  resourceTemplateReader;
30
31
  propertyResolver;
@@ -54,6 +55,16 @@ export class SimCfnResourceRecord {
54
55
  });
55
56
  this.resourceLogicalIds = resourceLogicalIds;
56
57
  }
58
+ /**
59
+ * The name real CloudFormation would have given this Resource, where a
60
+ * service worked it out before refusing to create it.
61
+ *
62
+ * A Resource with a name behind it answers Ref with that name. The
63
+ * logical-ID stand-in is left for a Resource nothing ever named.
64
+ */
65
+ get uncreatedPhysicalName() {
66
+ return this.#uncreatedPhysicalName;
67
+ }
57
68
  /**
58
69
  * The properties this Resource was created without acting on.
59
70
  */
@@ -140,6 +151,14 @@ export class SimCfnResourceRecord {
140
151
  ignoreProperty(path, reason) {
141
152
  this.ignoredPropertyList.record(this, path, reason);
142
153
  }
154
+ /**
155
+ * Record the name a service worked out for this Resource before refusing to
156
+ * create it. Called by the creation operation, which is where a refusal
157
+ * carrying a name is read.
158
+ */
159
+ recordUncreatedPhysicalName(physicalName) {
160
+ this.#uncreatedPhysicalName = physicalName;
161
+ }
143
162
  /**
144
163
  * The value returned when this Resource is referenced via Fn::GetAtt.
145
164
  *
@@ -183,11 +202,18 @@ export class SimCfnResourceRecord {
183
202
  clearIgnoredProperties() {
184
203
  this.ignoredPropertyList.clear();
185
204
  }
205
+ /**
206
+ * Forget the name a refusal recorded, for a Resource being created again.
207
+ */
208
+ clearUncreatedPhysicalName() {
209
+ this.#uncreatedPhysicalName = undefined;
210
+ }
186
211
  cfnValueAdapter() {
187
212
  return simCfnResourceValueAdapter({
188
213
  logicalId: this.logicalId,
189
214
  type: this.type,
190
215
  simResource: this.simResource,
216
+ uncreatedPhysicalName: this.uncreatedPhysicalName,
191
217
  });
192
218
  }
193
219
  }
@@ -176,6 +176,7 @@ export class SimCfnResource extends SimCfnResourceRecord {
176
176
  */
177
177
  markCreateInProgress() {
178
178
  this.clearIgnoredProperties();
179
+ this.clearUncreatedPhysicalName();
179
180
  this.creationState.markCreateInProgress();
180
181
  }
181
182
  /**
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A refusal from a service that had already worked out the name real
3
+ * CloudFormation would give the Resource.
4
+ *
5
+ * The logical ID a skipped Resource answers `Ref` with stands in for a value
6
+ * the simulation does not hold. Where a service names a Resource before
7
+ * refusing it, the simulation does hold one, so raising this carries the name
8
+ * through the refusal and the Resource answers `Ref` with it. Sim Lambda
9
+ * declining a function on its Runtime is the case that needs it: CDK writes a
10
+ * log group name as `/aws/lambda/` joined to a `Ref` of the function, and a
11
+ * logical ID there produces a log group under a name no account would hold.
12
+ *
13
+ * Nothing else about the refusal changes. The message still decides whether
14
+ * the Stack records a skip or fails. A service raising this says "Unsupported
15
+ * sim ... CloudFormation" as it would in an ordinary Error.
16
+ */
17
+ export declare class SimCfnNamedSkip extends Error {
18
+ readonly physicalName: string;
19
+ readonly name = "SimCfnNamedSkip";
20
+ constructor(message: string, physicalName: string);
21
+ }
22
+ /**
23
+ * The name a refusal carries, or nothing where the service had not named the
24
+ * Resource before refusing it.
25
+ */
26
+ export declare function simCfnSkippedPhysicalName(error: unknown): string | undefined;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A refusal from a service that had already worked out the name real
3
+ * CloudFormation would give the Resource.
4
+ *
5
+ * The logical ID a skipped Resource answers `Ref` with stands in for a value
6
+ * the simulation does not hold. Where a service names a Resource before
7
+ * refusing it, the simulation does hold one, so raising this carries the name
8
+ * through the refusal and the Resource answers `Ref` with it. Sim Lambda
9
+ * declining a function on its Runtime is the case that needs it: CDK writes a
10
+ * log group name as `/aws/lambda/` joined to a `Ref` of the function, and a
11
+ * logical ID there produces a log group under a name no account would hold.
12
+ *
13
+ * Nothing else about the refusal changes. The message still decides whether
14
+ * the Stack records a skip or fails. A service raising this says "Unsupported
15
+ * sim ... CloudFormation" as it would in an ordinary Error.
16
+ */
17
+ export class SimCfnNamedSkip extends Error {
18
+ physicalName;
19
+ name = "SimCfnNamedSkip";
20
+ constructor(message, physicalName) {
21
+ super(message);
22
+ this.physicalName = physicalName;
23
+ }
24
+ }
25
+ /**
26
+ * The name a refusal carries, or nothing where the service had not named the
27
+ * Resource before refusing it.
28
+ */
29
+ export function simCfnSkippedPhysicalName(error) {
30
+ return error instanceof SimCfnNamedSkip ? error.physicalName : undefined;
31
+ }
@@ -1,3 +1,4 @@
1
+ import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
1
2
  import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
2
3
  import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
3
4
  import type { SimCloudFront } from "../../sim-cloudfront.js";
@@ -10,15 +11,17 @@ interface SimCfnCfCachePolicyCreatorProperties {
10
11
  * Resources.
11
12
  */
12
13
  export declare class SimCfnCfCachePolicyCreator {
14
+ private static readonly createAction;
15
+ private static readonly deleteAction;
13
16
  private readonly cloudFront;
14
17
  constructor(properties: SimCfnCfCachePolicyCreatorProperties);
15
18
  /**
16
19
  * Create and store the policy one Resource describes.
17
20
  */
18
- create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontCachePolicy;
21
+ create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontCachePolicy;
19
22
  /**
20
23
  * Remove a policy created from a Resource.
21
24
  */
22
- delete(resource: SimCfnResource): void;
25
+ delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
23
26
  }
24
27
  export {};
@@ -4,6 +4,8 @@ import { SimCfnCfCachePolicyConfig } from "./sim-cfn-cf-cache-policy-config.js";
4
4
  * Resources.
5
5
  */
6
6
  export class SimCfnCfCachePolicyCreator {
7
+ static createAction = "cloudfront:CreateCachePolicy";
8
+ static deleteAction = "cloudfront:DeleteCachePolicy";
7
9
  cloudFront;
8
10
  constructor(properties) {
9
11
  this.cloudFront = properties.cloudFront;
@@ -11,7 +13,10 @@ export class SimCfnCfCachePolicyCreator {
11
13
  /**
12
14
  * Create and store the policy one Resource describes.
13
15
  */
14
- create(resource, properties) {
16
+ create(resource, properties, options) {
17
+ this.cloudFront
18
+ .cfnAuthorizer()
19
+ .authorizeAny(SimCfnCfCachePolicyCreator.createAction, options);
15
20
  const policy = new SimCfnCfCachePolicyConfig({
16
21
  resource,
17
22
  properties,
@@ -22,11 +27,14 @@ export class SimCfnCfCachePolicyCreator {
22
27
  /**
23
28
  * Remove a policy created from a Resource.
24
29
  */
25
- delete(resource) {
30
+ delete(resource, options) {
26
31
  const policy = resource.simResource;
27
32
  if (policy === undefined) {
28
33
  return;
29
34
  }
35
+ this.cloudFront
36
+ .cfnAuthorizer()
37
+ .authorizeResource(SimCfnCfCachePolicyCreator.deleteAction, `cache-policy/${policy.id}`, options);
30
38
  this.cloudFront.removeCachePolicy(policy.id);
31
39
  }
32
40
  }
@@ -1,3 +1,4 @@
1
+ import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
1
2
  import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
2
3
  import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
3
4
  import type { SimCloudFront } from "../../sim-cloudfront.js";
@@ -10,15 +11,17 @@ interface SimCfnCfOriginAccessControlCreatorProperties {
10
11
  * AWS::CloudFront::OriginAccessControl Resources.
11
12
  */
12
13
  export declare class SimCfnCfOriginAccessControlCreator {
14
+ private static readonly createAction;
15
+ private static readonly deleteAction;
13
16
  private readonly cloudFront;
14
17
  constructor(properties: SimCfnCfOriginAccessControlCreatorProperties);
15
18
  /**
16
19
  * Create and store the origin access control one Resource describes.
17
20
  */
18
- create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontOriginAccessControl;
21
+ create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontOriginAccessControl;
19
22
  /**
20
23
  * Remove an origin access control created from a Resource.
21
24
  */
22
- delete(resource: SimCfnResource): void;
25
+ delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
23
26
  }
24
27
  export {};
@@ -4,6 +4,8 @@ import { SimCfnCfOriginAccessControlConfig } from "./sim-cfn-cf-oac-config.js";
4
4
  * AWS::CloudFront::OriginAccessControl Resources.
5
5
  */
6
6
  export class SimCfnCfOriginAccessControlCreator {
7
+ static createAction = "cloudfront:CreateOriginAccessControl";
8
+ static deleteAction = "cloudfront:DeleteOriginAccessControl";
7
9
  cloudFront;
8
10
  constructor(properties) {
9
11
  this.cloudFront = properties.cloudFront;
@@ -11,7 +13,10 @@ export class SimCfnCfOriginAccessControlCreator {
11
13
  /**
12
14
  * Create and store the origin access control one Resource describes.
13
15
  */
14
- create(resource, properties) {
16
+ create(resource, properties, options) {
17
+ this.cloudFront
18
+ .cfnAuthorizer()
19
+ .authorizeAny(SimCfnCfOriginAccessControlCreator.createAction, options);
15
20
  const originAccessControl = new SimCfnCfOriginAccessControlConfig({
16
21
  resource,
17
22
  properties,
@@ -22,11 +27,14 @@ export class SimCfnCfOriginAccessControlCreator {
22
27
  /**
23
28
  * Remove an origin access control created from a Resource.
24
29
  */
25
- delete(resource) {
30
+ delete(resource, options) {
26
31
  const originAccessControl = resource.simResource;
27
32
  if (originAccessControl === undefined) {
28
33
  return;
29
34
  }
35
+ this.cloudFront
36
+ .cfnAuthorizer()
37
+ .authorizeResource(SimCfnCfOriginAccessControlCreator.deleteAction, `origin-access-control/${originAccessControl.id}`, options);
30
38
  this.cloudFront.removeOriginAccessControl(originAccessControl.id);
31
39
  }
32
40
  }
@@ -1,3 +1,4 @@
1
+ import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
1
2
  import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
2
3
  import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
3
4
  import type { SimCloudFront } from "../../sim-cloudfront.js";
@@ -10,15 +11,17 @@ interface SimCfnCfOriginRequestPolicyCreatorProperties {
10
11
  * AWS::CloudFront::OriginRequestPolicy Resources.
11
12
  */
12
13
  export declare class SimCfnCfOriginRequestPolicyCreator {
14
+ private static readonly createAction;
15
+ private static readonly deleteAction;
13
16
  private readonly cloudFront;
14
17
  constructor(properties: SimCfnCfOriginRequestPolicyCreatorProperties);
15
18
  /**
16
19
  * Create and store the policy one Resource describes.
17
20
  */
18
- create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontOriginRequestPolicy;
21
+ create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontOriginRequestPolicy;
19
22
  /**
20
23
  * Remove a policy created from a Resource.
21
24
  */
22
- delete(resource: SimCfnResource): void;
25
+ delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
23
26
  }
24
27
  export {};
@@ -4,6 +4,8 @@ import { SimCfnCfOriginRequestPolicyConfig } from "./sim-cfn-cf-orp-config.js";
4
4
  * AWS::CloudFront::OriginRequestPolicy Resources.
5
5
  */
6
6
  export class SimCfnCfOriginRequestPolicyCreator {
7
+ static createAction = "cloudfront:CreateOriginRequestPolicy";
8
+ static deleteAction = "cloudfront:DeleteOriginRequestPolicy";
7
9
  cloudFront;
8
10
  constructor(properties) {
9
11
  this.cloudFront = properties.cloudFront;
@@ -11,7 +13,10 @@ export class SimCfnCfOriginRequestPolicyCreator {
11
13
  /**
12
14
  * Create and store the policy one Resource describes.
13
15
  */
14
- create(resource, properties) {
16
+ create(resource, properties, options) {
17
+ this.cloudFront
18
+ .cfnAuthorizer()
19
+ .authorizeAny(SimCfnCfOriginRequestPolicyCreator.createAction, options);
15
20
  const policy = new SimCfnCfOriginRequestPolicyConfig({
16
21
  resource,
17
22
  properties,
@@ -22,11 +27,14 @@ export class SimCfnCfOriginRequestPolicyCreator {
22
27
  /**
23
28
  * Remove a policy created from a Resource.
24
29
  */
25
- delete(resource) {
30
+ delete(resource, options) {
26
31
  const policy = resource.simResource;
27
32
  if (policy === undefined) {
28
33
  return;
29
34
  }
35
+ this.cloudFront
36
+ .cfnAuthorizer()
37
+ .authorizeResource(SimCfnCfOriginRequestPolicyCreator.deleteAction, `origin-request-policy/${policy.id}`, options);
30
38
  this.cloudFront.removeOriginRequestPolicy(policy.id);
31
39
  }
32
40
  }
@@ -0,0 +1,33 @@
1
+ import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
2
+ import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
3
+ import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
4
+ import type { SimCloudFront } from "../../sim-cloudfront.js";
5
+ /**
6
+ * What the four creators in here have in common.
7
+ *
8
+ * Each builds its own kind of policy from a Resource's properties and stores
9
+ * it on the simulated CloudFront, and each authorizes the deployment's caller
10
+ * for its own pair of actions.
11
+ */
12
+ interface SimCfnCfPolicyCreator {
13
+ create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): object;
14
+ delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
15
+ }
16
+ /**
17
+ * The CloudFront Resource types a template is the only way to make.
18
+ *
19
+ * A cache policy, an origin request policy, a response headers policy and an
20
+ * origin access control have no SDK command here. The Resource factory hands
21
+ * all four to this one lookup, and its own switch stays about the Resource
22
+ * types a command creates.
23
+ */
24
+ export declare class SimCfnCfPolicyCreators {
25
+ private readonly creators;
26
+ constructor(cloudFront: SimCloudFront);
27
+ /**
28
+ * The creator owning one Resource type, or nothing where another part of
29
+ * the factory owns it.
30
+ */
31
+ creatorFor(resourceTypeName: string): SimCfnCfPolicyCreator | undefined;
32
+ }
33
+ export {};
@@ -0,0 +1,39 @@
1
+ import { SimCfnCfCachePolicyCreator } from "../cache-policy/sim-cfn-cf-cache-policy-creator.js";
2
+ import { SimCfnCfOriginAccessControlCreator } from "../origin-access-control/sim-cfn-cf-oac-creator.js";
3
+ import { SimCfnCfOriginRequestPolicyCreator } from "../origin-request-policy/sim-cfn-cf-orp-creator.js";
4
+ import { SimCfnCfResponseHeadersPolicyCreator } from "../response-headers-policy/sim-cfn-cf-rh-policy-creator.js";
5
+ /**
6
+ * The CloudFront Resource types a template is the only way to make.
7
+ *
8
+ * A cache policy, an origin request policy, a response headers policy and an
9
+ * origin access control have no SDK command here. The Resource factory hands
10
+ * all four to this one lookup, and its own switch stays about the Resource
11
+ * types a command creates.
12
+ */
13
+ export class SimCfnCfPolicyCreators {
14
+ creators;
15
+ constructor(cloudFront) {
16
+ this.creators = new Map([
17
+ [
18
+ "ResponseHeadersPolicy",
19
+ new SimCfnCfResponseHeadersPolicyCreator({ cloudFront }),
20
+ ],
21
+ ["CachePolicy", new SimCfnCfCachePolicyCreator({ cloudFront })],
22
+ [
23
+ "OriginRequestPolicy",
24
+ new SimCfnCfOriginRequestPolicyCreator({ cloudFront }),
25
+ ],
26
+ [
27
+ "OriginAccessControl",
28
+ new SimCfnCfOriginAccessControlCreator({ cloudFront }),
29
+ ],
30
+ ]);
31
+ }
32
+ /**
33
+ * The creator owning one Resource type, or nothing where another part of
34
+ * the factory owns it.
35
+ */
36
+ creatorFor(resourceTypeName) {
37
+ return this.creators.get(resourceTypeName);
38
+ }
39
+ }
@@ -1,3 +1,4 @@
1
+ import type { SimCfnResourceCallerOptions } from "../../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
1
2
  import type { SimCfnResource } from "../../../cloudformation/resource/sim-cfn-resource.js";
2
3
  import type { SimCfnTemplateValueRecord } from "../../../cloudformation/template/value/sim-cfn-template-value.js";
3
4
  import type { SimCloudFront } from "../../sim-cloudfront.js";
@@ -10,15 +11,17 @@ interface SimCfnCfResponseHeadersPolicyCreatorProperties {
10
11
  * AWS::CloudFront::ResponseHeadersPolicy Resources.
11
12
  */
12
13
  export declare class SimCfnCfResponseHeadersPolicyCreator {
14
+ private static readonly createAction;
15
+ private static readonly deleteAction;
13
16
  private readonly cloudFront;
14
17
  constructor(properties: SimCfnCfResponseHeadersPolicyCreatorProperties);
15
18
  /**
16
19
  * Create and store the policy one Resource describes.
17
20
  */
18
- create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord): SimCloudFrontResponseHeadersPolicy;
21
+ create(resource: SimCfnResource, properties: SimCfnTemplateValueRecord, options?: SimCfnResourceCallerOptions): SimCloudFrontResponseHeadersPolicy;
19
22
  /**
20
23
  * Remove a policy created from a Resource.
21
24
  */
22
- delete(resource: SimCfnResource): void;
25
+ delete(resource: SimCfnResource, options?: SimCfnResourceCallerOptions): void;
23
26
  }
24
27
  export {};
@@ -4,6 +4,8 @@ import { SimCfnCfResponseHeadersPolicyConfig } from "./sim-cfn-cf-rh-policy-conf
4
4
  * AWS::CloudFront::ResponseHeadersPolicy Resources.
5
5
  */
6
6
  export class SimCfnCfResponseHeadersPolicyCreator {
7
+ static createAction = "cloudfront:CreateResponseHeadersPolicy";
8
+ static deleteAction = "cloudfront:DeleteResponseHeadersPolicy";
7
9
  cloudFront;
8
10
  constructor(properties) {
9
11
  this.cloudFront = properties.cloudFront;
@@ -11,7 +13,10 @@ export class SimCfnCfResponseHeadersPolicyCreator {
11
13
  /**
12
14
  * Create and store the policy one Resource describes.
13
15
  */
14
- create(resource, properties) {
16
+ create(resource, properties, options) {
17
+ this.cloudFront
18
+ .cfnAuthorizer()
19
+ .authorizeAny(SimCfnCfResponseHeadersPolicyCreator.createAction, options);
15
20
  const policy = new SimCfnCfResponseHeadersPolicyConfig({
16
21
  resource,
17
22
  properties,
@@ -22,11 +27,14 @@ export class SimCfnCfResponseHeadersPolicyCreator {
22
27
  /**
23
28
  * Remove a policy created from a Resource.
24
29
  */
25
- delete(resource) {
30
+ delete(resource, options) {
26
31
  const policy = resource.simResource;
27
32
  if (policy === undefined) {
28
33
  return;
29
34
  }
35
+ this.cloudFront
36
+ .cfnAuthorizer()
37
+ .authorizeResource(SimCfnCfResponseHeadersPolicyCreator.deleteAction, `response-headers-policy/${policy.id}`, options);
30
38
  this.cloudFront.removeResponseHeadersPolicy(policy.id);
31
39
  }
32
40
  }
@@ -0,0 +1,40 @@
1
+ import type { SimAwsAccountId } from "../../aws/sim-aws-account.js";
2
+ import type { SimCfnResourceCallerOptions } from "../../cloudformation/resource/caller/sim-cfn-resource-caller-options.js";
3
+ import type { SimIamInterServiceAuthZ } from "../../iam/authorize/sim-iam-inter-service-auth-z.js";
4
+ interface SimCfnCfAuthorizerProperties {
5
+ readonly accountId: SimAwsAccountId;
6
+ readonly iam: SimIamInterServiceAuthZ;
7
+ }
8
+ /**
9
+ * Authorizes the CloudFront Resources a template is the only way to make.
10
+ *
11
+ * A cache policy, an origin request policy, a response headers policy and an
12
+ * origin access control have no SDK command here, so their CloudFormation
13
+ * creators reach the stored policy directly rather than through a command that
14
+ * would ask IAM on the way. This is where those creators ask instead, so a
15
+ * deploy Role holding no CloudFront permission is refused the way real
16
+ * CloudFormation refuses it.
17
+ */
18
+ export declare class SimCfnCfAuthorizer {
19
+ private readonly accountId;
20
+ private readonly iam;
21
+ constructor(properties: SimCfnCfAuthorizerProperties);
22
+ /**
23
+ * Ensure the caller may take an action that names nothing yet.
24
+ *
25
+ * A create action has no ID to authorize against until it succeeds, and
26
+ * CloudFront offers no resource-level permission for one, so a policy
27
+ * granting it writes `*` and that is what it is decided against.
28
+ */
29
+ authorizeAny(action: string, options?: SimCfnResourceCallerOptions): void;
30
+ /**
31
+ * Ensure the caller may take an action on the CloudFront resource a path
32
+ * names, such as `cache-policy/8f1a2b3c`.
33
+ *
34
+ * A delete names the thing it is deleting, so a policy can grant deleting
35
+ * one cache policy without granting deleting every cache policy in the
36
+ * Account.
37
+ */
38
+ authorizeResource(action: string, resourcePath: string, options?: SimCfnResourceCallerOptions): void;
39
+ }
40
+ export {};