# EventCommonOptions

Common options for Events.

- Source: [`aws-events/lib/on-event-options.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-events/lib/on-event-options.ts#L8)
- Type last changed: v2.38.0 · 17 Aug 2022

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_events as events } from 'aws-cdk-lib';
import * as constructs from 'constructs';

declare const construct: constructs.Construct;
declare const detail: any;
const eventCommonOptions: events.EventCommonOptions = {
  crossStackScope: construct,
  description: 'description',
  eventPattern: {
    account: ['account'],
    detail: {
      detailKey: detail,
    },
    detailType: ['detailType'],
    id: ['id'],
    region: ['region'],
    resources: ['resources'],
    source: ['source'],
    time: ['time'],
    version: ['version'],
  },
  ruleName: 'ruleName',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_events as events
import constructs as constructs

# construct: constructs.Construct
# detail: Any

event_common_options = events.EventCommonOptions(
    cross_stack_scope=construct,
    description="description",
    event_pattern=events.EventPattern(
        account=["account"],
        detail={
            "detail_key": detail
        },
        detail_type=["detailType"],
        id=["id"],
        region=["region"],
        resources=["resources"],
        source=["source"],
        time=["time"],
        version=["version"]
    ),
    rule_name="ruleName"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.events.*;
import software.constructs.*;

Construct construct;
Object detail;

EventCommonOptions eventCommonOptions = EventCommonOptions.builder()
        .crossStackScope(construct)
        .description("description")
        .eventPattern(EventPattern.builder()
                .account(List.of("account"))
                .detail(Map.of(
                        "detailKey", detail))
                .detailType(List.of("detailType"))
                .id(List.of("id"))
                .region(List.of("region"))
                .resources(List.of("resources"))
                .source(List.of("source"))
                .time(List.of("time"))
                .version(List.of("version"))
                .build())
        .ruleName("ruleName")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Events;
using Constructs;

Construct construct;
var detail;
var eventCommonOptions = new EventCommonOptions {
    CrossStackScope = construct,
    Description = "description",
    EventPattern = new EventPattern {
        Account = new [] { "account" },
        Detail = new Dictionary<string, object> {
            { "detailKey", detail }
        },
        DetailType = new [] { "detailType" },
        Id = new [] { "id" },
        Region = new [] { "region" },
        Resources = new [] { "resources" },
        Source = new [] { "source" },
        Time = new [] { "time" },
        Version = new [] { "version" }
    },
    RuleName = "ruleName"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import constructs "github.com/aws/constructs-go/constructs"

var construct Construct
var detail interface{}

eventCommonOptions := &EventCommonOptions{
	CrossStackScope: construct,
	Description: jsii.String("description"),
	EventPattern: &EventPattern{
		Account: []*string{
			jsii.String("account"),
		},
		Detail: map[string]interface{}{
			"detailKey": detail,
		},
		DetailType: []*string{
			jsii.String("detailType"),
		},
		Id: []*string{
			jsii.String("id"),
		},
		Region: []*string{
			jsii.String("region"),
		},
		Resources: []*string{
			jsii.String("resources"),
		},
		Source: []*string{
			jsii.String("source"),
		},
		Time: []*string{
			jsii.String("time"),
		},
		Version: []*string{
			jsii.String("version"),
		},
	},
	RuleName: jsii.String("ruleName"),
}
```

## Properties

- `crossStackScope`: [Construct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Construct.html) — The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region).

  **Default:** none (the main scope will be used, even for cross-stack Events)

  This helps dealing with cycles that often arise in these situations.

- `description`: string — A description of the rule's purpose.

  **Default:** No description

- `eventPattern`: [EventPattern](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.EventPattern.html) — Additional restrictions for the event to route to the specified target.

  **Default:** No additional filtering based on an event pattern.

  The method that generates the rule probably imposes some type of event
  filtering. The filtering implied by what you pass here is added
  on top of that filtering.

- `ruleName`: string — A name for the rule.

  **Default:** AWS CloudFormation generates a unique physical ID.
