Documentation ¶
Index ¶
- Constants
- Variables
- func FilterObjectLockMetadata(metadata map[string]string, filterRetention, filterLegalHold bool) map[string]string
- func IsObjectLockGovernanceBypassSet(h http.Header) bool
- func IsObjectLockLegalHoldRequested(h http.Header) bool
- func IsObjectLockRequested(h http.Header) bool
- func IsObjectLockRetentionRequested(h http.Header) bool
- func ParseObjectLockRetentionHeaders(h http.Header) (rmode RetMode, r RetentionDate, err error)
- func UTCNowNTP() (time.Time, error)
- type Config
- type DefaultRetention
- type LegalHoldStatus
- type ObjectLegalHold
- type ObjectRetention
- type RetMode
- type Retention
- type RetentionDate
Constants ¶
const ( AmzObjectLockBypassRetGovernance = "X-Amz-Bypass-Governance-Retention" AmzObjectLockRetainUntilDate = "X-Amz-Object-Lock-Retain-Until-Date" AmzObjectLockMode = "X-Amz-Object-Lock-Mode" AmzObjectLockLegalHold = "X-Amz-Object-Lock-Legal-Hold" )
Bypass retention governance header.
Variables ¶
var ( // ErrMalformedBucketObjectConfig -indicates that the bucket object lock config is malformed ErrMalformedBucketObjectConfig = errors.New("invalid bucket object lock config") // ErrInvalidRetentionDate - indicates that retention date needs to be in ISO 8601 format ErrInvalidRetentionDate = errors.New("date must be provided in ISO 8601 format") // ErrPastObjectLockRetainDate - indicates that retention date must be in the future ErrPastObjectLockRetainDate = errors.New("the retain until date must be in the future") // ErrUnknownWORMModeDirective - indicates that the retention mode is invalid ErrUnknownWORMModeDirective = errors.New("unknown WORM mode directive") // ErrObjectLockMissingContentMD5 - indicates missing Content-MD5 header for put object requests with locking ErrObjectLockMissingContentMD5 = errors.New("content-MD5 HTTP header is required for Put Object requests with Object Lock parameters") // ErrObjectLockInvalidHeaders indicates that object lock headers are missing ErrObjectLockInvalidHeaders = errors.New("x-amz-object-lock-retain-until-date and x-amz-object-lock-mode must both be supplied") // ErrMalformedXML - generic error indicating malformed XML ErrMalformedXML = errors.New("the XML you provided was not well-formed or did not validate against our published schema") )
Functions ¶
func FilterObjectLockMetadata ¶
func FilterObjectLockMetadata(metadata map[string]string, filterRetention, filterLegalHold bool) map[string]string
FilterObjectLockMetadata filters object lock metadata if s3:GetObjectRetention permission is denied or if isCopy flag set.
func IsObjectLockGovernanceBypassSet ¶
IsObjectLockGovernanceBypassSet returns true if object lock governance bypass header is set.
func IsObjectLockLegalHoldRequested ¶
IsObjectLockLegalHoldRequested returns true if object lock legal hold header is set.
func IsObjectLockRequested ¶
IsObjectLockRequested returns true if legal hold or object lock retention headers are requested.
func IsObjectLockRetentionRequested ¶
IsObjectLockRetentionRequested returns true if object lock retention headers are set.
func ParseObjectLockRetentionHeaders ¶
func ParseObjectLockRetentionHeaders(h http.Header) (rmode RetMode, r RetentionDate, err error)
ParseObjectLockRetentionHeaders parses http headers to extract retention mode and retention date
Types ¶
type Config ¶
type Config struct { XMLNS string `xml:"xmlns,attr,omitempty"` XMLName xml.Name `xml:"ObjectLockConfiguration"` ObjectLockEnabled string `xml:"ObjectLockEnabled"` Rule *struct { DefaultRetention DefaultRetention `xml:"DefaultRetention"` } `xml:"Rule,omitempty"` }
Config - object lock configuration specified in https://docs.aws.amazon.com/AmazonS3/latest/API/Type_API_ObjectLockConfiguration.html
func NewObjectLockConfig ¶
func NewObjectLockConfig() *Config
NewObjectLockConfig returns a initialized lock.Config struct
func ParseObjectLockConfig ¶
ParseObjectLockConfig parses ObjectLockConfig from xml
func (*Config) ToRetention ¶
ToRetention - convert to Retention type.
func (*Config) UnmarshalXML ¶
UnmarshalXML - decodes XML data.
type DefaultRetention ¶
type DefaultRetention struct { XMLName xml.Name `xml:"DefaultRetention"` Mode RetMode `xml:"Mode"` Days *uint64 `xml:"Days"` Years *uint64 `xml:"Years"` }
DefaultRetention - default retention configuration.
func (*DefaultRetention) UnmarshalXML ¶
func (dr *DefaultRetention) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML - decodes XML data.
type LegalHoldStatus ¶
type LegalHoldStatus string
LegalHoldStatus - object legal hold status.
const ( // LegalHoldOn - legal hold is on. LegalHoldOn LegalHoldStatus = "ON" // LegalHoldOff - legal hold is off. LegalHoldOff LegalHoldStatus = "OFF" )
func (LegalHoldStatus) Valid ¶
func (l LegalHoldStatus) Valid() bool
Valid - returns true if legal hold status has valid values
type ObjectLegalHold ¶
type ObjectLegalHold struct { XMLNS string `xml:"xmlns,attr,omitempty"` XMLName xml.Name `xml:"LegalHold"` Status LegalHoldStatus `xml:"Status,omitempty"` }
ObjectLegalHold specified in https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectLegalHold.html
func GetObjectLegalHoldMeta ¶
func GetObjectLegalHoldMeta(meta map[string]string) ObjectLegalHold
GetObjectLegalHoldMeta constructs ObjectLegalHold from metadata
func ParseObjectLegalHold ¶
func ParseObjectLegalHold(reader io.Reader) (hold *ObjectLegalHold, err error)
ParseObjectLegalHold decodes the XML into ObjectLegalHold
func ParseObjectLockLegalHoldHeaders ¶
func ParseObjectLockLegalHoldHeaders(h http.Header) (lhold ObjectLegalHold, err error)
ParseObjectLockLegalHoldHeaders parses request headers to construct ObjectLegalHold
func (*ObjectLegalHold) IsEmpty ¶
func (l *ObjectLegalHold) IsEmpty() bool
IsEmpty returns true if struct is empty
func (*ObjectLegalHold) UnmarshalXML ¶
func (l *ObjectLegalHold) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
UnmarshalXML - decodes XML data.
type ObjectRetention ¶
type ObjectRetention struct { XMLNS string `xml:"xmlns,attr,omitempty"` XMLName xml.Name `xml:"Retention"` Mode RetMode `xml:"Mode,omitempty"` RetainUntilDate RetentionDate `xml:"RetainUntilDate,omitempty"` }
ObjectRetention specified in https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectRetention.html
func GetObjectRetentionMeta ¶
func GetObjectRetentionMeta(meta map[string]string) ObjectRetention
GetObjectRetentionMeta constructs ObjectRetention from metadata
func ParseObjectRetention ¶
func ParseObjectRetention(reader io.Reader) (*ObjectRetention, error)
ParseObjectRetention constructs ObjectRetention struct from xml input
type RetentionDate ¶
RetentionDate is a embedded type containing time.Time to unmarshal Date in Retention
func (*RetentionDate) MarshalXML ¶
func (rDate *RetentionDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error
MarshalXML encodes expiration date if it is non-zero and encodes empty string otherwise
func (*RetentionDate) UnmarshalXML ¶
func (rDate *RetentionDate) UnmarshalXML(d *xml.Decoder, startElement xml.StartElement) error
UnmarshalXML parses date from Retention and validates date format