Documentation ¶
Index ¶
- type Account
- type Location
- type Manager
- type Subscription
- type SubscriptionCredentialProvider
- type SubscriptionTenantResolver
- type SubscriptionsManager
- func (m *SubscriptionsManager) ClearSubscriptions(ctx context.Context) error
- func (m *SubscriptionsManager) GetLocation(ctx context.Context, subscriptionId, locationName string) (Location, error)
- func (m *SubscriptionsManager) GetSubscription(ctx context.Context, subscriptionId string) (*Subscription, error)
- func (m *SubscriptionsManager) GetSubscriptions(ctx context.Context) ([]Subscription, error)
- func (m *SubscriptionsManager) ListLocations(ctx context.Context, subscriptionId string) ([]Location, error)
- func (m *SubscriptionsManager) ListSubscriptions(ctx context.Context) ([]Subscription, error)
- func (m *SubscriptionsManager) LookupTenant(ctx context.Context, subscriptionId string) (tenantId string, err error)
- func (m *SubscriptionsManager) RefreshSubscriptions(ctx context.Context) error
- type SubscriptionsService
- func (s *SubscriptionsService) GetSubscription(ctx context.Context, subscriptionId string, tenantId string) (*armsubscriptions.Subscription, error)
- func (s *SubscriptionsService) ListSubscriptionLocations(ctx context.Context, subscriptionId string, tenantId string) ([]Location, error)
- func (s *SubscriptionsService) ListSubscriptions(ctx context.Context, tenantId string) ([]*armsubscriptions.Subscription, error)
- func (s *SubscriptionsService) ListTenants(ctx context.Context) ([]armsubscriptions.TenantIDDescription, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { DefaultSubscription *Subscription `json:"defaultSubscription"` DefaultLocation *Location `json:"defaultLocation"` }
AZD Account configuration
type Location ¶
type Location struct { // The name of the location (e.g. "westus2") Name string `json:"name"` // The human friendly name of the location (e.g. "West US 2") DisplayName string `json:"displayName"` // The human friendly name of the location, prefixed with a // region name (e.g "(US) West US 2") RegionalDisplayName string `json:"regionalDisplayName"` }
type Manager ¶
type Manager interface { Clear(ctx context.Context) error HasDefaultSubscription() bool HasDefaultLocation() bool GetAccountDefaults(ctx context.Context) (*Account, error) GetDefaultLocationName(ctx context.Context) string GetDefaultSubscriptionID(ctx context.Context) string GetSubscriptions(ctx context.Context) ([]Subscription, error) GetSubscriptionsWithDefaultSet(ctx context.Context) ([]Subscription, error) GetLocations(ctx context.Context, subscriptionId string) ([]Location, error) SetDefaultSubscription(ctx context.Context, subscriptionId string) (*Subscription, error) SetDefaultLocation(ctx context.Context, subscriptionId string, location string) (*Location, error) }
func NewManager ¶
func NewManager( configManager config.FileConfigManager, subManager *SubscriptionsManager) (Manager, error)
Creates a new Account Manager instance
type Subscription ¶
type SubscriptionCredentialProvider ¶
type SubscriptionCredentialProvider interface {
CredentialForSubscription(ctx context.Context, subscriptionId string) (azcore.TokenCredential, error)
}
SubscriptionCredentialProvider provides an azcore.TokenCredential configured to use the tenant id that corresponds to the tenant the given subscription is located in.
func NewSubscriptionCredentialProvider ¶
func NewSubscriptionCredentialProvider( subResolver SubscriptionTenantResolver, credProvider auth.MultiTenantCredentialProvider, ) SubscriptionCredentialProvider
type SubscriptionTenantResolver ¶
type SubscriptionTenantResolver interface { // Resolve the tenant ID required by the current account to access the given subscription. LookupTenant(ctx context.Context, subscriptionId string) (tenantId string, err error) }
SubscriptionTenantResolver allows resolving the correct tenant ID that allows the current account access to a given subscription.
type SubscriptionsManager ¶
type SubscriptionsManager struct {
// contains filtered or unexported fields
}
SubscriptionsManager manages listing, storing and retrieving subscriptions for the current account.
Since the application supports multi-tenancy, subscriptions can be accessed by the user through different tenants. To lookup access to a given subscription, LookupTenant can be used to lookup the current account's required tenantID to access a given subscription.
func NewSubscriptionsManager ¶
func NewSubscriptionsManager( service *SubscriptionsService, auth *auth.Manager, console input.Console) (*SubscriptionsManager, error)
func (*SubscriptionsManager) ClearSubscriptions ¶
func (m *SubscriptionsManager) ClearSubscriptions(ctx context.Context) error
Clears stored cached subscriptions. This can only return an error if a filesystem error other than ErrNotExist occurred.
func (*SubscriptionsManager) GetLocation ¶
func (*SubscriptionsManager) GetSubscription ¶
func (m *SubscriptionsManager) GetSubscription(ctx context.Context, subscriptionId string) (*Subscription, error)
func (*SubscriptionsManager) GetSubscriptions ¶
func (m *SubscriptionsManager) GetSubscriptions(ctx context.Context) ([]Subscription, error)
GetSubscriptions retrieves subscriptions accessible by the current account with caching semantics.
Unlike ListSubscriptions, GetSubscriptions first examines the subscriptions cache. On cache miss, subscriptions are fetched, the cached is updated, before the result is returned.
func (*SubscriptionsManager) ListLocations ¶
func (*SubscriptionsManager) ListSubscriptions ¶
func (m *SubscriptionsManager) ListSubscriptions(ctx context.Context) ([]Subscription, error)
ListSubscription lists subscriptions accessible by the current account by calling azure management services.
func (*SubscriptionsManager) LookupTenant ¶
func (m *SubscriptionsManager) LookupTenant(ctx context.Context, subscriptionId string) (tenantId string, err error)
Resolve the tenant ID required by the current account to access the given subscription.
If the account is logged in with a service principal specified, the service principal's tenant ID is immediately returned (single-tenant mode).
Otherwise, the tenant ID is resolved by examining the stored subscriptionID to tenantID cache. See SubscriptionCache for details about caching. On cache miss, all tenants and subscriptions are queried from azure management services for the current account to build the mapping and populate the cache.
func (*SubscriptionsManager) RefreshSubscriptions ¶
func (m *SubscriptionsManager) RefreshSubscriptions(ctx context.Context) error
Updates stored cached subscriptions.
type SubscriptionsService ¶
type SubscriptionsService struct {
// contains filtered or unexported fields
}
SubscriptionsService allows querying of subscriptions and tenants.
func NewSubscriptionsService ¶
func NewSubscriptionsService( credentialProvider auth.MultiTenantCredentialProvider, armClientOptions *arm.ClientOptions, ) *SubscriptionsService
func (*SubscriptionsService) GetSubscription ¶
func (s *SubscriptionsService) GetSubscription( ctx context.Context, subscriptionId string, tenantId string) (*armsubscriptions.Subscription, error)
func (*SubscriptionsService) ListSubscriptionLocations ¶
func (s *SubscriptionsService) ListSubscriptionLocations( ctx context.Context, subscriptionId string, tenantId string) ([]Location, error)
ListSubscriptionLocations lists physical locations in Azure for the given subscription.
func (*SubscriptionsService) ListSubscriptions ¶
func (s *SubscriptionsService) ListSubscriptions( ctx context.Context, tenantId string, ) ([]*armsubscriptions.Subscription, error)
func (*SubscriptionsService) ListTenants ¶
func (s *SubscriptionsService) ListTenants(ctx context.Context) ([]armsubscriptions.TenantIDDescription, error)