Class: AWSCDK::CloudTrail::CfnTrailProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_trail/cfn_trail_props.rb

Overview

Properties for defining a CfnTrail.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_logging:, s3_bucket_name:, advanced_event_selectors: nil, aggregation_configurations: nil, cloud_watch_logs_log_group_arn: nil, cloud_watch_logs_role_arn: nil, enable_log_file_validation: nil, event_selectors: nil, include_global_service_events: nil, insight_selectors: nil, is_multi_region_trail: nil, is_organization_trail: nil, kms_key_id: nil, s3_key_prefix: nil, sns_topic_name: nil, tags: nil, trail_name: nil) ⇒ CfnTrailProps

Returns a new instance of CfnTrailProps.

Parameters:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'cloud_trail/cfn_trail_props.rb', line 26

def initialize(is_logging:, s3_bucket_name:, advanced_event_selectors: nil, aggregation_configurations: nil, cloud_watch_logs_log_group_arn: nil, cloud_watch_logs_role_arn: nil, enable_log_file_validation: nil, event_selectors: nil, include_global_service_events: nil, insight_selectors: nil, is_multi_region_trail: nil, is_organization_trail: nil, kms_key_id: nil, s3_key_prefix: nil, sns_topic_name: nil, tags: nil, trail_name: nil)
  @is_logging = is_logging
  Jsii::Type.check_type(@is_logging, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "isLogging")
  @s3_bucket_name = s3_bucket_name
  Jsii::Type.check_type(@s3_bucket_name, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19zMy5JQnVja2V0UmVmIn1dfX0=")), "s3BucketName")
  @advanced_event_selectors = advanced_event_selectors
  Jsii::Type.check_type(@advanced_event_selectors, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR0cmFpbC5DZm5UcmFpbC5BZHZhbmNlZEV2ZW50U2VsZWN0b3JQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "advancedEventSelectors") unless @advanced_event_selectors.nil?
  @aggregation_configurations = aggregation_configurations
  Jsii::Type.check_type(@aggregation_configurations, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR0cmFpbC5DZm5UcmFpbC5BZ2dyZWdhdGlvbkNvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "aggregationConfigurations") unless @aggregation_configurations.nil?
  @cloud_watch_logs_log_group_arn = cloud_watch_logs_log_group_arn
  Jsii::Type.check_type(@cloud_watch_logs_log_group_arn, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19sb2dzLklMb2dHcm91cFJlZiJ9XX19")), "cloudWatchLogsLogGroupArn") unless @cloud_watch_logs_log_group_arn.nil?
  @cloud_watch_logs_role_arn = cloud_watch_logs_role_arn
  Jsii::Type.check_type(@cloud_watch_logs_role_arn, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19pYW0uSVJvbGVSZWYifV19fQ==")), "cloudWatchLogsRoleArn") unless @cloud_watch_logs_role_arn.nil?
  @enable_log_file_validation = enable_log_file_validation
  Jsii::Type.check_type(@enable_log_file_validation, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "enableLogFileValidation") unless @enable_log_file_validation.nil?
  @event_selectors = event_selectors
  Jsii::Type.check_type(@event_selectors, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR0cmFpbC5DZm5UcmFpbC5FdmVudFNlbGVjdG9yUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "eventSelectors") unless @event_selectors.nil?
  @include_global_service_events = include_global_service_events
  Jsii::Type.check_type(@include_global_service_events, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "includeGlobalServiceEvents") unless @include_global_service_events.nil?
  @insight_selectors = insight_selectors
  Jsii::Type.check_type(@insight_selectors, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR0cmFpbC5DZm5UcmFpbC5JbnNpZ2h0U2VsZWN0b3JQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "insightSelectors") unless @insight_selectors.nil?
  @is_multi_region_trail = is_multi_region_trail
  Jsii::Type.check_type(@is_multi_region_trail, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "isMultiRegionTrail") unless @is_multi_region_trail.nil?
  @is_organization_trail = is_organization_trail
  Jsii::Type.check_type(@is_organization_trail, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "isOrganizationTrail") unless @is_organization_trail.nil?
  @kms_key_id = kms_key_id
  Jsii::Type.check_type(@kms_key_id, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19rbXMuSUFsaWFzUmVmIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19rbXMuSUtleVJlZiJ9XX19")), "kmsKeyId") unless @kms_key_id.nil?
  @s3_key_prefix = s3_key_prefix
  Jsii::Type.check_type(@s3_key_prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3KeyPrefix") unless @s3_key_prefix.nil?
  @sns_topic_name = sns_topic_name
  Jsii::Type.check_type(@sns_topic_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "snsTopicName") unless @sns_topic_name.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @trail_name = trail_name
  Jsii::Type.check_type(@trail_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "trailName") unless @trail_name.nil?
end

Instance Attribute Details

#advanced_event_selectorsAWSCDK::IResolvable, ... (readonly)

Specifies the settings for advanced event selectors.

You can use advanced event selectors to log management events, data events for all resource types, and network activity events.

You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either AdvancedEventSelectors or EventSelectors , but not both. If you apply AdvancedEventSelectors to a trail, any existing EventSelectors are overwritten. For more information about advanced event selectors, see Logging data events and Logging network activity events in the AWS CloudTrail User Guide .



83
84
85
# File 'cloud_trail/cfn_trail_props.rb', line 83

def advanced_event_selectors
  @advanced_event_selectors
end

#aggregation_configurationsAWSCDK::IResolvable, ... (readonly)

Specifies the aggregation configuration to aggregate CloudTrail Events.

A maximum of 1 aggregation configuration is allowed.



90
91
92
# File 'cloud_trail/cfn_trail_props.rb', line 90

def aggregation_configurations
  @aggregation_configurations
end

#cloud_watch_logs_log_group_arnString, ... (readonly)

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.

You must use a log group that exists in your account.

To enable CloudWatch Logs delivery, you must provide values for CloudWatchLogsLogGroupArn and CloudWatchLogsRoleArn .

If you previously enabled CloudWatch Logs delivery and want to disable CloudWatch Logs delivery, you must set the values of the CloudWatchLogsRoleArn and CloudWatchLogsLogGroupArn fields to "" .



101
102
103
# File 'cloud_trail/cfn_trail_props.rb', line 101

def cloud_watch_logs_log_group_arn
  @cloud_watch_logs_log_group_arn
end

#cloud_watch_logs_role_arnString, ... (readonly)

Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group.

You must use a role that exists in your account.

To enable CloudWatch Logs delivery, you must provide values for CloudWatchLogsLogGroupArn and CloudWatchLogsRoleArn .

If you previously enabled CloudWatch Logs delivery and want to disable CloudWatch Logs delivery, you must set the values of the CloudWatchLogsRoleArn and CloudWatchLogsLogGroupArn fields to "" .



112
113
114
# File 'cloud_trail/cfn_trail_props.rb', line 112

def cloud_watch_logs_role_arn
  @cloud_watch_logs_role_arn
end

#enable_log_file_validationBoolean, ... (readonly)

Specifies whether log file validation is enabled. The default is false.

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.



119
120
121
# File 'cloud_trail/cfn_trail_props.rb', line 119

def enable_log_file_validation
  @enable_log_file_validation
end

#event_selectorsAWSCDK::IResolvable, ... (readonly)

Use event selectors to further specify the management and data event settings for your trail.

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.



130
131
132
# File 'cloud_trail/cfn_trail_props.rb', line 130

def event_selectors
  @event_selectors
end

#include_global_service_eventsBoolean, ... (readonly)

Specifies whether the trail is publishing events from global services such as IAM to the log files.



135
136
137
# File 'cloud_trail/cfn_trail_props.rb', line 135

def include_global_service_events
  @include_global_service_events
end

#insight_selectorsAWSCDK::IResolvable, ... (readonly)

A JSON string that contains the Insights types you want to log on a trail.

ApiCallRateInsight and ApiErrorRateInsight are valid Insight types.

The ApiCallRateInsight Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume.

The ApiErrorRateInsight Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful.



146
147
148
# File 'cloud_trail/cfn_trail_props.rb', line 146

def insight_selectors
  @insight_selectors
end

#is_loggingBoolean, AWSCDK::IResolvable (readonly)

Whether the CloudTrail trail is currently logging AWS API calls.



67
68
69
# File 'cloud_trail/cfn_trail_props.rb', line 67

def is_logging
  @is_logging
end

#is_multi_region_trailBoolean, ... (readonly)

Specifies whether the trail applies only to the current Region or to all Regions.

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.



153
154
155
# File 'cloud_trail/cfn_trail_props.rb', line 153

def is_multi_region_trail
  @is_multi_region_trail
end

#is_organization_trailBoolean, ... (readonly)

Specifies whether the trail is applied to all accounts in an organization in AWS Organizations , or only for the current AWS account .

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.

Only the management account for the organization can convert an organization trail to a non-organization trail, or convert a non-organization trail to an organization trail.



162
163
164
# File 'cloud_trail/cfn_trail_props.rb', line 162

def is_organization_trail
  @is_organization_trail
end

#kms_key_idString, ... (readonly)

Specifies the AWS key ID to use to encrypt the logs and digest files delivered by CloudTrail.

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 multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the AWS Key Management Service Developer Guide .

Examples:

  • alias/MyAliasName
  • arn:aws:kms:us-east-2:123456789012:alias/MyAliasName
  • arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234-1234-123456789012
  • 12345678-1234-1234-1234-123456789012


178
179
180
# File 'cloud_trail/cfn_trail_props.rb', line 178

def kms_key_id
  @kms_key_id
end

#s3_bucket_nameString, AWSCDK::Interfaces::AWSS3::IBucketRef (readonly)

Specifies the name of the Amazon S3 bucket designated for publishing log files.

See Amazon S3 Bucket naming rules .



74
75
76
# File 'cloud_trail/cfn_trail_props.rb', line 74

def s3_bucket_name
  @s3_bucket_name
end

#s3_key_prefixString? (readonly)

Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery.

For more information, see Finding Your CloudTrail Log Files . The maximum length is 200 characters.



185
186
187
# File 'cloud_trail/cfn_trail_props.rb', line 185

def s3_key_prefix
  @s3_key_prefix
end

#sns_topic_nameString? (readonly)

Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery.

The maximum length is 256 characters.



192
193
194
# File 'cloud_trail/cfn_trail_props.rb', line 192

def sns_topic_name
  @sns_topic_name
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

A custom set of tags (key-value pairs) for this trail.



197
198
199
# File 'cloud_trail/cfn_trail_props.rb', line 197

def tags
  @tags
end

#trail_nameString? (readonly)

Specifies the name of the trail. The name must meet the following requirements:.

  • Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)
  • Start with a letter or number, and end with a letter or number
  • Be between 3 and 128 characters
  • Have no adjacent periods, underscores or dashes. Names like my-_namespace and my--namespace are not valid.
  • Not be in IP address format (for example, 192.168.5.4)


208
209
210
# File 'cloud_trail/cfn_trail_props.rb', line 208

def trail_name
  @trail_name
end

Class Method Details

.jsii_propertiesObject



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'cloud_trail/cfn_trail_props.rb', line 210

def self.jsii_properties
  {
    :is_logging => "isLogging",
    :s3_bucket_name => "s3BucketName",
    :advanced_event_selectors => "advancedEventSelectors",
    :aggregation_configurations => "aggregationConfigurations",
    :cloud_watch_logs_log_group_arn => "cloudWatchLogsLogGroupArn",
    :cloud_watch_logs_role_arn => "cloudWatchLogsRoleArn",
    :enable_log_file_validation => "enableLogFileValidation",
    :event_selectors => "eventSelectors",
    :include_global_service_events => "includeGlobalServiceEvents",
    :insight_selectors => "insightSelectors",
    :is_multi_region_trail => "isMultiRegionTrail",
    :is_organization_trail => "isOrganizationTrail",
    :kms_key_id => "kmsKeyId",
    :s3_key_prefix => "s3KeyPrefix",
    :sns_topic_name => "snsTopicName",
    :tags => "tags",
    :trail_name => "trailName",
  }
end

Instance Method Details

#to_jsiiObject



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'cloud_trail/cfn_trail_props.rb', line 232

def to_jsii
  result = {}
  result.merge!({
    "isLogging" => @is_logging,
    "s3BucketName" => @s3_bucket_name,
    "advancedEventSelectors" => @advanced_event_selectors,
    "aggregationConfigurations" => @aggregation_configurations,
    "cloudWatchLogsLogGroupArn" => @cloud_watch_logs_log_group_arn,
    "cloudWatchLogsRoleArn" => @cloud_watch_logs_role_arn,
    "enableLogFileValidation" => @enable_log_file_validation,
    "eventSelectors" => @event_selectors,
    "includeGlobalServiceEvents" => @include_global_service_events,
    "insightSelectors" => @insight_selectors,
    "isMultiRegionTrail" => @is_multi_region_trail,
    "isOrganizationTrail" => @is_organization_trail,
    "kmsKeyId" => @kms_key_id,
    "s3KeyPrefix" => @s3_key_prefix,
    "snsTopicName" => @sns_topic_name,
    "tags" => @tags,
    "trailName" => @trail_name,
  })
  result.compact
end