azureshared

package
v2.16.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gcpshared contains code to parse and define data types relevant for Microsoft Azure.

This package is intended to have a minimal size and surface. If you have Azure related code that is not shared by multiple applications, or if the code interacts with the GCP API, please keep the code in the application's internal package or add it to the Azure cloud package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicsFromProviderID

func BasicsFromProviderID(providerID string) (subscriptionID, resourceGroup string, err error)

BasicsFromProviderID extracts subscriptionID and resourceGroup from both types of valid azure providerID.

func ScaleSetInformationFromProviderID

func ScaleSetInformationFromProviderID(providerID string) (subscriptionID, resourceGroup, scaleSet, instanceID string, err error)

ScaleSetInformationFromProviderID splits a provider's id belonging to an azure scaleset into core components. A providerID for scale set VMs is build after the following schema: - 'azure:///subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Compute/virtualMachineScaleSets/<scale-set-name>/virtualMachines/<instance-id>'

Types

type ApplicationCredentials

type ApplicationCredentials struct {
	SubscriptionID      string
	ResourceGroup       string
	TenantID            string
	AppClientID         string
	ClientSecretValue   string
	Location            string
	UamiResourceID      string
	PreferredAuthMethod AuthMethod
}

ApplicationCredentials is a set of Azure API credentials. It can contain a client secret and carries the preferred authentication method. It is the equivalent of a service account key in other cloud providers.

func ApplicationCredentialsFromURI

func ApplicationCredentialsFromURI(cloudServiceAccountURI string) (ApplicationCredentials, error)

ApplicationCredentialsFromURI converts a cloudServiceAccountURI into Azure ApplicationCredentials.

func (ApplicationCredentials) ToCloudServiceAccountURI

func (c ApplicationCredentials) ToCloudServiceAccountURI() string

ToCloudServiceAccountURI converts the ApplicationCredentials into a cloud service account URI.

type AuthMethod added in v2.7.0

type AuthMethod uint32

AuthMethod is the authentication method used for the Azure API.

const (
	// AuthMethodUnknown is default value for AuthMethod.
	AuthMethodUnknown AuthMethod = iota
	// AuthMethodServicePrincipal uses a client ID and secret.
	AuthMethodServicePrincipal
	// AuthMethodUserAssignedIdentity uses a user assigned identity.
	AuthMethodUserAssignedIdentity
)

func FromString added in v2.7.0

func FromString(s string) AuthMethod

FromString converts a string into an AuthMethod.

func (AuthMethod) String added in v2.7.0

func (i AuthMethod) String() string

Jump to

Keyboard shortcuts

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