objectlock

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package objectlock provides object lock configuration and retention types.

Package objectlock provides object lock, legal hold, and retention types.

Index

Constants

View Source
const ObjectLockEnabledValue = "Enabled"

ObjectLockEnabledValue is the only valid object lock state for S3.

Variables

View Source
var (
	// ErrInvalidObjectLockState indicates an unsupported object lock state.
	ErrInvalidObjectLockState = errors.New("objectlock: invalid object lock state")

	// ErrInvalidRetentionMode indicates an unsupported retention mode.
	ErrInvalidRetentionMode = errors.New("objectlock: invalid retention mode")

	// ErrInvalidRetentionPeriod indicates an invalid retention period configuration.
	ErrInvalidRetentionPeriod = errors.New("objectlock: retention must specify either days or years")

	// ErrInvalidLegalHoldStatus indicates an unsupported legal hold status.
	ErrInvalidLegalHoldStatus = errors.New("objectlock: invalid legal hold status")

	// ErrInvalidRetentionDate indicates a missing retain-until date.
	ErrInvalidRetentionDate = errors.New("objectlock: retain-until date must be set")

	// ErrNoObjectLockConfig indicates that no object lock configuration exists.
	ErrNoObjectLockConfig = errors.New("objectlock: bucket has no object lock configuration")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	XMLName           xml.Name `xml:"ObjectLockConfiguration"`
	ObjectLockEnabled string   `xml:"ObjectLockEnabled"`
	Rule              *Rule    `xml:"Rule,omitempty"`
}

Config represents bucket-level object lock configuration.

func (*Config) Normalize

func (c *Config) Normalize() error

Normalize validates and normalizes the configuration in-place.

type DefaultRetention

type DefaultRetention struct {
	Mode  RetentionMode `xml:"Mode"`
	Days  int           `xml:"Days,omitempty"`
	Years int           `xml:"Years,omitempty"`
}

DefaultRetention defines default retention settings.

type LegalHold

type LegalHold struct {
	XMLName xml.Name        `xml:"LegalHold"`
	Status  LegalHoldStatus `xml:"Status,omitempty"`
}

LegalHold represents object-level legal hold configuration.

type LegalHoldStatus

type LegalHoldStatus string

LegalHoldStatus indicates whether legal hold is enabled.

const (
	LegalHoldOn  LegalHoldStatus = "ON"
	LegalHoldOff LegalHoldStatus = "OFF"
)

func (LegalHoldStatus) IsValid

func (l LegalHoldStatus) IsValid() bool

IsValid reports whether the legal hold status is supported.

type Retention

type Retention struct {
	XMLName         xml.Name      `xml:"Retention"`
	Mode            RetentionMode `xml:"Mode,omitempty"`
	RetainUntilDate time.Time     `xml:"RetainUntilDate,omitempty"`
}

Retention represents object-level retention configuration.

type RetentionMode

type RetentionMode string

RetentionMode is the retention mode for object locks.

const (
	RetentionGovernance RetentionMode = "GOVERNANCE"
	RetentionCompliance RetentionMode = "COMPLIANCE"
)

func (RetentionMode) IsValid

func (r RetentionMode) IsValid() bool

IsValid reports whether the retention mode is supported.

type Rule

type Rule struct {
	DefaultRetention DefaultRetention `xml:"DefaultRetention"`
}

Rule represents object lock default retention rules.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL