Documentation ¶
Index ¶
- 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 Mode, r RetentionDate, err error)
- func UTCNowNTP() (time.Time, error)
- type BucketObjectLockConfig
- type Config
- type DefaultRetention
- type LegalHoldStatus
- type Mode
- type ObjectLegalHold
- type ObjectRetention
- type Retention
- type RetentionDate
Constants ¶
This section is empty.
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 Mode, r RetentionDate, err error)
ParseObjectLockRetentionHeaders parses http headers to extract retention mode and retention date
Types ¶
type BucketObjectLockConfig ¶
BucketObjectLockConfig - map of bucket and retention configuration.
func NewBucketObjectLockConfig ¶
func NewBucketObjectLockConfig() *BucketObjectLockConfig
NewBucketObjectLockConfig returns initialized BucketObjectLockConfig
func (*BucketObjectLockConfig) Get ¶
func (config *BucketObjectLockConfig) Get(bucketName string) (r Retention, ok bool)
Get - Get retention configuration.
func (*BucketObjectLockConfig) Remove ¶
func (config *BucketObjectLockConfig) Remove(bucketName string)
Remove - removes retention configuration.
func (*BucketObjectLockConfig) Set ¶
func (config *BucketObjectLockConfig) Set(bucketName string, retention Retention)
Set - set retention configuration.
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 Mode `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 ( // ON -legal hold is on. ON LegalHoldStatus = "ON" // OFF -legal hold is off. OFF LegalHoldStatus = "OFF" )
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
type ObjectRetention ¶
type ObjectRetention struct { XMLNS string `xml:"xmlns,attr,omitempty"` XMLName xml.Name `xml:"Retention"` Mode Mode `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 Retention ¶
Retention - bucket level retention configuration.
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