arm

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 8 Imported by: 720

Documentation

Overview

Package arm contains functionality specific to Azure Resource Manager clients.

Index

Examples

Constants

This section is empty.

Variables

View Source
var ProviderResourceType = resource.ProviderResourceType

ProviderResourceType is the ResourceType of a provider

View Source
var ResourceGroupResourceType = resource.ResourceGroupResourceType

ResourceGroupResourceType is the ResourceType of a resource group

View Source
var RootResourceID = resource.RootResourceID

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

View Source
var SubscriptionResourceType = resource.SubscriptionResourceType

SubscriptionResourceType is the ResourceType of a subscription

View Source
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(clientName, 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.

  • clientName - the fully qualified name of the client ("module/package.Client"); this is used by the telemetry policy and tracing provider. if module and package are the same value, the "module/" prefix can be omitted.
  • moduleVersion - the version of the containing module; used by the telemetry policy
  • cred - the TokenCredential used to authenticate the request
  • options - optional client configurations; pass nil to accept the default values

func (*Client) Endpoint added in v1.3.0

func (c *Client) Endpoint() string

Endpoint returns the service's base URL for this client.

func (*Client) Pipeline added in v1.3.0

func (c *Client) Pipeline() runtime.Pipeline

Pipeline returns the pipeline for this client.

func (*Client) Tracer added in v1.3.0

func (c *Client) Tracer() tracing.Tracer

Tracer returns the tracer for this client.

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

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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