@kensio/yulin 1.21.26 → 1.21.28

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 (90) hide show
  1. package/dist/config/eslint/cffjs2.eslint.config.js +4 -0
  2. package/dist/service/cloudformation/parameters/sim-cfn-parameter-list-type.d.ts +7 -0
  3. package/dist/service/cloudformation/parameters/sim-cfn-parameter-list-type.js +9 -0
  4. package/dist/service/cloudformation/parameters/sim-cfn-parameter-values.d.ts +10 -0
  5. package/dist/service/cloudformation/parameters/sim-cfn-parameter-values.js +20 -0
  6. package/dist/service/cloudformation/parameters/sim-cfn-parameters.type.d.ts +7 -5
  7. package/dist/service/cloudformation/parameters/store/sim-cfn-parameter-store-value-type.js +2 -1
  8. package/dist/service/cloudformation/template/node/fn/join/sim-cfn-fn-join.d.ts +19 -14
  9. package/dist/service/cloudformation/template/node/fn/join/sim-cfn-fn-join.js +47 -28
  10. package/dist/service/cloudformation/template/parse/fn/join/sim-cfn-fn-join-parser.d.ts +7 -4
  11. package/dist/service/cloudformation/template/parse/fn/join/sim-cfn-fn-join-parser.js +11 -7
  12. package/dist/service/eventbridge/bus/sim-event-bus-name.d.ts +4 -0
  13. package/dist/service/eventbridge/bus/sim-event-bus-name.js +17 -12
  14. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-creator.js +8 -1
  15. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.d.ts +5 -0
  16. package/dist/service/eventbridge/cfn/bus/sim-cfn-event-bus-properties.js +14 -1
  17. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-creator.js +2 -0
  18. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-target-delivery.d.ts +15 -0
  19. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-target-delivery.js +53 -0
  20. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-targets.d.ts +4 -0
  21. package/dist/service/eventbridge/cfn/rule/sim-cfn-event-rule-targets.js +7 -3
  22. package/dist/service/eventbridge/command/authorize/sim-event-bridge-authorizer.d.ts +5 -0
  23. package/dist/service/eventbridge/command/authorize/sim-event-bridge-authorizer.js +7 -0
  24. package/dist/service/eventbridge/command/bus/sim-event-bridge-create-event-bus.d.ts +7 -1
  25. package/dist/service/eventbridge/command/bus/sim-event-bridge-create-event-bus.js +7 -1
  26. package/dist/service/eventbridge/command/bus/sim-event-bridge-partner-bus.d.ts +24 -0
  27. package/dist/service/eventbridge/command/bus/sim-event-bridge-partner-bus.js +44 -0
  28. package/dist/service/eventbridge/command/bus/sim-event-bridge-unsimulated-bus-input.js +0 -5
  29. package/dist/service/eventbridge/command/put-events/sim-event-bridge-authorized-entries.js +8 -0
  30. package/dist/service/eventbridge/command/sim-event-bridge-command.types.d.ts +1 -0
  31. package/dist/service/eventbridge/command/sim-event-bridge-commands.d.ts +6 -0
  32. package/dist/service/eventbridge/command/sim-event-bridge-commands.js +19 -1
  33. package/dist/service/eventbridge/command/source/sim-event-bridge-describe-event-source.d.ts +35 -0
  34. package/dist/service/eventbridge/command/source/sim-event-bridge-describe-event-source.js +46 -0
  35. package/dist/service/eventbridge/command/source/sim-event-bridge-put-partner-events.d.ts +41 -0
  36. package/dist/service/eventbridge/command/source/sim-event-bridge-put-partner-events.js +82 -0
  37. package/dist/service/eventbridge/command/source/source.command.d.ts +59 -0
  38. package/dist/service/eventbridge/command/source/source.command.js +1 -0
  39. package/dist/service/eventbridge/command/target/sim-event-bridge-target-commands.js +2 -0
  40. package/dist/service/eventbridge/command/target/sim-event-bridge-unsimulated-target-input.js +2 -12
  41. package/dist/service/eventbridge/command/target/target.command.d.ts +8 -5
  42. package/dist/service/eventbridge/delivery/sim-aws-event-bridge-delivery-targets.d.ts +6 -1
  43. package/dist/service/eventbridge/delivery/sim-aws-event-bridge-delivery-targets.js +16 -0
  44. package/dist/service/eventbridge/delivery/sim-event-bridge-dead-letter-attributes.d.ts +9 -0
  45. package/dist/service/eventbridge/delivery/sim-event-bridge-dead-letter-attributes.js +47 -0
  46. package/dist/service/eventbridge/delivery/sim-event-bridge-dead-letter-queue.d.ts +24 -0
  47. package/dist/service/eventbridge/delivery/sim-event-bridge-dead-letter-queue.js +28 -0
  48. package/dist/service/eventbridge/delivery/sim-event-bridge-delivery-attempt.d.ts +41 -0
  49. package/dist/service/eventbridge/delivery/sim-event-bridge-delivery-attempt.js +97 -0
  50. package/dist/service/eventbridge/delivery/sim-event-bridge-delivery-queue.js +7 -37
  51. package/dist/service/eventbridge/delivery/sim-event-bridge-delivery-retries.test-support.d.ts +25 -0
  52. package/dist/service/eventbridge/delivery/sim-event-bridge-delivery-retries.test-support.js +60 -0
  53. package/dist/service/eventbridge/delivery/sim-event-bridge-delivery.d.ts +22 -0
  54. package/dist/service/eventbridge/delivery/sim-event-bridge-failing-targets.test-support.d.ts +23 -0
  55. package/dist/service/eventbridge/delivery/sim-event-bridge-failing-targets.test-support.js +28 -0
  56. package/dist/service/eventbridge/delivery/sim-event-bridge-no-delivery-targets.d.ts +5 -1
  57. package/dist/service/eventbridge/delivery/sim-event-bridge-no-delivery-targets.js +9 -0
  58. package/dist/service/eventbridge/delivery/sim-event-bridge-queue-message.d.ts +28 -0
  59. package/dist/service/eventbridge/delivery/sim-event-bridge-queue-message.js +45 -0
  60. package/dist/service/eventbridge/delivery/sim-event-bridge-target-delivery.d.ts +4 -1
  61. package/dist/service/eventbridge/delivery/sim-event-bridge-target-delivery.js +19 -14
  62. package/dist/service/eventbridge/index.d.ts +2 -0
  63. package/dist/service/eventbridge/index.js +2 -0
  64. package/dist/service/eventbridge/routing/sim-event-bridge-router.js +1 -0
  65. package/dist/service/eventbridge/sdk/sim-event-bridge-sdk-command-router.js +4 -0
  66. package/dist/service/eventbridge/sim-event-bridge-inspection.d.ts +10 -0
  67. package/dist/service/eventbridge/sim-event-bridge-inspection.js +9 -0
  68. package/dist/service/eventbridge/sim-event-bridge-partners.d.ts +38 -0
  69. package/dist/service/eventbridge/sim-event-bridge-partners.js +43 -0
  70. package/dist/service/eventbridge/sim-event-bridge.d.ts +12 -12
  71. package/dist/service/eventbridge/sim-event-bridge.js +14 -11
  72. package/dist/service/eventbridge/source/sim-partner-event-source-name.d.ts +28 -0
  73. package/dist/service/eventbridge/source/sim-partner-event-source-name.js +62 -0
  74. package/dist/service/eventbridge/source/sim-partner-event-source-store.d.ts +18 -0
  75. package/dist/service/eventbridge/source/sim-partner-event-source-store.js +29 -0
  76. package/dist/service/eventbridge/source/sim-partner-event-source.d.ts +46 -0
  77. package/dist/service/eventbridge/source/sim-partner-event-source.js +43 -0
  78. package/dist/service/eventbridge/target/sim-event-target-dead-letter-config.d.ts +28 -0
  79. package/dist/service/eventbridge/target/sim-event-target-dead-letter-config.js +42 -0
  80. package/dist/service/eventbridge/target/sim-event-target-retry-policy.d.ts +28 -0
  81. package/dist/service/eventbridge/target/sim-event-target-retry-policy.js +53 -0
  82. package/dist/service/eventbridge/target/sim-event-target.d.ts +17 -0
  83. package/dist/service/eventbridge/target/sim-event-target.js +19 -0
  84. package/docs/serve/README.md +1 -1
  85. package/docs/services/cloudformation/README.md +28 -5
  86. package/docs/services/dynamodb/README.md +2 -2
  87. package/docs/services/eventbridge/README.md +223 -6
  88. package/docs/services/s3/README.md +1 -1
  89. package/docs/services/sqs/README.md +1 -1
  90. package/package.json +2 -2
