Documentation ¶
Index ¶
- Variables
- func Build(client *occlient.Client, componentName string, applicationName string, ...) error
- func CreateFromGit(client *occlient.Client, name string, componentImageType string, url string, ...) error
- func CreateFromPath(client *occlient.Client, name string, componentImageType string, path string, ...) error
- func Delete(client *occlient.Client, componentName string, applicationName string) error
- func Exists(client *occlient.Client, componentName, applicationName string) (bool, error)
- func GetComponentDesc(client *occlient.Client, componentName string, applicationName string) (componentImageType string, path string, componentURL string, ...)
- func GetComponentDir(path string, paramType CreateType) (string, error)
- func GetComponentPorts(client *occlient.Client, componentName string, applicationName string) (ports []string, err error)
- func GetComponentSource(client *occlient.Client, componentName string, applicationName string) (string, string, error)
- func GetComponentType(client *occlient.Client, componentName string, applicationName string) (string, error)
- func GetCurrent(applicationName string, projectName string) (string, error)
- func GetDefaultComponentName(componentPath string, componentPathType CreateType, componentType string, ...) (string, error)
- func GetLogs(client *occlient.Client, componentName string, applicationName string, ...) error
- func PushLocal(client *occlient.Client, componentName string, applicationName string, ...) error
- func SetCurrent(componentName string, applicationName string, projectName string) error
- func Update(client *occlient.Client, componentName string, applicationName string, ...) error
- func WatchAndPush(client *occlient.Client, componentName string, applicationName, path string, ...) error
- type ComponentInfo
- type CreateType
Constants ¶
This section is empty.
Variables ¶
var UserRequestedWatchExit = fmt.Errorf("safely exiting from filesystem watch based on user request")
Functions ¶
func Build ¶ added in v0.0.5
func Build(client *occlient.Client, componentName string, applicationName string, streamLogs bool, wait bool, stdout io.Writer) error
Build component from BuildConfig. If 'streamLogs' is true than it streams build logs on stdout, set 'wait' to true if you want to return error if build fails. If 'wait' is true than it waits for build to successfully complete. If 'wait' is false than this function won't return error even if build failed.
func CreateFromGit ¶
func CreateFromGit(client *occlient.Client, name string, componentImageType string, url string, applicationName string, inputPorts []string, envVars []string) error
CreateFromGit inputPorts is the array containing the string port values inputPorts is the array containing the string port values envVars is the array containing the environment variables
func CreateFromPath ¶ added in v0.0.5
func CreateFromPath(client *occlient.Client, name string, componentImageType string, path string, applicationName string, sourceType string, inputPorts []string, envVars []string) error
CreateFromPath create new component with source or binary from the given local path sourceType indicates the source type of the component and can be either local or binary envVars is the array containing the environment variables
func Exists ¶ added in v0.0.4
Exists checks whether a component with the given name exists in the current application or not componentName is the component name to perform check for The first returned parameter is a bool indicating if a component with the given name already exists or not The second returned parameter is the error that might occurs while execution
func GetComponentDesc ¶ added in v0.0.4
func GetComponentDesc(client *occlient.Client, componentName string, applicationName string) (componentImageType string, path string, componentURL string, appStore []storage.StorageInfo, err error)
GetComponentDesc provides description such as source, url & storage about given component
func GetComponentDir ¶ added in v0.0.15
func GetComponentDir(path string, paramType CreateType) (string, error)
GetComponentDir returns source repo name Parameters:
path: git url or source path or binary path paramType: One of CreateType as in GIT/SOURCE/BINARY
Returns: directory name
func GetComponentPorts ¶ added in v0.0.10
func GetComponentPorts(client *occlient.Client, componentName string, applicationName string) (ports []string, err error)
GetComponentPorts provides slice of ports used by the component in the form port_no/protocol
func GetComponentSource ¶ added in v0.0.3
func GetComponentSource(client *occlient.Client, componentName string, applicationName string) (string, string, error)
GetComponentSource what source type given component uses The first returned string is component source type ("git" or "local" or "binary") The second returned string is a source (url to git repository or local path or path to binary) we retrieve the source type by looking up the DeploymentConfig that's deployed
func GetComponentType ¶ added in v0.0.3
func GetComponentType(client *occlient.Client, componentName string, applicationName string) (string, error)
GetComponentType returns type of component in given application and project
func GetCurrent ¶
GetCurrent component in active application returns "" if there is no active component
func GetDefaultComponentName ¶ added in v0.0.15
func GetDefaultComponentName(componentPath string, componentPathType CreateType, componentType string, existingComponentList []ComponentInfo) (string, error)
GetDefaultComponentName generates a unique component name Parameters: desired default component name(w/o prefix) and slice of existing component names Returns: Unique component name and error if any
func GetLogs ¶ added in v0.0.6
func GetLogs(client *occlient.Client, componentName string, applicationName string, follow bool, stdout io.Writer) error
GetLogs follow the DeploymentConfig logs if follow is set to true
func PushLocal ¶ added in v0.0.3
func PushLocal(client *occlient.Client, componentName string, applicationName string, path string, out io.Writer, files []string) error
PushLocal push local code to the cluster and trigger build there. files is list of changed files captured during `odo watch` as well as binary file path During copying binary components, path represent base directory path to binary and files contains path of binary During copying local source components, path represent base directory path whereas files is empty During `odo watch`, path represent base directory path whereas files contains list of changed Files
func SetCurrent ¶
SetCurrent sets the given componentName as active component
func Update ¶ added in v0.0.4
func Update(client *occlient.Client, componentName string, applicationName string, newSourceType string, newSource string, stdout io.Writer) error
Update updates the requested component componentName is the name of the component to be updated applicationName is the name of the application of the component newSourceType indicates the type of the new source i.e git/local/binary newSource indicates path of the source directory or binary or the git URL stdout is the io writer for streaming build logs on stdout
func WatchAndPush ¶ added in v0.0.4
func WatchAndPush(client *occlient.Client, componentName string, applicationName, path string, out io.Writer, ignores []string, delayInterval int, extChan chan string, pushChangesToPod func(*occlient.Client, string, string, string, io.Writer, []string) error) error
WatchAndPush watches path, if something changes in that path it calls PushLocal ignores .git/* by default inspired by https://github.com/openshift/origin/blob/e785f76194c57bd0e1674c2f2776333e1e0e4e78/pkg/oc/cli/cmd/rsync/rsync.go#L257 Parameters:
client: occlient instance componentName: Name of component that is to be watched applicationName: Name of application, the component is part of path: The path to the source of component(local or binary) out: io Writer instance ignores: List/Slice of files/folders in component source, the updates to which need not be pushed to component deployed pod delayInterval: Interval of time before pushing changes to remote(component) pod extChan: This is a channel added to terminate the watch command gracefully without passing SIGINT. "Stop" message on this channel terminates WatchAndPush function pushChangesToPod: Custom function that can be used to push detected changes to remote pod. For more info about what each of the parameters to this function, please refer, pkg/component/component.go#PushLocal
Types ¶
type ComponentInfo ¶ added in v0.0.3
ComponentInfo holds all important information about one component
type CreateType ¶ added in v0.0.15
type CreateType string
CreateType is an enum to indicate the type of source of component -- local source/binary or git for the generation of app/component names
const ( // GIT as source of component GIT CreateType = "git" // SOURCE Local source path as source of component SOURCE CreateType = "source" // BINARY Local Binary as source of component BINARY CreateType = "binary" // NONE indicates there's no information about the type of source of the component NONE CreateType = "" )