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
- 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
- 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) 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_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 // 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 // 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"` }
Git is the package source from git registry.
func (*Git) FromString ¶ added in v0.9.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 WithCredsClient ¶ added in v0.9.1
func WithCredsClient(credsClient *CredClient) Option
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.