@@ -3,10 +3,12 @@ import type { SimAwsAccountRegionScope } from "../../../aws/sim-aws-account-regi
3
3
  import type { SimEventBusStore } from "../../bus/sim-event-bus-store.js";
4
4
  import type { SimEventBridgeRequestOptions } from "../sim-event-bridge-request-options.js";
5
5
  import type { SimEventBridgeBusAccess } from "./sim-event-bridge-bus-access.js";
6
+ import type { SimEventBridgePartnerBus } from "./sim-event-bridge-partner-bus.js";
6
7
  import type { SimCreateEventBusCommand, SimCreateEventBusCommandOutput } from "./bus.command.js";
7
8
  interface SimEventBridgeCreateEventBusProperties {
8
9
  readonly buses: SimEventBusStore;
9
10
  readonly access: SimEventBridgeBusAccess;
11
+ readonly partnerBus: SimEventBridgePartnerBus;
10
12
  readonly accountRegionScope: SimAwsAccountRegionScope;
11
13
  readonly clock: BackgroundScheduler;
12
14
  }
@@ -16,15 +18,19 @@ interface SimEventBridgeCreateEventBusProperties {
16
18
  * Unlike SNS CreateTopic this is not idempotent: a name already taken is
17
19
  * refused rather than answered with the existing bus. `default` is among those
18
20
  * names, since that bus is always there.
21
+ *
22
+ * A request carrying an `EventSourceName` creates a partner event bus, which
23
+ * activates the partner event source of the same name.
19
24
  */
20
25
  export declare class SimEventBridgeCreateEventBus {
21
26
  private readonly buses;
22
27
  private readonly access;
28
+ private readonly partnerBus;
23
29
  private readonly accountRegionScope;
24
30
  private readonly clock;
25
31
  constructor(properties: SimEventBridgeCreateEventBusProperties);
26
32
  /**
27
- * Create a custom event bus.
33
+ * Create a custom or partner event bus.
28
34
  *
29
35
  * The inputs are read before the name is looked for, so a request naming one
30
36
  * this simulation will not take is refused whether or not the name is free.
@@ -8,20 +8,25 @@ import { refuseUnsimulatedBusInput } from "./sim-event-bridge-unsimulated-bus-in
8
8
  * Unlike SNS CreateTopic this is not idempotent: a name already taken is
9
9
  * refused rather than answered with the existing bus. `default` is among those
10
10
  * names, since that bus is always there.
11
+ *
12
+ * A request carrying an `EventSourceName` creates a partner event bus, which
13
+ * activates the partner event source of the same name.
11
14
  */
12
15
  export class SimEventBridgeCreateEventBus {
13
16
  buses;
14
17
  access;
18
+ partnerBus;
15
19
  accountRegionScope;
16
20
  clock;
17
21
  constructor(properties) {
18
22
  this.buses = properties.buses;
19
23
  this.access = properties.access;
24
+ this.partnerBus = properties.partnerBus;
20
25
  this.accountRegionScope = properties.accountRegionScope;
21
26
  this.clock = properties.clock;
22
27
  }
23
28
  /**
24
- * Create a custom event bus.
29
+ * Create a custom or partner event bus.
25
30
  *
26
31
  * The inputs are read before the name is looked for, so a request naming one
27
32
  * this simulation will not take is refused whether or not the name is free.
@@ -34,6 +39,7 @@ export class SimEventBridgeCreateEventBus {
34
39
  if (this.buses.find(name.value) !== undefined) {
35
40
  throw new SimEventBridgeResourceAlreadyExistsException(`Event bus ${name.value} already exists.`);
36
41
  }
42
+ this.partnerBus.check(name, input.EventSourceName);
37
43
  const bus = this.created(name, input.Description);
38
44
  return {
39
45
  $metadata: {},
@@ -0,0 +1,24 @@
1
+ import type { SimEventBusName } from "../../bus/sim-event-bus-name.js";
2
+ import type { SimPartnerEventSourceStore } from "../../source/sim-partner-event-source-store.js";
3
+ /**
4
+ * Checks the name a bus is created under against the partner event source a
5
+ * CreateEventBus request names, if it names one.
6
+ *
7
+ * A partner event bus has to take the name of its source exactly, and only a
8
+ * partner event bus may carry a `/` in its name. The source has to exist
9
+ * already. A partner creates it from its own Account, and real EventBridge
10
+ * fails the request when there is no source to match.
11
+ */
12
+ export declare class SimEventBridgePartnerBus {
13
+ private readonly sources;
14
+ constructor(sources: SimPartnerEventSourceStore);
15
+ /**
16
+ * Refuse a bus name that does not fit the source the request names, or a
17
+ * source that is not there.
18
+ */
19
+ check(name: SimEventBusName, eventSourceName: string | undefined): void;
20
+ /**
21
+ * Refuse a partner bus name on a request that names no partner source.
22
+ */
23
+ private refusePartnerName;
24
+ }
@@ -0,0 +1,44 @@
1
+ import { SimEventBridgeValidationException } from "../../error/sim-event-bridge.error.js";
2
+ import { SimPartnerEventSourceName } from "../../source/sim-partner-event-source-name.js";
3
+ /**
4
+ * Checks the name a bus is created under against the partner event source a
5
+ * CreateEventBus request names, if it names one.
6
+ *
7
+ * A partner event bus has to take the name of its source exactly, and only a
8
+ * partner event bus may carry a `/` in its name. The source has to exist
9
+ * already. A partner creates it from its own Account, and real EventBridge
10
+ * fails the request when there is no source to match.
11
+ */
12
+ export class SimEventBridgePartnerBus {
13
+ sources;
14
+ constructor(sources) {
15
+ this.sources = sources;
16
+ }
17
+ /**
18
+ * Refuse a bus name that does not fit the source the request names, or a
19
+ * source that is not there.
20
+ */
21
+ check(name, eventSourceName) {
22
+ if (eventSourceName === undefined) {
23
+ this.refusePartnerName(name);
24
+ return;
25
+ }
26
+ const sourceName = SimPartnerEventSourceName.of(eventSourceName, "EventSourceName");
27
+ if (sourceName.value !== name.value) {
28
+ throw new SimEventBridgeValidationException(`Invalid parameter: Name Reason: a partner event bus takes the name ` +
29
+ `of its event source exactly, and '${name.value}' is not ` +
30
+ `'${sourceName.value}'.`);
31
+ }
32
+ this.sources.require(sourceName.value);
33
+ }
34
+ /**
35
+ * Refuse a partner bus name on a request that names no partner source.
36
+ */
37
+ refusePartnerName(name) {
38
+ if (name.isPartner) {
39
+ throw new SimEventBridgeValidationException(`Invalid parameter: Name Reason: custom event bus names cannot ` +
40
+ `contain the '/' character. '${name.value}' is a partner event bus ` +
41
+ `name, and a partner event bus is created with an EventSourceName.`);
42
+ }
43
+ }
44
+ }
@@ -7,11 +7,6 @@ const maximumDescriptionLength = 512;
7
7
  * What a CreateEventBus input carrying an unmodelled property is refused with.
8
8
  */
9
9
  const refusals = [
10
- [
11
- (input) => input.EventSourceName,
12
- "Partner event buses are not simulated, so CreateEventBus refuses an " +
13
- "EventSourceName rather than creating a bus no partner can reach",
14
- ],
15
10
  [
16
11
  (input) => input.KmsKeyIdentifier,
17
12
  "Event bus encryption with a customer managed key is not simulated, so " +
@@ -1,3 +1,4 @@
1
+ import { SimEventBridgeValidationException } from "../../error/sim-event-bridge.error.js";
1
2
  /**
2
3
  * Resolve and authorize the bus every entry names, before any of them is
3
4
  * delivered.
@@ -10,6 +11,13 @@
10
11
  export function authorizedEntries(entries, access, options) {
11
12
  return entries.map((entry) => {
12
13
  const busName = access.requestedName(entry.EventBusName);
14
+ // PutEvents takes no `/` in a bus name or ARN, so it cannot name a partner
15
+ // event bus. Only the partner that owns the bus's event source sends
16
+ // events to it.
17
+ if (busName.isPartner) {
18
+ throw new SimEventBridgeValidationException(`Invalid parameter: EventBusName Reason: '${busName.value}' is a ` +
19
+ `partner event bus, and only its partner sends events to it.`);
20
+ }
13
21
  access.authorizeName("events:PutEvents", busName, options);
14
22
  return { entry, busName: busName.value };
15
23
  });
@@ -2,3 +2,4 @@ export type { SimCreateEventBusCommand, SimCreateEventBusCommandInput, SimCreate
2
2
  export type { SimPutEventsCommand, SimPutEventsCommandInput, SimPutEventsCommandOutput, SimPutEventsRequestEntry, SimPutEventsResultEntry, } from "./put-events/put-events.command.js";
3
3
  export type { SimDeleteRuleCommand, SimDeleteRuleCommandInput, SimDeleteRuleCommandOutput, SimDescribeRuleCommand, SimDescribeRuleCommandInput, SimDescribeRuleCommandOutput, SimDisableRuleCommand, SimDisableRuleCommandInput, SimDisableRuleCommandOutput, SimEnableRuleCommand, SimEnableRuleCommandInput, SimEnableRuleCommandOutput, SimListedRule, SimListRulesCommand, SimListRulesCommandInput, SimListRulesCommandOutput, SimPutRuleCommand, SimPutRuleCommandInput, SimPutRuleCommandOutput, SimTestEventPatternCommand, SimTestEventPatternCommandInput, SimTestEventPatternCommandOutput, } from "./rule/rule.command.js";
4
4
  export type { SimEventBridgeTarget, SimEventBridgeTargetFailure, SimListRuleNamesByTargetCommand, SimListRuleNamesByTargetCommandInput, SimListRuleNamesByTargetCommandOutput, SimListTargetsByRuleCommand, SimListTargetsByRuleCommandInput, SimListTargetsByRuleCommandOutput, SimPutTargetsCommand, SimPutTargetsCommandInput, SimPutTargetsCommandOutput, SimRemoveTargetsCommand, SimRemoveTargetsCommandInput, SimRemoveTargetsCommandOutput, } from "./target/target.command.js";
5
+ export type { SimDescribeEventSourceCommand, SimDescribeEventSourceCommandInput, SimDescribeEventSourceCommandOutput, SimPutPartnerEventsCommand, SimPutPartnerEventsCommandInput, SimPutPartnerEventsCommandOutput, SimPutPartnerEventsRequestEntry, SimPutPartnerEventsResultEntry, } from "./source/source.command.js";
@@ -10,16 +10,20 @@ import { SimEventBridgeRuleSchedules } from "../schedule/sim-event-bridge-rule-s
10
10
  import { SimEventBridgeBusCommands } from "./bus/sim-event-bridge-bus-commands.js";
11
11
  import { SimEventBridgeCreateEventBus } from "./bus/sim-event-bridge-create-event-bus.js";
12
12
  import { SimEventBridgeDeleteEventBus } from "./bus/sim-event-bridge-delete-event-bus.js";
13
+ import type { SimPartnerEventSourceStore } from "../source/sim-partner-event-source-store.js";
13
14
  import { SimEventBridgePutEvents } from "./put-events/sim-event-bridge-put-events.js";
14
15
  import { SimEventBridgePutRule } from "./rule/sim-event-bridge-put-rule.js";
15
16
  import { SimEventBridgeRuleCommands } from "./rule/sim-event-bridge-rule-commands.js";
16
17
  import { SimEventBridgeTestEventPattern } from "./rule/sim-event-bridge-test-event-pattern.js";
18
+ import { SimEventBridgeDescribeEventSource } from "./source/sim-event-bridge-describe-event-source.js";
19
+ import { SimEventBridgePutPartnerEvents } from "./source/sim-event-bridge-put-partner-events.js";
17
20
  import { SimEventBridgePutTargets } from "./target/sim-event-bridge-put-targets.js";
18
21
  import { SimEventBridgeTargetCommands } from "./target/sim-event-bridge-target-commands.js";
19
22
  interface SimEventBridgeCommandsProperties {
20
23
  readonly buses: SimEventBusStore;
21
24
  readonly rules: SimEventRuleStore;
22
25
  readonly targets: SimEventTargetStore;
26
+ readonly partnerSources: SimPartnerEventSourceStore;
23
27
  readonly deliveryTargets?: SimEventBridgeDeliveryTargets | undefined;
24
28
  readonly iam: SimIamInterServiceAuthZ;
25
29
  readonly background: BackgroundScheduler;
@@ -38,6 +42,8 @@ export declare class SimEventBridgeCommands {
38
42
  readonly busDeletion: SimEventBridgeDeleteEventBus;
39
43
  readonly buses: SimEventBridgeBusCommands;
40
44
  readonly putEvents: SimEventBridgePutEvents;
45
+ readonly putPartnerEvents: SimEventBridgePutPartnerEvents;
46
+ readonly eventSources: SimEventBridgeDescribeEventSource;
41
47
  readonly ruleCreation: SimEventBridgePutRule;
42
48
  readonly rules: SimEventBridgeRuleCommands;
43
49
  readonly patternTest: SimEventBridgeTestEventPattern;
@@ -6,11 +6,14 @@ import { SimEventBridgeBusAccess } from "./bus/sim-event-bridge-bus-access.js";
6
6
  import { SimEventBridgeBusCommands } from "./bus/sim-event-bridge-bus-commands.js";
7
7
  import { SimEventBridgeCreateEventBus } from "./bus/sim-event-bridge-create-event-bus.js";
8
8
  import { SimEventBridgeDeleteEventBus } from "./bus/sim-event-bridge-delete-event-bus.js";
9
+ import { SimEventBridgePartnerBus } from "./bus/sim-event-bridge-partner-bus.js";
9
10
  import { SimEventBridgePutEvents } from "./put-events/sim-event-bridge-put-events.js";
10
11
  import { SimEventBridgePutRule } from "./rule/sim-event-bridge-put-rule.js";
11
12
  import { SimEventBridgeRuleAccess } from "./rule/sim-event-bridge-rule-access.js";
12
13
  import { SimEventBridgeRuleCommands } from "./rule/sim-event-bridge-rule-commands.js";
13
14
  import { SimEventBridgeTestEventPattern } from "./rule/sim-event-bridge-test-event-pattern.js";
15
+ import { SimEventBridgeDescribeEventSource } from "./source/sim-event-bridge-describe-event-source.js";
16
+ import { SimEventBridgePutPartnerEvents } from "./source/sim-event-bridge-put-partner-events.js";
14
17
  import { SimEventBridgePutTargets } from "./target/sim-event-bridge-put-targets.js";
15
18
  import { SimEventBridgeTargetCommands } from "./target/sim-event-bridge-target-commands.js";
16
19
  /**
@@ -26,6 +29,8 @@ export class SimEventBridgeCommands {
26
29
  busDeletion;
27
30
  buses;
28
31
  putEvents;
32
+ putPartnerEvents;
33
+ eventSources;
29
34
  ruleCreation;
30
35
  rules;
31
36
  patternTest;
@@ -34,7 +39,7 @@ export class SimEventBridgeCommands {
34
39
  router;
35
40
  schedules;
36
41
  constructor(properties) {
37
- const { buses, rules, targets, accountRegionScope, background } = properties;
42
+ const { buses, rules, targets, partnerSources, accountRegionScope, background, } = properties;
38
43
  const authorizer = new SimEventBridgeAuthorizer({ iam: properties.iam });
39
44
  const access = new SimEventBridgeBusAccess({
40
45
  buses,
@@ -50,6 +55,7 @@ export class SimEventBridgeCommands {
50
55
  this.busCreation = new SimEventBridgeCreateEventBus({
51
56
  buses,
52
57
  access,
58
+ partnerBus: new SimEventBridgePartnerBus(partnerSources),
53
59
  accountRegionScope,
54
60
  clock: background,
55
61
  });
@@ -80,6 +86,18 @@ export class SimEventBridgeCommands {
80
86
  clock: background,
81
87
  router: this.router,
82
88
  });
89
+ this.putPartnerEvents = new SimEventBridgePutPartnerEvents({
90
+ sources: partnerSources,
91
+ accountRegionScope,
92
+ clock: background,
93
+ router: this.router,
94
+ });
95
+ this.eventSources = new SimEventBridgeDescribeEventSource({
96
+ sources: partnerSources,
97
+ buses,
98
+ authorizer,
99
+ accountRegionScope,
100
+ });
83
101
  this.ruleCreation = new SimEventBridgePutRule({
84
102
  rules,
85
103
  access: ruleAccess,
@@ -0,0 +1,35 @@
1
+ import type { SimAwsAccountRegionScope } from "../../../aws/sim-aws-account-region-scope.js";
2
+ import type { SimEventBusStore } from "../../bus/sim-event-bus-store.js";
3
+ import type { SimPartnerEventSourceStore } from "../../source/sim-partner-event-source-store.js";
4
+ import type { SimEventBridgeAuthorizer } from "../authorize/sim-event-bridge-authorizer.js";
5
+ import type { SimEventBridgeRequestOptions } from "../sim-event-bridge-request-options.js";
6
+ import type { SimDescribeEventSourceCommand, SimDescribeEventSourceCommandOutput } from "./source.command.js";
7
+ interface SimEventBridgeDescribeEventSourceProperties {
8
+ readonly sources: SimPartnerEventSourceStore;
9
+ readonly buses: SimEventBusStore;
10
+ readonly authorizer: SimEventBridgeAuthorizer;
11
+ readonly accountRegionScope: SimAwsAccountRegionScope;
12
+ }
13
+ /**
14
+ * The DescribeEventSource command.
15
+ *
16
+ * The state is `ACTIVE` while a partner event bus of the source's name exists,
17
+ * and `PENDING` otherwise. `ExpirationTime` is left out, because a pending
18
+ * source never expires here.
19
+ */
20
+ export declare class SimEventBridgeDescribeEventSource {
21
+ private readonly sources;
22
+ private readonly buses;
23
+ private readonly authorizer;
24
+ private readonly accountRegionScope;
25
+ constructor(properties: SimEventBridgeDescribeEventSourceProperties);
26
+ /**
27
+ * Describe a partner event source shared with this Account and Region.
28
+ *
29
+ * The caller is authorized against the ARN the source would have before it
30
+ * is looked up, so a caller with no permission learns nothing about which
31
+ * sources exist.
32
+ */
33
+ handle(command: SimDescribeEventSourceCommand, options?: SimEventBridgeRequestOptions): SimDescribeEventSourceCommandOutput;
34
+ }
35
+ export {};
@@ -0,0 +1,46 @@
1
+ import { SimEventBridgeValidationException } from "../../error/sim-event-bridge.error.js";
2
+ import { SimPartnerEventSourceName } from "../../source/sim-partner-event-source-name.js";
3
+ import { partnerEventSourceArn } from "../../source/sim-partner-event-source.js";
4
+ /**
5
+ * The DescribeEventSource command.
6
+ *
7
+ * The state is `ACTIVE` while a partner event bus of the source's name exists,
8
+ * and `PENDING` otherwise. `ExpirationTime` is left out, because a pending
9
+ * source never expires here.
10
+ */
11
+ export class SimEventBridgeDescribeEventSource {
12
+ sources;
13
+ buses;
14
+ authorizer;
15
+ accountRegionScope;
16
+ constructor(properties) {
17
+ this.sources = properties.sources;
18
+ this.buses = properties.buses;
19
+ this.authorizer = properties.authorizer;
20
+ this.accountRegionScope = properties.accountRegionScope;
21
+ }
22
+ /**
23
+ * Describe a partner event source shared with this Account and Region.
24
+ *
25
+ * The caller is authorized against the ARN the source would have before it
26
+ * is looked up, so a caller with no permission learns nothing about which
27
+ * sources exist.
28
+ */
29
+ handle(command, options) {
30
+ const requested = command.input.Name;
31
+ if (requested === undefined) {
32
+ throw new SimEventBridgeValidationException("Invalid parameter: Name is required");
33
+ }
34
+ const name = SimPartnerEventSourceName.of(requested, "Name");
35
+ this.authorizer.authorizeEventSource("events:DescribeEventSource", partnerEventSourceArn(name, this.accountRegionScope), options);
36
+ const source = this.sources.require(name.value);
37
+ return {
38
+ $metadata: {},
39
+ Arn: source.arn,
40
+ CreatedBy: source.name.partner,
41
+ CreationTime: source.creationTime,
42
+ Name: source.name.value,
43
+ State: source.state(this.buses.find(source.name.value) !== undefined),
44
+ };
45
+ }
46
+ }
@@ -0,0 +1,41 @@
1
+ import type { BackgroundScheduler } from "../../../../util/background/background.js";
2
+ import type { SimAwsAccountRegionScope } from "../../../aws/sim-aws-account-region-scope.js";
3
+ import type { SimEventBridgeRouter } from "../../routing/sim-event-bridge-router.js";
4
+ import type { SimPartnerEventSourceStore } from "../../source/sim-partner-event-source-store.js";
5
+ import type { SimPutPartnerEventsCommand, SimPutPartnerEventsCommandOutput } from "./source.command.js";
6
+ interface SimEventBridgePutPartnerEventsProperties {
7
+ readonly sources: SimPartnerEventSourceStore;
8
+ readonly accountRegionScope: SimAwsAccountRegionScope;
9
+ readonly clock: BackgroundScheduler;
10
+ readonly router: SimEventBridgeRouter;
11
+ }
12
+ /**
13
+ * Puts events onto partner event buses as their SaaS partner would.
14
+ *
15
+ * Each entry's `Source` names the partner event source it comes from, and the
16
+ * event goes to the bus of the same name. An event for a source with no bus is
17
+ * dropped. Real EventBridge documents that it keeps nothing a partner sends
18
+ * before the receiving Account creates the bus.
19
+ *
20
+ * Nothing is authorized. The partner sends from its own Account, which is
21
+ * outside the simulation, and the receiving Account's IAM has no say in it.
22
+ */
23
+ export declare class SimEventBridgePutPartnerEvents {
24
+ private readonly sources;
25
+ private readonly clock;
26
+ private readonly router;
27
+ private readonly reader;
28
+ constructor(properties: SimEventBridgePutPartnerEventsProperties);
29
+ /**
30
+ * Put a partner's events onto the buses of their sources.
31
+ *
32
+ * Every `Source` is resolved before any event is put, so a request naming a
33
+ * source that was never registered changes nothing.
34
+ */
35
+ handle(command: SimPutPartnerEventsCommand): SimPutPartnerEventsCommandOutput;
36
+ /**
37
+ * Put one entry onto the bus its source names.
38
+ */
39
+ private put;
40
+ }
41
+ export {};
@@ -0,0 +1,82 @@
1
+ import { SimEventBridgeValidationException } from "../../error/sim-event-bridge.error.js";
2
+ import { SimEventBridgeEntryFailure } from "../put-events/sim-event-bridge-entry-failure.js";
3
+ import { SimEventBridgeEntryReader } from "../put-events/sim-event-bridge-entry-reader.js";
4
+ import { simEventBridgeMaximumRequestBytes, simEventBridgeRequestSize, } from "../put-events/sim-event-bridge-entry-size.js";
5
+ /**
6
+ * The most entries one PutPartnerEvents request may carry.
7
+ */
8
+ const maximumEntries = 20;
9
+ /**
10
+ * Puts events onto partner event buses as their SaaS partner would.
11
+ *
12
+ * Each entry's `Source` names the partner event source it comes from, and the
13
+ * event goes to the bus of the same name. An event for a source with no bus is
14
+ * dropped. Real EventBridge documents that it keeps nothing a partner sends
15
+ * before the receiving Account creates the bus.
16
+ *
17
+ * Nothing is authorized. The partner sends from its own Account, which is
18
+ * outside the simulation, and the receiving Account's IAM has no say in it.
19
+ */
20
+ export class SimEventBridgePutPartnerEvents {
21
+ sources;
22
+ clock;
23
+ router;
24
+ reader;
25
+ constructor(properties) {
26
+ this.sources = properties.sources;
27
+ this.clock = properties.clock;
28
+ this.router = properties.router;
29
+ this.reader = new SimEventBridgeEntryReader({
30
+ accountRegionScope: properties.accountRegionScope,
31
+ });
32
+ }
33
+ /**
34
+ * Put a partner's events onto the buses of their sources.
35
+ *
36
+ * Every `Source` is resolved before any event is put, so a request naming a
37
+ * source that was never registered changes nothing.
38
+ */
39
+ handle(command) {
40
+ const entries = partnerRequestEntries(command.input.Entries ?? []);
41
+ for (const entry of entries) {
42
+ if (entry.Source !== undefined) {
43
+ this.sources.require(entry.Source);
44
+ }
45
+ }
46
+ const at = this.clock.now();
47
+ const results = entries.map((entry) => this.put(entry, at));
48
+ return {
49
+ $metadata: {},
50
+ Entries: results,
51
+ FailedEntryCount: results.filter((result) => result.ErrorCode !== undefined).length,
52
+ };
53
+ }
54
+ /**
55
+ * Put one entry onto the bus its source names.
56
+ */
57
+ put(entry, at) {
58
+ const read = this.reader.read(entry, at);
59
+ if (read instanceof SimEventBridgeEntryFailure) {
60
+ return read.toResultEntry();
61
+ }
62
+ this.router.deliver(read.source, read);
63
+ return { EventId: read.id };
64
+ }
65
+ }
66
+ /**
67
+ * Refuse a request carrying no entries, too many, or too many bytes.
68
+ */
69
+ function partnerRequestEntries(entries) {
70
+ if (entries.length === 0 || entries.length > maximumEntries) {
71
+ throw new SimEventBridgeValidationException(`Invalid parameter: Entries Reason: a PutPartnerEvents request carries ` +
72
+ `between 1 and ${String(maximumEntries)} entries, and this one ` +
73
+ `carries ${String(entries.length)}`);
74
+ }
75
+ const size = simEventBridgeRequestSize(entries);
76
+ if (size > simEventBridgeMaximumRequestBytes) {
77
+ throw new SimEventBridgeValidationException(`Total size of the entries in the request is ${String(size)} bytes, ` +
78
+ `which is over the ${String(simEventBridgeMaximumRequestBytes)} byte ` +
79
+ `limit.`);
80
+ }
81
+ return entries;
82
+ }
@@ -0,0 +1,59 @@
1
+ import type { SimResponseMetadata } from "../../../aws/metadata/response-metadata.type.js";
2
+ /**
3
+ * Minimal structural sim EventBridge DescribeEventSource command.
4
+ *
5
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/eventbridge/command/DescribeEventSourceCommand/
6
+ */
7
+ export interface SimDescribeEventSourceCommand {
8
+ readonly input: SimDescribeEventSourceCommandInput;
9
+ }
10
+ export interface SimDescribeEventSourceCommandInput {
11
+ readonly Name?: string | undefined;
12
+ }
13
+ export interface SimDescribeEventSourceCommandOutput {
14
+ readonly Arn?: string | undefined;
15
+ readonly CreatedBy?: string | undefined;
16
+ readonly CreationTime?: Date | undefined;
17
+ readonly Name?: string | undefined;
18
+ readonly State?: string | undefined;
19
+ readonly $metadata: SimResponseMetadata;
20
+ }
21
+ /**
22
+ * One event as a partner's PutPartnerEvents request carries it.
23
+ *
24
+ * https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutPartnerEventsRequestEntry.html
25
+ */
26
+ export interface SimPutPartnerEventsRequestEntry {
27
+ readonly Source?: string | undefined;
28
+ readonly DetailType?: string | undefined;
29
+ readonly Detail?: string | undefined;
30
+ readonly Resources?: readonly string[] | undefined;
31
+ readonly Time?: Date | undefined;
32
+ }
33
+ /**
34
+ * One partner entry's result, which carries either an event id or a failure.
35
+ */
36
+ export interface SimPutPartnerEventsResultEntry {
37
+ readonly EventId?: string | undefined;
38
+ readonly ErrorCode?: string | undefined;
39
+ readonly ErrorMessage?: string | undefined;
40
+ }
41
+ /**
42
+ * Minimal structural sim EventBridge PutPartnerEvents command.
43
+ *
44
+ * A SaaS partner sends this from its own Account. In a simulation it is a
45
+ * test acting as the partner, through `SimEventBridge.putPartnerEvents`.
46
+ *
47
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/eventbridge/command/PutPartnerEventsCommand/
48
+ */
49
+ export interface SimPutPartnerEventsCommand {
50
+ readonly input: SimPutPartnerEventsCommandInput;
51
+ }
52
+ export interface SimPutPartnerEventsCommandInput {
53
+ readonly Entries?: readonly SimPutPartnerEventsRequestEntry[] | undefined;
54
+ }
55
+ export interface SimPutPartnerEventsCommandOutput {
56
+ readonly Entries?: readonly SimPutPartnerEventsResultEntry[] | undefined;
57
+ readonly FailedEntryCount?: number | undefined;
58
+ readonly $metadata: SimResponseMetadata;
59
+ }
@@ -54,6 +54,8 @@ export class SimEventBridgeTargetCommands {
54
54
  Input: target.input,
55
55
  RoleArn: target.ecs?.roleArn,
56
56
  EcsParameters: target.ecs?.task.parameters.declared,
57
+ RetryPolicy: target.retryPolicy?.declared,
58
+ DeadLetterConfig: target.deadLetterConfig?.declared,
57
59
  }));
58
60
  const page = new SimEventBridgePage(listed, input.Limit, input.NextToken);
59
61
  return {
@@ -3,8 +3,8 @@ import { SimEventBridgeUnsimulatedInputException } from "../../error/sim-event-b
3
3
  * The properties that change what a target receives, or whether it receives
4
4
  * anything at all.
5
5
  *
6
- * Ignoring one would leave a test believing in a transformation, a retry or a
7
- * dead letter queue that never happened.
6
+ * Ignoring one would leave a test believing in a transformation that never
7
+ * happened.
8
8
  */
9
9
  const behaviourRefusals = [
10
10
  [
@@ -17,16 +17,6 @@ const behaviourRefusals = [
17
17
  "Target InputTransformer is not simulated, so PutTargets refuses one " +
18
18
  "rather than sending the untransformed event",
19
19
  ],
20
- [
21
- (target) => target.DeadLetterConfig,
22
- "Target dead letter queues are not simulated, so PutTargets refuses a " +
23
- "DeadLetterConfig rather than dropping undelivered events silently",
24
- ],
25
- [
26
- (target) => target.RetryPolicy,
27
- "Target retry policies are not simulated, so PutTargets refuses a " +
28
- "RetryPolicy rather than delivering once and calling it retried",
29
- ],
30
20
  [
31
21
  (target) => target.SqsParameters,
32
22
  "SqsParameters names a FIFO queue's message group, and FIFO queues are " +
@@ -1,11 +1,14 @@
1
1
  import type { SimResponseMetadata } from "../../../aws/metadata/response-metadata.type.js";
2
2
  import type { SimEcsTargetParametersType } from "../../../ecs/target/sim-ecs-target-parameters.js";
3
+ import type { SimEventTargetDeadLetterConfigInput } from "../../target/sim-event-target-dead-letter-config.js";
4
+ import type { SimEventTargetRetryPolicyInput } from "../../target/sim-event-target-retry-policy.js";
3
5
  /**
4
6
  * One target as a request carries it, and as ListTargetsByRule reports it.
5
7
  *
6
- * The properties beyond `Id`, `Arn`, `Input`, `RoleArn` and `EcsParameters`
7
- * are the ones real EventBridge takes and this simulation refuses, kept in the
8
- * shape so a request carrying one is recognised and named rather than ignored.
8
+ * The properties beyond `Id`, `Arn`, `Input`, `RoleArn`, `EcsParameters`,
9
+ * `DeadLetterConfig` and `RetryPolicy` are the ones real EventBridge takes and
10
+ * this simulation refuses. They are kept in the shape so a request carrying
11
+ * one is recognised and named.
9
12
  */
10
13
  export interface SimEventBridgeTarget {
11
14
  readonly Id?: string | undefined;
@@ -14,8 +17,8 @@ export interface SimEventBridgeTarget {
14
17
  readonly InputPath?: string | undefined;
15
18
  readonly InputTransformer?: object | undefined;
16
19
  readonly RoleArn?: string | undefined;
17
- readonly DeadLetterConfig?: object | undefined;
18
- readonly RetryPolicy?: object | undefined;
20
+ readonly DeadLetterConfig?: SimEventTargetDeadLetterConfigInput | undefined;
21
+ readonly RetryPolicy?: SimEventTargetRetryPolicyInput | undefined;
19
22
  readonly SqsParameters?: object | undefined;
20
23
  readonly KinesisParameters?: object | undefined;
21
24
  readonly EcsParameters?: SimEcsTargetParametersType | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { SimAws } from "../../aws/sim-aws.js";
2
- import type { SimEventBridgeDeliveryRequest, SimEventBridgeDeliveryTargets } from "./sim-event-bridge-delivery.js";
2
+ import type { SimEventBridgeDeadLetterRequest, SimEventBridgeDeliveryRequest, SimEventBridgeDeliveryTargets } from "./sim-event-bridge-delivery.js";
3
3
  interface SimAwsEventBridgeDeliveryTargetsProperties {
4
4
  readonly simAws: SimAws;
5
5
  }
@@ -21,6 +21,11 @@ export declare class SimAwsEventBridgeDeliveryTargets implements SimEventBridgeD
21
21
  * Send one event to the target its ARN names.
22
22
  */
23
23
  deliver(request: SimEventBridgeDeliveryRequest): Promise<void>;
24
+ /**
25
+ * Send an event EventBridge gave up on to the dead-letter queue its target
26
+ * names, in the queue's own Account and Region.
27
+ */
28
+ deadLetter(request: SimEventBridgeDeadLetterRequest): Promise<void>;
24
29
  /**
25
30
  * Hand the delivery to the one destination that knows this service.
26
31
  */