Documentation ¶
Index ¶
- Variables
- func GetSourceAddrAndVersion(sourceURL string) (string, string)
- func IsLocalSourceAddr(addr string) bool
- func IsRegistrySourceAddr(addr string) bool
- func IsRemoteTypeTerraformRegistry(remoteType string) bool
- func IsValidRemoteType(remoteType string) bool
- func NewAuthenticatedRegistryClient(rcFile string) terraformRegistryClient
- func SplitAddrSubdir(addr string) (repoURL, subDir string)
- type Downloader
- type ModuleDownloader
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyURLType = fmt.Errorf("empty remote url and type") ErrEmptyURLDest = fmt.Errorf("remote url or destination dir path cannot be empty") ErrEmptyURLTypeDest = fmt.Errorf("empty remote url or type or destination dir path") ErrInvalidRemoteType = fmt.Errorf("supplied remote type is not supported") )
list of errors
Functions ¶
func GetSourceAddrAndVersion ¶
GetSourceAddrAndVersion extracts source address and version from supplied source url
func IsLocalSourceAddr ¶
IsLocalSourceAddr validates if a source address is a local address or not
func IsRegistrySourceAddr ¶
IsRegistrySourceAddr will validate if the source address is a valid registry module or not. a valid source address is of the form <HOSTNAME>/NAMESPACE>/<NAME>/<PROVIDER> regsrc.ParseModuleSource func returns a terraform registry module source.
func IsRemoteTypeTerraformRegistry ¶
IsRemoteTypeTerraformRegistry checks if supplied remote type is terraform-registry
func IsValidRemoteType ¶
IsValidRemoteType validates the remote type supplied as scan option
func NewAuthenticatedRegistryClient ¶
func NewAuthenticatedRegistryClient(rcFile string) terraformRegistryClient
NewAuthenticatedRegistryClient parses the contents of a terraformrc file and builds an authenticated registry client using the credentials found in the rcfile
func SplitAddrSubdir ¶
SplitAddrSubdir splits the given address into a package portion and a sub-directory portion.
The package portion defines the URL what should be downloaded and then the sub-directory portion, if present, specifies a sub-directory within the downloaded object .
The subDir portion will be returned as empty if no subdir separator ("//") is present in the address.
Types ¶
type Downloader ¶
type Downloader interface { Download(url, destDir string) (finalDir string, err error) DownloadWithType(remoteType, url, dest string) (finalDir string, err error) GetURLSubDir(url, dest string) (urlWithType string, subDir string, err error) SubDirGlob(string, string) (string, error) }
Downloader helps in downloading different kinds of modules from different types of sources
type ModuleDownloader ¶
type ModuleDownloader interface { DownloadModule(addr, destPath string) (string, error) DownloadRemoteModule(requiredVersion hclConfigs.VersionConstraint, destPath string, module *regsrc.Module) (string, error) CleanUp() GetDownloaderCache() map[string]string }
ModuleDownloader helps in downloading the remote modules
func NewRemoteDownloader ¶
func NewRemoteDownloader() ModuleDownloader
NewRemoteDownloader returns a new ModuleDownloader