utils

package
v0.0.0-...-260b785 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const DockerfileGolang string = `` /* 251-byte string literal not displayed */

DockerfileGolang is the docker file to use for golang projects

View Source
const DockerfileNodejs string = `` /* 167-byte string literal not displayed */

DockerfileNodejs is the docker file to use for node js projects

View Source
const DockerfilePython string = `` /* 199-byte string literal not displayed */

DockerfilePython is the docker file to use for python projects

Variables

This section is empty.

Functions

func AppendConfigToDisk

func AppendConfigToDisk(specObj *model.SpecObject, filename string) error

AppendConfigToDisk creates a yml file or appends to existing

func ChangeSelectedAccount

func ChangeSelectedAccount(clusterName string) error

ChangeSelectedAccount change selected account according to cluster name provided

func CheckPortAvailability

func CheckPortAvailability(port, s string) (string, error)

CheckPortAvailability checks if specified port is available on local machine

func CloseTheCloser

func CloseTheCloser(c io.Closer)

CloseTheCloser closes the closer

func CreateChart

func CreateChart(chartLocation, downloadURL string) (*action.Configuration, *chart.Chart, error)

CreateChart returns chart object, which describe the provide chart

func CreateConfigFile

func CreateConfigFile(path string) error

CreateConfigFile create empty config file

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string) error

CreateDirIfNotExist creates a directory if it doesn't already exists

func CreateFileIfNotExist

func CreateFileIfNotExist(path, content string) error

CreateFileIfNotExist creates a file with the provided content if it doesn't already exists

func CreateSpecObject

func CreateSpecObject(api, objType string, meta map[string]string, spec interface{}) (*model.SpecObject, error)

CreateSpecObject returns the string equivalent of the git op object

func ExtractValuesObj

func ExtractValuesObj(setValuesFlag, valuesYamlFile string) (map[string]interface{}, error)

ExtractValuesObj extract chart values from yaml file & cli flags

func FileExists

func FileExists(filename string) bool

FileExists checks if the file exists

func GenerateAccountsFile

func GenerateAccountsFile(credential *model.Credential) error

GenerateAccountsFile generates the yaml file for accounts

func Get

func Get(method, url string, params map[string]string, vPtr interface{}) error

Get gets spec object

func GetContainers

func GetContainers(ctx context.Context, dockerClient *client.Client, clusterName, containerType string) ([]types.Container, error)

GetContainers gets container running in a specific cluster

func GetCredentials

func GetCredentials() (*model.Credential, error)

GetCredentials get all the stored credentials

func GetDatabaseContainerName

func GetDatabaseContainerName(id, alias string) string

GetDatabaseContainerName provides name for database container

func GetHelmChartDownloadURL

func GetHelmChartDownloadURL(url, version string) string

GetHelmChartDownloadURL adjusts the url prefixes according to the version

func GetInternalServiceDomain

func GetInternalServiceDomain(projectID, serviceID, version string) string

GetInternalServiceDomain is used for getting internal service domain

func GetMountConfigFilePath

func GetMountConfigFilePath(id string) string

GetMountConfigFilePath returns the path of the config files to be mounted in space cloud

func GetMountHostsFilePath

func GetMountHostsFilePath(id string) string

GetMountHostsFilePath returns the path of the hosts files to be mounted in in space cloud

func GetMountRoutingConfigPath

func GetMountRoutingConfigPath(id string) string

GetMountRoutingConfigPath returns the path of the routing config to be mounted in space cloud

func GetMountSecretsDir

func GetMountSecretsDir(id string) string

GetMountSecretsDir returns the path of the secret dir to be mounted in space cloud

func GetMountTempSecretsDir

func GetMountTempSecretsDir(id string) string

GetMountTempSecretsDir returns the path of the temp secret dir to be mounted in space cloud

func GetNetworkName

func GetNetworkName(clusterName string) string

GetNetworkName provides network name of particular cluster

func GetProjectID

func GetProjectID() (string, bool)

GetProjectID checks if project is specified in flags

func GetProjectsFromSC

func GetProjectsFromSC() ([]*model.Projects, error)

GetProjectsFromSC returns the projects array from sc

func GetProjectsNamesFromArray

func GetProjectsNamesFromArray(projects []*model.Projects) ([]string, error)

GetProjectsNamesFromArray returns the array of projects names

func GetRegistryContainerName

func GetRegistryContainerName(clusterName string) string

GetRegistryContainerName provides name for registry container

