Package com.pulumi.aws.cloudwatch
Class EventArchive
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.cloudwatch.EventArchive
-
public class EventArchive extends com.pulumi.resources.CustomResourceProvides an EventBridge event archive resource. > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical. ## Example Usage
### Example Usage Optional Argumentspackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.cloudwatch.EventBus; import com.pulumi.aws.cloudwatch.EventBusArgs; import com.pulumi.aws.cloudwatch.EventArchive; import com.pulumi.aws.cloudwatch.EventArchiveArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var order = new EventBus("order", EventBusArgs.builder() .name("orders") .build()); var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder() .name("order-archive") .eventSourceArn(order.arn()) .build()); } }
### Example Usage CMK Encryptionpackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.cloudwatch.EventBus; import com.pulumi.aws.cloudwatch.EventBusArgs; import com.pulumi.aws.cloudwatch.EventArchive; import com.pulumi.aws.cloudwatch.EventArchiveArgs; import static com.pulumi.codegen.internal.Serialization.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var order = new EventBus("order", EventBusArgs.builder() .name("orders") .build()); var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder() .name("order-archive") .description("Archived events from order service") .eventSourceArn(order.arn()) .retentionDays(7) .eventPattern(serializeJson( jsonObject( jsonProperty("source", jsonArray("company.team.order")) ))) .build()); } }
## Import ### Identity Schema #### Required * `name` (String) Name of the archive. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import Archives using `name`. For example: ```sh $ pulumi import aws:cloudwatch/eventArchive:EventArchive example example-archive ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.AwsFunctions; import com.pulumi.aws.inputs.GetCallerIdentityArgs; import com.pulumi.aws.inputs.GetPartitionArgs; import com.pulumi.aws.cloudwatch.EventBus; import com.pulumi.aws.cloudwatch.EventBusArgs; import com.pulumi.aws.kms.Key; import com.pulumi.aws.kms.KeyArgs; import com.pulumi.aws.cloudwatch.EventArchive; import com.pulumi.aws.cloudwatch.EventArchiveArgs; import static com.pulumi.codegen.internal.Serialization.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder() .build()); final var currentGetPartition = AwsFunctions.getPartition(GetPartitionArgs.builder() .build()); var example = new EventBus("example", EventBusArgs.builder() .name("example") .build()); var exampleKey = new Key("exampleKey", KeyArgs.builder() .deletionWindowInDays(7) .policy(example.arn().applyValue(_arn -> serializeJson( jsonObject( jsonProperty("Version", "2012-10-17"), jsonProperty("Id", "key-policy-example"), jsonProperty("Statement", jsonArray( jsonObject( jsonProperty("Sid", "Enable IAM User Permissions"), jsonProperty("Effect", "Allow"), jsonProperty("Principal", jsonObject( jsonProperty("AWS", String.format("arn:%s:iam::%s:root", currentGetPartition.partition(),current.accountId())) )), jsonProperty("Action", "kms:*"), jsonProperty("Resource", "*") ), jsonObject( jsonProperty("Sid", "Allow describing of the key"), jsonProperty("Effect", "Allow"), jsonProperty("Principal", jsonObject( jsonProperty("Service", "events.amazonaws.com") )), jsonProperty("Action", jsonArray("kms:DescribeKey")), jsonProperty("Resource", "*") ), jsonObject( jsonProperty("Sid", "Allow use of the key"), jsonProperty("Effect", "Allow"), jsonProperty("Principal", jsonObject( jsonProperty("Service", "events.amazonaws.com") )), jsonProperty("Action", jsonArray( "kms:GenerateDataKey", "kms:Decrypt", "kms:ReEncrypt*" )), jsonProperty("Resource", "*"), jsonProperty("Condition", jsonObject( jsonProperty("StringEquals", jsonObject( jsonProperty("kms:EncryptionContext:aws:events:event-bus:arn", _arn) )) )) ) )) )))) .tags(Map.of("EventBridgeApiDestinations", "true")) .build()); var exampleEventArchive = new EventArchive("exampleEventArchive", EventArchiveArgs.builder() .name("example") .eventSourceArn(example.arn()) .kmsKeyIdentifier(exampleKey.id()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description EventArchive(java.lang.String name)EventArchive(java.lang.String name, EventArchiveArgs args)EventArchive(java.lang.String name, EventArchiveArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.util.Optional<java.lang.String>>description()com.pulumi.core.Output<java.util.Optional<java.lang.String>>eventPattern()com.pulumi.core.Output<java.lang.String>eventSourceArn()static EventArchiveget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, EventArchiveState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<java.lang.String>>kmsKeyIdentifier()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>retentionDays()
-
-
-
Constructor Detail
-
EventArchive
public EventArchive(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
EventArchive
public EventArchive(java.lang.String name, EventArchiveArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
EventArchive
public EventArchive(java.lang.String name, EventArchiveArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the archive.
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- Description for the archive.
-
eventPattern
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> eventPattern()
- Returns:
- Event pattern to use to filter events sent to the archive. By default, it attempts to archive every event received in the `eventSourceArn`.
-
eventSourceArn
public com.pulumi.core.Output<java.lang.String> eventSourceArn()
- Returns:
- ARN of the event bus associated with the archive. Only events from this event bus are sent to the archive.
-
kmsKeyIdentifier
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> kmsKeyIdentifier()
- Returns:
- Identifier of the AWS KMS customer managed key for EventBridge to use, if you choose to use a customer managed key to encrypt this archive. The identifier can be the key ARN, KeyId, key alias, or key alias ARN.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Name of the archive. The archive name cannot exceed 48 characters.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
retentionDays
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> retentionDays()
- Returns:
- The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
-
get
public static EventArchive get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable EventArchiveState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-