@Generated(value="jsii-pacmak/1.58.0 (build f8ba112)", date="2022-05-27T16:28:01.131Z") public class CfnTrail extends CfnResource implements IInspectable
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 .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();
Modifier and Type | Class and Description |
---|---|
static class |
CfnTrail.Builder
A fluent builder for
CfnTrail . |
static interface |
CfnTrail.DataResourceProperty
The Amazon S3 buckets, AWS Lambda functions, or Amazon DynamoDB tables that you specify in event selectors in your AWS CloudFormation template for your trail to log data events.
|
static interface |
CfnTrail.EventSelectorProperty
Use event selectors to further specify the management and data event settings for your trail.
|
static interface |
CfnTrail.InsightSelectorProperty
A JSON string that contains a list of insight types that are logged on a trail.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnTrail(Construct scope,
java.lang.String id,
CfnTrailProps props)
Create a new `AWS::CloudTrail::Trail`.
|
protected |
CfnTrail(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnTrail(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrArn()
`Ref` returns the ARN of the CloudTrail trail, such as `arn:aws:cloudtrail:us-east-2:123456789012:trail/myCloudTrail` .
|
java.lang.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` .
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.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.
|
java.lang.String |
getCloudWatchLogsRoleArn()
Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
|
java.lang.Object |
getEnableLogFileValidation()
Specifies whether log file validation is enabled.
|
java.lang.Object |
getEventSelectors()
Use event selectors to further specify the management and data event settings for your trail.
|
java.lang.Object |
getIncludeGlobalServiceEvents()
Specifies whether the trail is publishing events from global services such as IAM to the log files.
|
java.lang.Object |
getInsightSelectors()
`AWS::CloudTrail::Trail.InsightSelectors`.
|
java.lang.Object |
getIsLogging()
Whether the CloudTrail trail is currently logging AWS API calls.
|
java.lang.Object |
getIsMultiRegionTrail()
Specifies whether the trail applies only to the current region or to all regions.
|
java.lang.Object |
getIsOrganizationTrail()
Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .
|
java.lang.String |
getKmsKeyId()
Specifies the AWS KMS key ID to use to encrypt the logs delivered by CloudTrail.
|
java.lang.String |
getS3BucketName()
Specifies the name of the Amazon S3 bucket designated for publishing log files.
|
java.lang.String |
getS3KeyPrefix()
Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery.
|
java.lang.String |
getSnsTopicName()
Specifies the name of the Amazon SNS topic defined for notification of log file delivery.
|
TagManager |
getTags()
A custom set of tags (key-value pairs) for this trail.
|
java.lang.String |
getTrailName()
Specifies the name of the trail.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setCloudWatchLogsLogGroupArn(java.lang.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.
|
void |
setCloudWatchLogsRoleArn(java.lang.String value)
Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.
|
void |
setEnableLogFileValidation(java.lang.Boolean value)
Specifies whether log file validation is enabled.
|
void |
setEnableLogFileValidation(IResolvable value)
Specifies whether log file validation is enabled.
|
void |
setEventSelectors(IResolvable value)
Use event selectors to further specify the management and data event settings for your trail.
|
void |
setEventSelectors(java.util.List<java.lang.Object> value)
Use event selectors to further specify the management and data event settings for your trail.
|
void |
setIncludeGlobalServiceEvents(java.lang.Boolean value)
Specifies whether the trail is publishing events from global services such as IAM to the log files.
|
void |
setIncludeGlobalServiceEvents(IResolvable value)
Specifies whether the trail is publishing events from global services such as IAM to the log files.
|
void |
setInsightSelectors(IResolvable value)
`AWS::CloudTrail::Trail.InsightSelectors`.
|
void |
setInsightSelectors(java.util.List<java.lang.Object> value)
`AWS::CloudTrail::Trail.InsightSelectors`.
|
void |
setIsLogging(java.lang.Boolean value)
Whether the CloudTrail trail is currently logging AWS API calls.
|
void |
setIsLogging(IResolvable value)
Whether the CloudTrail trail is currently logging AWS API calls.
|
void |
setIsMultiRegionTrail(java.lang.Boolean value)
Specifies whether the trail applies only to the current region or to all regions.
|
void |
setIsMultiRegionTrail(IResolvable value)
Specifies whether the trail applies only to the current region or to all regions.
|
void |
setIsOrganizationTrail(java.lang.Boolean value)
Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .
|
void |
setIsOrganizationTrail(IResolvable value)
Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .
|
void |
setKmsKeyId(java.lang.String value)
Specifies the AWS KMS key ID to use to encrypt the logs delivered by CloudTrail.
|
void |
setS3BucketName(java.lang.String value)
Specifies the name of the Amazon S3 bucket designated for publishing log files.
|
void |
setS3KeyPrefix(java.lang.String value)
Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery.
|
void |
setSnsTopicName(java.lang.String value)
Specifies the name of the Amazon SNS topic defined for notification of log file delivery.
|
void |
setTrailName(java.lang.String value)
Specifies the name of the trail.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnTrail(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnTrail(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnTrail(Construct scope, java.lang.String id, CfnTrailProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrArn()
public java.lang.String getAttrSnsTopicArn()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
public java.lang.Object getIsLogging()
public void setIsLogging(java.lang.Boolean value)
public void setIsLogging(IResolvable value)
public java.lang.String getS3BucketName()
public void setS3BucketName(java.lang.String value)
public java.lang.String getCloudWatchLogsLogGroupArn()
Not required unless you specify CloudWatchLogsRoleArn
.
public void setCloudWatchLogsLogGroupArn(java.lang.String value)
Not required unless you specify CloudWatchLogsRoleArn
.
public java.lang.String getCloudWatchLogsRoleArn()
public void setCloudWatchLogsRoleArn(java.lang.String value)
public java.lang.Object getEnableLogFileValidation()
When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
public void setEnableLogFileValidation(java.lang.Boolean value)
When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
public void setEnableLogFileValidation(IResolvable value)
When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail.
public java.lang.Object getEventSelectors()
By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event.
You can configure up to five event selectors for a trail.
You cannot apply both event selectors and advanced event selectors to a trail.
public void setEventSelectors(IResolvable value)
By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event.
You can configure up to five event selectors for a trail.
You cannot apply both event selectors and advanced event selectors to a trail.
public void setEventSelectors(java.util.List<java.lang.Object> value)
By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event.
You can configure up to five event selectors for a trail.
You cannot apply both event selectors and advanced event selectors to a trail.
public java.lang.Object getIncludeGlobalServiceEvents()
public void setIncludeGlobalServiceEvents(java.lang.Boolean value)
public void setIncludeGlobalServiceEvents(IResolvable value)
public java.lang.Object getInsightSelectors()
public void setInsightSelectors(IResolvable value)
public void setInsightSelectors(java.util.List<java.lang.Object> value)
public java.lang.Object getIsMultiRegionTrail()
The default is false. If the trail exists only in the current region and this value is set to true, shadow trails (replications of the trail) will be created in the other regions. If the trail exists in all regions and this value is set to false, the trail will remain in the region where it was created, and its shadow trails in other regions will be deleted. As a best practice, consider using trails that log events in all regions.
public void setIsMultiRegionTrail(java.lang.Boolean value)
The default is false. If the trail exists only in the current region and this value is set to true, shadow trails (replications of the trail) will be created in the other regions. If the trail exists in all regions and this value is set to false, the trail will remain in the region where it was created, and its shadow trails in other regions will be deleted. As a best practice, consider using trails that log events in all regions.
public void setIsMultiRegionTrail(IResolvable value)
The default is false. If the trail exists only in the current region and this value is set to true, shadow trails (replications of the trail) will be created in the other regions. If the trail exists in all regions and this value is set to false, the trail will remain in the region where it was created, and its shadow trails in other regions will be deleted. As a best practice, consider using trails that log events in all regions.
public java.lang.Object getIsOrganizationTrail()
The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the management account for an organization in AWS Organizations . If the trail is not an organization trail and this is set to true
, the trail will be created in all AWS accounts that belong to the organization. If the trail is an organization trail and this is set to false
, the trail will remain in the current AWS account but be deleted from all member accounts in the organization.
public void setIsOrganizationTrail(java.lang.Boolean value)
The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the management account for an organization in AWS Organizations . If the trail is not an organization trail and this is set to true
, the trail will be created in all AWS accounts that belong to the organization. If the trail is an organization trail and this is set to false
, the trail will remain in the current AWS account but be deleted from all member accounts in the organization.
public void setIsOrganizationTrail(IResolvable value)
The default is false, and cannot be true unless the call is made on behalf of an AWS account that is the management account for an organization in AWS Organizations . If the trail is not an organization trail and this is set to true
, the trail will be created in all AWS accounts that belong to the organization. If the trail is an organization trail and this is set to false
, the trail will remain in the current AWS account but be deleted from all member accounts in the organization.
public java.lang.String getKmsKeyId()
The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.
CloudTrail also supports AWS KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the AWS Key Management Service Developer Guide .
Examples:
public void setKmsKeyId(java.lang.String value)
The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier.
CloudTrail also supports AWS KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the AWS Key Management Service Developer Guide .
Examples:
public java.lang.String getS3KeyPrefix()
For more information, see Finding Your CloudTrail Log Files . The maximum length is 200 characters.
public void setS3KeyPrefix(java.lang.String value)
For more information, see Finding Your CloudTrail Log Files . The maximum length is 200 characters.
public java.lang.String getSnsTopicName()
The maximum length is 256 characters.
public void setSnsTopicName(java.lang.String value)
The maximum length is 256 characters.
public java.lang.String getTrailName()
my-_namespace
and my--namespace
are not valid.public void setTrailName(java.lang.String value)
my-_namespace
and my--namespace
are not valid.