# Functions
AddFileToIgnoreFile adds a file to the gitignore file.
CheckKubeConfigExist checks for existence of kubeconfig.
CheckOutputFlag returns true if specified output format is supported.
CheckPathExists checks if a path exists or not.
CloneGitRepo clones a GitHub repo to a destination directory Deprecated: in favor of the method git.CloneGitRepo() with the devfile/library/v2/pkg/git package.
Converts Git ssh remote to https.
ConvertKeyValueStringToMap converts String Slice of Parameters to a Map[String]string Each value of the slice is expected to be in the key=value format Values that do not conform to this "spec", will be ignored.
ConvertLabelsToSelector converts the given labels to selector.
CopyAllDirFiles recursively copies a source directory to a destination directory.
CopyFile copies file from source path to destination path.
DeletePath deletes a file/directory if it exists and doesn't throw error if it doesn't exist.
DisplayLog displays logs to user stdout with some color formatting.
DownloadFile downloads the file to the filepath given URL and token (if applicable).
DownloadFileInMemory uses the url to download the file and return bytes Deprecated, use DownloadInMemory() instead.
DownloadFileWithCache downloads the file to the filepath given URL and token (if applicable) cacheFor determines how long the response should be cached (in minutes), 0 for no caching.
DownloadInMemory uses HTTPRequestParams to download the file and return bytes.
ExtractComponentType returns only component type part from passed component type(default unqualified, fully qualified, versioned, etc...and their combinations) for use as component name Possible types of parameters: 1.
FetchResourceQuantity takes passed min, max and requested resource quantities and returns min and max resource requests.
FilterIgnores applies the glob rules on the filesChanged and filesDeleted and filters them returns the filtered results which match any of the glob rules.
GenerateRandomString generates a random string of lower case characters of the given size.
GenFileURL Converts file path on windows to /C:/path/to/file to work in URL.
GetAbsGlobExps converts the relative glob expressions into absolute glob expressions returns the absolute glob expressions.
GetAbsPath returns absolute path from passed file path resolving even ~ to user home dir and any other such symbols that are only shell expanded can also be handled here.
GetAndExtractZip downloads a zip file from a URL with a http prefix or takes an absolute path prefixed with file:// and extracts it to a destination.
GetContainerPortsFromStrings generates ContainerPort values from the array of string port values ports is the array containing the string port values.
GetDNS1123Name Converts passed string into DNS-1123 string.
GetGitUrlComponentsFromRaw converts a raw GitHub file link to a map of the url components Deprecated: in favor of the method git.ParseGitUrl() with the devfile/library/v2/pkg/git package.
GetHostWithPort parses provided url and returns string formated as host:port even if port was not specifically specified in the origin url.
GetIgnoreRulesFromDirectory reads the .odoignore file, if present, and reads the rules from it if the .odoignore file is not found, then .gitignore is searched for the rules if both are not found, return empty array directory is the name of the directory to look into for either of the files rules is the array of rules (in string form).
GetRandomName returns a randomly generated name which can be used for naming odo and/or openshift entities prefix: Desired prefix part of the name prefixMaxLen: Desired maximum length of prefix part of random name; if -1 is passed, no limit on length will be enforced existList: List to verify that the returned name does not already exist retries: number of retries to try generating a unique name Returns: 1.
GetRemoteFilesMarkedForDeletion returns the list of remote files marked for deletion.
GetSortedKeys retrieves the alphabetically-sorted keys of the specified map.
GetSplitValuesFromStr returns a slice containing the split string, using ',' as a separator.
HTTPGetFreePort gets a free port from the system.
HTTPGetRequest gets resource contents given URL and token (if applicable) cacheFor determines how long the response should be cached (in minutes), 0 for no caching.
In checks if the value is in the array.
IsEmpty checks to see if a directory is empty shamelessly taken from: https://stackoverflow.com/questions/30697324/how-to-check-if-directory-on-path-is-empty this helps detect any edge cases where an empty directory is copied over.
IsGitProviderRepo checks if the url matches a repo from a supported git provider.
IsGlobExpMatch compiles strToMatch against each of the passed globExps Parameters: strToMatch : a string for matching against the rules globExps : a list of glob patterns to match strToMatch with Returns: true if there is any match else false the error (if any) Notes: Source as well as glob expression to match is changed to forward slashes due to supporting Windows as well as support with the "github.com/gobwas/glob" library that we use.
IsValidProjectDir checks that the folder to download the project from devfile is either empty or only contains the devfile used.
NamespaceOpenShiftObject hyphenates applicationName and componentName.
NewGitURL NewGitUrl creates a GitUrl from a string url and token.
NewGitUrlWithURL NewGitUrl creates a GitUrl from a string url.
OpenBrowser opens the URL within the users default browser.
ParseComponentImageName returns 1.
ParseGitUrl extracts information from a support git url Only supports git repositories hosted on GitHub, GitLab, and Bitbucket.
PathEqual compare the paths to determine if they are equal.
ReadFilePath Reads file path form URL file:///C:/path/to/file to C:\path\to\file.
RemoveDuplicates goes through a string slice and removes all duplicates.
RemoveRelativePathFromFiles removes a specified path from a list of files.
SliceDifference returns the values of s2 that do not exist in s1.
TruncateString truncates passed string to given length Note: if -1 is passed, the original string is returned.
Unzip will decompress a zip archive, moving specified files and folders within the zip file (parameter 1) to an output directory (parameter 2) Source: https://golangcode.com/unzip-files-in-go/ pathToUnzip (parameter 3) is the path within the zip folder to extract.
ValidateFile validates the file.
ValidateK8sResourceName sanitizes kubernetes resource name with the following requirements: - Contain at most 63 characters - Contain only lowercase alphanumeric characters or ‘-’ - Start with an alphanumeric character - End with an alphanumeric character - Must not contain all numeric values.
ValidateURL validates the URL.
# Constants
No description provided by the author
CredentialPrefix is the prefix of the credential that uses to access secure registry.
No description provided by the author
No description provided by the author
No description provided by the author
HTTPRequestTimeout configures timeout of all HTTP requests.
default Permission for a file.
No description provided by the author
TelemetryClientName is the name of the devfile library client.
TelemetryIndirectDevfileCall is used to identify calls made to retrieve the parent or plugin devfile.
WIN represent the windows OS.
# Variables
No description provided by the author
No description provided by the author
# Structs
DownloadParams holds parameters of forming file download request.
No description provided by the author
HTTPRequestParams holds parameters of forming http request.
No description provided by the author
No description provided by the author
No description provided by the author
ResourceRequirementInfo holds resource quantity before transformation into its appropriate form in container spec.
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author