tags

package
v7.0.28 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	error
	Code() string
}

Error contains tag specific error.

type Tag

type Tag struct {
	Key   string `xml:"Key"`
	Value string `xml:"Value"`
}

Tag denotes key and value.

func (Tag) IsEmpty

func (tag Tag) IsEmpty() bool

IsEmpty returns whether this tag is empty or not.

func (Tag) MarshalXML

func (tag Tag) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes to XML data.

func (Tag) String

func (tag Tag) String() string

func (*Tag) UnmarshalXML

func (tag *Tag) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML decodes XML data to tag.

func (Tag) Validate

func (tag Tag) Validate() error

Validate checks this tag.

type Tags

type Tags tagging

Tags is list of tags of XML request/response as per https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html#API_GetBucketTagging_RequestBody

func MapToBucketTags

func MapToBucketTags(tagMap map[string]string) (*Tags, error)

MapToBucketTags converts an input map of key and value into *Tags data structure with validation.

func MapToObjectTags

func MapToObjectTags(tagMap map[string]string) (*Tags, error)

MapToObjectTags converts an input map of key and value into *Tags data structure with validation.

func NewTags

func NewTags(tagMap map[string]string, isObject bool) (*Tags, error)

NewTags creates Tags from tagMap, If isObject is set, it validates for object tags.

func Parse

func Parse(s string, isObject bool) (*Tags, error)

Parse decodes HTTP query formatted string into tags which is limited by isObject. A query formatted string is like "key1=value1&key2=value2".

func ParseBucketXML

func ParseBucketXML(reader io.Reader) (*Tags, error)

ParseBucketXML decodes XML data of tags in reader specified in https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketTagging.html#API_PutBucketTagging_RequestSyntax.

func ParseObjectTags

func ParseObjectTags(s string) (*Tags, error)

ParseObjectTags decodes HTTP query formatted string into tags. A query formatted string is like "key1=value1&key2=value2".

func ParseObjectXML

func ParseObjectXML(reader io.Reader) (*Tags, error)

ParseObjectXML decodes XML data of tags in reader specified in https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html#API_PutObjectTagging_RequestSyntax

func (*Tags) Remove

func (tags *Tags) Remove(key string)

Remove removes a tag by its key.

func (*Tags) Set

func (tags *Tags) Set(key, value string) error

Set sets new tag.

func (Tags) String

func (tags Tags) String() string

func (Tags) ToMap

func (tags Tags) ToMap() map[string]string

ToMap returns copy of tags.

Jump to

Keyboard shortcuts

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