rid

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: BSD-3-Clause Imports: 4 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceIdentifier

type ResourceIdentifier struct {
	// Service is a string that represents the service (or application) that namespaces the rest of the identifier.
	// Must conform with regex pattern [a-z][a-z0-9\-]*.
	Service string
	// Instance is an optionally empty string that represents a specific service cluster, to allow disambiguation of artifacts from different service clusters.
	// Must conform to regex pattern ([a-z0-9][a-z0-9\-]*)?.
	Instance string
	// Type is a service-specific resource type to namespace a group of locators.
	// Must conform to regex pattern [a-z][a-z0-9\-]*.
	Type string
	// Locator is a string used to uniquely locate the specific resource.
	// Must conform to regex pattern [a-zA-Z0-9\-\._]+.
	Locator string
}

A ResourceIdentifier is a four-part identifier string for a resource whose format is specified at https://github.com/palantir/resource-identifier.

Resource Identifiers offer a common encoding for wrapping existing unique identifiers with some additional context that can be useful when storing those identifiers in other applications. Additionally, the context can be used to disambiguate application-unique, but not globally-unique, identifiers when used in a common space.

func MustNew

func MustNew(service, instance, resourceType, locator string) ResourceIdentifier

func New

func New(service, instance, resourceType, locator string) (ResourceIdentifier, error)

func ParseRID

func ParseRID(s string) (ResourceIdentifier, error)

ParseRID parses a string into a 4-part resource identifier.

func (ResourceIdentifier) MarshalText

func (rid ResourceIdentifier) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler (used by encoding/json and others).

func (ResourceIdentifier) String

func (rid ResourceIdentifier) String() string

func (*ResourceIdentifier) UnmarshalText

func (rid *ResourceIdentifier) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler (used by encoding/json and others).

Jump to

Keyboard shortcuts

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