utils

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllBackendStacksString

func AllBackendStacksString() string

func AllMobileStacksString

func AllMobileStacksString() string

func AllStacksString

func AllStacksString() string

func AllWebStacksString

func AllWebStacksString() string

func AppendToFile

func AppendToFile(path, data string) error

AppendToFile will append given string to existing file.

func CheckStacksExist

func CheckStacksExist(stacks []string) error

func ConvertStacksIntoString

func ConvertStacksIntoString(stacks []string) string

func ConvertToCamelCase

func ConvertToCamelCase(slice []string) []string

CovertToCamelCase return camel cased array of string of the given array of string.

func CreateDirectory

func CreateDirectory(filePath string) error

CreateDirectory creates directory according to the input.

func CreateFile

func CreateFile(file string) error

func CreateGithubWorkflowDir

func CreateGithubWorkflowDir()

func CreateInfraOutputsJson

func CreateInfraOutputsJson(environment string) error

func CreateMessageTemplate

func CreateMessageTemplate(name, text string) *template.Template

CreateMessageTemplate creates new text template for printing colorful logs.

func CreateStackDirectory

func CreateStackDirectory(dirName, stack, database string) string

CreateStackDirectory will create a a directory based on the user input, stack and the database selected.

func CurrentDirectory

func CurrentDirectory() string

CurrentDirectory will give the root directory.

func EndsWith

func EndsWith(inputString, endString string) bool

func ExistingStackAndDatabase

func ExistingStackAndDatabase(dirName string) (string, string)

ExistingStackAndDatabase return stack and database of the given stack directory name.

func FetchExistingPortNumber

func FetchExistingPortNumber(stackDir, portName string) string

func FindExistingGraphqlBackendAndWebStacks

func FindExistingGraphqlBackendAndWebStacks() ([]string, []string)

func FindService

func FindService(dirName string) string

FindService return service of the given stack directory name.

func FindStackAndDatabase

func FindStackAndDatabase(dirName string) (string, string)

FindStackAndDatabase return stack and database of given directory name.

func FindStackDirectoriesByConfigStacks

func FindStackDirectoriesByConfigStacks(configStacks []string) []string

FindStackDirectoriesByConfigStacks will return an array of stack directories present in the root directory. Eg: [api-node-hapi-mysql, fe-react-web]

func FindUserInputStackName

func FindUserInputStackName(dirName string) string

FindUserInputStackName return user-input of the given stack directory name.

func GetCloudProvider

func GetCloudProvider(cp string) string

func GetDatabase

func GetDatabase(db string) string

func GetDatabasePortNumber

func GetDatabasePortNumber(driver string) int

func GetEnvironmentValue

func GetEnvironmentValue(env string) string

func GetExistingInfraStacks

func GetExistingInfraStacks() []string

GetExistingInfraStacks fetch stack files inside the stacks directory.

func GetExistingStacks

func GetExistingStacks() []string

func GetExistingStacksDatabasesAndDirectories

func GetExistingStacksDatabasesAndDirectories() ([]string, []string, []string)

GetExistingStacksDatabasesAndDirectories return existing stacks details. Stack details contain stack name, database, and the directory name.

func GetPackageManagerOfUser

func GetPackageManagerOfUser() string

GetPackageManagerOfUser checks whether yarn or npm is installed in the user's machine. If both are not installed, then the system will throw error.

func GetPortNumber

func GetPortNumber(defaultPN int) int

func GetProjectName

func GetProjectName() string

GetProjectName returns projectName

func GetShortEnvName

func GetShortEnvName(environment string) string

GetShortEnvName return short environment name for the given environment.

func GetStackByFlags

func GetStackByFlags(stack string) string

func GetStackDetails

func GetStackDetails(service string) []stackDetails

GetStackDetails returns an array of StackDetails for showing details when user selects stacks prompt.

func GetSuffixOfStack

func GetSuffixOfStack(stack, database string) string

GetSuffixOfStack returns suffix name for the given stack and database.

func IsBackendStack

func IsBackendStack(stack string) (string, bool)

func IsBackendWebAndMobileExist

func IsBackendWebAndMobileExist() (bool, bool, bool)

IsBackendWebAndMobileExist checks backend, web and mobile stacks is exist or not.

func IsExists

func IsExists(path string) (bool, error)

IsExists will check if the path exists or no.

func IsMobileStack

func IsMobileStack(stack string) (string, bool)

func IsWebStack

func IsWebStack(stack string) (string, bool)

