Documentation ¶
Index ¶
- Constants
- func InitiateAzureOIDCFlow(ctx context.Context, sc *SetUpCmd, s spinner.Spinner, gh GhClient, ...) error
- func PromptTenantId(azc AzClientInterface, ctx context.Context) (string, error)
- type AzClient
- func (az *AzClient) AssignSpRole(ctx context.Context, ...) error
- func (az *AzClient) AzAcrExists(acrName string) bool
- func (az *AzClient) AzAksExists(aksName string, resourceGroup string) bool
- func (az *AzClient) AzAppExists(appName string) bool
- func (az *AzClient) CreateAzApp(appName string) (string, error)
- func (az *AzClient) CreateServicePrincipal(appId string) (string, error)
- func (az *AzClient) EnsureAzCli() error
- func (az *AzClient) EnsureAzCliLoggedIn() error
- func (az *AzClient) GetAzCliVersion() (string, error)
- func (az *AzClient) GetAzSubscriptionLabels() ([]SubLabel, error)
- func (az *AzClient) GetAzUpgrade() string
- func (az *AzClient) GetCurrentAzSubscriptionLabel() (SubLabel, error)
- func (az *AzClient) GetServicePrincipal(appId string) (string, error)
- func (az *AzClient) IsLoggedInToAz() bool
- func (az *AzClient) IsSubscriptionIdValid(subscriptionId string) error
- func (az *AzClient) IsValidResourceGroup(subscriptionId string, resourceGroup string) error
- func (az *AzClient) ListResourceGroups(ctx context.Context, subscriptionID string) ([]armresources.ResourceGroup, error)
- func (az *AzClient) ListTenants(ctx context.Context) ([]armsubscription.TenantIDDescription, error)
- func (az *AzClient) LogInToAz() error
- func (az *AzClient) UpgradeAzCli()
- func (az *AzClient) ValidateAzCliInstalled() error
- type AzClientInterface
- type CommandRunner
- type DefaultCommandRunner
- type FakeCommandRunner
- type GhCliClient
- func (gh GhCliClient) EnsureGhCli()
- func (gh GhCliClient) EnsureGhCliInstalled()
- func (gh GhCliClient) EnsureGhCliLoggedIn()
- func (gh GhCliClient) GetRepoNameWithOwner() (string, error)
- func (gh GhCliClient) IsLoggedInToGh() bool
- func (gh GhCliClient) IsValidGhRepo(repo string) error
- func (gh GhCliClient) LogInToGh() error
- type GhClient
- type SetUpCmd
- type SubLabel
Constants ¶
const CONTRIBUTOR_ROLE_ID = "b24988ac-6180-42a0-ab88-20f7382dd24c"
Variables ¶
This section is empty.
Functions ¶
func InitiateAzureOIDCFlow ¶
func PromptTenantId ¶ added in v0.17.0
func PromptTenantId(azc AzClientInterface, ctx context.Context) (string, error)
Prompt the user to select a tenant ID if there are multiple tenants, or return the only tenant ID if there is only one
Types ¶
type AzClient ¶ added in v0.0.34
type AzClient struct { Credential *azidentity.DefaultAzureCredential TenantClient *armsubscription.TenantsClient RoleAssignClient *armauthorization.RoleAssignmentsClient ResourceGroupClient *armresources.ResourceGroupsClient CommandRunner CommandRunner }
AzClient is a struct that contains the Azure client and its dependencies It is used to interact with Azure resources Create a new AzClient with NewAzClient
func NewAzClient ¶ added in v0.17.0
func NewAzClient(cred *azidentity.DefaultAzureCredential) (*AzClient, error)
func (*AzClient) AssignSpRole ¶ added in v0.17.0
func (*AzClient) AzAcrExists ¶ added in v0.17.0
func (*AzClient) AzAksExists ¶ added in v0.17.0
func (*AzClient) AzAppExists ¶ added in v0.17.0
func (*AzClient) CreateAzApp ¶ added in v0.17.0
CreateAzApp creates an Azure app with the given name Returns the appId of the created app
func (*AzClient) CreateServicePrincipal ¶ added in v0.17.0
CreateServicePrincipal creates a service principal with the given appId Returns the objectId of the created service principal
func (*AzClient) EnsureAzCli ¶ added in v0.17.0
EnsureAzCli ensures that the Azure CLI is installed and the user is logged in
func (*AzClient) EnsureAzCliLoggedIn ¶ added in v0.17.0
func (*AzClient) GetAzCliVersion ¶ added in v0.17.0
func (*AzClient) GetAzSubscriptionLabels ¶ added in v0.17.0
func (*AzClient) GetAzUpgrade ¶ added in v0.17.0
func (*AzClient) GetCurrentAzSubscriptionLabel ¶ added in v0.17.0
func (*AzClient) GetServicePrincipal ¶ added in v0.17.0
func (*AzClient) IsLoggedInToAz ¶ added in v0.17.0
func (*AzClient) IsSubscriptionIdValid ¶ added in v0.17.0
func (*AzClient) IsValidResourceGroup ¶ added in v0.17.0
func (*AzClient) ListResourceGroups ¶ added in v0.17.0
func (az *AzClient) ListResourceGroups(ctx context.Context, subscriptionID string) ([]armresources.ResourceGroup, error)
func (*AzClient) ListTenants ¶ added in v0.17.0
func (az *AzClient) ListTenants(ctx context.Context) ([]armsubscription.TenantIDDescription, error)
func (*AzClient) UpgradeAzCli ¶ added in v0.17.0
func (az *AzClient) UpgradeAzCli()
func (*AzClient) ValidateAzCliInstalled ¶ added in v0.17.0
type AzClientInterface ¶ added in v0.17.0
type AzClientInterface interface { AssignSpRole(ctx context.Context, subscriptionId, resourceGroup, servicePrincipalObjectID, roleId string) error AzAcrExists(acrName string) bool AzAksExists(aksName string, resourceGroup string) bool AzAppExists(appName string) bool CreateAzApp(appName string) (string, error) CreateServicePrincipal(appId string) (string, error) EnsureAzCli() error EnsureAzCliLoggedIn() error GetAzCliVersion() (string, error) GetAzSubscriptionLabels() ([]SubLabel, error) GetAzUpgrade() string GetCurrentAzSubscriptionLabel() (SubLabel, error) GetServicePrincipal(appId string) (string, error) IsLoggedInToAz() bool IsSubscriptionIdValid(subscriptionId string) error IsValidResourceGroup(subscriptionId string, resourceGroup string) error ListResourceGroups(ctx context.Context, subscriptionID string) ([]armresources.ResourceGroup, error) ListTenants(ctx context.Context) ([]armsubscription.TenantIDDescription, error) LogInToAz() error UpgradeAzCli() ValidateAzCliInstalled() error }
type CommandRunner ¶ added in v0.17.0
CommandRunner is an interface for executing commands and getting the output/error
type DefaultCommandRunner ¶ added in v0.17.0
type DefaultCommandRunner struct{}
func (*DefaultCommandRunner) RunCommand ¶ added in v0.17.0
func (d *DefaultCommandRunner) RunCommand(args ...string) (string, error)
type FakeCommandRunner ¶ added in v0.17.0
func (*FakeCommandRunner) RunCommand ¶ added in v0.17.0
func (f *FakeCommandRunner) RunCommand(args ...string) (string, error)
type GhCliClient ¶ added in v0.17.0
type GhCliClient struct {
CommandRunner CommandRunner
}
func NewGhClient ¶ added in v0.17.0
func NewGhClient() *GhCliClient
func (GhCliClient) EnsureGhCli ¶ added in v0.17.0
func (gh GhCliClient) EnsureGhCli()
EnsureGhCliInstalled ensures that the Github CLI is installed and the user is logged in
func (GhCliClient) EnsureGhCliInstalled ¶ added in v0.17.0
func (gh GhCliClient) EnsureGhCliInstalled()
func (GhCliClient) EnsureGhCliLoggedIn ¶ added in v0.17.0
func (gh GhCliClient) EnsureGhCliLoggedIn()
func (GhCliClient) GetRepoNameWithOwner ¶ added in v0.17.0
func (gh GhCliClient) GetRepoNameWithOwner() (string, error)
func (GhCliClient) IsLoggedInToGh ¶ added in v0.17.0
func (gh GhCliClient) IsLoggedInToGh() bool
func (GhCliClient) IsValidGhRepo ¶ added in v0.17.0
func (gh GhCliClient) IsValidGhRepo(repo string) error
func (GhCliClient) LogInToGh ¶ added in v0.17.0
func (gh GhCliClient) LogInToGh() error
type SetUpCmd ¶
type SetUpCmd struct { AppName string SubscriptionID string ResourceGroupName string Provider string Repo string TenantId string AzClient AzClientInterface // contains filtered or unexported fields }
func (*SetUpCmd) ValidateSetUpConfig ¶
func (sc *SetUpCmd) ValidateSetUpConfig(gh GhClient, az AzClientInterface) error