Class: AWSCDK::Logs::LogGroupProps

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

Overview

Properties for a LogGroup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_protection_policy: nil, deletion_protection_enabled: nil, encryption_key: nil, field_index_policies: nil, log_group_class: nil, log_group_name: nil, removal_policy: nil, retention: nil) ⇒ LogGroupProps

Returns a new instance of LogGroupProps.

Parameters:

  • data_protection_policy (AWSCDK::Logs::DataProtectionPolicy, nil) (defaults to: nil)

    Data Protection Policy for this log group.

  • deletion_protection_enabled (Boolean, nil) (defaults to: nil)

    Indicates whether deletion protection is enabled for this log group.

  • encryption_key (AWSCDK::Interfaces::AWSKMS::IKeyRef, nil) (defaults to: nil)

    The KMS customer managed key to encrypt the log group with.

  • field_index_policies (Array<AWSCDK::Logs::FieldIndexPolicy>, nil) (defaults to: nil)

    Field Index Policies for this log group.

  • log_group_class (AWSCDK::Logs::LogGroupClass, nil) (defaults to: nil)

    The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS.

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

    Name of the log group.

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

    Determine the removal policy of this log group.

  • retention (AWSCDK::Logs::RetentionDays, nil) (defaults to: nil)

    How long, in days, the log contents will be retained.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'logs/log_group_props.rb', line 15

def initialize(data_protection_policy: nil, deletion_protection_enabled: nil, encryption_key: nil, field_index_policies: nil, log_group_class: nil, log_group_name: nil, removal_policy: nil, retention: nil)
  @data_protection_policy = data_protection_policy
  Jsii::Type.check_type(@data_protection_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5EYXRhUHJvdGVjdGlvblBvbGljeSJ9")), "dataProtectionPolicy") unless @data_protection_policy.nil?
  @deletion_protection_enabled = deletion_protection_enabled
  Jsii::Type.check_type(@deletion_protection_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deletionProtectionEnabled") unless @deletion_protection_enabled.nil?
  @encryption_key = encryption_key
  Jsii::Type.check_type(@encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19rbXMuSUtleVJlZiJ9")), "encryptionKey") unless @encryption_key.nil?
  @field_index_policies = field_index_policies
  Jsii::Type.check_type(@field_index_policies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19sb2dzLkZpZWxkSW5kZXhQb2xpY3kifSwia2luZCI6ImFycmF5In19")), "fieldIndexPolicies") unless @field_index_policies.nil?
  @log_group_class = log_group_class
  Jsii::Type.check_type(@log_group_class, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5Mb2dHcm91cENsYXNzIn0=")), "logGroupClass") unless @log_group_class.nil?
  @log_group_name = log_group_name
  Jsii::Type.check_type(@log_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "logGroupName") unless @log_group_name.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @retention = retention
  Jsii::Type.check_type(@retention, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5SZXRlbnRpb25EYXlzIn0=")), "retention") unless @retention.nil?
end

Instance Attribute Details

#data_protection_policyAWSCDK::Logs::DataProtectionPolicy? (readonly)

Note:

Default: - no data protection policy

Data Protection Policy for this log group.



38
39
40
# File 'logs/log_group_props.rb', line 38

def data_protection_policy
  @data_protection_policy
end

#deletion_protection_enabledBoolean? (readonly)

Note:

Default: false

Indicates whether deletion protection is enabled for this log group.

When enabled, deletion protection blocks all deletion operations until it is explicitly disabled.

Returns:

  • (Boolean, nil)


46
47
48
# File 'logs/log_group_props.rb', line 46

def deletion_protection_enabled
  @deletion_protection_enabled
end

#encryption_keyAWSCDK::Interfaces::AWSKMS::IKeyRef? (readonly)

Note:

Default: Server-side encryption managed by the CloudWatch Logs service

The KMS customer managed key to encrypt the log group with.



51
52
53
# File 'logs/log_group_props.rb', line 51

def encryption_key
  @encryption_key
end

#field_index_policiesArray<AWSCDK::Logs::FieldIndexPolicy>? (readonly)

Note:

Default: - no field index policies for this log group.

Field Index Policies for this log group.

Returns:



56
57
58
# File 'logs/log_group_props.rb', line 56

def field_index_policies
  @field_index_policies
end

#log_group_classAWSCDK::Logs::LogGroupClass? (readonly)

Note:

Default: LogGroupClass.STANDARD

The class of the log group. Possible values are: STANDARD and INFREQUENT_ACCESS.

INFREQUENT_ACCESS class provides customers a cost-effective way to consolidate logs which supports querying using Logs Insights. The logGroupClass property cannot be changed once the log group is created.

Returns:



65
66
67
# File 'logs/log_group_props.rb', line 65

def log_group_class
  @log_group_class
end

#log_group_nameString? (readonly)

Note:

Default: Automatically generated

Name of the log group.

Returns:

  • (String, nil)


70
71
72
# File 'logs/log_group_props.rb', line 70

def log_group_name
  @log_group_name
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.Retain

Determine the removal policy of this log group.

Normally you want to retain the log group so you can diagnose issues from logs even after a deployment that no longer includes the log group. In that case, use the normal date-based retention policy to age out your logs.

Returns:



80
81
82
# File 'logs/log_group_props.rb', line 80

def removal_policy
  @removal_policy
end

#retentionAWSCDK::Logs::RetentionDays? (readonly)

Note:

Default: RetentionDays.TWO_YEARS

How long, in days, the log contents will be retained.

To retain all logs, set this value to RetentionDays.INFINITE.

Returns:



87
88
89
# File 'logs/log_group_props.rb', line 87

def retention
  @retention
end

Class Method Details

.jsii_propertiesObject



89
90
91
92
93
94
95
96
97
98
99
100
# File 'logs/log_group_props.rb', line 89

def self.jsii_properties
  {
    :data_protection_policy => "dataProtectionPolicy",
    :deletion_protection_enabled => "deletionProtectionEnabled",
    :encryption_key => "encryptionKey",
    :field_index_policies => "fieldIndexPolicies",
    :log_group_class => "logGroupClass",
    :log_group_name => "logGroupName",
    :removal_policy => "removalPolicy",
    :retention => "retention",
  }
end

Instance Method Details

#to_jsiiObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'logs/log_group_props.rb', line 102

def to_jsii
  result = {}
  result.merge!({
    "dataProtectionPolicy" => @data_protection_policy,
    "deletionProtectionEnabled" => @deletion_protection_enabled,
    "encryptionKey" => @encryption_key,
    "fieldIndexPolicies" => @field_index_policies,
    "logGroupClass" => @log_group_class,
    "logGroupName" => @log_group_name,
    "removalPolicy" => @removal_policy,
    "retention" => @retention,
  })
  result.compact
end