Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadFile ¶
type DownloadFile struct { Mode Mode `hcl:"mode"` DownloadURL string `hcl:"downloadURL"` Paths []*DownloadPath `hcl:"download,block"` }
DownloadFile represents a custom HCL format of how to handle module@version requests that are not found in storage.
func NewFile ¶
func NewFile(m Mode, downloadURL string) (*DownloadFile, error)
NewFile takes a mode and returns a DownloadFile. Mode can be one of the constants declared above or a custom HCL file. To pass a custom HCL file, you can either point to a file path by passing file:/path/to/file OR custom:<base64-encoded-hcl> directly.
func (*DownloadFile) Match ¶
func (d *DownloadFile) Match(mod string) Mode
Match returns the Mode that matches the given module. A pattern is prioritized by order in which it appears in the HCL file, while the default Mode will be returned if no patterns exist or match.
func (*DownloadFile) URL ¶
func (d *DownloadFile) URL(mod string) string
URL returns the redirect URL that applies to the given module. If no pattern matches, the top level downloadURL is returned.
type DownloadPath ¶
type DownloadPath struct { Pattern string `hcl:"pattern,label"` Mode Mode `hcl:"mode"` DownloadURL string `hcl:"downloadURL,optional"` }
DownloadPath represents a custom Mode for a matching path.