Class CustomDataIdentifier

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.logs.DataIdentifier
software.amazon.awscdk.services.logs.CustomDataIdentifier
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:09.585Z") @Stability(Stable) public class CustomDataIdentifier extends DataIdentifier
A custom data identifier.

Include a custom data identifier name and regular expression in the JSON policy used to define the data protection policy.

Example:

 import software.amazon.awscdk.services.kinesisfirehose.alpha.*;
 import software.amazon.awscdk.services.kinesisfirehose.destinations.alpha.*;
 LogGroup logGroupDestination = LogGroup.Builder.create(this, "LogGroupLambdaAudit")
         .logGroupName("auditDestinationForCDK")
         .build();
 Bucket bucket = new Bucket(this, "audit-bucket");
 S3Bucket s3Destination = new S3Bucket(bucket);
 DeliveryStream deliveryStream = DeliveryStream.Builder.create(this, "Delivery Stream")
         .destinations(List.of(s3Destination))
         .build();
 DataProtectionPolicy dataProtectionPolicy = DataProtectionPolicy.Builder.create()
         .name("data protection policy")
         .description("policy description")
         .identifiers(List.of(DataIdentifier.DRIVERSLICENSE_US,  // managed data identifier
             new DataIdentifier("EmailAddress"),  // forward compatibility for new managed data identifiers
             new CustomDataIdentifier("EmployeeId", "EmployeeId-\\d{9}"))) // custom data identifier
         .logGroupAuditDestination(logGroupDestination)
         .s3BucketAuditDestination(bucket)
         .deliveryStreamNameAuditDestination(deliveryStream.getDeliveryStreamName())
         .build();
 LogGroup.Builder.create(this, "LogGroupLambda")
         .logGroupName("cdkIntegLogGroup")
         .dataProtectionPolicy(dataProtectionPolicy)
         .build();
 
  • Constructor Details

    • CustomDataIdentifier

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

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

      @Stability(Stable) public CustomDataIdentifier(@NotNull String name, @NotNull String regex)
      Create a custom data identifier.

      Parameters:
      name -
      • the name of the custom data identifier.
      This parameter is required.
      regex -
      • the regular expresssion to detect and mask log events for.
      This parameter is required.
  • Method Details

    • toString

      @Stability(Stable) @NotNull public String toString()
      String representation of a CustomDataIdentifier.

      Overrides:
      toString in class DataIdentifier
      Returns:
      the name and RegEx of the custom data identifier
    • getName

      @Stability(Stable) @NotNull public String getName()
      • the name of the custom data identifier.

      This cannot share the same name as a managed data identifier.

      Overrides:
      getName in class DataIdentifier
    • getRegex

      @Stability(Stable) @NotNull public String getRegex()
      • the regular expresssion to detect and mask log events for.