Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCachedToken ¶ added in v0.3.1
func SetCachedToken(s *TokenSource, token Token)
SetCachedToken seeds a TokenSource with a pre-baked Token. Tests use it to bypass the OAuth2 round trip when only the downstream API matters.
Types ¶
type Cloud ¶
type Cloud string
func (Cloud) ActiveDirectoryEndpoint ¶
func (Cloud) MicrosoftGraphEndpoint ¶ added in v0.3.1
MicrosoftGraphEndpoint returns the Microsoft Graph resource URL used as the OAuth2 scope and base URL for Microsoft Graph requests in the given cloud.
func (Cloud) ResourceManagerEndpoint ¶
type Credential ¶
type Credential struct {
ClientID string
ClientSecret string
TenantID string
SubscriptionID string
Cloud Cloud
}
Credential is the provider-local Azure credential shape used by the lightweight ARM client. SubscriptionID is optional; when empty the provider enumerates all visible subscriptions first.
func FromOptions ¶
func FromOptions(options schema.Options) (Credential, error)
func New ¶
func New(clientID, clientSecret, tenantID, subscriptionID string, cloud Cloud) Credential
func (Credential) Validate ¶
func (c Credential) Validate() error
type TokenSource ¶
type TokenSource struct {
// contains filtered or unexported fields
}
TokenSource fetches and caches OAuth2 client credentials tokens.
func NewTokenSource ¶
func NewTokenSource(cred Credential, httpClient *http.Client) *TokenSource
NewTokenSource returns a TokenSource bound to the ARM resource scope of the credential's cloud.
func NewTokenSourceForScope ¶ added in v0.3.1
func NewTokenSourceForScope(cred Credential, httpClient *http.Client, scope string) *TokenSource
NewTokenSourceForScope returns a TokenSource that mints tokens for an explicit OAuth2 scope (e.g. Microsoft Graph). Use the resource-suffixed `.default` form (e.g. "https://graph.microsoft.com/.default").