Documentation ¶
Overview ¶
Copyright 2022 The KCL Authors. All rights reserved.
Index ¶
- Constants
- func ParseSourceUrlFrom(sourceStr string, settings *settings.Settings) (*url.URL, error)
- type CredClient
- type DepDownloader
- type DownloadOptions
- type Downloader
- type Git
- func (git *Git) FromString(gitStr string) error
- func (git *Git) GetPackage() string
- func (git *Git) GetValidGitReference() (string, error)
- func (git *Git) MarshalTOML() string
- func (git *Git) ToFilePath() (string, error)
- func (git *Git) ToString() (string, error)
- func (git *Git) UnmarshalModTOML(data interface{}) error
- type GitDownloader
- type Local
- func (local *Local) FindRootPath() (string, error)
- func (local *Local) FromString(localStr string) error
- func (local *Local) IsDir() bool
- func (local *Local) IsLocalKPath() bool
- func (local *Local) IsLocalTarPath() bool
- func (local *Local) IsLocalTgzPath() bool
- func (local *Local) MarshalTOML() string
- func (local *Local) ToFilePath() (string, error)
- func (local *Local) ToString() (string, error)
- func (local *Local) UnmarshalModTOML(data interface{}) error
- type Oci
- type OciDownloader
- type Option
- func WithCachePath(cachePath string) Option
- func WithCredsClient(credsClient *CredClient) Option
- func WithEnableCache(enableCache bool) Option
- func WithInsecureSkipTLSverify(insecureSkipTLSverify bool) Option
- func WithLocalPath(localPath string) Option
- func WithLogWriter(logWriter io.Writer) Option
- func WithSettings(settings settings.Settings) Option
- func WithSource(source Source) Option
- type Platform
- type Registry
- type Source
- func (source *Source) FindRootPath() (string, error)
- func (source *Source) FromString(sourceStr string) error
- func (source *Source) IsLocalPath() bool
- func (source *Source) IsLocalPkg() bool
- func (source *Source) IsLocalTarPath() bool
- func (source *Source) IsLocalTgzPath() bool
- func (source *Source) IsPackaged() bool
- func (source *Source) IsRemote() bool
- func (source *Source) MarshalTOML() string
- func (source *Source) ToFilePath() (string, error)
- func (source *Source) ToString() (string, error)
- func (source *Source) UnmarshalModTOML(data interface{}) error
Constants ¶
const GIT_BRANCH_FLAG = "branch"
const GIT_BRANCH_PATTERN = "branch = \"%s\""
const GIT_COMMIT_FLAG = "commit"
const GIT_COMMIT_PATTERN = "commit = \"%s\""
const GIT_PACKAGE = "package = \"%s\""
const GIT_PACKAGE_FLAG = "package"
const GIT_URL_FLAG = "git"
const GIT_URL_PATTERN = "git = \"%s\""
const LOCAL_PATH_FLAG = "path"
const LOCAL_PATH_PATTERN = "path = %s"
const NEWLINE = "\n"
const OCI_URL_PATTERN = "oci = \"%s\""
const SEPARATOR = ", "
const SOURCE_PATTERN = "{ %s }"
const TAG_FLAG = "tag"
const TAG_PATTERN = "tag = \"%s\""
const VERSION_PATTERN = "version = \"%s\""
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CredClient ¶ added in v0.9.1
type CredClient struct {
// contains filtered or unexported fields
}
CredClient is the client to get the credentials.
func LoadCredentialFile ¶ added in v0.9.1
func LoadCredentialFile(filepath string) (*CredClient, error)
LoadCredentialFile loads the credential file and return the CredClient.
func (*CredClient) Credential ¶ added in v0.9.1
func (cred *CredClient) Credential(hostName string) (*remoteauth.Credential, error)
Credential will reture the credential info cache in CredClient
func (*CredClient) GetAuthClient ¶ added in v0.9.1
func (cred *CredClient) GetAuthClient() *dockerauth.Client
GetAuthClient returns the auth client.
type DepDownloader ¶
type DepDownloader struct { *OciDownloader *GitDownloader }
DepDownloader is the downloader for the package. Only support the OCI and git source.
func NewOciDownloader ¶
func NewOciDownloader(platform string) *DepDownloader
func (*DepDownloader) Download ¶
func (d *DepDownloader) Download(opts DownloadOptions) error
type DownloadOptions ¶
type DownloadOptions struct { // LocalPath is the local path to download the package. LocalPath string // CachePath is the cache path to download the package. CachePath string // EnableCache is the flag to enable the cache. // If `EnableCache` is false, this will not result in increasing disk usage. EnableCache bool // Source is the source of the package. including git, oci, local. Source Source // Settings is the default settings and authrization information. Settings settings.Settings // LogWriter is the writer to write the log. LogWriter io.Writer // InsecureSkipTLSverify is the flag to skip the verification of the certificate. InsecureSkipTLSverify bool // contains filtered or unexported fields }
DownloadOptions is the options for downloading a package.
func NewDownloadOptions ¶
func NewDownloadOptions(opts ...Option) *DownloadOptions
type Downloader ¶
type Downloader interface {
Download(opts DownloadOptions) error
}
Downloader is the interface for downloading a package.
type Git ¶ added in v0.9.0
type Git struct { Url string `toml:"url,omitempty"` Branch string `toml:"branch,omitempty"` Commit string `toml:"commit,omitempty"` Tag string `toml:"git_tag,omitempty"` Version string `toml:"version,omitempty"` Package string `toml:"package,omitempty"` }
Git is the package source from git registry.
func (*Git) FromString ¶ added in v0.9.0
func (*Git) GetPackage ¶ added in v0.10.0
func (*Git) GetValidGitReference ¶ added in v0.9.0
GetValidGitReference will get the valid git reference from git source. Only one of branch, tag or commit is allowed.
func (*Git) MarshalTOML ¶ added in v0.9.0
func (*Git) ToFilePath ¶ added in v0.9.0
func (*Git) UnmarshalModTOML ¶ added in v0.9.0
type GitDownloader ¶
type GitDownloader struct{}
GitDownloader is the downloader for the git source.
func (*GitDownloader) Download ¶
func (d *GitDownloader) Download(opts DownloadOptions) error
type Local ¶ added in v0.9.0
type Local struct {
Path string `toml:"path,omitempty"`
}
func (*Local) FindRootPath ¶ added in v0.9.0
func (*Local) FromString ¶ added in v0.9.0
func (*Local) IsLocalKPath ¶ added in v0.9.0
func (*Local) IsLocalTarPath ¶ added in v0.9.0
func (*Local) IsLocalTgzPath ¶ added in v0.9.1
func (*Local) MarshalTOML ¶ added in v0.9.0
func (*Local) ToFilePath ¶ added in v0.9.0
func (*Local) UnmarshalModTOML ¶ added in v0.9.0
type Oci ¶ added in v0.9.0
type Oci struct { Reg string `toml:"reg,omitempty"` Repo string `toml:"repo,omitempty"` Tag string `toml:"oci_tag,omitempty"` }
func (*Oci) FromString ¶ added in v0.9.0
func (*Oci) IntoOciUrl
deprecated
added in
v0.9.0
func (*Oci) MarshalTOML ¶ added in v0.9.0
func (*Oci) ToFilePath ¶ added in v0.9.0
func (*Oci) UnmarshalModTOML ¶ added in v0.9.0
type OciDownloader ¶
type OciDownloader struct {
Platform string
}
OciDownloader is the downloader for the OCI source.
func (*OciDownloader) Download ¶
func (d *OciDownloader) Download(opts DownloadOptions) error
type Option ¶
type Option func(*DownloadOptions)
func WithCachePath ¶ added in v0.10.0
func WithCredsClient ¶ added in v0.9.1
func WithCredsClient(credsClient *CredClient) Option
func WithEnableCache ¶ added in v0.10.0
func WithInsecureSkipTLSverify ¶ added in v0.10.0
func WithLocalPath ¶
func WithLogWriter ¶
func WithSettings ¶
func WithSource ¶
type Registry ¶ added in v0.9.0
func (*Registry) FromString ¶ added in v0.9.0
default::oci://ghcr.io/kcl-lang/k8s?name=k8s?version=0.1.1
func (*Registry) MarshalTOML ¶ added in v0.9.0
func (*Registry) ToFilePath ¶ added in v0.9.0
func (*Registry) UnmarshalModTOML ¶ added in v0.9.0
type Source ¶ added in v0.9.0
Source is the package source from registry.
func NewSourceFromStr ¶ added in v0.9.0
func (*Source) FindRootPath ¶ added in v0.9.0
func (*Source) FromString ¶ added in v0.9.0
func (*Source) IsLocalPath ¶ added in v0.9.0
func (*Source) IsLocalPkg ¶ added in v0.10.0
If the source is a local path, check if it is a real local package(a directory with kcl.mod file).