...

Source file src/github.com/redhat-developer/odo/pkg/init/backend/interface.go

Documentation: github.com/redhat-developer/odo/pkg/init/backend

     1  // Package backend provides different backends to initiate projects.
     2  // - `Flags` backend gets needed information from command line flags.
     3  // - `Interactive` backend interacts with the user to get needed information.
     4  package backend
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
    10  	"github.com/devfile/library/v2/pkg/devfile/parser"
    11  
    12  	"github.com/redhat-developer/odo/pkg/api"
    13  	"github.com/redhat-developer/odo/pkg/testingutil/filesystem"
    14  )
    15  
    16  // InitBackend is a specialized backend for steps of initiating a project, based on various input (either from CLI flags or interactively from user)
    17  type InitBackend interface {
    18  	// Validate returns an error if it does not validate the flags based on the directory content
    19  	Validate(flags map[string]string, fs filesystem.Filesystem, dir string) error
    20  
    21  	// SelectDevfile selects a devfile and returns its location information, depending on the flags
    22  	SelectDevfile(ctx context.Context, flags map[string]string, fs filesystem.Filesystem, dir string) (location *api.DetectionResult, err error)
    23  
    24  	// SelectStarterProject selects a starter project from the devfile and returns information about the starter project,
    25  	// depending on the flags. If not starter project is selected, a nil starter is returned
    26  	SelectStarterProject(devfile parser.DevfileObj, flags map[string]string) (starter *v1alpha2.StarterProject, err error)
    27  
    28  	// PersonalizeName returns the customized Devfile Metadata Name.
    29  	// Depending on the flags, it may return a name set interactively or not.
    30  	PersonalizeName(devfile parser.DevfileObj, flags map[string]string) (string, error)
    31  
    32  	// PersonalizeDevfileConfig updates the devfile config for ports and environment variables
    33  	PersonalizeDevfileConfig(devfileobj parser.DevfileObj) (parser.DevfileObj, error)
    34  
    35  	// HandleApplicationPorts updates the ports in the Devfile accordingly.
    36  	HandleApplicationPorts(devfileobj parser.DevfileObj, ports []int, flags map[string]string) (parser.DevfileObj, error)
    37  }
    38  

View as plain text