1// Code generated by go-bindata.
2// sources:
3// ../../../../../../../../../tmp/terraform
4// DO NOT EDIT!
5
6// +build !includeTerraform
7
8package binary_dist
9
10import (
11	"fmt"
12	"io/ioutil"
13	"os"
14	"os/exec"
15	"path/filepath"
16	"strings"
17)
18
19// bindataRead reads the given file from disk. It returns an error on failure.
20func bindataRead(path, name string) ([]byte, error) {
21	buf, err := ioutil.ReadFile(path)
22	if err != nil {
23		err = fmt.Errorf("Error reading asset %s at %s: %v", name, path, err)
24	}
25	return buf, err
26}
27
28type asset struct {
29	bytes []byte
30	info  os.FileInfo
31}
32
33// terraform reads file data from disk. It returns an error on failure.
34func terraform() (*asset, error) {
35	path, _ := exec.LookPath("terraform")
36	name := "terraform"
37	bytes, err := bindataRead(path, name)
38	if err != nil {
39		return nil, err
40	}
41
42	fi, err := os.Stat(path)
43	if err != nil {
44		err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
45	}
46
47	a := &asset{bytes: bytes, info: fi}
48	return a, err
49}
50
51// Asset loads and returns the asset for the given name.
52// It returns an error if the asset could not be found or
53// could not be loaded.
54func Asset(name string) ([]byte, error) {
55	cannonicalName := strings.Replace(name, "\\", "/", -1)
56	if f, ok := _bindata[cannonicalName]; ok {
57		a, err := f()
58		if err != nil {
59			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
60		}
61		return a.bytes, nil
62	}
63	return nil, fmt.Errorf("Asset %s not found", name)
64}
65
66// MustAsset is like Asset but panics when Asset would return an error.
67// It simplifies safe initialization of global variables.
68func MustAsset(name string) []byte {
69	a, err := Asset(name)
70	if err != nil {
71		panic("asset: Asset(" + name + "): " + err.Error())
72	}
73
74	return a
75}
76
77// AssetInfo loads and returns the asset info for the given name.
78// It returns an error if the asset could not be found or
79// could not be loaded.
80func AssetInfo(name string) (os.FileInfo, error) {
81	cannonicalName := strings.Replace(name, "\\", "/", -1)
82	if f, ok := _bindata[cannonicalName]; ok {
83		a, err := f()
84		if err != nil {
85			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
86		}
87		return a.info, nil
88	}
89	return nil, fmt.Errorf("AssetInfo %s not found", name)
90}
91
92// AssetNames returns the names of the assets.
93func AssetNames() []string {
94	names := make([]string, 0, len(_bindata))
95	for name := range _bindata {
96		names = append(names, name)
97	}
98	return names
99}
100
101// _bindata is a table, holding each asset generator, mapped to its name.
102var _bindata = map[string]func() (*asset, error){
103	"terraform": terraform,
104}
105
106// AssetDir returns the file names below a certain
107// directory embedded in the file by go-bindata.
108// For example if you run go-bindata on data/... and data contains the
109// following hierarchy:
110//     data/
111//       foo.txt
112//       img/
113//         a.png
114//         b.png
115// then AssetDir("data") would return []string{"foo.txt", "img"}
116// AssetDir("data/img") would return []string{"a.png", "b.png"}
117// AssetDir("foo.txt") and AssetDir("notexist") would return an error
118// AssetDir("") will return []string{"data"}.
119func AssetDir(name string) ([]string, error) {
120	node := _bintree
121	if len(name) != 0 {
122		cannonicalName := strings.Replace(name, "\\", "/", -1)
123		pathList := strings.Split(cannonicalName, "/")
124		for _, p := range pathList {
125			node = node.Children[p]
126			if node == nil {
127				return nil, fmt.Errorf("Asset %s not found", name)
128			}
129		}
130	}
131	if node.Func != nil {
132		return nil, fmt.Errorf("Asset %s not found", name)
133	}
134	rv := make([]string, 0, len(node.Children))
135	for childName := range node.Children {
136		rv = append(rv, childName)
137	}
138	return rv, nil
139}
140
141type bintree struct {
142	Func     func() (*asset, error)
143	Children map[string]*bintree
144}
145
146var _bintree = &bintree{nil, map[string]*bintree{
147	"terraform": &bintree{terraform, map[string]*bintree{}},
148}}
149
150// RestoreAsset restores an asset under the given directory
151func RestoreAsset(dir, name string) error {
152	data, err := Asset(name)
153	if err != nil {
154		return err
155	}
156	info, err := AssetInfo(name)
157	if err != nil {
158		return err
159	}
160	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
161	if err != nil {
162		return err
163	}
164	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
165	if err != nil {
166		return err
167	}
168	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
169	if err != nil {
170		return err
171	}
172	return nil
173}
174
175// RestoreAssets restores an asset under the given directory recursively
176func RestoreAssets(dir, name string) error {
177	children, err := AssetDir(name)
178	// File
179	if err != nil {
180		return RestoreAsset(dir, name)
181	}
182	// Dir
183	for _, child := range children {
184		err = RestoreAssets(dir, filepath.Join(name, child))
185		if err != nil {
186			return err
187		}
188	}
189	return nil
190}
191
192func _filePath(dir, name string) string {
193	cannonicalName := strings.Replace(name, "\\", "/", -1)
194	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
195}
196