Class: AWSCDK::Logs::LogRetention

Inherits:
Constructs::Construct
  • Object
show all
Defined in:
logs/log_retention.rb

Overview

Creates a custom resource to control the retention policy of a CloudWatch Logs log group.

The log group is created if it doesn't already exist. The policy is removed when retention_days is undefined or equal to Infinity. Log group can be created in the region that is different from stack region by specifying log_group_region

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ LogRetention

Returns a new instance of LogRetention.

Parameters:



16
17
18
19
20
21
22
# File 'logs/log_retention.rb', line 16

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::Logs::LogRetentionProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5Mb2dSZXRlbnRpb25Qcm9wcyJ9")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.jsii_overridable_methodsObject



24
25
26
27
28
29
30
31
# File 'logs/log_retention.rb', line 24

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :log_group_arn => { kind: :property, name: "logGroupArn", is_optional: false },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


43
44
45
# File 'logs/log_retention.rb', line 43

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_logs.LogRetention", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#log_group_arnString

The ARN of the LogGroup.

Returns:

  • (String)


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

def log_group_arn()
  jsii_get_property("logGroupArn")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


36
37
38
# File 'logs/log_retention.rb', line 36

def node()
  jsii_get_property("node")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


57
58
59
# File 'logs/log_retention.rb', line 57

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



70
71
72
73
74
75
# File 'logs/log_retention.rb', line 70

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end