Documentation ¶
Index ¶
- Constants
- func ExtractPlanesPrefixFromURLPath(path string) (planeType string, planeName string, remainder string, err error)
- func IDEquals(x ID, y ID) bool
- func MakeRelativeID(scopes []ScopeSegment, resourceTypes []TypeSegment, ...) string
- func MakeUCPID(scopes []ScopeSegment, resourceTypes []TypeSegment, ...) string
- type ID
- func (ri ID) Append(resourceType TypeSegment) ID
- func (ri ID) ExtensionSegments() []TypeSegment
- func (ri ID) FindScope(scopeType string) string
- func (ri ID) IsEmpty() bool
- func (ri ID) IsExtensionCollection() bool
- func (ri ID) IsExtensionResource() bool
- func (ri ID) IsResource() bool
- func (ri ID) IsResourceCollection() bool
- func (ri ID) IsScope() bool
- func (ri ID) IsScopeCollection() bool
- func (ri ID) IsUCPQualified() bool
- func (id ID) MarshalJSON() ([]byte, error)
- func (id ID) MarshalText() ([]byte, error)
- func (ri ID) Name() string
- func (ri ID) ParentResource() string
- func (ri ID) PlaneNamespace() string
- func (ri ID) PlaneScope() string
- func (ri ID) ProviderNamespace() string
- func (ri ID) QualifiedName() string
- func (ri ID) RootScope() string
- func (ri ID) RoutingScope() string
- func (ri ID) ScopeSegments() []ScopeSegment
- func (ri ID) String() string
- func (ri ID) Truncate() ID
- func (ri ID) Type() string
- func (ri ID) TypeSegments() []TypeSegment
- func (id *ID) UnmarshalJSON(data []byte) error
- func (id *ID) UnmarshalText(data []byte) error
- func (ri ID) ValidateResourceType(t KnownType) error
- type KnownType
- type ScopeSegment
- type TypeSegment
Constants ¶
const ( // SegmentSeparator is the separator between segments in a resource ID. SegmentSeparator = "/" // ProvidersSegment is the segment that separates the scope from the resource type. ProvidersSegment = "providers" // PlanesSegment is the segment the planes delimiter that distinguishes between UCP and ARM resource IDs. PlanesSegment = "planes" PlaneTypePrefix = "System.Planes" ResourceGroupType = "System.Resources/resourceGroups" )
Variables ¶
This section is empty.
Functions ¶
func ExtractPlanesPrefixFromURLPath ¶
func ExtractPlanesPrefixFromURLPath(path string) (planeType string, planeName string, remainder string, err error)
ExtractPlanesPrefixFromURLPath splits a URL path into segments and checks if the first two segments are valid, returning
the first two segments and the remainder of the URL path if valid, or an error if not.
func MakeRelativeID ¶
func MakeRelativeID(scopes []ScopeSegment, resourceTypes []TypeSegment, extensionTypes []TypeSegment) string
MakeRelativeID makes a plane-relative resource ID (ARM style) from a slice of ScopeSegment and a variadic of TypeSegment..
func MakeUCPID ¶
func MakeUCPID(scopes []ScopeSegment, resourceTypes []TypeSegment, extensionTypes []TypeSegment) string
MakeUCPID creates a fully-qualified UCP resource ID, from the given scopes and resource types.
Types ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID represents an ARM or UCP resource id. ID is immutable once created. Use Parse() or ParseXyz() to create IDs and use String() to convert back to strings.
func MustParse ¶
MustParse parses a resource ID. MustParse will panic if the ID is not valid. This should only be used in tests and other circumstances where the ID is known to be valid.
func Parse ¶
Parse parses a resource ID. Parse will parse ALL valid resource IDs in the most permissive way. Most code should use a more specific function like ParseResource to parse the specific kind of ID they want to handle.
func ParseByMethod ¶
ParseByMethod is a helper function to extract the custom actions from the id. If there is a custom action in the request, then the method will be POST. To be able to get the proper type, we need to remove the custom action from the id.
func ParseResource ¶
ParseResource returns a parsed resource ID if the ID represents a named resource (not a collection or custom action).
Example:
/planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications/my-app
func ParseScope ¶
ParseScope returns a parsed resource ID if the ID represents a named scope (not a collection or custom action).
Example:
/planes/radius/local/resourceGroups/rg1
func (ID) Append ¶
func (ri ID) Append(resourceType TypeSegment) ID
Append appends a resource type segment to the ID and returns the resulting ID. If the ID is UCP qualified, it will return a UCP qualified ID, otherwise it will return a relative ID.
func (ID) ExtensionSegments ¶
func (ri ID) ExtensionSegments() []TypeSegment
ExtensionSegments gets the slice of extension segments.
func (ID) FindScope ¶
Method FindScope searches through the scopeSegments of the ID instance and returns the Name of the scopeType if found.
func (ID) IsExtensionCollection ¶
IsExtensionCollection returns true if the ID represents a collection or custom action on an extension resource.
Example:
/planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications/my-app/providers/Some.Other/type
func (ID) IsExtensionResource ¶
IsExtensionResource returns true if the ID represents an extension resource.
Example:
/planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications/my-app/providers/Some.Other/type/my-extension
func (ID) IsResource ¶
IsResource returns true if the ID represents a named resource (not a collection or custom action).
Example:
/planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications/my-app /planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications/my-app/providers/Some.Other/type/my-extension
func (ID) IsResourceCollection ¶
IsResourceCollection returns true if the ID represents a collection or custom action on a resource.
Example:
/planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications /planes/radius/local/resourceGroups/rg1/providers/Applications.Core/applications/my-app/providers/Some.Other/type
func (ID) IsScope ¶
IsScope returns true if the ID represents a named scope (not a collection or custom action).
Example:
/planes/radius/local
func (ID) IsScopeCollection ¶
IsScopeCollection returns true if the ID represents a collection or custom action on a scope.
Example:
/planes/radius/local/resourceGroups/resources
func (ID) IsUCPQualified ¶ added in v0.28.0
IsUCPQualified checks if the ID has a prefix of SegmentSeparator and PlanesSegment.
func (ID) MarshalJSON ¶
MarshalJSON implements JSON marshalling support for Resource IDs.
func (ID) MarshalText ¶
MarshalText implements text marshalling support for Resource IDs.
func (ID) ParentResource ¶
ParentResource returns the parent resource of the resource ID, or an empty string if the ID is a scope or non-extension resource.
Example:
/planes/radius/local/resourceGroups/cool-group/providers/Applications.Core/application/my-app/providers/Applications.Core/someExtensionType/my-extension => /planes/radius/local/resourceGroups/cool-group/providers/Applications.Core/application/my-app
func (ID) PlaneNamespace ¶
PlaneNamespace returns the plane part of the UCP ID, or an empty string if the ID is not UCP qualified.
Examples:
radius/local
func (ID) PlaneScope ¶
PlaneScope returns plane or subscription scope without resourceGroup
Examples:
/subscriptions/{guid} /planes/radius/local
func (ID) ProviderNamespace ¶
ProviderNamespace returns the namespace of the resource provider. Will be empty if the resource ID is empty or refers to a scope.
Examples:
Applications.Core
func (ID) QualifiedName ¶
QualifiedName gets the fully-qualified resource name (eg. `radiusv3/myapp/mycontainer`) by joining the type segments with the SegmentSeparator.
func (ID) RootScope ¶
RootScope returns the root-scope (the part before the first 'providers'), taking into account whether the ID is qualified for UCP or not.
For an exension resource the root scope is the same as its parent resource's root scope.
Examples:
/subscriptions/{guid}/resourceGroups/cool-group /planes/radius/local/resourceGroups/cool-group
func (ID) RoutingScope ¶
RoutingScope returns the routing-scope (the part after 'providers') - it is composed of the type and name segments of the ID instance.
Examples:
Applications.Core/applications/my-app
func (ID) ScopeSegments ¶
func (ri ID) ScopeSegments() []ScopeSegment
ScopeSegments gets the slice of root-scope segments.
func (ID) Truncate ¶
Truncate removes the last type/name pair for a resource id or scope id. Calling truncate on a top level resource or scope has no effect.
func (ID) Type ¶
Type returns the fully-qualified resource type of a ResourceID, or an empty string if the type cannot be determined.
func (ID) TypeSegments ¶
func (ri ID) TypeSegments() []TypeSegment
TypeSegments gets the slice of type segments.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON implements JSON unmarshalling support for Resource IDs.
func (*ID) UnmarshalText ¶
UnmarshalText implements text unmarshalling support for Resource IDs.
func (ID) ValidateResourceType ¶
ValidateResourceType validates that the resource ID type segment matches the expected type.
type KnownType ¶
type KnownType struct { // Types is the set of TypeSegments that make up the type. Types []TypeSegment }
KnownType represents a known resource type. Since resource types can have child types, this includes multiple segments.
type ScopeSegment ¶
type ScopeSegment struct { // Type is the type of the scope. // // Example: // resourceGroup // subscription // Type string // Name is the name of the scope. Name string }
ScopeSegment represents one of the root-scope pairs of a resource ID.
type TypeSegment ¶
type TypeSegment struct { // Type one of the segments of a resource type. This will be a namespace/type combo for the first // segment, and a simple name for subsequent ones. // // Example: // Microsoft.Resources/deployment // database // Type string // Name is the name of the resource. Name string }
TypeSegment represents one of the type/name pairs of a resource ID.
Directories ¶
Path | Synopsis |
---|---|
package aws defines utility functions and constants for working with AWS types and UCP resource IDs.
|
package aws defines utility functions and constants for working with AWS types and UCP resource IDs. |
package azure defines utility functions and constants for working with Azure types and UCP resource IDs.
|
package azure defines utility functions and constants for working with Azure types and UCP resource IDs. |
package kubernetes defines utility functions and constants for working with Kubernetes types and UCP resource IDs.
|
package kubernetes defines utility functions and constants for working with Kubernetes types and UCP resource IDs. |
package radius defines utility functions and constants for working with Radius types and UCP resource IDs.
|
package radius defines utility functions and constants for working with Radius types and UCP resource IDs. |