const (
FLAG_NAME = "name"
FLAG_DEVFILE = "devfile"
FLAG_DEVFILE_REGISTRY = "devfile-registry"
FLAG_STARTER = "starter"
FLAG_DEVFILE_PATH = "devfile-path"
FLAG_DEVFILE_VERSION = "devfile-version"
FLAG_RUN_PORT = "run-port"
FLAG_ARCHITECTURE = "architecture"
)
const (
STATE_ASK_ARCHITECTURES = iota
STATE_ASK_LANG
STATE_ASK_TYPE
STATE_ASK_VERSION
STATE_END
)
func PrintConfiguration(config asker.DevfileConfiguration)
type AlizerBackend struct {
// contains filtered or unexported fields
}
func NewAlizerBackend(askerClient asker.Asker, alizerClient alizer.Client) *AlizerBackend
func (o *AlizerBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)
func (o *AlizerBackend) PersonalizeDevfileConfig(devfile parser.DevfileObj) (parser.DevfileObj, error)
func (o *AlizerBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)
func (o *AlizerBackend) SelectDevfile(ctx context.Context, flags map[string]string, fs filesystem.Filesystem, dir string) (*api.DetectionResult, error)
SelectDevfile calls the Alizer to detect the devfile and asks for confirmation to the user
func (o *AlizerBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (starter *v1alpha2.StarterProject, err error)
func (o *AlizerBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
FlagsBackend is a backend that will extract all needed information from flags passed to the command
type FlagsBackend struct {
// contains filtered or unexported fields
}
func NewFlagsBackend(registryClient registry.Client) *FlagsBackend
func (o FlagsBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, _ []int, flags map[string]string) (parser.DevfileObj, error)
func (o FlagsBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)
func (o *FlagsBackend) PersonalizeName(_ parser.DevfileObj, flags map[string]string) (string, error)
func (o *FlagsBackend) SelectDevfile(ctx context.Context, flags map[string]string, _ filesystem.Filesystem, _ string) (*api.DetectionResult, error)
func (o *FlagsBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)
func (o *FlagsBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
InitBackend is a specialized backend for steps of initiating a project, based on various input (either from CLI flags or interactively from user)
type InitBackend interface {
// Validate returns an error if it does not validate the flags based on the directory content
Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
// SelectDevfile selects a devfile and returns its location information, depending on the flags
SelectDevfile(ctx context.Context, flags map[string]string, fs filesystem.Filesystem, dir string) (location *api.DetectionResult, err error)
// SelectStarterProject selects a starter project from the devfile and returns information about the starter project,
// depending on the flags. If not starter project is selected, a nil starter is returned
SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (starter *v1alpha2.StarterProject, err error)
// PersonalizeName returns the customized Devfile Metadata Name.
// Depending on the flags, it may return a name set interactively or not.
PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)
// PersonalizeDevfileConfig updates the devfile config for ports and environment variables
PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)
// HandleApplicationPorts updates the ports in the Devfile accordingly.
HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)
}
InteractiveBackend is a backend that will ask information interactively using the `asker` package
type InteractiveBackend struct {
// contains filtered or unexported fields
}
func NewInteractiveBackend(askerClient asker.Asker, registryClient registry.Client, alizerClient alizer.Client) *InteractiveBackend
func (o *InteractiveBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)
func (o *InteractiveBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)
func (o *InteractiveBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)
func (o *InteractiveBackend) SelectDevfile(ctx context.Context, flags map[string]string, _ filesystem.Filesystem, _ string) (*api.DetectionResult, error)
func (o *InteractiveBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)
func (o *InteractiveBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
MockInitBackend is a mock of InitBackend interface.
type MockInitBackend struct {
// contains filtered or unexported fields
}
func NewMockInitBackend(ctrl *gomock.Controller) *MockInitBackend
NewMockInitBackend creates a new mock instance.
func (m *MockInitBackend) EXPECT() *MockInitBackendMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockInitBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)
HandleApplicationPorts mocks base method.
func (m *MockInitBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)
PersonalizeDevfileConfig mocks base method.
func (m *MockInitBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)
PersonalizeName mocks base method.
func (m *MockInitBackend) SelectDevfile(ctx context.Context, flags map[string]string, fs filesystem.Filesystem, dir string) (*api.DetectionResult, error)
SelectDevfile mocks base method.
func (m *MockInitBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)
SelectStarterProject mocks base method.
func (m *MockInitBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
Validate mocks base method.
MockInitBackendMockRecorder is the mock recorder for MockInitBackend.
type MockInitBackendMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockInitBackendMockRecorder) HandleApplicationPorts(devfileobj, ports, flags interface{}) *gomock.Call
HandleApplicationPorts indicates an expected call of HandleApplicationPorts.
func (mr *MockInitBackendMockRecorder) PersonalizeDevfileConfig(devfileobj interface{}) *gomock.Call
PersonalizeDevfileConfig indicates an expected call of PersonalizeDevfileConfig.
func (mr *MockInitBackendMockRecorder) PersonalizeName(devfile, flags interface{}) *gomock.Call
PersonalizeName indicates an expected call of PersonalizeName.
func (mr *MockInitBackendMockRecorder) SelectDevfile(ctx, flags, fs, dir interface{}) *gomock.Call
SelectDevfile indicates an expected call of SelectDevfile.
func (mr *MockInitBackendMockRecorder) SelectStarterProject(devfile, flags interface{}) *gomock.Call
SelectStarterProject indicates an expected call of SelectStarterProject.
func (mr *MockInitBackendMockRecorder) Validate(flags, fs, dir interface{}) *gomock.Call
Validate indicates an expected call of Validate.