Documentation ¶
Index ¶
- Constants
- Variables
- func Execute()
- func NewBashCmd() *cobra.Command
- func NewBuildCmd() *cobra.Command
- func NewCheckConnectionCmd() *cobra.Command
- func NewCheckUpdatesCmd() *cobra.Command
- func NewDeleteCmd() *cobra.Command
- func NewDestroyCmd() *cobra.Command
- func NewExecCmd() *cobra.Command
- func NewFetchCmd() *cobra.Command
- func NewForwardCmd() *cobra.Command
- func NewInitCmd() *cobra.Command
- func NewListPodsCmd() *cobra.Command
- func NewLogsCmd() *cobra.Command
- func NewPushCmd() *cobra.Command
- func NewSyncCmd() *cobra.Command
- func NewVersionCmd() *cobra.Command
- func NewWatchCmd() *cobra.Command
- func RunExec(handler *execHandle, interactive bool, flowID string, args []string) (suggestion string, err error)
- func RunPush(handler *PushHandle, args []string, settings *config.Config) (suggestion string, err error)
- func RunWatch(handler *WatchHandle, args []string, settings *config.Config) (reason string, err error)
- type BuildHandle
- type CheckConnectionHandle
- type CheckUpdates
- type DeletePodCmdHandle
- type DestroyHandle
- type FetchHandle
- type ForwardHandle
- type Handler
- type InitHandler
- type InitInteractiveHandler
- type InitStrategy
- type LogsCmdHandle
- type PushHandle
- type VersionHandle
- type WatchHandle
Constants ¶
const BashCmdName = "bash"
BashCmdName is the name identifier for the exec command
const BuildCmdName = "build"
BuildCmdName is the name identifier for the build command
const CheckConnectionCmdName = "checkconnection"
CheckConnectionCmdName is the command name identifier
const CheckUpdatesCmdName = "checkupdates"
CheckUpdatesCmdName is the command name identifier
const DeleteCmdName = "delete"
DeleteCmdName is the command name identifier
const DestroyCmdName = "destroy"
DestroyCmdName is the name identifier for the destroy command
const ExecCmdName = "exec"
ExecCmdName is the name identifier for the exec command
const FetchCmdName = "fetch"
FetchCmdName is the command name identifier
const ForwardCmdName = "forward"
ForwardCmdName is the command name identifier
const InitCmdName = "init"
InitCmdName is the name identifier for the build command
const LogsCmdName = "logs"
LogsCmdName is the command name identifier
const PushCmdName = "push"
PushCmdName is the command name identifier
const SyncCmdName = "sync"
SyncCmdName is the command name identifier
const WatchCmdName = "watch"
WatchCmdName is the command name identifier
Variables ¶
var RootCmd = &cobra.Command{
Use: "cp-remote",
Short: "A tool to help with using ContinuousPipe as a remote development environment.",
Long: `A tool to help with using ContinuousPipe as a remote development environment.
This helps to set up Kubectl, create, build and destroy remote environments and keep files
in sync with the local filesystem.
You will need the following:
* A ContinuousPipe hosted project with the GitHub integration set up
* The project checked out locally
* rsync and git installed locally
Note: if the GitHub repository is not the origin of your checked out project then you will
need to add a remote for that repository.`,
}
Functions ¶
func NewBashCmd ¶
func NewBuildCmd ¶
NewBuildCmd return a new cobra command that handles the build
func NewCheckConnectionCmd ¶
NewCheckConnectionCmd return a new cobra command that on run executes the CheckConnectionHandle
func NewCheckUpdatesCmd ¶
func NewDeleteCmd ¶
NewDeleteCmd returns a new command that wraps the kubectl delete command it finds the target pod and pass the arguments to the wrapped command
func NewDestroyCmd ¶
NewDestroyCmd return a new cobra command that handles the destruction of a remote environment
func NewExecCmd ¶
NewExecCmd return a cobra command struct pointer which on Run, if required it prepares the config so we can reach the pod and then uses a command handler to execute the command specified in the arguments
func NewFetchCmd ¶
func NewForwardCmd ¶
func NewListPodsCmd ¶
NewListPodsCmd return a cobra cmd alias of NewCheckConnectionCmd
func NewLogsCmd ¶
func NewPushCmd ¶
func NewSyncCmd ¶
func NewVersionCmd ¶
func NewWatchCmd ¶
Types ¶
type BuildHandle ¶
type BuildHandle struct {
// contains filtered or unexported fields
}
BuildHandle holds the dependencies of the build handler
func (*BuildHandle) Handle ¶
func (h *BuildHandle) Handle() (suggestion string, err error)
Handle performs the 2 init stages that trigger that build and wait for the environment to be ready
type CheckConnectionHandle ¶
type CheckConnectionHandle struct { Command *cobra.Command Environment string // contains filtered or unexported fields }
CheckConnectionHandle holds the command handler dependencies
func (*CheckConnectionHandle) Complete ¶
func (h *CheckConnectionHandle) Complete(cmd *cobra.Command, argsIn []string, setting *config.Config)
Complete verifies command line arguments and loads data from the command environment
func (*CheckConnectionHandle) Handle ¶
func (h *CheckConnectionHandle) Handle(args []string, podsFinder pods.Finder) (suggestion string, err error)
Handle finds the pods and prints them
func (*CheckConnectionHandle) Validate ¶
func (h *CheckConnectionHandle) Validate() error
Validate checks that the provided checkconnection options are specified.
type CheckUpdates ¶
type DeletePodCmdHandle ¶
type DeletePodCmdHandle struct {
// contains filtered or unexported fields
}
DeletePodCmdHandle holds the information required to delete a pod
func (*DeletePodCmdHandle) Complete ¶
func (h *DeletePodCmdHandle) Complete(argsIn []string, settings *config.Config)
Complete verifies command line arguments and loads data from the command environment
func (*DeletePodCmdHandle) Handle ¶
func (h *DeletePodCmdHandle) Handle(args []string) (suggestion string, err error)
Handle set the flags in the kubeclt logs handle command and executes it
func (*DeletePodCmdHandle) Validate ¶
func (h *DeletePodCmdHandle) Validate() error
Validate checks that the provided exec options are specified.
type DestroyHandle ¶
type DestroyHandle struct {
// contains filtered or unexported fields
}
DestroyHandle holds the dependencies of the destroy handler
func NewDestroyHandle ¶
func NewDestroyHandle() *DestroyHandle
NewDestroyHandle ctor for the DestroyHandle struct
func (*DestroyHandle) Handle ¶
func (h *DestroyHandle) Handle() (suggestion string, err error)
Handle cancels a running tide if exists, then deletes the remote environment via CP Api and finally proceed with the deletion of the git remote branch
type FetchHandle ¶
type FetchHandle struct { Command *cobra.Command Environment string Service string File string RemoteProjectPath string // contains filtered or unexported fields }
func (*FetchHandle) Complete ¶
Complete verifies command line arguments and loads data from the command environment
func (*FetchHandle) Handle ¶
func (h *FetchHandle) Handle(args []string, podsFinder pods.Finder, podsFilter pods.Filter, fetcher sync.Fetcher) (suggestion string, err error)
Copies all the files and folders from the remote development environment into the current directory
func (*FetchHandle) Validate ¶
func (h *FetchHandle) Validate() error
Validate checks that the provided fetch options are specified.
type ForwardHandle ¶
type ForwardHandle struct { Command *cobra.Command Environment string Service string // contains filtered or unexported fields }
func (*ForwardHandle) Complete ¶
Complete verifies command line arguments and loads data from the command environment
func (*ForwardHandle) Handle ¶
func (h *ForwardHandle) Handle() (suggestion string, err error)
func (*ForwardHandle) Validate ¶
func (h *ForwardHandle) Validate() error
Validate checks that the provided forward options are specified.
type InitHandler ¶
type InitHandler struct {
// contains filtered or unexported fields
}
InitHandler is the default initialisation mode which prepare the remote environment so that can be used with any command.
func NewInitHandler ¶
func NewInitHandler(remoteName string, reset bool) *InitHandler
NewInitHandler ctor for InitHandler
func (*InitHandler) Complete ¶
func (i *InitHandler) Complete(argsIn []string) (suggestion string, err error)
Complete verifies command line arguments and loads data from the command environment
func (InitHandler) Handle ¶
func (i InitHandler) Handle() (suggestion string, err error)
Handle Executes the initialization
func (*InitHandler) SetWriter ¶
func (i *InitHandler) SetWriter(writer io.Writer)
SetWriter sets the default writer for the struct
func (InitHandler) Validate ¶
func (i InitHandler) Validate() error
Validate checks that the token provided has at least 5 values comma separated
type InitInteractiveHandler ¶
type InitInteractiveHandler struct {
// contains filtered or unexported fields
}
InitInteractiveHandler is a interactive mode strategy where we request the user to insert the global configuration data which is the cp username and cp api-key which are mandatory to use the interactive mode on all command that support it.
func NewInitInteractiveHandler ¶
func NewInitInteractiveHandler(reset bool) *InitInteractiveHandler
NewInitInteractiveHandler ctor for InitInteractiveHandler
func (*InitInteractiveHandler) Complete ¶
func (i *InitInteractiveHandler) Complete(argsIn []string) (suggestion string, err error)
Complete verifies command line arguments and loads data from the command environment
func (InitInteractiveHandler) Handle ¶
func (i InitInteractiveHandler) Handle() (suggestion string, err error)
Handle request the user the config data required for the interactive mode to work
func (*InitInteractiveHandler) SetWriter ¶
func (i *InitInteractiveHandler) SetWriter(writer io.Writer)
SetWriter sets the default writer for the struct
func (InitInteractiveHandler) Validate ¶
func (i InitInteractiveHandler) Validate() error
Validate checks that the handler has all it needs
type InitStrategy ¶
type InitStrategy interface { Complete(argsIn []string) (suggestion string, err error) Validate() error Handle() (suggestion string, err error) SetWriter(io.Writer) }
InitStrategy is the interface for the init strategy struct
type LogsCmdHandle ¶
type LogsCmdHandle struct {
// contains filtered or unexported fields
}
func (*LogsCmdHandle) Complete ¶
Complete verifies command line arguments and loads data from the command environment
func (*LogsCmdHandle) Handle ¶
func (h *LogsCmdHandle) Handle(args []string, podsFinder pods.Finder, podsFilter pods.Filter) (suggestion string, err error)
Handle set the flags in the kubeclt logs handle command and executes it
func (*LogsCmdHandle) Validate ¶
func (h *LogsCmdHandle) Validate() error
Validate checks that the provided exec options are specified.
type PushHandle ¶
type PushHandle struct {
// contains filtered or unexported fields
}
func (*PushHandle) Complete ¶
func (h *PushHandle) Complete(argsIn []string, settings *config.Config)
Complete verifies command line arguments and loads data from the command environment
func (*PushHandle) Handle ¶
func (h *PushHandle) Handle(args []string, podsFinder pods.Finder, podsFilter pods.Filter, syncer sync.Syncer) (suggestion string, err error)
Copies all the files and folders from the current directory into the remote container
func (*PushHandle) Validate ¶
func (h *PushHandle) Validate() error
Validate checks that the provided push options are specified.
type VersionHandle ¶
func (*VersionHandle) Handle ¶
func (h *VersionHandle) Handle(args []string)
type WatchHandle ¶
func (*WatchHandle) Complete ¶
func (h *WatchHandle) Complete(argsIn []string, settings *config.Config)
Complete verifies command line arguments and loads data from the command environment
func (*WatchHandle) Handle ¶
func (h *WatchHandle) Handle(dirMonitor monitor.DirectoryMonitor, podsFinder pods.Finder, podsFilter pods.Filter) (suggestion string, err error)
func (*WatchHandle) Validate ¶
func (h *WatchHandle) Validate() (suggestion string, err error)
Validate checks that the provided watch options are specified.