java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-12-27T17:01:58.598Z") @Stability(Stable) public class CfnTrail extends CfnResource implements IInspectable, ITaggable
Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.cloudtrail.*;
 CfnTrail cfnTrail = CfnTrail.Builder.create(this, "MyCfnTrail")
         .isLogging(false)
         .s3BucketName("s3BucketName")
         // the properties below are optional
         .advancedEventSelectors(List.of(AdvancedEventSelectorProperty.builder()
                 .fieldSelectors(List.of(AdvancedFieldSelectorProperty.builder()
                         .field("field")
                         // the properties below are optional
                         .endsWith(List.of("endsWith"))
                         .equalTo(List.of("equalTo"))
                         .notEndsWith(List.of("notEndsWith"))
                         .notEquals(List.of("notEquals"))
                         .notStartsWith(List.of("notStartsWith"))
                         .startsWith(List.of("startsWith"))
                         .build()))
                 // the properties below are optional
                 .name("name")
                 .build()))
         .cloudWatchLogsLogGroupArn("cloudWatchLogsLogGroupArn")
         .cloudWatchLogsRoleArn("cloudWatchLogsRoleArn")
         .enableLogFileValidation(false)
         .eventSelectors(List.of(EventSelectorProperty.builder()
                 .dataResources(List.of(DataResourceProperty.builder()
                         .type("type")
                         // the properties below are optional
                         .values(List.of("values"))
                         .build()))
                 .excludeManagementEventSources(List.of("excludeManagementEventSources"))
                 .includeManagementEvents(false)
                 .readWriteType("readWriteType")
                 .build()))
         .includeGlobalServiceEvents(false)
         .insightSelectors(List.of(InsightSelectorProperty.builder()
                 .insightType("insightType")
                 .build()))
         .isMultiRegionTrail(false)
         .isOrganizationTrail(false)
         .kmsKeyId("kmsKeyId")
         .s3KeyPrefix("s3KeyPrefix")
         .snsTopicName("snsTopicName")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .trailName("trailName")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnTrail

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

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

      @Stability(Stable) public CfnTrail(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnTrailProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      Ref returns the ARN of the CloudTrail trail, such as arn:aws:cloudtrail:us-east-2:123456789012:trail/myCloudTrail .
    • getAttrSnsTopicArn

      @Stability(Stable) @NotNull public String getAttrSnsTopicArn()
      Ref returns the ARN of the Amazon SNS topic that's associated with the CloudTrail trail, such as arn:aws:sns:us-east-2:123456789012:mySNSTopic .
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getIsLogging

      @Stability(Stable) @NotNull public Object getIsLogging()
      Whether the CloudTrail trail is currently logging AWS API calls.
    • setIsLogging

      @Stability(Stable) public void setIsLogging(@NotNull Boolean value)
      Whether the CloudTrail trail is currently logging AWS API calls.
    • setIsLogging

      @Stability(Stable) public void setIsLogging(@NotNull IResolvable value)
      Whether the CloudTrail trail is currently logging AWS API calls.
    • getS3BucketName

      @Stability(Stable) @NotNull public String getS3BucketName()
      Specifies the name of the Amazon S3 bucket designated for publishing log files.
    • setS3BucketName

      @Stability(Stable) public void setS3BucketName(@NotNull String value)
      Specifies the name of the Amazon S3 bucket designated for publishing log files.
    • getAdvancedEventSelectors

      @Stability(Stable) @Nullable public Object getAdvancedEventSelectors()
      Specifies the settings for advanced event selectors.
    • setAdvancedEventSelectors

      @Stability(Stable) public void setAdvancedEventSelectors(@Nullable IResolvable value)
      Specifies the settings for advanced event selectors.
    • setAdvancedEventSelectors

      @Stability(Stable) public void setAdvancedEventSelectors(@Nullable List<Object> value)
      Specifies the settings for advanced event selectors.
    • getCloudWatchLogsLogGroupArn

      @Stability(Stable) @Nullable public String getCloudWatchLogsLogGroupArn()
      Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs are delivered.
    • setCloudWatchLogsLogGroupArn

      @Stability(Stable) public void setCloudWatchLogsLogGroupArn(@Nullable String value)
      Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs are delivered.
    • getCloudWatchLogsRoleArn

      @Stability(Stable) @Nullable public String getCloudWatchLogsRoleArn()
      Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
    • setCloudWatchLogsRoleArn

      @Stability(Stable) public void setCloudWatchLogsRoleArn(@Nullable String value)
      Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
    • getEnableLogFileValidation

      @Stability(Stable) @Nullable public Object getEnableLogFileValidation()
      Specifies whether log file validation is enabled.

      The default is false.

    • setEnableLogFileValidation

      @Stability(Stable) public void setEnableLogFileValidation(@Nullable Boolean value)
      Specifies whether log file validation is enabled.

      The default is false.

    • setEnableLogFileValidation

      @Stability(Stable) public void setEnableLogFileValidation(@Nullable IResolvable value)
      Specifies whether log file validation is enabled.

      The default is false.

    • getEventSelectors

      @Stability(Stable) @Nullable public Object getEventSelectors()
      Use event selectors to further specify the management and data event settings for your trail.
    • setEventSelectors

      @Stability(Stable) public void setEventSelectors(@Nullable IResolvable value)
      Use event selectors to further specify the management and data event settings for your trail.
    • setEventSelectors

      @Stability(Stable) public void setEventSelectors(@Nullable List<Object> value)
      Use event selectors to further specify the management and data event settings for your trail.
    • getIncludeGlobalServiceEvents

      @Stability(Stable) @Nullable public Object getIncludeGlobalServiceEvents()
      Specifies whether the trail is publishing events from global services such as IAM to the log files.
    • setIncludeGlobalServiceEvents

      @Stability(Stable) public void setIncludeGlobalServiceEvents(@Nullable Boolean value)
      Specifies whether the trail is publishing events from global services such as IAM to the log files.
    • setIncludeGlobalServiceEvents

      @Stability(Stable) public void setIncludeGlobalServiceEvents(@Nullable IResolvable value)
      Specifies whether the trail is publishing events from global services such as IAM to the log files.
    • getInsightSelectors

      @Stability(Stable) @Nullable public Object getInsightSelectors()
      A JSON string that contains the Insights types you want to log on a trail.
    • setInsightSelectors

      @Stability(Stable) public void setInsightSelectors(@Nullable IResolvable value)
      A JSON string that contains the Insights types you want to log on a trail.
    • setInsightSelectors

      @Stability(Stable) public void setInsightSelectors(@Nullable List<Object> value)
      A JSON string that contains the Insights types you want to log on a trail.
    • getIsMultiRegionTrail

      @Stability(Stable) @Nullable public Object getIsMultiRegionTrail()
      Specifies whether the trail applies only to the current Region or to all Regions.
    • setIsMultiRegionTrail

      @Stability(Stable) public void setIsMultiRegionTrail(@Nullable Boolean value)
      Specifies whether the trail applies only to the current Region or to all Regions.
    • setIsMultiRegionTrail

      @Stability(Stable) public void setIsMultiRegionTrail(@Nullable IResolvable value)
      Specifies whether the trail applies only to the current Region or to all Regions.
    • getIsOrganizationTrail

      @Stability(Stable) @Nullable public Object getIsOrganizationTrail()
      Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .
    • setIsOrganizationTrail

      @Stability(Stable) public void setIsOrganizationTrail(@Nullable Boolean value)
      Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .
    • setIsOrganizationTrail

      @Stability(Stable) public void setIsOrganizationTrail(@Nullable IResolvable value)
      Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .
    • getKmsKeyId

      @Stability(Stable) @Nullable public String getKmsKeyId()
      Specifies the AWS KMS key ID to use to encrypt the logs delivered by CloudTrail.
    • setKmsKeyId

      @Stability(Stable) public void setKmsKeyId(@Nullable String value)
      Specifies the AWS KMS key ID to use to encrypt the logs delivered by CloudTrail.
    • getS3KeyPrefix

      @Stability(Stable) @Nullable public String getS3KeyPrefix()
      Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery.
    • setS3KeyPrefix

      @Stability(Stable) public void setS3KeyPrefix(@Nullable String value)
      Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery.
    • getSnsTopicName

      @Stability(Stable) @Nullable public String getSnsTopicName()
      Specifies the name of the Amazon SNS topic defined for notification of log file delivery.
    • setSnsTopicName

      @Stability(Stable) public void setSnsTopicName(@Nullable String value)
      Specifies the name of the Amazon SNS topic defined for notification of log file delivery.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      A custom set of tags (key-value pairs) for this trail.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      A custom set of tags (key-value pairs) for this trail.
    • getTrailName

      @Stability(Stable) @Nullable public String getTrailName()
      Specifies the name of the trail.

      The name must meet the following requirements:.

    • setTrailName

      @Stability(Stable) public void setTrailName(@Nullable String value)
      Specifies the name of the trail.

      The name must meet the following requirements:.