Documentation ¶
Index ¶
- Constants
- func GetDomain(str string) string
- func GetNamespace(str string) string
- func IsFullNamespaceURI(str string) bool
- func IsFullNativeNamespaceURI(str string) bool
- func IsNamespaceURI(str string) bool
- func IsNativeNamespaceURI(str string) bool
- func IsNativeRepoNamespaceURI(str string) bool
- func IsUserAddressURI(str string) bool
- func IsUserNamespaceURI(str string) bool
- func IsValidResourceName(name string) error
- func IsValidResourceNameNoMinLen(name string) error
- func IsValidScope(addr string) bool
- func IsValidUserAddr(str string) error
- func IsWholeNativeRepoURI(str string) bool
- func IsWholeNativeURI(str string) bool
- func IsWholeNativeUserAddressURI(str string) bool
- type Address
- func (a Address) Equal(addr Address) bool
- func (a Address) IsEmpty() bool
- func (a Address) IsFullNamespace() bool
- func (a Address) IsFullNativeNamespace() bool
- func (a Address) IsNamespace() bool
- func (a Address) IsNativeNamespace() bool
- func (a Address) IsNativeNamespaceRepo() bool
- func (a Address) IsNativeNamespaceUserAddress() bool
- func (a Address) IsNativeRepoAddress() bool
- func (a Address) IsNativeUserAddress() bool
- func (a Address) IsUserAddress() bool
- func (a Address) IsUserNamespace() bool
- func (a Address) IsValidNativeAddress() bool
- func (a Address) String() string
Constants ¶
const ( NativeNamespaceRepo = "r/" NativeNamespaceRepoChar = "r" NativeNamespaceUserAddress = "a/" NativeNamespaceUserAddressChar = "a" NativeNamespaceRegexp = "^[ar]{1}/[a-zA-Z0-9_-]{0,}$" // e.g r/abc-xyz, a/abc-xyz, r/, a/ NativeNamespaceRepoRegexp = "^[r]{1}/[a-zA-Z0-9_-]{0,}$" // e.g r/abc-xyz, r/ NativeNamespaceAddressRegexp = "^[a]{1}/[a-zA-Z0-9_-]{0,}$" // e.g a/abc-xyz, a/ FullNativeNamespaceRegexp = "^[ar]{1}/[a-zA-Z0-9_-]+$" // e.g r/abc-xyz or a/abc-xyz UserNamespaceRegexp = "^[a-zA-Z0-9_-]{3,}/[a-zA-Z0-9_-]{0,}$" // e.g namespace/abc-xyz_ (excluding: r/abc-xyz) WholeNamespaceRegexp = "^([a-zA-Z0-9_-]+)/[a-zA-Z0-9_-]+$" // e.g namespace/abc-xyz_, r/abc-xyz )
const MaxResourceNameLength = 128
Variables ¶
This section is empty.
Functions ¶
func GetDomain ¶
GetDomain returns the domain part of a whole namespace. URI
Example: r/abc => abc , a/os1 => os1 , ns1/abc => abc
func GetNamespace ¶
GetNamespace returns the namespace part of a whole namespace. URI
Example: r/abc => r , a/os1 => a , ns1/abc => ns1
func IsFullNamespaceURI ¶
IsFullNamespaceURI checks whether the given string is a whole namespace URI.
Example: r/domain, ns1/domain, a/os1abc
func IsFullNativeNamespaceURI ¶
IsFullNativeNamespaceURI checks whether the given string is a whole native user address or repo namespace URI.
Example: a/os1abc , r/repo
func IsNamespaceURI ¶
IsNamespaceURI checks whether the given string is a valid namespace.
Example: user-ns/domain, user-ns/, r/repo, r/, a/, a/os1abc
func IsNativeNamespaceURI ¶
IsNativeNamespaceURI checks whether the given string is a whole or partial native namespace URI.
Example: r/repo, a/os1abc, r/, a/
func IsNativeRepoNamespaceURI ¶
IsNativeRepoNamespaceURI checks whether the address is a whole or partial native repo namespace URI.
Example: r/repo, r/
func IsUserAddressURI ¶
IsUserAddressURI checks whether the address is a whole or partial user address namespace URI.
Example: a/os1abc, a/
func IsUserNamespaceURI ¶
IsUserNamespaceURI checks whether the given string is a whole or partial user-defined namespace URI.
Example: ns1/domain, ns1/
func IsValidResourceName ¶
IsValidResourceName checks whether a user-defined name is valid as a resource name
func IsValidResourceNameNoMinLen ¶
IsValidResourceNameNoMinLen is like IsValidResourceName but minimum length is not enforced.
func IsValidScope ¶
IsValidScope checks whether and address can be used as a scope
func IsValidUserAddr ¶
IsValidUserAddr checks whether a bech32 user address is valid
func IsWholeNativeRepoURI ¶
IsWholeNativeRepoURI checks whether the given string is a whole native repo namespace URI.
Example: r/repo
func IsWholeNativeURI ¶
IsWholeNativeURI checks whether the given string is a full native namespace URI.
Example: r/repo, a/os1abc
func IsWholeNativeUserAddressURI ¶
IsWholeNativeUserAddressURI checks whether the given string is a whole native user address namespace URI.
Example: a/os1abc
Types ¶
type Address ¶
type Address string
Address represents an identifier for a resource
func (Address) IsFullNamespace ¶
IsFullNamespaceURI checks whether the address is a full namespace path.
func (Address) IsFullNativeNamespace ¶
IsFullNativeNamespace checks whether the address is prefixed with a/ or /r which indicates a repo and account address respectively
func (Address) IsNamespace ¶
IsNamespaceURI checks whether the given address is a valid native or user namespace
func (Address) IsNativeNamespace ¶
IsNativeNamespace checks whether the given address is a native namespace
func (Address) IsNativeNamespaceRepo ¶
IsNativeRepoNamespaceURI checks whether the address is a native namespace address for repositories
func (Address) IsNativeNamespaceUserAddress ¶
IsUserAddressURI checks whether the address is a native namespace address for users
func (Address) IsNativeRepoAddress ¶
IsWholeNativeRepoURI checks if the address is native repo address
func (Address) IsNativeUserAddress ¶
IsWholeNativeUserAddressURI checks if the address is native user address
func (Address) IsUserAddress ¶
IsUserAddress checks whether the address is a bech32 user address.
func (Address) IsUserNamespace ¶
IsUserNamespaceURI checks whether the address is a user
func (Address) IsValidNativeAddress ¶
IsValidNativeAddress checks whether the address is a valid native namespace address