tagging

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyTags     = Errorf("Object tags cannot be greater than 10", "BadRequest")
	ErrInvalidTagKey   = Errorf("The TagKey you have provided is invalid", "InvalidTag")
	ErrInvalidTagValue = Errorf("The TagValue you have provided is invalid", "InvalidTag")
	ErrInvalidTag      = Errorf("Cannot provide multiple Tags with the same key", "InvalidTag")
)

errors returned by tagging package

Functions

func Errorf

func Errorf(format, code string, a ...interface{}) error

Errorf - formats according to a format specifier and returns the string as a value that satisfies error of type tagging.Error

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is the generic type for any error happening during tag parsing.

func (Error) Code

func (e Error) Code() string

Code returns appropriate error code.

func (Error) Error

func (e Error) Error() string

Error 'error' compatible method.

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap the internal error.

type Tag

type Tag struct {
	XMLName xml.Name `xml:"Tag"`
	Key     string   `xml:"Key,omitempty"`
	Value   string   `xml:"Value,omitempty"`
}

Tag - single tag

func (Tag) IsEmpty

func (t Tag) IsEmpty() bool

IsEmpty - checks if tag is empty or not

func (Tag) String

func (t Tag) String() string

String - returns a string in format "tag1=value1" for the current Tag

func (Tag) Validate

func (t Tag) Validate() error

Validate - validates the tag element

type TagSet

type TagSet struct {
	XMLName xml.Name `xml:"TagSet"`
	Tags    []Tag    `xml:"Tag"`
}

TagSet - Set of tags under Tagging

func (TagSet) ContainsDuplicateTag

func (t TagSet) ContainsDuplicateTag() bool

ContainsDuplicateTag - returns true if duplicate keys are present in TagSet

type Tagging

type Tagging struct {
	XMLName xml.Name `xml:"Tagging"`
	TagSet  TagSet   `xml:"TagSet"`
}

Tagging - object tagging interface

func FromString

func FromString(tagStr string) (Tagging, error)

FromString - returns a Tagging struct when given a string in format "tag1=value1&tag2=value2"

func ParseTagging

func ParseTagging(reader io.Reader) (*Tagging, error)

ParseTagging - parses incoming xml data in given reader into Tagging interface. After parsing, also validates the parsed fields based on S3 API constraints.

func (Tagging) String

func (t Tagging) String() string

String - returns a string in format "tag1=value1&tag2=value2" with all the tags in this Tagging Struct

func (Tagging) Validate

func (t Tagging) Validate() error

Validate - validates the tagging configuration

Jump to

Keyboard shortcuts

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