Documentation
¶
Overview ¶
Package imports provides functionality for processing stack imports, including support for remote imports from URLs via go-getter.
Index ¶
- func DownloadRemoteImport(atmosConfig *schema.AtmosConfiguration, uri string) (string, error)
- func HasSchemeSeparator(uri string) bool
- func IsGCSURI(uri string) bool
- func IsGitURI(uri string) bool
- func IsHTTPURI(uri string) bool
- func IsLocalPath(uri string) bool
- func IsRemote(uri string) bool
- func IsS3URI(uri string) bool
- func ProcessImportPath(atmosConfig *schema.AtmosConfiguration, basePath, importPath string) (string, error)
- func ResolveImportPaths(atmosConfig *schema.AtmosConfiguration, basePath string, importPaths []string) ([]string, error)
- type RemoteImporter
- type RemoteImporterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadRemoteImport ¶
func DownloadRemoteImport(atmosConfig *schema.AtmosConfiguration, uri string) (string, error)
DownloadRemoteImport is a convenience function that uses the global importer.
func HasSchemeSeparator ¶
HasSchemeSeparator checks if the URI contains a scheme separator. Examples:
- true: "https://github.com", "git::https://...", "s3::https://...".
- false: "github.com/repo", "./local/path", "components/terraform".
func IsGitURI ¶
IsGitURI checks if the URI appears to be a Git repository URL. Detection rules: 1. Explicit git:: prefix. 2. SCP-style URLs (git@github.com:owner/repo.git). 3. Known Git hosting platforms (github.com, gitlab.com, bitbucket.org) in host. 4. .git extension in path (not in host). 5. Azure DevOps _git/ pattern in path.
func IsLocalPath ¶
IsLocalPath checks if the URI is a local file system path. Examples:
- Local: "/absolute/path", "./relative/path", "../parent/path", "components/terraform".
- Remote: "github.com/owner/repo", "https://example.com", "git.company.com/repo".
func IsRemote ¶
IsRemote returns true if the URI is a remote URL that should be downloaded. This is the inverse of IsLocalPath.
func IsS3URI ¶
IsS3URI checks if the URI is an S3 URI. Go-getter supports both explicit s3:: prefix and auto-detected .amazonaws.com URLs.
func ProcessImportPath ¶
func ProcessImportPath(atmosConfig *schema.AtmosConfiguration, basePath, importPath string) (string, error)
ProcessImportPath resolves an import path (local or remote) to a local file path. For local paths, it joins with basePath. For remote URLs, it downloads and returns the temp file path.
func ResolveImportPaths ¶
func ResolveImportPaths(atmosConfig *schema.AtmosConfiguration, basePath string, importPaths []string) ([]string, error)
ResolveImportPaths resolves multiple import paths, returning local file paths. This is a convenience function for batch processing.
Types ¶
type RemoteImporter ¶
type RemoteImporter struct {
// contains filtered or unexported fields
}
RemoteImporter handles downloading stack imports from remote URLs.
func NewRemoteImporter ¶
func NewRemoteImporter(atmosConfig *schema.AtmosConfiguration, opts ...RemoteImporterOption) (*RemoteImporter, error)
NewRemoteImporter creates a new RemoteImporter.
func (*RemoteImporter) ClearCache ¶
func (r *RemoteImporter) ClearCache() error
ClearCache removes all cached imports.
type RemoteImporterOption ¶
type RemoteImporterOption func(*RemoteImporter)
RemoteImporterOption is a functional option for configuring RemoteImporter.
func WithCache ¶
func WithCache(c *cache.FileCache) RemoteImporterOption
WithCache sets a custom FileCache (useful for testing).
func WithDownloader ¶
func WithDownloader(d downloader.FileDownloader) RemoteImporterOption
WithDownloader sets a custom downloader (useful for testing).