...

Package backend

Overview ▾

Package backend provides different backends to initiate projects. - `Flags` backend gets needed information from command line flags. - `Interactive` backend interacts with the user to get needed information.

Package backend is a generated GoMock package.

Index ▾

Constants
func PrintConfiguration(config asker.DevfileConfiguration)
type AlizerBackend
    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)
    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
type FlagsBackend
    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
type InitBackend
type InteractiveBackend
    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
type MockInitBackend
    func NewMockInitBackend(ctrl *gomock.Controller) *MockInitBackend
    func (m *MockInitBackend) EXPECT() *MockInitBackendMockRecorder
    func (m *MockInitBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)
    func (m *MockInitBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)
    func (m *MockInitBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)
    func (m *MockInitBackend) SelectDevfile(ctx context.Context, flags map[string]string, fs filesystem.Filesystem, dir string) (*api.DetectionResult, error)
    func (m *MockInitBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)
    func (m *MockInitBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
type MockInitBackendMockRecorder
    func (mr *MockInitBackendMockRecorder) HandleApplicationPorts(devfileobj, ports, flags interface{}) *gomock.Call
    func (mr *MockInitBackendMockRecorder) PersonalizeDevfileConfig(devfileobj interface{}) *gomock.Call
    func (mr *MockInitBackendMockRecorder) PersonalizeName(devfile, flags interface{}) *gomock.Call
    func (mr *MockInitBackendMockRecorder) SelectDevfile(ctx, flags, fs, dir interface{}) *gomock.Call
    func (mr *MockInitBackendMockRecorder) SelectStarterProject(devfile, flags interface{}) *gomock.Call
    func (mr *MockInitBackendMockRecorder) Validate(flags, fs, dir interface{}) *gomock.Call

Package files

alizer.go applicationports.go flags.go interactive.go interface.go mock.go

Constants

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

func PrintConfiguration(config asker.DevfileConfiguration)

type AlizerBackend

type AlizerBackend struct {
    // contains filtered or unexported fields
}

func NewAlizerBackend

func NewAlizerBackend(askerClient asker.Asker, alizerClient alizer.Client) *AlizerBackend

func (*AlizerBackend) HandleApplicationPorts

func (o *AlizerBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)

func (*AlizerBackend) PersonalizeDevfileConfig

func (o *AlizerBackend) PersonalizeDevfileConfig(devfile parser.DevfileObj) (parser.DevfileObj, error)

func (*AlizerBackend) PersonalizeName

func (o *AlizerBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)

func (*AlizerBackend) SelectDevfile

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 (*AlizerBackend) SelectStarterProject

func (o *AlizerBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (starter *v1alpha2.StarterProject, err error)

func (*AlizerBackend) Validate

func (o *AlizerBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error

type FlagsBackend

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

func NewFlagsBackend(registryClient registry.Client) *FlagsBackend

func (FlagsBackend) HandleApplicationPorts

func (o FlagsBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, _ []int, flags map[string]string) (parser.DevfileObj, error)

func (FlagsBackend) PersonalizeDevfileConfig

func (o FlagsBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)

func (*FlagsBackend) PersonalizeName

func (o *FlagsBackend) PersonalizeName(_ parser.DevfileObj, flags map[string]string) (string, error)

func (*FlagsBackend) SelectDevfile

func (o *FlagsBackend) SelectDevfile(ctx context.Context, flags map[string]string, _ filesystem.Filesystem, _ string) (*api.DetectionResult, error)

func (*FlagsBackend) SelectStarterProject

func (o *FlagsBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)

func (*FlagsBackend) Validate

func (o *FlagsBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error

type InitBackend

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)
}

type InteractiveBackend

InteractiveBackend is a backend that will ask information interactively using the `asker` package

type InteractiveBackend struct {
    // contains filtered or unexported fields
}

func NewInteractiveBackend

func NewInteractiveBackend(askerClient asker.Asker, registryClient registry.Client, alizerClient alizer.Client) *InteractiveBackend

func (*InteractiveBackend) HandleApplicationPorts

func (o *InteractiveBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)

func (*InteractiveBackend) PersonalizeDevfileConfig

func (o *InteractiveBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)

func (*InteractiveBackend) PersonalizeName

func (o *InteractiveBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)

func (*InteractiveBackend) SelectDevfile

func (o *InteractiveBackend) SelectDevfile(ctx context.Context, flags map[string]string, _ filesystem.Filesystem, _ string) (*api.DetectionResult, error)

func (*InteractiveBackend) SelectStarterProject

func (o *InteractiveBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)

func (*InteractiveBackend) Validate

func (o *InteractiveBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error

type MockInitBackend

MockInitBackend is a mock of InitBackend interface.

type MockInitBackend struct {
    // contains filtered or unexported fields
}

func NewMockInitBackend

func NewMockInitBackend(ctrl *gomock.Controller) *MockInitBackend

NewMockInitBackend creates a new mock instance.

func (*MockInitBackend) EXPECT

func (m *MockInitBackend) EXPECT() *MockInitBackendMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockInitBackend) HandleApplicationPorts

func (m *MockInitBackend) HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)

HandleApplicationPorts mocks base method.

func (*MockInitBackend) PersonalizeDevfileConfig

func (m *MockInitBackend) PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)

PersonalizeDevfileConfig mocks base method.

func (*MockInitBackend) PersonalizeName

func (m *MockInitBackend) PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)

PersonalizeName mocks base method.

func (*MockInitBackend) SelectDevfile

func (m *MockInitBackend) SelectDevfile(ctx context.Context, flags map[string]string, fs filesystem.Filesystem, dir string) (*api.DetectionResult, error)

SelectDevfile mocks base method.

func (*MockInitBackend) SelectStarterProject

func (m *MockInitBackend) SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (*v1alpha2.StarterProject, error)

SelectStarterProject mocks base method.

func (*MockInitBackend) Validate

func (m *MockInitBackend) Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error

Validate mocks base method.

type MockInitBackendMockRecorder

MockInitBackendMockRecorder is the mock recorder for MockInitBackend.

type MockInitBackendMockRecorder struct {
    // contains filtered or unexported fields
}

func (*MockInitBackendMockRecorder) HandleApplicationPorts

func (mr *MockInitBackendMockRecorder) HandleApplicationPorts(devfileobj, ports, flags interface{}) *gomock.Call

HandleApplicationPorts indicates an expected call of HandleApplicationPorts.

func (*MockInitBackendMockRecorder) PersonalizeDevfileConfig

func (mr *MockInitBackendMockRecorder) PersonalizeDevfileConfig(devfileobj interface{}) *gomock.Call

PersonalizeDevfileConfig indicates an expected call of PersonalizeDevfileConfig.

func (*MockInitBackendMockRecorder) PersonalizeName

func (mr *MockInitBackendMockRecorder) PersonalizeName(devfile, flags interface{}) *gomock.Call

PersonalizeName indicates an expected call of PersonalizeName.

func (*MockInitBackendMockRecorder) SelectDevfile

func (mr *MockInitBackendMockRecorder) SelectDevfile(ctx, flags, fs, dir interface{}) *gomock.Call

SelectDevfile indicates an expected call of SelectDevfile.

func (*MockInitBackendMockRecorder) SelectStarterProject

func (mr *MockInitBackendMockRecorder) SelectStarterProject(devfile, flags interface{}) *gomock.Call

SelectStarterProject indicates an expected call of SelectStarterProject.

func (*MockInitBackendMockRecorder) Validate

func (mr *MockInitBackendMockRecorder) Validate(flags, fs, dir interface{}) *gomock.Call

Validate indicates an expected call of Validate.