Class EventBus

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.events.EventBus
All Implemented Interfaces:
IResource, IEventBus, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-21T06:34:08.500Z") @Stability(Stable) public class EventBus extends Resource implements IEventBus
Define an EventBridge EventBus.

Example:

 EventBus bus = EventBus.Builder.create(this, "bus")
         .eventBusName("MyCustomEventBus")
         .description("MyCustomEventBus")
         .build();
 bus.archive("MyArchive", BaseArchiveProps.builder()
         .archiveName("MyCustomEventBusArchive")
         .description("MyCustomerEventBus Archive")
         .eventPattern(EventPattern.builder()
                 .account(List.of(Stack.of(this).getAccount()))
                 .build())
         .retention(Duration.days(365))
         .build());
 
  • Constructor Details

    • EventBus

      protected EventBus(software.amazon.jsii.JsiiObjectRef objRef)
    • EventBus

      protected EventBus(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • EventBus

      @Stability(Stable) public EventBus(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable EventBusProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • EventBus

      @Stability(Stable) public EventBus(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromEventBusArn

      @Stability(Stable) @NotNull public static IEventBus fromEventBusArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String eventBusArn)
      Import an existing event bus resource.

      Parameters:
      scope - Parent construct. This parameter is required.
      id - Construct ID. This parameter is required.
      eventBusArn - ARN of imported event bus. This parameter is required.
    • fromEventBusAttributes

      @Stability(Stable) @NotNull public static IEventBus fromEventBusAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EventBusAttributes attrs)
      Import an existing event bus resource.

      Parameters:
      scope - Parent construct. This parameter is required.
      id - Construct ID. This parameter is required.
      attrs - Imported event bus properties. This parameter is required.
    • fromEventBusName

      @Stability(Stable) @NotNull public static IEventBus fromEventBusName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String eventBusName)
      Import an existing event bus resource.

      Parameters:
      scope - Parent construct. This parameter is required.
      id - Construct ID. This parameter is required.
      eventBusName - Name of imported event bus. This parameter is required.
    • grantAllPutEvents

      @Stability(Stable) @NotNull public static Grant grantAllPutEvents(@NotNull IGrantable grantee)
      Permits an IAM Principal to send custom events to EventBridge so that they can be matched to rules.

      Parameters:
      grantee - The principal (no-op if undefined). This parameter is required.
    • addToResourcePolicy

      @Stability(Stable) @NotNull public AddToResourcePolicyResult addToResourcePolicy(@NotNull PolicyStatement statement)
      Adds a statement to the IAM resource policy associated with this event bus.

      Parameters:
      statement - This parameter is required.
    • archive

      @Stability(Stable) @NotNull public Archive archive(@NotNull String id, @NotNull BaseArchiveProps props)
      Create an EventBridge archive to send events to.

      When you create an archive, incoming events might not immediately start being sent to the archive. Allow a short period of time for changes to take effect.

      Specified by:
      archive in interface IEventBus
      Parameters:
      id - This parameter is required.
      props - This parameter is required.
    • grantPutEventsTo

      @Stability(Stable) @NotNull public Grant grantPutEventsTo(@NotNull IGrantable grantee)
      Grants an IAM Principal to send custom events to the eventBus so that they can be matched to rules.

      Specified by:
      grantPutEventsTo in interface IEventBus
      Parameters:
      grantee - This parameter is required.
    • getEventBusArn

      @Stability(Stable) @NotNull public String getEventBusArn()
      The ARN of the event bus, such as: arn:aws:events:us-east-2:123456789012:event-bus/aws.partner/PartnerName/acct1/repo1.
      Specified by:
      getEventBusArn in interface IEventBus
    • getEventBusName

      @Stability(Stable) @NotNull public String getEventBusName()
      The physical ID of this event bus resource.
      Specified by:
      getEventBusName in interface IEventBus
    • getEventBusPolicy

      @Stability(Stable) @NotNull public String getEventBusPolicy()
      The policy for the event bus in JSON form.
      Specified by:
      getEventBusPolicy in interface IEventBus
    • getEventSourceName

      @Stability(Stable) @Nullable public String getEventSourceName()
      The name of the partner event source.
      Specified by:
      getEventSourceName in interface IEventBus