Class: AWSCDK::Logs::LogRetentionProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
logs/log_retention_props.rb

Overview

Construction properties for a LogRetention.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(log_group_name:, retention:, log_group_region: nil, log_retention_retry_options: nil, removal_policy: nil, role: nil) ⇒ LogRetentionProps

Returns a new instance of LogRetentionProps.

Parameters:

  • log_group_name (String)

    The log group name.

  • retention (AWSCDK::Logs::RetentionDays)

    The number of days log events are kept in CloudWatch Logs.

  • log_group_region (String, nil) (defaults to: nil)

    The region where the log group should be created.

  • log_retention_retry_options (AWSCDK::Logs::LogRetentionRetryOptions, nil) (defaults to: nil)

    Retry options for all AWS API calls.

  • removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    The removalPolicy for the log group when the stack is deleted.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The IAM role for the Lambda function associated with the custom resource.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'logs/log_retention_props.rb', line 13

def initialize(log_group_name:, retention:, log_group_region: nil, log_retention_retry_options: nil, removal_policy: nil, role: nil)
  @log_group_name = log_group_name
  Jsii::Type.check_type(@log_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "logGroupName")
  @retention = retention
  Jsii::Type.check_type(@retention, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5SZXRlbnRpb25EYXlzIn0=")), "retention")
  @log_group_region = log_group_region
  Jsii::Type.check_type(@log_group_region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "logGroupRegion") unless @log_group_region.nil?
  @log_retention_retry_options = log_retention_retry_options.is_a?(Hash) ? ::AWSCDK::Logs::LogRetentionRetryOptions.new(**log_retention_retry_options.transform_keys(&:to_sym)) : log_retention_retry_options
  Jsii::Type.check_type(@log_retention_retry_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5Mb2dSZXRlbnRpb25SZXRyeU9wdGlvbnMifQ==")), "logRetentionRetryOptions") unless @log_retention_retry_options.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
end

Instance Attribute Details

#log_group_nameString (readonly)

The log group name.

Returns:

  • (String)


31
32
33
# File 'logs/log_retention_props.rb', line 31

def log_group_name
  @log_group_name
end

#log_group_regionString? (readonly)

Note:

Default: - same region as the stack

The region where the log group should be created.

Returns:

  • (String, nil)


40
41
42
# File 'logs/log_retention_props.rb', line 40

def log_group_region
  @log_group_region
end

#log_retention_retry_optionsAWSCDK::Logs::LogRetentionRetryOptions? (readonly)

Note:

Default: - AWS SDK default retry options

Retry options for all AWS API calls.



45
46
47
# File 'logs/log_retention_props.rb', line 45

def log_retention_retry_options
  @log_retention_retry_options
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.RETAIN

The removalPolicy for the log group when the stack is deleted.

Returns:



50
51
52
# File 'logs/log_retention_props.rb', line 50

def removal_policy
  @removal_policy
end

#retentionAWSCDK::Logs::RetentionDays (readonly)

The number of days log events are kept in CloudWatch Logs.



35
36
37
# File 'logs/log_retention_props.rb', line 35

def retention
  @retention
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A new role is created

The IAM role for the Lambda function associated with the custom resource.

Returns:



55
56
57
# File 'logs/log_retention_props.rb', line 55

def role
  @role
end

Class Method Details

.jsii_propertiesObject



57
58
59
60
61
62
63
64
65
66
# File 'logs/log_retention_props.rb', line 57

def self.jsii_properties
  {
    :log_group_name => "logGroupName",
    :retention => "retention",
    :log_group_region => "logGroupRegion",
    :log_retention_retry_options => "logRetentionRetryOptions",
    :removal_policy => "removalPolicy",
    :role => "role",
  }
end

Instance Method Details

#to_jsiiObject



68
69
70
71
72
73
74
75
76
77
78
79
# File 'logs/log_retention_props.rb', line 68

def to_jsii
  result = {}
  result.merge!({
    "logGroupName" => @log_group_name,
    "retention" => @retention,
    "logGroupRegion" => @log_group_region,
    "logRetentionRetryOptions" => @log_retention_retry_options,
    "removalPolicy" => @removal_policy,
    "role" => @role,
  })
  result.compact
end