Documentation ¶
Index ¶
- Constants
- Variables
- func IsYamlFile(entry os.DirEntry) bool
- type GitHubRegistryModuleLoader
- type GitHubRegistryModuleLoaderOptions
- type LocalDirectoryModuleLoader
- type LocalDirectoryModuleLoaderOptions
- type ModuleLoader
- type ModuleLoaderOptions
- type ModuleLoaderType
- type S3BucketModuleLoader
- type S3BucketModuleLoaderOptions
- type URLModuleLoader
- type URLModuleLoaderOptions
Constants ¶
const (
DownloadModulesDirectoryName = "modules"
)
Variables ¶
var Pattern = regexp.MustCompile("^[A-Za-z_-]?[\\w\\-_@.]+$")
Functions ¶
func IsYamlFile ¶
Types ¶
type GitHubRegistryModuleLoader ¶
type GitHubRegistryModuleLoader struct {
// contains filtered or unexported fields
}
GitHubRegistryModuleLoader Load the module from GitHub's Registry
func NewGitHubRegistryModuleLoader ¶
func NewGitHubRegistryModuleLoader(options *GitHubRegistryModuleLoaderOptions) (*GitHubRegistryModuleLoader, error)
func (*GitHubRegistryModuleLoader) Name ¶
func (x *GitHubRegistryModuleLoader) Name() ModuleLoaderType
func (*GitHubRegistryModuleLoader) Options ¶
func (x *GitHubRegistryModuleLoader) Options() *GitHubRegistryModuleLoaderOptions
type GitHubRegistryModuleLoaderOptions ¶
type GitHubRegistryModuleLoaderOptions struct { *ModuleLoaderOptions // The full name of the Registry's repository RegistryRepoFullName string `json:"registry-repo-full-name" yaml:"registry-repo-full-name"` }
GitHubRegistryModuleLoaderOptions Options when creating the GitHub Registry
type LocalDirectoryModuleLoader ¶
type LocalDirectoryModuleLoader struct {
// contains filtered or unexported fields
}
LocalDirectoryModuleLoader Load the module from the local directory
func NewLocalDirectoryModuleLoader ¶
func NewLocalDirectoryModuleLoader(options *LocalDirectoryModuleLoaderOptions) (*LocalDirectoryModuleLoader, error)
func (*LocalDirectoryModuleLoader) Name ¶
func (x *LocalDirectoryModuleLoader) Name() ModuleLoaderType
func (*LocalDirectoryModuleLoader) Options ¶
func (x *LocalDirectoryModuleLoader) Options() *LocalDirectoryModuleLoaderOptions
type LocalDirectoryModuleLoaderOptions ¶
type LocalDirectoryModuleLoaderOptions struct { *ModuleLoaderOptions // Directory where the module resides Directory ModuleDirectory string `json:"module-directory" yaml:"module-directory"` }
LocalDirectoryModuleLoaderOptions Option when loading modules from a local directory
func (*LocalDirectoryModuleLoaderOptions) BuildFullName ¶
func (x *LocalDirectoryModuleLoaderOptions) BuildFullName() string
BuildFullName Gets the globally unique identity of the module
type ModuleLoader ¶
type ModuleLoader[Options any] interface { // Name The name of the loader Name() ModuleLoaderType // Load Use this loader to load the module Load(ctx context.Context) (*module.Module, bool) Options() Options }
ModuleLoader Module loader
type ModuleLoaderOptions ¶
type ModuleLoaderOptions struct { // Where can I download the module Source string `json:"source" yaml:"source"` // Which version of which module to download Version string `json:"version" yaml:"version"` // What is the download path configured in the current system DownloadDirectory string `json:"download-directory" yaml:"download-directory"` // TODO Can be used to track download progress ProgressTracker getter.ProgressTracker // It's used to send information back in real time MessageChannel *message.Channel[*schema.Diagnostics] `json:"message-channel"` // How do I go from the root module to the current module DependenciesTree []string `json:"dependencies-tree" yaml:"dependencies-tree"` }
ModuleLoaderOptions Options when loading the module
func (*ModuleLoaderOptions) DeepDependenciesTree ¶
func (x *ModuleLoaderOptions) DeepDependenciesTree(source string) []string
DeepDependenciesTree The dependence goes deeper
type ModuleLoaderType ¶
type ModuleLoaderType string
const ( // ModuleLoaderTypeInvalid Default value if not set ModuleLoaderTypeInvalid ModuleLoaderType = "" // ModuleLoaderTypeS3Bucket Load modules from S3 bucket.s ModuleLoaderTypeS3Bucket ModuleLoaderType = "s3-bucket-module-loader" // ModuleLoaderTypeGitHubRegistry Load the module from GitHub's Registry ModuleLoaderTypeGitHubRegistry ModuleLoaderType = "github-registry-module-loader" // ModuleLoaderTypeLocalDirectory Load the module from the local directory ModuleLoaderTypeLocalDirectory ModuleLoaderType = "local-directory-module-loader" ModuleLoaderTypeURL ModuleLoaderType = "url-module-loader" )
func NewModuleLoaderBySource ¶
func NewModuleLoaderBySource(source string) ModuleLoaderType
NewModuleLoaderBySource Distributed to different module loaders based on load options
type S3BucketModuleLoader ¶
type S3BucketModuleLoader struct {
// contains filtered or unexported fields
}
func NewS3BucketModuleLoader ¶
func NewS3BucketModuleLoader(options *S3BucketModuleLoaderOptions) (*S3BucketModuleLoader, error)
func (*S3BucketModuleLoader) Name ¶
func (x *S3BucketModuleLoader) Name() ModuleLoaderType
func (*S3BucketModuleLoader) Options ¶
func (x *S3BucketModuleLoader) Options() *S3BucketModuleLoaderOptions
type S3BucketModuleLoaderOptions ¶
type S3BucketModuleLoaderOptions struct { *ModuleLoaderOptions S3BucketURL string }
type URLModuleLoader ¶
type URLModuleLoader struct {
// contains filtered or unexported fields
}
URLModuleLoader Load the module from a URL, which should be a zipped package that happens to be the module's directory
func NewURLModuleLoader ¶
func NewURLModuleLoader(options *URLModuleLoaderOptions) (*URLModuleLoader, error)
func (*URLModuleLoader) Name ¶
func (x *URLModuleLoader) Name() ModuleLoaderType
func (*URLModuleLoader) Options ¶
func (x *URLModuleLoader) Options() *URLModuleLoaderOptions
type URLModuleLoaderOptions ¶
type URLModuleLoaderOptions struct { *ModuleLoaderOptions // Module URL, It's a zip package ModuleURL string `json:"module-url" yaml:"module-url"` }
URLModuleLoaderOptions Parameter options when creating the URL module loader