...

Package registry

Overview ▾

package registry wraps various package level functions into a Client interface to be able to mock them

Package registry is a generated GoMock package.

Index ▾

Constants
func DownloadStarterProject(fs filesystem.Filesystem, starterProject *devfilev1.StarterProject, decryptedToken string, contextDir string, verbose bool) error
func IsGithubBasedRegistry(url string) (bool, error)
func IsSecure(prefClient preference.Client, registryName string) bool
type Client
type DevfileStackList
    func (o *DevfileStackList) GetLanguages() []string
    func (o *DevfileStackList) GetProjectTypes(language string) TypesWithDetails
type ErrGithubRegistryNotSupported
    func (s *ErrGithubRegistryNotSupported) Error() string
type MockClient
    func NewMockClient(ctrl *gomock.Controller) *MockClient
    func (m *MockClient) DownloadFileInMemory(params util.HTTPRequestParams) ([]byte, error)
    func (m *MockClient) DownloadStarterProject(starterProject *v1alpha2.StarterProject, decryptedToken, contextDir string, verbose bool) (bool, error)
    func (m *MockClient) EXPECT() *MockClientMockRecorder
    func (m *MockClient) GetDevfileRegistries(registryName string) ([]api.Registry, error)
    func (m *MockClient) ListDevfileStacks(ctx context.Context, registryName, devfileFlag, filterFlag string, detailsFlag, withDevfileContent bool) (DevfileStackList, error)
    func (m *MockClient) PullStackFromRegistry(registry, stack, destDir string, options library.RegistryOptions) error
type MockClientMockRecorder
    func (mr *MockClientMockRecorder) DownloadFileInMemory(params interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) DownloadStarterProject(starterProject, decryptedToken, contextDir, verbose interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) GetDevfileRegistries(registryName interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) ListDevfileStacks(ctx, registryName, devfileFlag, filterFlag, detailsFlag, withDevfileContent interface{}) *gomock.Call
    func (mr *MockClientMockRecorder) PullStackFromRegistry(registry, stack, destDir, options interface{}) *gomock.Call
type RegistryClient
    func NewRegistryClient(fsys filesystem.Filesystem, preferenceClient preference.Client, kubeClient kclient.ClientInterface) RegistryClient
    func (o RegistryClient) DownloadFileInMemory(params dfutil.HTTPRequestParams) ([]byte, error)
    func (o RegistryClient) DownloadStarterProject(starterProject *devfilev1.StarterProject, decryptedToken string, contextDir string, verbose bool) (containsDevfile bool, err error)
    func (o RegistryClient) GetDevfileRegistries(registryName string) ([]api.Registry, error)
    func (o RegistryClient) ListDevfileStacks(ctx context.Context, registryName, devfileFlag, filterFlag string, detailsFlag bool, withDevfileContent bool) (DevfileStackList, error)
    func (o RegistryClient) PullStackFromRegistry(registry string, stack string, destDir string, options library.RegistryOptions) error
type TypesWithDetails
    func (types TypesWithDetails) GetAtOrderedPosition(pos int) (api.DevfileStack, error)
    func (types TypesWithDetails) GetOrderedLabels() []string

Package files

devfile_component_type_list.go errors.go interface.go mock.go registry.go starter_project.go types.go types_with_details.go utils.go

Constants

const (
    CONFLICT_DIR_NAME = "CONFLICT_STARTER_PROJECT"
)
const (
    RegistryUser = "default"
)

func DownloadStarterProject

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

func IsGithubBasedRegistry(url string) (bool, error)

func IsSecure

func IsSecure(prefClient preference.Client, registryName string) bool

IsSecure checks if the registry is secure

type Client

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

type DevfileStackList

DevfileStackList lists all the Devfile Stacks

type DevfileStackList struct {
    DevfileRegistries []api.Registry
    Items             []api.DevfileStack
}

func (*DevfileStackList) GetLanguages

func (o *DevfileStackList) GetLanguages() []string