func MakeDirectory

func MakeDirectory(path string, dirName string) error

MakeDirectory will make directory according to input.

func MakeFile

func MakeFile(path, fileName string) error

MakeFile will create new file according to input path and file name.

func PrintErrorMessage

func PrintErrorMessage(message string) error

PrintErrorMessage prints the given message in red color as error message

func PrintInfoMessage

func PrintInfoMessage(message string) error

PrintInfoMessage prints given message in cyan color as info message in terminal.

func PrintMultiSelectMessage

func PrintMultiSelectMessage(messages []string) error

PrintMultiSelectMessage prints multi selected options.

func PrintWarningMessage

func PrintWarningMessage(message string) error

PrintWarningMessage prints given message in yellow color as warning message in terminal.

func ReadAllContents

func ReadAllContents(path string) ([]string, error)

Read all existing in the given path.

func ReadJsonDataInSstOutputs

func ReadJsonDataInSstOutputs() map[string]interface{}

func RemoveAll

func RemoveAll(path string) error

Remove all the files existing in the path directory and the path.

func RemoveAllContents

func RemoveAllContents(path string) error

Remove all existing files in the given path.

func RemoveFile

func RemoveFile(path string) error

Remove a single file

func RunCommandWithLogs

func RunCommandWithLogs(path string, name string, args ...string) error

RunCommandWithLogs runs the given command with logs.

func RunCommandWithoutLogs

func RunCommandWithoutLogs(path string, name string, args ...string) error

RunCommandWithLogs runs the given command without logs.

func SplitStackDirectoryName

func SplitStackDirectoryName(dirName string) (string, string, string, string)

SplitStackDirectoryName returns user-input, stack-suffix and last-suffix of the given stack directory name.

func StartsWith

func StartsWith(inputString, startString string) bool

func TruncateAndWriteToFile

func TruncateAndWriteToFile(path, file, data string) error

TruncateAndWriteToFile will delete all the existing data and write input data into the file.

func UseCD

func UseCD() string

func UseCI

func UseCI() string

func UseCloudProvider

func UseCloudProvider() string

func UseDatabase

func UseDatabase() string

func UseDirectory

func UseDirectory() string

func UseDockerCompose

func UseDockerCompose() string

func UseEnvironment

func UseEnvironment() string

func UseInfraStacks

func UseInfraStacks() string

func UsePlatform

func UsePlatform() string

func UseService

func UseService() string

func UseStack

func UseStack() string

func WriteToFile

func WriteToFile(file, data string) error

WriteToFile will delete all the existing data and write input data into the file.

Types

type BackendOutputKeys

type BackendOutputKeys struct {
	TaskRole                     string `json:"taskRole"`
	Image                        string `json:"image"`
	ContainerName                string `json:"containerName"`
	ContainerPort                string `json:"containerPort"`
	ExecutionRole                string `json:"executionRole"`
	TaskDefinition               string `json:"taskDefinition"`
	LogDriver                    string `json:"logDriver"`
	LogDriverOptions             LogDriverOptionsKeys
	Family                       string `json:"family"`
	AwsRegion                    string `json:"awsRegion"`
	RedisHost                    string `json:"redisHost"`
	SecretName                   string `json:"secretName"`
	DatabaseHost                 string `json:"databaseHost"`
	DatabaseName                 string `json:"databaseName"`
	SecretArn                    string `json:"secretArn"`
	LoadBalancerDns              string `json:"loadBalancerDns"`
	ServiceName                  string `json:"serviceName"`
	ClusterName                  string `json:"clusterName"`
	ElasticContainerRegistryRepo string `json:"elasticContainerRegistryRepo"`
}

type LogDriverOptionsKeys

type LogDriverOptionsKeys struct {
	AwsLogsGroup        string `json:"awsLogsGroup"`
	AwsLogsStreamPrefix string `json:"awsLogsStreamPrefix"`
	AwsLogsRegion       string `json:"awsLogsRegion"`
}

type TaskDefinitionDetails

type TaskDefinitionDetails struct {
	BackendObj  BackendOutputKeys
	Environment string
	EnvName     string
	SecretName  string
}

func GetOutputsBackendObject

func GetOutputsBackendObject(environment, stackDir string) TaskDefinitionDetails

type WebOutputKeys

type WebOutputKeys struct {
	DistributionId string `json:"distributionId"`
	BucketName     string `json:"bucketName"`
	SiteUrl        string `json:"siteUrl"`
}

Jump to

Keyboard shortcuts

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