input

package
v0.0.0-...-8684de4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
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}$"
)
View Source
const (
	CloudProviderAmazon = "amazon"
	CloudProviderAzure  = "azure"
	CloudProviderGoogle = "google"
)
View Source
const AwsRegionKey = "AWS_DEFAULT_REGION"

Variables

This section is empty.

Functions

func AskCloud

func AskCloud() (string, error)

AskCloud asks for cloud provider

func AskLocation

func AskLocation(banzaiCli cli.Cli, cloud string) (string, error)

AskLocation asks for cloud provider location for the given provider

func AskOrganization

func AskOrganization(banzaiCli cli.Cli) int32

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 AskSecret

func AskSecret(banzaiCli cli.Cli, orgID int32, cloud string) (string, error)

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

func GetAmazonCredentials(profile string, assumeRole string) (string, map[string]string, error)

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

func GetCurrentKubecontext() (string, []byte, error)

GetCurrentKubecontext extracts the Kubernetes context selected locally

func GetOrganization

func GetOrganization(banzaiCli cli.Cli) int32

GetOrganization returns the current organization.

func GetOrganizations

func GetOrganizations(banzaiCli cli.Cli) (map[string]int32, error)

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

func IsCloudProviderSupported(cloud string) error

IsCloudProviderSupported checks whether the given cloud provider is supported

func IsLocationValid

func IsLocationValid(banzaiCli cli.Cli, cloud, location string) error

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

func RewriteLocalhostToHostDockerInternal(in []byte) ([]byte, error)

RewriteLocalhostToHostDockerInternal rewrites a minified kubeconfig to use `host.docker.internal` in place of localhost

func ValidateBucketName

func ValidateBucketName(cloud, name string) error

Types

type QuestionBase

type QuestionBase struct {
	Message string
	Help    string
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL