uri

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubeFoxScheme = "kubefox"
	PathSeparator = "/"
	HTTPSeparator = ":"
	HeadPath      = "head"
)

Variables

View Source
var (
	ErrInvalidURI = errors.New("invalid uri")
)

Functions

This section is empty.

Types

type Key

type Key string

func (Key) Equals

func (l Key) Equals(r Key) bool

type Kind

type Kind int
const (
	Unknown Kind = iota
	Config
	Environment
	System
	Platform
)

func KindFromString

func KindFromString(str string) Kind

func (*Kind) MarshalJSON

func (k *Kind) MarshalJSON() ([]byte, error)

func (Kind) String

func (r Kind) String() string

func (*Kind) UnmarshalJSON

func (k *Kind) UnmarshalJSON(data []byte) error

type SubKind

type SubKind int
const (
	None SubKind = iota
	Metadata
	Id
	Tag
	Branch
	Deployment
	Release
)

func SubKindFromString

func SubKindFromString(str string) SubKind

func (*SubKind) MarshalJSON

func (k *SubKind) MarshalJSON() ([]byte, error)

func (SubKind) String

func (r SubKind) String() string

func (*SubKind) UnmarshalJSON

func (k *SubKind) UnmarshalJSON(data []byte) error

type URI

type URI interface {
	Authority() string
	Kind() Kind
	Name() string
	SubKind() SubKind
	SubPath() string
	SubPathWithKind() string
	Path() string
	HeadPath() string
	MetadataPath() string
	Key() Key
	HTTPKey() string
	URL() string

	String() string

	UnmarshalJSON([]byte) error
	MarshalJSON() ([]byte, error)
}

func New

func New(authority string, kind Kind, parts ...any) (URI, error)

New builds a URI from the parts provided. The parts should be provided in the order: authority, kind, name, subKind, subPath. Only authority and kind are required. Each part is trimmed of leading or trailing '/' before parsing.

func Parse

func Parse(val string) (URI, error)

type URIType

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

+kubebuilder:validation:Type=string +kubebuilder:validation:Format=uri

func (*URIType) Authority

func (u *URIType) Authority() string

func (*URIType) HTTPKey

func (u *URIType) HTTPKey() string

func (*URIType) HeadPath

func (u *URIType) HeadPath() string

func (*URIType) Key

func (u *URIType) Key() Key

func (*URIType) Kind

func (u *URIType) Kind() Kind

func (*URIType) MarshalJSON

func (u *URIType) MarshalJSON() ([]byte, error)

func (*URIType) MetadataPath

func (u *URIType) MetadataPath() string

func (*URIType) Name

func (u *URIType) Name() string

func (*URIType) Path

func (u *URIType) Path() string

func (*URIType) String

func (u *URIType) String() string

func (*URIType) SubKind

func (u *URIType) SubKind() SubKind

func (*URIType) SubPath

func (u *URIType) SubPath() string

func (*URIType) SubPathWithKind

func (u *URIType) SubPathWithKind() string

func (*URIType) URL

func (u *URIType) URL() string

func (*URIType) UnmarshalJSON

func (u *URIType) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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