azure

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCanAccessResource

func CheckCanAccessResource(actionID string, scope string) (bool, error)

CheckCanAccessResource checks to see if the user can create a specific

func GetCloudDriveResourceGroup

func GetCloudDriveResourceGroup() string

GetCloudDriveResourceGroup gets the resource group name associated with the clouddrive used in CloudShell

func GetCloudShellLocation

func GetCloudShellLocation() string

GetCloudShellLocation returns the location that CloudShell is running in

func GetCloudShellToken

func GetCloudShellToken() (*adal.Token, error)

GetCloudShellToken gets the CloudShell Token

func GetContainerClient

func GetContainerClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*containerinstance.ContainerClient, error)

GetContainerClient gets a Container Management Client

func GetContainerGroupsClient

func GetContainerGroupsClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*containerinstance.ContainerGroupsClient, error)

GetContainerGroupsClient gets a ContainerGroups Management Client

func GetGroupsClient

func GetGroupsClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*resources.GroupsClient, error)

GetGroupsClient gets a Resource Group Management Client

func GetProvidersClient

func GetProvidersClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*resources.ProvidersClient, error)

GetProvidersClient gets a Providers Management Client

func GetRoleAssignmentClient

func GetRoleAssignmentClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*authorization.RoleAssignmentsClient, error)

GetRoleAssignmentClient gets a RoleAssignment Management Client

func GetRoleDefinitionsClient

func GetRoleDefinitionsClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*authorization.RoleDefinitionsClient, error)

GetRoleDefinitionsClient gets a RoleDefinitions Management Client

func GetStorageAccountsClient

func GetStorageAccountsClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*storage.AccountsClient, error)

GetStorageAccountsClient gets a Providers Management Client

func GetSubscriptionIDFromCliProfile

func GetSubscriptionIDFromCliProfile() string

GetSubscriptionIDFromCliProfile gets default subscription id from az cli profile

func GetSubscriptionsClient

func GetSubscriptionsClient(authorizer autorest.Authorizer, userAgent string) (*subscriptions.Client, error)

GetSubscriptionsClient gets a Subscriptions Management Client

func GetTenantIDFromCliProfile

func GetTenantIDFromCliProfile() string

GetTenantIDFromCliProfile gets tenant id from az cli profile

func GetUserAssignedIdentitiesClient

func GetUserAssignedIdentitiesClient(subscriptionID string, authorizer autorest.Authorizer, userAgent string) (*msi.UserAssignedIdentitiesClient, error)

GetUserAssignedIdentitiesClient gets a UserAssignedIdentities Management Client

func IsInCloudShell

func IsInCloudShell() bool

IsInCloudShell checks if we are currently running in CloudShell

func TryGetRGandLocation

func TryGetRGandLocation() (rg string, location string)

TryGetRGandLocation tries to get Resource Group and Location Information from az defaults and ACC_env var

Types

type FileShare

type FileShare struct {
	// contains filtered or unexported fields
}

func NewFileShare

func NewFileShare(accountName string, accountKey string, shareName string) (*FileShare, error)

NewFileShare creates a new AzureFileShare client

func (*FileShare) CheckIfFileExists

func (afs *FileShare) CheckIfFileExists(fileName string) (bool, error)

func (*FileShare) DeleteFileFromShare

func (afs *FileShare) DeleteFileFromShare(fileName string) (bool, error)

func (*FileShare) ReadFileFromShare

func (afs *FileShare) ReadFileFromShare(fileName string) (string, error)

func (*FileShare) WriteFileToShare

func (afs *FileShare) WriteFileToShare(fileName string, content []byte, overwrite bool) error

type FileShareDetails

type FileShareDetails struct {
	Name               string
	StorageAccountName string
	StorageAccountKey  string
}

FileShareDetails contains details of the clouddrive FileShare

func GetCloudDriveDetails

func GetCloudDriveDetails(userAgent string) (*FileShareDetails, error)

GetCloudDriveDetails gets the details of the clouddrive cloudshare

type LoginInfo

type LoginInfo struct {
	Authorizer         autorest.Authorizer
	LoginType          LoginType
	OAuthTokenProvider adal.OAuthTokenProvider
}

LoginInfo contains Azure login information

func LoginToAzure

func LoginToAzure(clientID string, clientSecret string, tenantID string, applicationID string) (LoginInfo, error)

LoginToAzure attempts to login to azure

type LoginType

type LoginType int

LoginType is the type of login used

const (
	// ServicePrincipal - logged in using Service Principal
	ServicePrincipal LoginType = iota
	// DeviceCode - logged in using DeviceCode Flow
	DeviceCode
	// CloudShell - logged in using DeviceCode Flow
	CloudShell
	// MSI - logged in using DeviceCode Flow
	MSI
	// CLI - logged in using DeviceCode Flow
	CLI
)

Jump to

Keyboard shortcuts

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