const (
CONFLICT_DIR_NAME = "CONFLICT_STARTER_PROJECT"
)
const (
RegistryUser = "default"
)
func DownloadStarterProject(fs filesystem.Filesystem, starterProject *devfilev1.StarterProject, decryptedToken string, contextDir string, verbose bool) error
DownloadStarterProject downloads a starter project referenced in devfile This will first remove the content of the contextDir
func IsGithubBasedRegistry(url string) (bool, error)
func IsSecure(prefClient preference.Client, registryName string) bool
IsSecure checks if the registry is secure
type Client interface { PullStackFromRegistry(registry string, stack string, destDir string, options library.RegistryOptions) error DownloadFileInMemory(params dfutil.HTTPRequestParams) ([]byte, error) DownloadStarterProject(starterProject *devfilev1.StarterProject, decryptedToken string, contextDir string, verbose bool) (bool, error) GetDevfileRegistries(registryName string) ([]api.Registry, error) ListDevfileStacks(ctx context.Context, registryName, devfileFlag, filterFlag string, detailsFlag bool, withDevfileContent bool) (DevfileStackList, error) }
DevfileStackList lists all the Devfile Stacks
type DevfileStackList struct { DevfileRegistries []api.Registry Items []api.DevfileStack }
func (o *DevfileStackList) GetLanguages() []string
GetLanguages returns the list of unique languages, ordered by name, from a list of registry items
func (o *DevfileStackList) GetProjectTypes(language string) TypesWithDetails
GetProjectTypes returns the list of project types and associated details from a list of registry items
type ErrGithubRegistryNotSupported struct { }
func (s *ErrGithubRegistryNotSupported) Error() string
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) DownloadFileInMemory(params util.HTTPRequestParams) ([]byte, error)
DownloadFileInMemory mocks base method.
func (m *MockClient) DownloadStarterProject(starterProject *v1alpha2.StarterProject, decryptedToken, contextDir string, verbose bool) (bool, error)
DownloadStarterProject mocks base method.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) GetDevfileRegistries(registryName string) ([]api.Registry, error)
GetDevfileRegistries mocks base method.
func (m *MockClient) ListDevfileStacks(ctx context.Context, registryName, devfileFlag, filterFlag string, detailsFlag, withDevfileContent bool) (DevfileStackList, error)
ListDevfileStacks mocks base method.
func (m *MockClient) PullStackFromRegistry(registry, stack, destDir string, options library.RegistryOptions) error
PullStackFromRegistry mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) DownloadFileInMemory(params interface{}) *gomock.Call
DownloadFileInMemory indicates an expected call of DownloadFileInMemory.
func (mr *MockClientMockRecorder) DownloadStarterProject(starterProject, decryptedToken, contextDir, verbose interface{}) *gomock.Call
DownloadStarterProject indicates an expected call of DownloadStarterProject.
func (mr *MockClientMockRecorder) GetDevfileRegistries(registryName interface{}) *gomock.Call
GetDevfileRegistries indicates an expected call of GetDevfileRegistries.
func (mr *MockClientMockRecorder) ListDevfileStacks(ctx, registryName, devfileFlag, filterFlag, detailsFlag, withDevfileContent interface{}) *gomock.Call
ListDevfileStacks indicates an expected call of ListDevfileStacks.
func (mr *MockClientMockRecorder) PullStackFromRegistry(registry, stack, destDir, options interface{}) *gomock.Call
PullStackFromRegistry indicates an expected call of PullStackFromRegistry.
type RegistryClient struct {
// contains filtered or unexported fields
}
func NewRegistryClient(fsys filesystem.Filesystem, preferenceClient preference.Client, kubeClient kclient.ClientInterface) RegistryClient
func (o RegistryClient) DownloadFileInMemory(params dfutil.HTTPRequestParams) ([]byte, error)
DownloadFileInMemory uses the url to download the file and return bytes
func (o RegistryClient) DownloadStarterProject(starterProject *devfilev1.StarterProject, decryptedToken string, contextDir string, verbose bool) (containsDevfile bool, err error)
DownloadStarterProject downloads a starter project referenced in devfile There are 3 cases to consider here: Case 1: If there is devfile in the starterproject, replace all the contents of contextDir with that of the starterproject; warn about this Case 2: If there is no devfile, and there is no conflict between the contents of contextDir and starterproject, then copy the contents of the starterproject into contextDir. Case 3: If there is no devfile, and there is conflict between the contents of contextDir and starterproject, copy contents of starterproject into a dir named CONFLICT_STARTER_PROJECT; warn about this
func (o RegistryClient) GetDevfileRegistries(registryName string) ([]api.Registry, error)
GetDevfileRegistries gets devfile registries from preference file, if registry name is specified return the specific registry, otherwise return all registries
func (o RegistryClient) ListDevfileStacks(ctx context.Context, registryName, devfileFlag, filterFlag string, detailsFlag bool, withDevfileContent bool) (DevfileStackList, error)
ListDevfileStacks lists all the available devfile stacks in devfile registry When `withDevfileContent` and `detailsFlag` are both true, another HTTP call is executed to download the Devfile
func (o RegistryClient) PullStackFromRegistry(registry string, stack string, destDir string, options library.RegistryOptions) error
PullStackFromRegistry pulls stack from registry with all stack resources (all media types) to the destination directory
TypesWithDetails is the list of project types in devfile registries, and their associated devfiles
type TypesWithDetails map[string][]api.DevfileStack
func (types TypesWithDetails) GetAtOrderedPosition(pos int) (api.DevfileStack, error)
GetAtOrderedPosition returns the project type at the given position, when the list of project types is ordered by GetOrderedLabels
func (types TypesWithDetails) GetOrderedLabels() []string
GetOrderedLabels returns a list of labels for a list of project types