util

package
v2.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OutputDevfileYamlPath = "devfile.yaml"
)

Default filenames for create devfile to be used in mocks

Variables

View Source
var DevfilePossibilities = [...]string{"devfile.yaml", ".devfile.yaml", "devfile.yml", ".devfile.yml"}

Contains common naming conventions for devfiles to look for when downloading resources

Functions

func ValidateDevfileExistence

func ValidateDevfileExistence(path string) bool

ValidateDevfileExistence verifies if any of the naming possibilities for devfile are present in the url path

Types

type DevfileUtils

type DevfileUtils interface {
	DownloadGitRepoResources(url string, destDir string, token string) error
	DownloadInMemory(params util.HTTPRequestParams) ([]byte, error)
}

type DevfileUtilsClient

type DevfileUtilsClient struct {
}

func NewDevfileUtilsClient

func NewDevfileUtilsClient() DevfileUtilsClient

func (DevfileUtilsClient) DownloadGitRepoResources

func (c DevfileUtilsClient) DownloadGitRepoResources(url string, destDir string, token string) error

DownloadGitRepoResources downloads the git repository resources

func (DevfileUtilsClient) DownloadInMemory

func (c DevfileUtilsClient) DownloadInMemory(params util.HTTPRequestParams) ([]byte, error)

DownloadInMemory is a wrapper to the util.DownloadInMemory() call. This is done to help devfile/library clients invoke this function with a client.

type MockDevfileUtilsClient

type MockDevfileUtilsClient struct {
	// Specify a valid git URL as an alias if using a localhost HTTP server in order to pass validation.
	ParentURLAlias string

	// MockGitUrl struct for mocking git related ops
	MockGitURL util.MockGitUrl

	// Mock Git token.  Specify the string "valid-token" for the mock CloneGitRepo to pass
	GitTestToken string

	// Options to specify what file download needs to be mocked
	DownloadOptions util.MockDownloadOptions
}

func NewMockDevfileUtilsClient

func NewMockDevfileUtilsClient() MockDevfileUtilsClient

func (MockDevfileUtilsClient) DownloadGitRepoResources

func (gc MockDevfileUtilsClient) DownloadGitRepoResources(url string, destDir string, token string) error

func (*MockDevfileUtilsClient) DownloadInMemory

func (gc *MockDevfileUtilsClient) DownloadInMemory(params util.HTTPRequestParams) ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL