]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/go-getter/get.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / go-getter / get.go
index e6053d934a18fc15569cf3e53ec2685e8ac59219..c233763c67f7091104bb24041bfaf36e4af8da8b 100644 (file)
@@ -41,6 +41,11 @@ type Getter interface {
        // ClientMode returns the mode based on the given URL. This is used to
        // allow clients to let the getters decide which mode to use.
        ClientMode(*url.URL) (ClientMode, error)
+
+       // SetClient allows a getter to know it's client
+       // in order to access client's Get functions or
+       // progress tracking.
+       SetClient(*Client)
 }
 
 // Getters is the mapping of scheme to the Getter implementation that will
@@ -62,6 +67,7 @@ func init() {
        Getters = map[string]Getter{
                "file":  new(FileGetter),
                "git":   new(GitGetter),
+               "gcs":   new(GCSGetter),
                "hg":    new(HgGetter),
                "s3":    new(S3Getter),
                "http":  httpGetter,
@@ -74,12 +80,12 @@ func init() {
 //
 // src is a URL, whereas dst is always just a file path to a folder. This
 // folder doesn't need to exist. It will be created if it doesn't exist.
-func Get(dst, src string) error {
+func Get(dst, src string, opts ...ClientOption) error {
        return (&Client{
                Src:     src,
                Dst:     dst,
                Dir:     true,
-               Getters: Getters,
+               Options: opts,
        }).Get()
 }
 
@@ -89,23 +95,23 @@ func Get(dst, src string) error {
 // dst must be a directory. If src is a file, it will be downloaded
 // into dst with the basename of the URL. If src is a directory or
 // archive, it will be unpacked directly into dst.
-func GetAny(dst, src string) error {
+func GetAny(dst, src string, opts ...ClientOption) error {
        return (&Client{
                Src:     src,
                Dst:     dst,
                Mode:    ClientModeAny,
-               Getters: Getters,
+               Options: opts,
        }).Get()
 }
 
 // GetFile downloads the file specified by src into the path specified by
 // dst.
-func GetFile(dst, src string) error {
+func GetFile(dst, src string, opts ...ClientOption) error {
        return (&Client{
                Src:     src,
                Dst:     dst,
                Dir:     false,
-               Getters: Getters,
+               Options: opts,
        }).Get()
 }