cli

package module
Version: v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 15 Imported by: 102

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessTokensPath

func AccessTokensPath() (string, error)

AccessTokensPath returns the path where access tokens are stored from the Azure CLI TODO(#199): add unit test.

func GetAzureCLICommand added in v0.4.3

func GetAzureCLICommand() *exec.Cmd

GetAzureCLICommand can be used to run arbitrary Azure CLI command

func ParseExpirationDate

func ParseExpirationDate(input string) (*time.Time, error)

ParseExpirationDate parses either a Azure CLI or CloudShell date into a time object

func ProfilePath

func ProfilePath() (string, error)

ProfilePath returns the path where the Azure Profile is stored from the Azure CLI

Types

type GetAccessTokenParams added in v0.4.3

type GetAccessTokenParams struct {
	Resource     string
	ResourceType string
	Subscription string
	Tenant       string
}

GetAccessTokenParams is the parameter struct of GetTokenFromCLIWithParams

type Profile

type Profile struct {
	InstallationID string         `json:"installationId"`
	Subscriptions  []Subscription `json:"subscriptions"`
}

Profile represents a Profile from the Azure CLI

func LoadProfile

func LoadProfile(path string) (result Profile, err error)

LoadProfile restores a Profile object from a file located at 'path'.

type Subscription

type Subscription struct {
	EnvironmentName string `json:"environmentName"`
	ID              string `json:"id"`
	IsDefault       bool   `json:"isDefault"`
	Name            string `json:"name"`
	State           string `json:"state"`
	TenantID        string `json:"tenantId"`
	User            *User  `json:"user"`
}

Subscription represents a Subscription from the Azure CLI

type Token

type Token struct {
	AccessToken      string `json:"accessToken"`
	Authority        string `json:"_authority"`
	ClientID         string `json:"_clientId"`
	ExpiresOn        string `json:"expiresOn"`
	IdentityProvider string `json:"identityProvider"`
	IsMRRT           bool   `json:"isMRRT"`
	RefreshToken     string `json:"refreshToken"`
	Resource         string `json:"resource"`
	TokenType        string `json:"tokenType"`
	UserID           string `json:"userId"`
}

Token represents an AccessToken from the Azure CLI

func GetTokenFromCLI

func GetTokenFromCLI(resource string) (*Token, error)

GetTokenFromCLI gets a token using Azure CLI 2.0 for local development scenarios.

func GetTokenFromCLIWithParams added in v0.4.3

func GetTokenFromCLIWithParams(params GetAccessTokenParams) (*Token, error)

GetTokenFromCLIWithParams gets a token using Azure CLI 2.0 for local development scenarios.

func LoadTokens

func LoadTokens(path string) ([]Token, error)

LoadTokens restores a set of Token objects from a file located at 'path'.

func (Token) ToADALToken

func (t Token) ToADALToken() (converted adal.Token, err error)

ToADALToken converts an Azure CLI `Token“ to an `adal.Token“

type User

type User struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

User represents a User from the Azure CLI

Jump to

Keyboard shortcuts

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