Files
odo/pkg/dev/interface.go
Philippe Martin 94e32303bd Implement API endpoints (#6915)
* Pass odo context to api server

* Get /instance

* DELETE /instance implementation

* Move describe logic to pkg/component/describe

* Get /component implementation

* POST /component/command implementation

* Fix example by replacing action with name

* Fix integration test

* Integration tests

* Add comment for PushWatcher

* Test DELETE /instance without --no-watch

* Apply suggestions from code review

Co-authored-by: Armel Soro <armel@rm3l.org>

* Return an error if not ready for push

* Fix windows tests

* Fix tests for Windows

---------

Co-authored-by: Armel Soro <armel@rm3l.org>
2023-06-26 16:00:49 +02:00

64 lines
2.6 KiB
Go

package dev
import (
"context"
"io"
"github.com/redhat-developer/odo/pkg/api"
)
type StartOptions struct {
// IgnorePaths are files/directories to ignore when pushing files to the container.
IgnorePaths []string
// If Debug is true, executes the debug command, or the run command by default.
Debug bool
// If BuildCommand is set, this will look up the specified build command in the Devfile. Otherwise, it uses the default one.
BuildCommand string
// If RunCommand is set, this will look up the specified run command in the Devfile and execute it. Otherwise, it uses the default one.
RunCommand string
// If DebugCommand is set, this will look up the specified debug command in the Devfile and execute it. Otherwise, it uses the default one.
DebugCommand string
// SkipCommands indicates if commands (either Build, Run or Debug) will be skipped when starting the Dev Session.
// If SkipCommands is true, then the specified (or default) Build, Run, or Debug commands will not be executed.
SkipCommands bool
// if RandomPorts is set, will port forward on random local ports, else uses ports starting at 20001
RandomPorts bool
// CustomForwardedPorts define custom ports for port forwarding
CustomForwardedPorts []api.ForwardedPort
// CustomAddress defines a custom local address for port forwarding; default value is 127.0.0.1
CustomAddress string
// if WatchFiles is set, files changes will trigger a new sync to the container
WatchFiles bool
// IgnoreLocalhost indicates whether to proceed with port-forwarding regardless of any container ports being bound to the container loopback interface.
// Applicable to Podman only.
IgnoreLocalhost bool
// ForwardLocalhost is a flag indicating if we inject a side container that will make port-forwarding work with container apps listening on the loopback interface.
// Applicable to Podman only.
ForwardLocalhost bool
// Variables to override in the Devfile
Variables map[string]string
// PushWatcher is a channel that will emit an event when Pushing files to the component is requested
PushWatcher <-chan struct{}
Out io.Writer
ErrOut io.Writer
}
type Client interface {
// Start the resources defined in context's Devfile on the platform. It then pushes the files in path to the container.
// It then watches for any changes to the files under path.
// It logs messages and errors to out and errOut.
Start(
ctx context.Context,
options StartOptions,
) error
Run(
ctx context.Context,
commandName string,
) error
// CleanupResources deletes the component created using the context's devfile and writes any outputs to out
CleanupResources(ctx context.Context, out io.Writer) error
}