Documentation ¶
Index ¶
- Constants
- func AskCloud() (string, error)
- func AskLocation(banzaiCli cli.Cli, cloud string) (string, error)
- func AskOrganization(banzaiCli cli.Cli) int32
- func AskResourceGroup(banzaiCli cli.Cli, orgID int32, secretID, defaultResourceGroup string) (string, error)
- func AskSecret(banzaiCli cli.Cli, orgID int32, cloud string) (string, error)
- func BucketNameValidator(cloud string) survey.Validator
- func DoQuestions(questions []QuestionMaker) error
- func GetAmazonCredentials(profile string, assumeRole string) (string, map[string]string, error)
- func GetAmazonCredentialsRegion(profile string, defaultRegion string, assumeRole string) (string, string, map[string]string, error)
- func GetCurrentKubecontext() (string, []byte, error)
- func GetOrganization(banzaiCli cli.Cli) int32
- func GetOrganizations(banzaiCli cli.Cli) (map[string]int32, error)
- func InputNumberValidator(min, max int) survey.Validator
- func IsCloudProviderSupported(cloud string) error
- func IsLocationValid(banzaiCli cli.Cli, cloud, location string) error
- func IsResourceGroupValid(banzaiCli cli.Cli, orgID int32, secretID string, resourceGroup string) error
- func RewriteLocalhostToHostDockerInternal(in []byte) ([]byte, error)
- func ValidateBucketName(cloud, name string) error
- type QuestionBase
- type QuestionConfirm
- type QuestionInput
- type QuestionMaker
- type QuestionSelect
Constants ¶
const ( AmazonBucketNameRegex = "^[a-z]([-a-z0-9]{1,62}[a-z0-9])$" AzureBucketNameRegex = "^[a-z]([-a-z0-9]{1,61}[a-z0-9])$" GoogleBucketNameRegex = "^[a-z]([-a-z0-9]{1,61}[a-z0-9])$" BucketNameRegex = "^[\\w-.]{3,63}$" )
const ( CloudProviderAmazon = "amazon" CloudProviderAzure = "azure" CloudProviderGoogle = "google" )
const AwsRegionKey = "AWS_DEFAULT_REGION"
Variables ¶
This section is empty.
Functions ¶
func AskLocation ¶
AskLocation asks for cloud provider location for the given provider
func AskOrganization ¶
AskOrganization asks for an organization.
func AskResourceGroup ¶
func AskResourceGroup(banzaiCli cli.Cli, orgID int32, secretID, defaultResourceGroup string) (string, error)
AskResourceGroup asks for Azure resource group available with the given secret ID
func BucketNameValidator ¶
func BucketNameValidator(cloud string) survey.Validator
BucketNameValidator validates bucket name for the specified cloud provider
func DoQuestions ¶
func DoQuestions(questions []QuestionMaker) error
func GetAmazonCredentials ¶
GetAmazonCredentials extracts the local credentials from env vars and user profile
func GetAmazonCredentialsRegion ¶
func GetAmazonCredentialsRegion(profile string, defaultRegion string, assumeRole string) (string, string, map[string]string, error)
GetAmazonCredentialsRegion extracts the local credentials from env vars and user profile while ensuring a region
func GetCurrentKubecontext ¶
GetCurrentKubecontext extracts the Kubernetes context selected locally
func GetOrganization ¶
GetOrganization returns the current organization.
func GetOrganizations ¶
GetOrganizations returns a map with the list of organizations where the key is the organization name and the value is the id
func InputNumberValidator ¶
func InputNumberValidator(min, max int) survey.Validator
InputNumberValidator validates an integer number input, between min and max values
func IsCloudProviderSupported ¶
IsCloudProviderSupported checks whether the given cloud provider is supported
func IsLocationValid ¶
IsLocationValid checks whether the given location is valid the the specified cloud provider
func IsResourceGroupValid ¶
func IsResourceGroupValid(banzaiCli cli.Cli, orgID int32, secretID string, resourceGroup string) error
IsResourceGroupValid checks whether the given resource group name is valid
func RewriteLocalhostToHostDockerInternal ¶
RewriteLocalhostToHostDockerInternal rewrites a minified kubeconfig to use `host.docker.internal` in place of localhost
func ValidateBucketName ¶
Types ¶
type QuestionBase ¶
type QuestionConfirm ¶
type QuestionConfirm struct { QuestionBase DefaultValue bool Output *bool }
func (QuestionConfirm) Do ¶
func (q QuestionConfirm) Do() error
type QuestionInput ¶
type QuestionInput struct { QuestionBase DefaultValue string Output *string }
func (QuestionInput) Do ¶
func (q QuestionInput) Do() error
type QuestionMaker ¶
type QuestionMaker interface {
Do() error
}
type QuestionSelect ¶
type QuestionSelect struct { QuestionInput Options []string }
func (QuestionSelect) Do ¶
func (q QuestionSelect) Do() error