Documentation ¶
Index ¶
- Constants
- Variables
- type CLI
- func (cli CLI) ActiveSubscription() (Subscription, error)
- func (cli CLI) GetSubscriptionByName(subscriptionName string) (Subscription, bool)
- func (cli CLI) InteractiveLogin(extraArgs []string) error
- func (cli CLI) IterativeTenantLogin(extraArgs []string) error
- func (cli *CLI) MapTenantIdsToNames()
- func (cli *CLI) Reload() error
- func (CLI) SetSubscription(subscription Subscription) error
- func (cli CLI) SubscriptionNames() []string
- func (cli CLI) Subscriptions() utils.ComparableNamedSlice[Subscription]
- func (cli CLI) Tenants() []Tenant
- func (cli CLI) TryFindSubscription(subscriptionName string) (utils.ComparableNamedSlice[Subscription], error)
- func (cli *CLI) UpdateTenants() error
- type Profile
- type Subscription
- type Tenant
Constants ¶
const ( AZ_COMMAND = "az" CONFIG_DIR_ENV = "AZURE_CONFIG_DIR" PROFILES_JSON = "azureProfile.json" TENANTS_JSON = "azctxTenants.json" )
const TENANT_LEVEL_ACCOUNT_NAME = "N/A(tenant level account)"
Variables ¶
var FilterTenantLevelAccount bool = true // Filter tenant level accounts with no available subscriptions, will be manipulated by the flag --filter-tenant-level in cmd/root.go#L47
Functions ¶
This section is empty.
Types ¶
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI represents the azure cli
func (CLI) ActiveSubscription ¶
func (cli CLI) ActiveSubscription() (Subscription, error)
ActiveSubscription returns the active subscription
func (CLI) GetSubscriptionByName ¶
func (cli CLI) GetSubscriptionByName(subscriptionName string) (Subscription, bool)
GetSubscriptionByName returns the azure subscription with the given name
func (CLI) InteractiveLogin ¶
InteractiveLogin executes the az login command
func (CLI) IterativeTenantLogin ¶
IterativeTenantLogin explicitly executes the az login command for each tenant
func (*CLI) MapTenantIdsToNames ¶
func (cli *CLI) MapTenantIdsToNames()
MapTenanIdsToNames maps the tenant ids to the tenant names
func (*CLI) Reload ¶
Reload refreshes the CLI instance by fetching the latest data from the azure cli config files
func (CLI) SetSubscription ¶
func (CLI) SetSubscription(subscription Subscription) error
SetSubscription sets the default subscription in the azure config file
func (CLI) SubscriptionNames ¶
SubscriptionNames returns the names of the given subscriptions
func (CLI) Subscriptions ¶
func (cli CLI) Subscriptions() utils.ComparableNamedSlice[Subscription]
Subscriptions returns all subscriptions
func (CLI) TryFindSubscription ¶
func (cli CLI) TryFindSubscription(subscriptionName string) (utils.ComparableNamedSlice[Subscription], error)
TryFindSubscription fuzzy searches for the azure subscription in the given AzureProfilesConfig
func (*CLI) UpdateTenants ¶
UpdateTenants fetches all available tenants from the azure management api and persists them to the azctxTenants.json file
type Profile ¶
type Profile struct { Subscriptions utils.ComparableNamedSlice[Subscription] `json:"subscriptions"` InstallationId string `json:"installationId"` }
Profile represents the AzureProfiles.json file
type Subscription ¶
type Subscription struct { Id string `json:"id"` Name string `json:"name"` State string `json:"state"` User struct { Name string `json:"name"` Type string `json:"type"` } `json:"user"` IsDefault bool `json:"isDefault"` Tenant string `json:"tenantId"` TenantName string `` // This is a duplicate of Tenant, used only for display purposes Environment string `json:"environmentName"` HomeTenantId string `json:"homeTenantId"` ManagedBy []struct { Id string `json:"tenantId"` } `json:"managedByTenants"` }
Subscription represents a subscription in the AzureProfiles.json file
func (Subscription) Compare ¶
func (s Subscription) Compare(other utils.Comparable) int
Implement utils.Compartable interface