Documentation ¶
Overview ¶
Package arm contains functionality specific to Azure Resource Manager clients.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ProviderResourceType = resource.ProviderResourceType
ProviderResourceType is the ResourceType of a provider
var ResourceGroupResourceType = resource.ResourceGroupResourceType
ResourceGroupResourceType is the ResourceType of a resource group
var RootResourceID = resource.RootResourceID
RootResourceID defines the tenant as the root parent of all other ResourceID.
var SubscriptionResourceType = resource.SubscriptionResourceType
SubscriptionResourceType is the ResourceType of a subscription
var TenantResourceType = resource.TenantResourceType
TenantResourceType is the ResourceType of a tenant
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.3.0
type Client struct {
// contains filtered or unexported fields
}
Client is a HTTP client for use with ARM endpoints. It consists of an endpoint, pipeline, and tracing provider.
func NewClient ¶ added in v1.3.0
func NewClient(moduleName, moduleVersion string, cred azcore.TokenCredential, options *ClientOptions) (*Client, error)
NewClient creates a new Client instance with the provided values. This client is intended to be used with Azure Resource Manager endpoints.
- moduleName - the fully qualified name of the module where the client is defined; used by the telemetry policy and tracing provider.
- moduleVersion - the semantic version of the module; used by the telemetry policy and tracing provider.
- cred - the TokenCredential used to authenticate the request
- options - optional client configurations; pass nil to accept the default values
type ClientOptions ¶ added in v0.20.0
type ClientOptions = armpolicy.ClientOptions
ClientOptions contains configuration settings for a client's pipeline.
type ResourceID ¶ added in v0.21.0
type ResourceID = resource.ResourceID
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 ¶ added in v0.21.0
func ParseResourceID(id string) (*ResourceID, error)
ParseResourceID parses a string to an instance of ResourceID
Example ¶
rawResourceID := "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet/subsets/mySub" id, err := ParseResourceID(rawResourceID) if err != nil { panic(err) } fmt.Printf("ID: %s\n", id.String()) fmt.Printf("Name: %s, ResourceType: %s, SubscriptionId: %s, ResourceGroupName: %s\n", id.Name, id.ResourceType, id.SubscriptionID, id.ResourceGroupName) fmt.Printf("Parent: %s\n", id.Parent.String()) fmt.Printf("Name: %s, ResourceType: %s, SubscriptionId: %s, ResourceGroupName: %s\n", id.Parent.Name, id.Parent.ResourceType, id.Parent.SubscriptionID, id.Parent.ResourceGroupName) fmt.Printf("Parent: %s\n", id.Parent.Parent.String()) fmt.Printf("Name: %s, ResourceType: %s, SubscriptionId: %s, ResourceGroupName: %s\n", id.Parent.Parent.Name, id.Parent.Parent.ResourceType, id.Parent.Parent.SubscriptionID, id.Parent.Parent.ResourceGroupName) fmt.Printf("Parent: %s\n", id.Parent.Parent.Parent.String()) fmt.Printf("Name: %s, ResourceType: %s, SubscriptionId: %s, ResourceGroupName: %s\n", id.Parent.Parent.Parent.Name, id.Parent.Parent.Parent.ResourceType, id.Parent.Parent.Parent.SubscriptionID, id.Parent.Parent.Parent.ResourceGroupName)
Output: ID: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet/subsets/mySub Name: mySub, ResourceType: Microsoft.Network/virtualNetworks/subsets, SubscriptionId: 00000000-0000-0000-0000-000000000000, ResourceGroupName: myRg Parent: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet Name: vnet, ResourceType: Microsoft.Network/virtualNetworks, SubscriptionId: 00000000-0000-0000-0000-000000000000, ResourceGroupName: myRg Parent: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg Name: myRg, ResourceType: Microsoft.Resources/resourceGroups, SubscriptionId: 00000000-0000-0000-0000-000000000000, ResourceGroupName: myRg Parent: /subscriptions/00000000-0000-0000-0000-000000000000 Name: 00000000-0000-0000-0000-000000000000, ResourceType: Microsoft.Resources/subscriptions, SubscriptionId: 00000000-0000-0000-0000-000000000000, ResourceGroupName:
type ResourceType ¶ added in v0.21.0
type ResourceType = resource.ResourceType
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 ¶ added in v0.21.0
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 ¶ added in v0.21.0
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)
Example ¶
rawResourceType := "Microsoft.Network/virtualNetworks/subnets" resourceType, err := ParseResourceType(rawResourceType) if err != nil { panic(err) } fmt.Printf("ResourceType: %s\n", resourceType.String()) fmt.Printf("Namespace: %s, Type: %s\n", resourceType.Namespace, resourceType.Type)
Output: ResourceType: Microsoft.Network/virtualNetworks/subnets Namespace: Microsoft.Network, Type: virtualNetworks/subnets
Example (FromResourceID) ¶
rawResourceID := "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/mySub" resourceType, err := ParseResourceType(rawResourceID) if err != nil { panic(err) } fmt.Printf("ResourceType: %s\n", resourceType.String()) fmt.Printf("Namespace: %s, Type: %s\n", resourceType.Namespace, resourceType.Type)
Output: ResourceType: Microsoft.Network/virtualNetworks/subnets Namespace: Microsoft.Network, Type: virtualNetworks/subnets