resource

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderResourceType = NewResourceType(builtInResourceNamespace, "providers")

ProviderResourceType is the ResourceType of a provider

View Source
var ResourceGroupResourceType = NewResourceType(builtInResourceNamespace, "resourceGroups")

ResourceGroupResourceType is the ResourceType of a resource group

View Source
var RootResourceID = &ResourceID{
	Parent:       nil,
	ResourceType: TenantResourceType,
	Name:         "",
}

RootResourceID defines the tenant as the root parent of all other ResourceID.

View Source
var SubscriptionResourceType = NewResourceType(builtInResourceNamespace, "subscriptions")

SubscriptionResourceType is the ResourceType of a subscription

View Source
var TenantResourceType = NewResourceType(builtInResourceNamespace, "tenants")

TenantResourceType is the ResourceType of a tenant

Functions

This section is empty.

Types

type ResourceID

type ResourceID struct {
	// Parent is the parent ResourceID of this instance.
	// Can be nil if there is no parent.
	Parent *ResourceID

	// SubscriptionID is the subscription ID in this resource ID.
	// The value can be empty if the resource ID does not contain a subscription ID.
	SubscriptionID string

	// ResourceGroupName is the resource group name in this resource ID.
	// The value can be empty if the resource ID does not contain a resource group name.
	ResourceGroupName string

	// Provider represents the provider name in this resource ID.
	// This is only valid when the resource ID represents a resource provider.
	// Example: `/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Insights`
	Provider string

	// Location is the location in this resource ID.
	// The value can be empty if the resource ID does not contain a location name.
	Location string

	// ResourceType represents the type of this resource ID.
	ResourceType ResourceType

	// Name is the resource name of this resource ID.
	Name string
	// contains filtered or unexported fields
}

ResourceID represents a resource ID such as `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg`. Don't create this type directly, use ParseResourceID instead.

func ParseResourceID

func ParseResourceID(id string) (*ResourceID, error)

ParseResourceID parses a string to an instance of ResourceID

func (*ResourceID) String

func (id *ResourceID) String() string

String returns the string of the ResourceID

type ResourceType

type ResourceType struct {
	// Namespace is the namespace of the resource type.
	// e.g. "Microsoft.Network" in resource type "Microsoft.Network/virtualNetworks/subnets"
	Namespace string

	// Type is the full type name of the resource type.
	// e.g. "virtualNetworks/subnets" in resource type "Microsoft.Network/virtualNetworks/subnets"
	Type string

	// Types is the slice of all the sub-types of this resource type.
	// e.g. ["virtualNetworks", "subnets"] in resource type "Microsoft.Network/virtualNetworks/subnets"
	Types []string
	// contains filtered or unexported fields
}

ResourceType represents an Azure resource type, e.g. "Microsoft.Network/virtualNetworks/subnets". Don't create this type directly, use ParseResourceType or NewResourceType instead.

func NewResourceType

func NewResourceType(providerNamespace, typeName string) ResourceType

NewResourceType creates an instance of ResourceType using a provider namespace such as "Microsoft.Network" and type such as "virtualNetworks/subnets".

func ParseResourceType

func ParseResourceType(resourceIDOrType string) (ResourceType, error)

ParseResourceType parses the ResourceType from a resource type string (e.g. Microsoft.Network/virtualNetworks/subsets) or a resource identifier string. e.g. /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/mySubnet)

func (ResourceType) AppendChild

func (t ResourceType) AppendChild(childType string) ResourceType

AppendChild creates an instance of ResourceType using the receiver as the parent with childType appended to it.

func (ResourceType) IsParentOf

func (t ResourceType) IsParentOf(child ResourceType) bool

IsParentOf returns true when the receiver is the parent resource type of the child.

func (ResourceType) String

func (t ResourceType) String() string

String returns the string of the ResourceType

Jump to

Keyboard shortcuts

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