urnx

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package urnx is a package for creating and parsing Infratographer based URNs in the format of urn:<namespace>:<resource type>:<resource id> which are used to identify resources in the Infratographer ecosystem.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidURN = errors.New("invalid urn: expected 'urn:<namespace>:<resource type>:<resource id>")

ErrInvalidURN is returned when the URN is invalid

View Source
var ErrInvalidURNNamespace = errors.New("invalid urn namespace: expected string consisting of [A-za-z0-9-]{1,30}")

ErrInvalidURNNamespace is returned when the URN namespace is invalid and does not match the regex [A-za-z0-9-]{1,30}

View Source
var ErrInvalidURNPrefix = errors.New("invalid urn prefix: expected '" + prefix + "'")

ErrInvalidURNPrefix is returned when the URN prefix is invalid

View Source
var ErrInvalidURNResourceID = errors.New("invalid urn resource id: expected valid uuid")

ErrInvalidURNResourceID is returned when the URN resource ID is invalid and not a valid UUID

View Source
var ErrInvalidURNResourceType = errors.New("invalid urn resource type: expected string consisting of [A-za-z0-9-]{1,255}")

ErrInvalidURNResourceType is returned when the URN resource type is invalid and does not match the regex [A-za-z0-9-]{1,}

Functions

This section is empty.

Types

type URN

type URN struct {
	Namespace    string
	ResourceType string
	ResourceID   uuid.UUID
}

URN is an infratographer based URN consisting of a namespace, resource type and resource ID

func Build

func Build(namespace string, resourceType string, resourceID uuid.UUID) (*URN, error)

Build create a new URN with the specified fields

func Parse

func Parse(urn string) (*URN, error)

Parse parses a string into a URN object

func (*URN) String

func (u *URN) String() string

String returns the string representation of the URN

Jump to

Keyboard shortcuts

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