GetLanguages returns the list of unique languages, ordered by name, from a list of registry items

func (*DevfileStackList) GetProjectTypes

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

type ErrGithubRegistryNotSupported struct {
}

func (*ErrGithubRegistryNotSupported) Error

func (s *ErrGithubRegistryNotSupported) Error() string

type MockClient

MockClient is a mock of Client interface.

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

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) DownloadFileInMemory

func (m *MockClient) DownloadFileInMemory(params util.HTTPRequestParams) ([]byte, error)

DownloadFileInMemory mocks base method.

func (*MockClient) DownloadStarterProject

func (m *MockClient) DownloadStarterProject(starterProject *v1alpha2.StarterProject, decryptedToken, contextDir string, verbose bool) (bool, error)

DownloadStarterProject mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

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

func (*MockClient) GetDevfileRegistries

func (m *MockClient) GetDevfileRegistries(registryName string) ([]api.Registry, error)

GetDevfileRegistries mocks base method.

func (*MockClient) ListDevfileStacks

func (m *MockClient) ListDevfileStacks(ctx context.Context, registryName, devfileFlag, filterFlag string, detailsFlag, withDevfileContent bool) (DevfileStackList, error)

ListDevfileStacks mocks base method.

func (*MockClient) PullStackFromRegistry

func (m *MockClient) PullStackFromRegistry(registry, stack, destDir string, options library.RegistryOptions) error

PullStackFromRegistry mocks base method.

type MockClientMockRecorder

MockClientMockRecorder is the mock recorder for MockClient.

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

func (*MockClientMockRecorder) DownloadFileInMemory

func (mr *MockClientMockRecorder) DownloadFileInMemory(params interface{}) *gomock.Call

DownloadFileInMemory indicates an expected call of DownloadFileInMemory.

func (*MockClientMockRecorder) DownloadStarterProject

func (mr *MockClientMockRecorder) DownloadStarterProject(starterProject, decryptedToken, contextDir, verbose interface{}) *gomock.Call

DownloadStarterProject indicates an expected call of DownloadStarterProject.

func (*MockClientMockRecorder) GetDevfileRegistries

func (mr *MockClientMockRecorder) GetDevfileRegistries(registryName interface{}) *gomock.Call

GetDevfileRegistries indicates an expected call of GetDevfileRegistries.

func (*MockClientMockRecorder) ListDevfileStacks

func (mr *MockClientMockRecorder) ListDevfileStacks(ctx, registryName, devfileFlag, filterFlag, detailsFlag, withDevfileContent interface{}) *gomock.Call

ListDevfileStacks indicates an expected call of ListDevfileStacks.

func (*MockClientMockRecorder) PullStackFromRegistry

func (mr *MockClientMockRecorder) PullStackFromRegistry(registry, stack, destDir, options interface{}) *gomock.Call

PullStackFromRegistry indicates an expected call of PullStackFromRegistry.

type RegistryClient

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

func NewRegistryClient

func NewRegistryClient(fsys filesystem.Filesystem, preferenceClient preference.Client, kubeClient kclient.ClientInterface) RegistryClient

func (RegistryClient) DownloadFileInMemory

func (o RegistryClient) DownloadFileInMemory(params dfutil.HTTPRequestParams) ([]byte, error)

DownloadFileInMemory uses the url to download the file and return bytes

func (RegistryClient) DownloadStarterProject

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 (RegistryClient) GetDevfileRegistries

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 (RegistryClient) ListDevfileStacks

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 (RegistryClient) PullStackFromRegistry

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

type TypesWithDetails

TypesWithDetails is the list of project types in devfile registries, and their associated devfiles

type TypesWithDetails map[string][]api.DevfileStack

func (TypesWithDetails) GetAtOrderedPosition

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 (TypesWithDetails) GetOrderedLabels

func (types TypesWithDetails) GetOrderedLabels() []string

GetOrderedLabels returns a list of labels for a list of project types