From ca694fecd51ff1df54f9f9a7cdab96393559e58d Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Mon, 30 Oct 2023 17:50:16 -0500 Subject: [PATCH] added reference to the file provider interface --- src/content/docs/ingredients/file-providers.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/content/docs/ingredients/file-providers.md b/src/content/docs/ingredients/file-providers.md index ba16b86..1db2fdb 100644 --- a/src/content/docs/ingredients/file-providers.md +++ b/src/content/docs/ingredients/file-providers.md @@ -2,7 +2,17 @@ title: grlx.ingedients.file.providers description: grlx built-in file providers --- -`grlx` has a concept of file providers for different ways that you might obtain a file to be added to a given `sprout`. This uses a provider interface to keep this extensible and provide a standard way to use different file types. By default, `grlx` has three built-in providers: local, HTTP, and S3. +`grlx` has a concept of file providers for different ways that you might obtain a file to be added to a given `sprout`. This uses a provider interface to keep this extensible and provide a standard way to use different file types. The `go` interface for File Providers looks like the following: +```go +type FileProvider interface { + Download(context.Context) error + Properties() (map[string]interface{}, error) + Parse(id, source, destination, hash string, properties map[string]interface{}) (FileProvider, error) + Protocols() []string + Verify(context.Context) (bool, error) +} +``` +By default, `grlx` has three built-in providers: local, HTTP, and S3. ## Local The local provider would be how you would use a file from your host system. @@ -14,7 +24,7 @@ file.cached: ``` ## HTTP -The HTTP provider allows you to download files via HTTP for use. The [example](/ingredients/file-providers/#example) below is using the HTTP provider to download Go from the Internet. This file then gets cached to the sprout. +The HTTP provider allows you to download files via HTTP for use. The [example](/ingredients/file-providers/#example) below is using the HTTP provider to download Go from the Internet. This file then gets cached to the sprout. #### Example ```yaml file.cached: