# OnCloudTrailImagePushedOptions

Options for the onCloudTrailImagePushed method.

Extends: [OnEventOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.OnEventOptions.html)
Used as argument in: [IRepository.onCloudTrailImagePushed](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecr.IRepository.html#oncloudtrailimagepushed)

- Source: [`aws-ecr/lib/repository.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecr/lib/repository.ts#L514)

## Example

TypeScript:

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

declare const construct: constructs.Construct;
declare const detail: any;
declare const ruleTarget: events.IRuleTarget;
const onCloudTrailImagePushedOptions: ecr.OnCloudTrailImagePushedOptions = {
  crossStackScope: construct,
  description: 'description',
  eventPattern: {
    account: ['account'],
    detail: {
      detailKey: detail,
    },
    detailType: ['detailType'],
    id: ['id'],
    region: ['region'],
    resources: ['resources'],
    source: ['source'],
    time: ['time'],
    version: ['version'],
  },
  imageTag: 'imageTag',
  ruleName: 'ruleName',
  target: ruleTarget,
};
```

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_ecr as ecr
from aws_cdk import aws_events as events
import constructs as constructs

# construct: constructs.Construct
# detail: Any
# rule_target: events.IRuleTarget

on_cloud_trail_image_pushed_options = ecr.OnCloudTrailImagePushedOptions(
    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"]
    ),
    image_tag="imageTag",
    rule_name="ruleName",
    target=rule_target
)
```

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.ecr.*;
import software.amazon.awscdk.services.events.*;
import software.constructs.*;

Construct construct;
Object detail;
IRuleTarget ruleTarget;

OnCloudTrailImagePushedOptions onCloudTrailImagePushedOptions = OnCloudTrailImagePushedOptions.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())
        .imageTag("imageTag")
        .ruleName("ruleName")
        .target(ruleTarget)
        .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.ECR;
using Amazon.CDK.AWS.Events;
using Constructs;

Construct construct;
var detail;
IRuleTarget ruleTarget;
var onCloudTrailImagePushedOptions = new OnCloudTrailImagePushedOptions {
    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" }
    },
    ImageTag = "imageTag",
    RuleName = "ruleName",
    Target = ruleTarget
};
```

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 "github.com/aws/aws-cdk-go/awscdk"
import constructs "github.com/aws/constructs-go/constructs"

var construct Construct
var detail interface{}
var ruleTarget IRuleTarget

onCloudTrailImagePushedOptions := &OnCloudTrailImagePushedOptions{
	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"),
		},
	},
	ImageTag: jsii.String("imageTag"),
	RuleName: jsii.String("ruleName"),
	Target: ruleTarget,
}
```

## 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.

- `imageTag`: string — Only watch changes to this image tag.

  **Default:** Watch changes to all tags

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

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

- `target`: [IRuleTarget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IRuleTarget.html) — The target to register for the event.

  **Default:** No target is added to the rule. Use `addTarget()` to add a target.
