urn

package
v3.116.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Prefix        = "urn:" + NamespaceID + ":" // the standard URN prefix
	NamespaceID   = "pulumi"                   // the URN namespace
	NameDelimiter = "::"                       // the delimiter between URN name elements
	TypeDelimiter = "$"                        // the delimiter between URN type elements
)

Variables

This section is empty.

Functions

This section is empty.

Types

type URN

type URN string

URN is a friendly, but unique, URN for a resource, most often auto-assigned by Pulumi. These are used as unique IDs for objects, and help us to perform graph diffing and resolution of resource objects.

In theory, we could support manually assigned URIs in the future. For the time being, however, we have opted to simplify developers' lives by mostly automating the generation of them algorithmically. The one caveat where it isn't truly automatic is that a developer -- or resource provider -- must provide a semi-unique name part.

Each resource URN is of the form:

urn:pulumi:<Stack>::<Project>::<Qualified$Type$Name>::<Name>

wherein each element is the following:

<Stack>                 The stack being deployed into
<Project>               The project being evaluated
<Qualified$Type$Name>   The object type's qualified type token (including the parent type)
<Name>                  The human-friendly name identifier assigned by the developer or provider

In the future, we may add elements to the URN; it is more important that it is unique than it is human-typable.

func New

func New(stack tokens.QName, proj tokens.PackageName, parentType, baseType tokens.Type, name string) URN

New creates a unique resource URN for the given resource object.

func Parse

func Parse(s string) (URN, error)

Parse attempts to parse a string into a URN returning an error if it's not valid.

func ParseOptional

func ParseOptional(s string) (URN, error)

ParseOptional is the same as Parse except it will allow the empty string.

func (URN) IsValid

func (urn URN) IsValid() bool

IsValid returns true if the URN is well-formed.

func (URN) Name

func (urn URN) Name() string

Name returns the resource name part of a URN.

func (URN) Project

func (urn URN) Project() tokens.PackageName

Project returns the project name part of a URN.

func (URN) QualifiedType

func (urn URN) QualifiedType() tokens.Type

QualifiedType returns the resource type part of a URN including the parent type

func (URN) Quote

func (urn URN) Quote() string

Quote returns the quoted form of the URN appropriate for use as a command line argument for the current OS.

func (URN) Rename

func (urn URN) Rename(newName string) URN

Returns a new URN with an updated name part

func (URN) Stack

func (urn URN) Stack() tokens.QName

Stack returns the resource stack part of a URN.

func (URN) Type

func (urn URN) Type() tokens.Type

Type returns the resource type part of a URN

func (URN) URNName

func (urn URN) URNName() string

URNName returns the URN name part of a URN (i.e., strips off the prefix).

Jump to

Keyboard shortcuts

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