github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/initwd/module_install_hooks.go (about) 1 package initwd 2 3 import ( 4 version "github.com/hashicorp/go-version" 5 ) 6 7 // ModuleInstallHooks is an interface used to provide notifications about the 8 // installation process being orchestrated by InstallModules. 9 // 10 // This interface may have new methods added in future, so implementers should 11 // embed InstallHooksImpl to get no-op implementations of any unimplemented 12 // methods. 13 type ModuleInstallHooks interface { 14 // Download is called for modules that are retrieved from a remote source 15 // before that download begins, to allow a caller to give feedback 16 // on progress through a possibly-long sequence of downloads. 17 Download(moduleAddr, packageAddr string, version *version.Version) 18 19 // Install is called for each module that is installed, even if it did 20 // not need to be downloaded from a remote source. 21 Install(moduleAddr string, version *version.Version, localPath string) 22 } 23 24 // ModuleInstallHooksImpl is a do-nothing implementation of InstallHooks that 25 // can be embedded in another implementation struct to allow only partial 26 // implementation of the interface. 27 type ModuleInstallHooksImpl struct { 28 } 29 30 func (h ModuleInstallHooksImpl) Download(moduleAddr, packageAddr string, version *version.Version) { 31 } 32 33 func (h ModuleInstallHooksImpl) Install(moduleAddr string, version *version.Version, localPath string) { 34 } 35 36 var _ ModuleInstallHooks = ModuleInstallHooksImpl{}