Documentation ¶
Index ¶
- func Errorf(format string, a ...interface{}) error
- type Action
- type And
- type Error
- type Expiration
- type ExpirationDate
- type ExpirationDays
- type ExpireDeleteMarker
- type Filter
- type Lifecycle
- func (lc Lifecycle) ComputeAction(obj ObjectOpts) Action
- func (lc Lifecycle) FilterActionableRules(obj ObjectOpts) []Rule
- func (lc Lifecycle) HasActiveRules(prefix string, recursive bool) bool
- func (lc Lifecycle) PredictExpiryTime(obj ObjectOpts) (string, time.Time)
- func (lc Lifecycle) Validate() error
- type NoncurrentVersionExpiration
- type NoncurrentVersionTransition
- type ObjectOpts
- type Rule
- type Status
- type Tag
- type Transition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action int
Action represents a delete action or other transition actions that will be implemented later.
type And ¶
type And struct { XMLName xml.Name `xml:"And"` Prefix string `xml:"Prefix,omitempty"` Tags []Tag `xml:"Tag,omitempty"` }
And - a tag to combine a prefix and multiple tags for lifecycle configuration rule.
func (And) ContainsDuplicateTag ¶
ContainsDuplicateTag - returns true if duplicate keys are present in And
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is the generic type for any error happening during tag parsing.
type Expiration ¶
type Expiration struct { XMLName xml.Name `xml:"Expiration"` Days ExpirationDays `xml:"Days,omitempty"` Date ExpirationDate `xml:"Date,omitempty"` DeleteMarker ExpireDeleteMarker `xml:"ExpiredObjectDeleteMarker,omitempty"` }
Expiration - expiration actions for a rule in lifecycle configuration.
func (Expiration) IsDateNull ¶
func (e Expiration) IsDateNull() bool
IsDateNull returns true if date field is null
func (Expiration) IsDaysNull ¶
func (e Expiration) IsDaysNull() bool
IsDaysNull returns true if days field is null
func (Expiration) IsNull ¶
func (e Expiration) IsNull() bool
IsNull returns true if both date and days fields are null
func (Expiration) Validate ¶
func (e Expiration) Validate() error
Validate - validates the "Expiration" element
type ExpirationDate ¶
ExpirationDate is a embedded type containing time.Time to unmarshal Date in Expiration
func (ExpirationDate) MarshalXML ¶
func (eDate ExpirationDate) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error
MarshalXML encodes expiration date if it is non-zero and encodes empty string otherwise
func (*ExpirationDate) UnmarshalXML ¶
func (eDate *ExpirationDate) UnmarshalXML(d *xml.Decoder, startElement xml.StartElement) error
UnmarshalXML parses date from Expiration and validates date format
type ExpirationDays ¶
type ExpirationDays int
ExpirationDays is a type alias to unmarshal Days in Expiration
func (ExpirationDays) MarshalXML ¶
func (eDays ExpirationDays) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error
MarshalXML encodes number of days to expire if it is non-zero and encodes empty string otherwise
func (*ExpirationDays) UnmarshalXML ¶
func (eDays *ExpirationDays) UnmarshalXML(d *xml.Decoder, startElement xml.StartElement) error
UnmarshalXML parses number of days from Expiration and validates if greater than zero
type ExpireDeleteMarker ¶
type ExpireDeleteMarker bool
ExpireDeleteMarker represents value of ExpiredObjectDeleteMarker field in Expiration XML element.
func (ExpireDeleteMarker) MarshalXML ¶
func (b ExpireDeleteMarker) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error
MarshalXML encodes delete marker boolean into an XML form.
type Filter ¶
type Filter struct { XMLName xml.Name `xml:"Filter"` Prefix string And And Tag Tag // contains filtered or unexported fields }
Filter - a filter for a lifecycle configuration Rule.
func (Filter) MarshalXML ¶
MarshalXML - produces the xml representation of the Filter struct only one of Prefix, And and Tag should be present in the output.
type Lifecycle ¶
Lifecycle - Configuration for bucket lifecycle.
func ParseLifecycleConfig ¶
ParseLifecycleConfig - parses data in given reader to Lifecycle.
func (Lifecycle) ComputeAction ¶
func (lc Lifecycle) ComputeAction(obj ObjectOpts) Action
ComputeAction returns the action to perform by evaluating all lifecycle rules against the object name and its modification time.
func (Lifecycle) FilterActionableRules ¶
func (lc Lifecycle) FilterActionableRules(obj ObjectOpts) []Rule
FilterActionableRules returns the rules actions that need to be executed after evaluating prefix/tag filtering
func (Lifecycle) HasActiveRules ¶
HasActiveRules - returns whether policy has active rules for. Optionally a prefix can be supplied. If recursive is specified the function will also return true if any level below the prefix has active rules. If no prefix is specified recursive is effectively true.
func (Lifecycle) PredictExpiryTime ¶
func (lc Lifecycle) PredictExpiryTime(obj ObjectOpts) (string, time.Time)
PredictExpiryTime returns the expiry date/time of a given object after evaluting the current lifecycle document.
type NoncurrentVersionExpiration ¶
type NoncurrentVersionExpiration struct { XMLName xml.Name `xml:"NoncurrentVersionExpiration"` NoncurrentDays ExpirationDays `xml:"NoncurrentDays,omitempty"` }
NoncurrentVersionExpiration - an action for lifecycle configuration rule.
func (NoncurrentVersionExpiration) IsDaysNull ¶
func (n NoncurrentVersionExpiration) IsDaysNull() bool
IsDaysNull returns true if days field is null
func (NoncurrentVersionExpiration) MarshalXML ¶
func (n NoncurrentVersionExpiration) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML if non-current days not set to non zero value
type NoncurrentVersionTransition ¶
type NoncurrentVersionTransition struct { NoncurrentDays ExpirationDays `xml:"NoncurrentDays"` StorageClass string `xml:"StorageClass"` }
NoncurrentVersionTransition - an action for lifecycle configuration rule.
func (NoncurrentVersionTransition) MarshalXML ¶
func (n NoncurrentVersionTransition) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML is extended to leave out <NoncurrentVersionTransition></NoncurrentVersionTransition> tags
func (NoncurrentVersionTransition) UnmarshalXML ¶
func (n NoncurrentVersionTransition) UnmarshalXML(d *xml.Decoder, startElement xml.StartElement) error
UnmarshalXML is extended to indicate lack of support for NoncurrentVersionTransition xml tag in object lifecycle configuration
type ObjectOpts ¶
type ObjectOpts struct { Name string UserTags string ModTime time.Time VersionID string IsLatest bool DeleteMarker bool NumVersions int }
ObjectOpts provides information to deduce the lifecycle actions which can be triggered on the resultant object.
type Rule ¶
type Rule struct { XMLName xml.Name `xml:"Rule"` ID string `xml:"ID,omitempty"` Status Status `xml:"Status"` Filter Filter `xml:"Filter,omitempty"` Expiration Expiration `xml:"Expiration,omitempty"` Transition Transition `xml:"Transition,omitempty"` // FIXME: add a type to catch unsupported AbortIncompleteMultipartUpload AbortIncompleteMultipartUpload `xml:"AbortIncompleteMultipartUpload,omitempty"` NoncurrentVersionExpiration NoncurrentVersionExpiration `xml:"NoncurrentVersionExpiration,omitempty"` NoncurrentVersionTransition NoncurrentVersionTransition `xml:"NoncurrentVersionTransition,omitempty"` }
Rule - a rule for lifecycle configuration.
func (Rule) Prefix ¶
Prefix - a rule can either have prefix under <filter></filter> or under <filter><and></and></filter>. This method returns the prefix from the location where it is available
type Tag ¶
type Tag struct { XMLName xml.Name `xml:"Tag"` Key string `xml:"Key,omitempty"` Value string `xml:"Value,omitempty"` }
Tag - a tag for a lifecycle configuration Rule filter.
func (*Tag) UnmarshalXML ¶
UnmarshalXML - decodes XML data.
type Transition ¶
type Transition struct { XMLName xml.Name `xml:"Transition"` Days int `xml:"Days,omitempty"` Date string `xml:"Date,omitempty"` StorageClass string `xml:"StorageClass"` }
Transition - transition actions for a rule in lifecycle configuration.
func (Transition) MarshalXML ¶
func (t Transition) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML is extended to leave out <Transition></Transition> tags
func (Transition) UnmarshalXML ¶
func (t Transition) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML is extended to indicate lack of support for Transition xml tag in object lifecycle configuration