github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/internal/getproviders/filesystem_mirror_source.go (about) 1 package getproviders 2 3 import ( 4 "github.com/hashicorp/terraform/addrs" 5 ) 6 7 // FilesystemMirrorSource is a source that reads providers and their metadata 8 // from a directory prefix in the local filesystem. 9 type FilesystemMirrorSource struct { 10 baseDir string 11 } 12 13 var _ Source = (*FilesystemMirrorSource)(nil) 14 15 // NewFilesystemMirrorSource constructs and returns a new filesystem-based 16 // mirror source with the given base directory. 17 func NewFilesystemMirrorSource(baseDir string) *FilesystemMirrorSource { 18 return &FilesystemMirrorSource{ 19 baseDir: baseDir, 20 } 21 } 22 23 // AvailableVersions scans the directory structure under the source's base 24 // directory for locally-mirrored packages for the given provider, returning 25 // a list of version numbers for the providers it found. 26 func (s *FilesystemMirrorSource) AvailableVersions(provider addrs.Provider) (VersionList, error) { 27 // TODO: Implement 28 panic("FilesystemMirrorSource.AvailableVersions not yet implemented") 29 } 30 31 // PackageMeta checks to see if the source's base directory contains a 32 // local copy of the distribution package for the given provider version on 33 // the given target, and returns the metadata about it if so. 34 func (s *FilesystemMirrorSource) PackageMeta(provider addrs.Provider, version Version, target Platform) (PackageMeta, error) { 35 // TODO: Implement 36 panic("FilesystemMirrorSource.PackageMeta not yet implemented") 37 }