Class: AWSCDK::S3::ObjectLockRetention

Inherits:
Jsii::Object
  • Object
show all
Defined in:
s3/object_lock_retention.rb

Overview

The default retention settings for an S3 Object Lock configuration.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ObjectLockRetention

Returns a new instance of ObjectLockRetention.

Raises:

  • (NoMethodError)


10
11
12
# File 's3/object_lock_retention.rb', line 10

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_s3.ObjectLockRetention does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.compliance(duration) ⇒ AWSCDK::S3::ObjectLockRetention

Configure for Compliance retention for a specified duration.

When an object is locked in compliance mode, its retention mode can't be changed, and its retention period can't be shortened. Compliance mode helps ensure that an object version can't be overwritten or deleted for the duration of the retention period.

Parameters:

  • duration (AWSCDK::Duration)

    the length of time for which objects should be retained.

Returns:

  • (AWSCDK::S3::ObjectLockRetention)

    the ObjectLockRetention configuration



29
30
31
32
# File 's3/object_lock_retention.rb', line 29

def self.compliance(duration)
  Jsii::Type.check_type(duration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "duration")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.ObjectLockRetention", "compliance", [duration])
end

.governance(duration) ⇒ AWSCDK::S3::ObjectLockRetention

Configure for Governance retention for a specified duration.

With governance mode, you protect objects against being deleted by most users, but you can still grant some users permission to alter the retention settings or delete the object if necessary. You can also use governance mode to test retention-period settings before creating a compliance-mode retention period.

Parameters:

  • duration (AWSCDK::Duration)

    the length of time for which objects should retained.

Returns:

  • (AWSCDK::S3::ObjectLockRetention)

    the ObjectLockRetention configuration



43
44
45
46
# File 's3/object_lock_retention.rb', line 43

def self.governance(duration)
  Jsii::Type.check_type(duration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "duration")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_s3.ObjectLockRetention", "governance", [duration])
end

.jsii_overridable_methodsObject



14
15
16
17
18
19
# File 's3/object_lock_retention.rb', line 14

def self.jsii_overridable_methods
  {
    :duration => { kind: :property, name: "duration", is_optional: false },
    :mode => { kind: :property, name: "mode", is_optional: false },
  }
end

Instance Method Details

#durationAWSCDK::Duration

The default period for which objects should be retained.

Returns:



51
52
53
# File 's3/object_lock_retention.rb', line 51

def duration()
  jsii_get_property("duration")
end

#modeAWSCDK::S3::ObjectLockMode

The retention mode to use for the object lock configuration.



59
60
61
# File 's3/object_lock_retention.rb', line 59

def mode()
  jsii_get_property("mode")
end