func GetSCImageName

func GetSCImageName(imagePrefix, version string, t model.ImageType) string

GetSCImageName get the sc image name and add the image prefix when required

func GetScContainers

func GetScContainers(clusterName, name string) string

GetScContainers provides name for space-cloud containers

func GetSecretsDir

func GetSecretsDir(id string) string

GetSecretsDir returns the path of the directory storing all the secrets

func GetServiceDomain

func GetServiceDomain(projectID, serviceID string) string

GetServiceDomain is used for getting the main service domain

func GetSpaceCloudClusterDirectory

func GetSpaceCloudClusterDirectory(clusterID string) string

GetSpaceCloudClusterDirectory gets the root space cloud directory

func GetSpaceCloudConfigFilePath

func GetSpaceCloudConfigFilePath(id string) string

GetSpaceCloudConfigFilePath returns the path of the file storing the config

func GetSpaceCloudDirectory

func GetSpaceCloudDirectory() string

GetSpaceCloudDirectory gets the root space cloud directory

func GetSpaceCloudHostsFilePath

func GetSpaceCloudHostsFilePath(id string) string

GetSpaceCloudHostsFilePath returns the path of the hosts files used in space cloud

func GetSpaceCloudRoutingConfigPath

func GetSpaceCloudRoutingConfigPath(id string) string

GetSpaceCloudRoutingConfigPath returns the path of the file storing the service routing config

func GetTempSecretsDir

func GetTempSecretsDir(id string) string

GetTempSecretsDir gets the path of the directory storing all the temp secrets

func HelmGet

func HelmGet(releaseName string) (*release.Release, error)

HelmGet gets chart info

func HelmInstall

func HelmInstall(chartReleaseName, chartLocation, downloadURL, namespace string, valuesFileObj map[string]interface{}) (*chart.Chart, error)

HelmInstall install helm chart

func HelmList

func HelmList(filterRegex string) ([]*release.Release, error)

HelmList uninstall helm chart

func HelmShow

func HelmShow(chartLocation, downloadURL, releaseArg string) (string, error)

HelmShow executes the helm show command

func HelmUninstall

func HelmUninstall(releaseName string) error

HelmUninstall uninstall helm chart

func HelmUpgrade

func HelmUpgrade(releaseName, chartLocation, downloadURL, namespace string, valuesFileObj map[string]interface{}) (*chart.Chart, error)

HelmUpgrade upgrade space cloud chart

func LogDebug

func LogDebug(message string, extraFields map[string]interface{})

LogDebug logs the debug message in proper format

func LogError

func LogError(message string, err error) error

LogError logs the error in the proper format

func LogInfo

func LogInfo(message string)

LogInfo logs te info message in the proper format

func LoginStart

func LoginStart(userName, ID, key, url string) error

LoginStart take info of the user

func LoginWithSelectedAccount

func LoginWithSelectedAccount() (*model.Account, string, error)

LoginWithSelectedAccount returns selected account & login token

func PrintYaml

func PrintYaml(objs []*model.SpecObject) error

PrintYaml prints array of yaml object

func PullImageIfNotExist

func PullImageIfNotExist(ctx context.Context, dockerClient *client.Client, image string) error

PullImageIfNotExist pulls the docker image if it does not exist

func ReadSpecObjectsFromFile

func ReadSpecObjectsFromFile(fileName string) ([]*model.SpecObject, error)

ReadSpecObjectsFromFile returns the spec objects present in the file

func RemoveAccount

func RemoveAccount(clusterName string) error

RemoveAccount removes account from accounts file

func SetDefaultProject

func SetDefaultProject(project string) error

SetDefaultProject sets the default project for the selected account in accounts.yaml file if empty value provided it will try to project from server & prompts user to select project from server response

func SetLogLevel

func SetLogLevel(loglevel string)

SetLogLevel sets a single verbosity level for log messages.

func StoreCredentials

func StoreCredentials(account *model.Account) error

StoreCredentials stores the credential in the accounts config file

func UnmarshalYAML

func UnmarshalYAML(in []byte, out *model.SpecObject) error

UnmarshalYAML converts to map[string]interface{} instead of map[interface{}]interface{}.

Types

type MockInputInterface

type MockInputInterface struct {
	mock.Mock
}

MockInputInterface is the mock interface for survey package

func (*MockInputInterface) AskOne

func (m *MockInputInterface) AskOne(p survey.Prompt, response interface{}) error

AskOne is the mock method for MockInputInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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