Documentation ¶
Overview ¶
Package urn implements the Uniform Resource Name (URN) specification, as defined in RFC 2141 with a focus on cloud computing.
Index ¶
Constants ¶
const ( // DefaultSeparator is the separator used to separate the segments of a URN. DefaultSeparator = ":" // DefaultNamespace is the default namespace used for URNs. DefaultNamespace = "urn" )
Variables ¶
var ErrorInvalid = errors.New("urn: invalid format")
ErrorInvalid is returned when parsing an URN with an invalid format.
Functions ¶
This section is empty.
Types ¶
type Match ¶ added in v0.5.1
type Match string
Match is a string that can be used to match a URN segment.
type URN ¶
type URN struct { // Namespace is the namespace segment of the URN. Namespace Match `validate:"required"` // Partition is the partition segment of the URN. Partition Match `validate:"max=256"` // Service is the service segment of the URN. Service Match `validate:"max=256"` // Region is the region segment of the URN. Region Match `validate:"max=256"` // Identifier is the identifier segment of the URN. Identifier Match `validate:"max=64"` // Resource is the resource segment of the URN. Resource Match `validate:"required,max=256"` }
URN represents a unique, uniform identifier for a resource
func FromProto ¶
func FromProto(r *pb.ResourceURN) (*URN, error)
FromProto returns the URN representation from a proto.ResourceURN representation.
func New ¶
New takes a namespace, partition, service, region, identifier and resource and returns a URN.
func (*URN) ExactMatch ¶ added in v0.5.1
ExactMatch returns true if the URN matches the given URN exactly.
func (*URN) Match ¶ added in v0.5.1
Match returns true if the right-hand side URN matches the left-hand side URN. The left-hand side URN is assumed to be specific and the right-hand side URN is assumed to be generic.
func (*URN) ProtoMessage ¶
func (u *URN) ProtoMessage() *pb.ResourceURN
ProtoMessage returns the proto.ResourceURN representation of the URN.