utils

package
v0.0.0-...-49a42b0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessSecret

func AccessSecret(projectID, secretID string) (string, error)

AccessSecret retrieves a secret from Secret Manager.

func BindingExists

func BindingExists(projectID, region, resourceName, serviceAccount, role string) bool

BindingExists checks if a specific IAM binding already exists.

func ConfirmPrompt

func ConfirmPrompt(message string) bool

ConfirmPrompt asks the user for confirmation with a yes/no question.

func CreateOrUpdateSecret

func CreateOrUpdateSecret(projectID, secretID, secretValue string, quiet bool) error

CreateOrUpdateSecret creates or updates a secret in Secret Manager.

func DisplayVersion

func DisplayVersion()

DisplayVersion prints the version of the Litmus CLI.

func ExtractServiceURL

func ExtractServiceURL(output string) string

ExtractServiceURL extracts the service URL from the gcloud command output.

func FirestoreDatabaseExists

func FirestoreDatabaseExists(projectID string) bool

FirestoreDatabaseExists checks if the default Firestore database exists for the project.

func GenerateRandomPassword

func GenerateRandomPassword(length int) string

GenerateRandomPassword generates a random password of the given length.

func GetAuthCredentials

func GetAuthCredentials(projectID string) (string, string, error)

getAuthCredentials retrieves the basic authentication username and password from Secret Manager.

func GetDefaultProjectID

func GetDefaultProjectID() (string, error)

GetDefaultProjectID retrieves the default project ID from gcloud.

func HandleGcloudError

func HandleGcloudError(err error)

HandleGcloudError provides user-friendly messages for gcloud errors.

func IsAPIEnabled

func IsAPIEnabled(api, projectID string) bool

IsAPIEnabled checks if a given API is enabled for the project.

func JobExists

func JobExists(projectID, region, jobName string) bool

JobExists checks if a Cloud Run job already exists.

func PrintUsage

func PrintUsage()

Updated PrintUsage function

func RemoveAnsiEscapeSequences

func RemoveAnsiEscapeSequences(text string) string

RemoveAnsiEscapeSequences removes ANSI escape sequences from a string.

func SelectUpstreamURL

func SelectUpstreamURL() (string, error)

SelectUpstreamURL presents a list of upstream URLs to the user and lets them choose one.

func ServiceAccountExists

func ServiceAccountExists(projectID, serviceAccount string) bool

ServiceAccountExists checks if a service account already exists.

func ServiceExists

func ServiceExists(projectID, region, serviceName string) bool

ServiceExists checks if a Cloud Run service already exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

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