mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Remove duplicated functions from pkg/util * Use generator.GetVolumeMountPath from devfile library
33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
package registry
|
|
|
|
import (
|
|
devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
|
|
dfutil "github.com/devfile/library/pkg/util"
|
|
"github.com/devfile/registry-support/registry-library/library"
|
|
|
|
"github.com/redhat-developer/odo/pkg/component"
|
|
"github.com/redhat-developer/odo/pkg/util"
|
|
)
|
|
|
|
type RegistryClient struct{}
|
|
|
|
func NewRegistryClient() RegistryClient {
|
|
return RegistryClient{}
|
|
}
|
|
|
|
// PullStackFromRegistry pulls stack from registry with all stack resources (all media types) to the destination directory
|
|
func (o RegistryClient) PullStackFromRegistry(registry string, stack string, destDir string, options library.RegistryOptions) error {
|
|
return library.PullStackFromRegistry(registry, stack, destDir, options)
|
|
}
|
|
|
|
// DownloadFileInMemory uses the url to download the file and return bytes
|
|
func (o RegistryClient) DownloadFileInMemory(params dfutil.HTTPRequestParams) ([]byte, error) {
|
|
return util.DownloadFileInMemory(params)
|
|
}
|
|
|
|
// DownloadStarterProject downloads a starter project referenced in devfile
|
|
// This will first remove the content of the contextDir
|
|
func (o RegistryClient) DownloadStarterProject(starterProject *devfilev1.StarterProject, decryptedToken string, contextDir string, verbose bool) error {
|
|
return component.DownloadStarterProject(starterProject, decryptedToken, contextDir, verbose)
|
|
}
|