Class: AwsCloudTrailTrail
- Inherits:
-
Object
- Object
- AwsCloudTrailTrail
- Includes:
- AwsSingularResourceMixin
- Defined in:
- lib/resources/aws/aws_cloudtrail_trail.rb
Defined Under Namespace
Classes: Backend
Instance Attribute Summary collapse
-
#cloud_watch_logs_log_group_arn ⇒ Object
readonly
Returns the value of attribute cloud_watch_logs_log_group_arn.
-
#cloud_watch_logs_role_arn ⇒ Object
readonly
Returns the value of attribute cloud_watch_logs_role_arn.
-
#home_region ⇒ Object
readonly
Returns the value of attribute home_region.
-
#kms_key_id ⇒ Object
readonly
Returns the value of attribute kms_key_id.
-
#s3_bucket_name ⇒ Object
readonly
Returns the value of attribute s3_bucket_name.
-
#trail_arn ⇒ Object
readonly
Returns the value of attribute trail_arn.
Instance Method Summary collapse
- #delivered_logs_days_ago ⇒ Object
- #encrypted? ⇒ Boolean
- #log_file_validation_enabled? ⇒ Boolean
- #multi_region_trail? ⇒ Boolean
- #to_s ⇒ Object
Methods included from AwsSingularResourceMixin
Methods included from AwsResourceMixin
#catch_aws_errors, #check_resource_param_names, #initialize, #inspec_runner
Instance Attribute Details
#cloud_watch_logs_log_group_arn ⇒ Object (readonly)
Returns the value of attribute cloud_watch_logs_log_group_arn.
13 14 15 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 13 def cloud_watch_logs_log_group_arn @cloud_watch_logs_log_group_arn end |
#cloud_watch_logs_role_arn ⇒ Object (readonly)
Returns the value of attribute cloud_watch_logs_role_arn.
13 14 15 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 13 def cloud_watch_logs_role_arn @cloud_watch_logs_role_arn end |
#home_region ⇒ Object (readonly)
Returns the value of attribute home_region.
13 14 15 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 13 def home_region @home_region end |
#kms_key_id ⇒ Object (readonly)
Returns the value of attribute kms_key_id.
13 14 15 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 13 def kms_key_id @kms_key_id end |
#s3_bucket_name ⇒ Object (readonly)
Returns the value of attribute s3_bucket_name.
13 14 15 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 13 def s3_bucket_name @s3_bucket_name end |
#trail_arn ⇒ Object (readonly)
Returns the value of attribute trail_arn.
13 14 15 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 13 def trail_arn @trail_arn end |
Instance Method Details
#delivered_logs_days_ago ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 32 def delivered_logs_days_ago query = { name: @trail_name } catch_aws_errors do begin resp = BackendFactory.create(inspec_runner).get_trail_status(query).to_h ((Time.now - resp[:latest_cloud_watch_logs_delivery_time])/(24*60*60)).to_i unless resp[:latest_cloud_watch_logs_delivery_time].nil? rescue Aws::CloudTrail::Errors::TrailNotFoundException nil end end end |
#encrypted? ⇒ Boolean
28 29 30 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 28 def encrypted? !kms_key_id.nil? end |
#log_file_validation_enabled? ⇒ Boolean
24 25 26 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 24 def log_file_validation_enabled? @log_file_validation_enabled end |
#multi_region_trail? ⇒ Boolean
20 21 22 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 20 def multi_region_trail? @is_multi_region_trail end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/resources/aws/aws_cloudtrail_trail.rb', line 16 def to_s "CloudTrail #{@trail_name}" end |