Documentation ¶
Index ¶
- type Id
- type ParseResult
- type Parser
- type ResourceID
- type ResourceId
- type Segment
- func ConstantSegment(name string, possibleValues []string, exampleValue string) Segment
- func ResourceGroupSegment(name, exampleValue string) Segment
- func ResourceProviderSegment(name, resourceProvider, exampleValue string) Segment
- func ScopeSegment(name, exampleValue string) Segment
- func StaticSegment(name, staticValue, exampleValue string) Segment
- func SubscriptionIdSegment(name, exampleValue string) Segment
- func UserSpecifiedSegment(name, exampleValue string) Segment
- type SegmentType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Id ¶
type Id interface { // ID returns the fully formatted ID for this Resource ID ID() string // String returns a friendly description of the components of this Resource ID // which is suitable for use in error messages (for example 'MyThing %q / Resource Group %q') String() string }
Id defines a type for a ResourceId of some kind
type ParseResult ¶ added in v0.17.0
type Parser ¶ added in v0.17.0
type Parser struct {
// contains filtered or unexported fields
}
func NewParserFromResourceIdType ¶ added in v0.17.0
func NewParserFromResourceIdType(id ResourceId) Parser
NewParserFromResourceIdType takes a ResourceId interface and uses its (ordered) Segments to create a Parser which can be used to Parse Resource ID's.
func (Parser) Parse ¶ added in v0.17.0
func (p Parser) Parse(input string, insensitively bool) (*ParseResult, error)
Parse processes a Resource ID and parses it into a ParseResult containing a map of the Known Segments for this Resource ID which callers of this method can then process to form a Resource ID struct of those values doing any type conversions as necessary (for
example, type-casting/converting Constants).
`input`: the Resource ID to be parsed, which should match the segments for this Resource ID `insensitively`: should this Resource ID be parsed case-insensitively and fix up any Constant,
Resource Provider and Static Segments to the expected casing.
type ResourceID ¶
type ResourceID struct { SubscriptionID string ResourceGroup string Provider string SecondaryProvider string Path map[string]string }
ResourceID represents a parsed long-form Azure Resource Manager ID with the Subscription ID, Resource Group and the Provider as top- level fields, and other key-value pairs available via a map in the Path field.
func ParseAzureResourceID ¶
func ParseAzureResourceID(id string) (*ResourceID, error)
ParseAzureResourceID converts a long-form Azure Resource Manager ID into a ResourceID.
func (*ResourceID) PopSegment ¶
func (id *ResourceID) PopSegment(name string) (string, error)
PopSegment retrieves a segment from the Path and returns it if found it removes it from the Path then return the value if not found, this returns nil
func (*ResourceID) ValidateNoEmptySegments ¶
func (id *ResourceID) ValidateNoEmptySegments(sourceId string) error
ValidateNoEmptySegments validates ...
type ResourceId ¶ added in v0.17.0
type ResourceId interface { // ID returns the fully formatted ID for this Resource ID ID() string // String returns a friendly description of the components of this Resource ID // which is suitable for use in error messages (for example 'MyThing %q / Resource Group %q') String() string // Segments returns an ordered list of expected Segments that make up this Resource ID Segments() []Segment }
type Segment ¶ added in v0.17.0
type Segment struct { // ExampleValue is an example of a value for this field, which is intended only to // be used as a placeholder. ExampleValue string // FixedValue is the Fixed/Static value for this segment - only present when `Type` // is `ResourceProviderSegmentType` or `StaticSegmentType`. FixedValue *string // Name is the camelCased name of this segment, which is normalized (and safe to use as a // parameter/a field if necessary). Name string // PossibleValues is a list of possible values for this segment - only present when // `Type` is `ConstantSegmentType` PossibleValues *[]string // Type specifies the Type of Segment that this is, for example a `StaticSegmentType` Type SegmentType }
func ConstantSegment ¶ added in v0.17.0
ConstantSegment is a helper which returns a Segment for a Constant
func ResourceGroupSegment ¶ added in v0.17.0
ResourceGroupSegment is a helper which returns a Segment for a Resource Group
func ResourceProviderSegment ¶ added in v0.17.0
ResourceProviderSegment is a helper which returns a Segment for a Resource Provider
func ScopeSegment ¶ added in v0.17.0
ScopeSegment is a helper which returns a Segment for a Scope
func StaticSegment ¶ added in v0.17.0
StaticSegment is a helper which returns a Segment for a Static Value
func SubscriptionIdSegment ¶ added in v0.17.0
SubscriptionIdSegment is a helper which returns a Segment for a Subscription Id
func UserSpecifiedSegment ¶ added in v0.17.0
UserSpecifiedSegment is a helper which returns a Segment for a User Specified Segment
type SegmentType ¶ added in v0.17.0
type SegmentType string
const ( // ConstantSegmentType specifies that this Segment is a Constant ConstantSegmentType SegmentType = "Constant" // ResourceGroupSegmentType specifies that this Segment is a Resource Group name ResourceGroupSegmentType SegmentType = "ResourceGroup" // ResourceProviderSegmentType specifies that this Segment is a Resource Provider ResourceProviderSegmentType SegmentType = "ResourceProvider" // ScopeSegmentType specifies that this Segment is a Scope ScopeSegmentType SegmentType = "Scope" // StaticSegmentType specifies that this Segment is a Static/Fixed Value StaticSegmentType SegmentType = "Static" // SubscriptionIdSegmentType specifies that this Segment is a Subscription ID SubscriptionIdSegmentType SegmentType = "SubscriptionId" // UserSpecifiedSegmentType specifies that this Segment is User-Specifiable UserSpecifiedSegmentType SegmentType = "UserSpecified" )