imports

package
v1.221.0-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package imports provides functionality for processing stack imports, including support for remote imports from URLs via go-getter.

Index

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

func HasSchemeSeparator(uri string) bool

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 IsGCSURI

func IsGCSURI(uri string) bool

IsGCSURI checks if the URI is a Google Cloud Storage URI.

func IsGitURI

func IsGitURI(uri string) bool

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 IsHTTPURI

func IsHTTPURI(uri string) bool

IsHTTPURI checks if the URI is an HTTP/HTTPS URL.

func IsLocalPath

func IsLocalPath(uri string) bool

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

func IsRemote(uri string) bool

IsRemote returns true if the URI is a remote URL that should be downloaded. This is the inverse of IsLocalPath.

func IsS3URI

func IsS3URI(uri string) bool

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 RemoteImportMatch

type RemoteImportMatch struct {
	Path     string
	Key      string
	BasePath string
}

RemoteImportMatch is a resolved remote stack import ready for local processing.

func ResolveRemoteImport

func ResolveRemoteImport(atmosConfig *schema.AtmosConfiguration, uri string) ([]RemoteImportMatch, error)

ResolveRemoteImport is a convenience function that uses the global importer.

func ResolveRemoteImportNested

func ResolveRemoteImportNested(atmosConfig *schema.AtmosConfiguration, uri, nestedImports string) ([]RemoteImportMatch, error)

ResolveRemoteImportNested is a convenience function that uses the global importer.

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.

func (*RemoteImporter) Download

func (r *RemoteImporter) Download(uri string) (string, error)

Download fetches a remote import and returns the local path. Downloads are cached by URL hash to avoid redundant downloads. Uses file locking and atomic writes for safe concurrent access.

func (*RemoteImporter) Resolve

func (r *RemoteImporter) Resolve(uri string) ([]RemoteImportMatch, error)

Resolve fetches a remote import and returns all local stack files it resolves to.

func (*RemoteImporter) ResolveNested

func (r *RemoteImporter) ResolveNested(uri, nestedImports string) ([]RemoteImportMatch, error)

ResolveNested fetches a remote import and returns all local stack files it resolves to, preserving remote source context when nested imports should resolve remotely.

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

WithDownloader sets a custom downloader (useful for testing).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL