github.com/docker/app@v0.9.1-beta3.0.20210611140623-a48f773ab002/specification/bindata.go (about) 1 // Code generated by "esc -o bindata.go -pkg specification -ignore .*\.go -private -modtime=1518458244 schemas"; DO NOT EDIT. 2 3 package specification 4 5 import ( 6 "bytes" 7 "compress/gzip" 8 "encoding/base64" 9 "fmt" 10 "io" 11 "io/ioutil" 12 "net/http" 13 "os" 14 "path" 15 "sync" 16 "time" 17 ) 18 19 type _escLocalFS struct{} 20 21 var _escLocal _escLocalFS 22 23 type _escStaticFS struct{} 24 25 var _escStatic _escStaticFS 26 27 type _escDirectory struct { 28 fs http.FileSystem 29 name string 30 } 31 32 type _escFile struct { 33 compressed string 34 size int64 35 modtime int64 36 local string 37 isDir bool 38 39 once sync.Once 40 data []byte 41 name string 42 } 43 44 func (_escLocalFS) Open(name string) (http.File, error) { 45 f, present := _escData[path.Clean(name)] 46 if !present { 47 return nil, os.ErrNotExist 48 } 49 return os.Open(f.local) 50 } 51 52 func (_escStaticFS) prepare(name string) (*_escFile, error) { 53 f, present := _escData[path.Clean(name)] 54 if !present { 55 return nil, os.ErrNotExist 56 } 57 var err error 58 f.once.Do(func() { 59 f.name = path.Base(name) 60 if f.size == 0 { 61 return 62 } 63 var gr *gzip.Reader 64 b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed)) 65 gr, err = gzip.NewReader(b64) 66 if err != nil { 67 return 68 } 69 f.data, err = ioutil.ReadAll(gr) 70 }) 71 if err != nil { 72 return nil, err 73 } 74 return f, nil 75 } 76 77 func (fs _escStaticFS) Open(name string) (http.File, error) { 78 f, err := fs.prepare(name) 79 if err != nil { 80 return nil, err 81 } 82 return f.File() 83 } 84 85 func (dir _escDirectory) Open(name string) (http.File, error) { 86 return dir.fs.Open(dir.name + name) 87 } 88 89 func (f *_escFile) File() (http.File, error) { 90 type httpFile struct { 91 *bytes.Reader 92 *_escFile 93 } 94 return &httpFile{ 95 Reader: bytes.NewReader(f.data), 96 _escFile: f, 97 }, nil 98 } 99 100 func (f *_escFile) Close() error { 101 return nil 102 } 103 104 func (f *_escFile) Readdir(count int) ([]os.FileInfo, error) { 105 if !f.isDir { 106 return nil, fmt.Errorf(" escFile.Readdir: '%s' is not directory", f.name) 107 } 108 109 fis, ok := _escDirs[f.local] 110 if !ok { 111 return nil, fmt.Errorf(" escFile.Readdir: '%s' is directory, but we have no info about content of this dir, local=%s", f.name, f.local) 112 } 113 limit := count 114 if count <= 0 || limit > len(fis) { 115 limit = len(fis) 116 } 117 118 if len(fis) == 0 && count > 0 { 119 return nil, io.EOF 120 } 121 122 return []os.FileInfo(fis[0:limit]), nil 123 } 124 125 func (f *_escFile) Stat() (os.FileInfo, error) { 126 return f, nil 127 } 128 129 func (f *_escFile) Name() string { 130 return f.name 131 } 132 133 func (f *_escFile) Size() int64 { 134 return f.size 135 } 136 137 func (f *_escFile) Mode() os.FileMode { 138 return 0 139 } 140 141 func (f *_escFile) ModTime() time.Time { 142 return time.Unix(f.modtime, 0) 143 } 144 145 func (f *_escFile) IsDir() bool { 146 return f.isDir 147 } 148 149 func (f *_escFile) Sys() interface{} { 150 return f 151 } 152 153 // _escFS returns a http.Filesystem for the embedded assets. If useLocal is true, 154 // the filesystem's contents are instead used. 155 func _escFS(useLocal bool) http.FileSystem { 156 if useLocal { 157 return _escLocal 158 } 159 return _escStatic 160 } 161 162 // _escDir returns a http.Filesystem for the embedded assets on a given prefix dir. 163 // If useLocal is true, the filesystem's contents are instead used. 164 func _escDir(useLocal bool, name string) http.FileSystem { 165 if useLocal { 166 return _escDirectory{fs: _escLocal, name: name} 167 } 168 return _escDirectory{fs: _escStatic, name: name} 169 } 170 171 // _escFSByte returns the named file from the embedded assets. If useLocal is 172 // true, the filesystem's contents are instead used. 173 func _escFSByte(useLocal bool, name string) ([]byte, error) { 174 if useLocal { 175 f, err := _escLocal.Open(name) 176 if err != nil { 177 return nil, err 178 } 179 b, err := ioutil.ReadAll(f) 180 _ = f.Close() 181 return b, err 182 } 183 f, err := _escStatic.prepare(name) 184 if err != nil { 185 return nil, err 186 } 187 return f.data, nil 188 } 189 190 // _escFSMustByte is the same as _escFSByte, but panics if name is not present. 191 func _escFSMustByte(useLocal bool, name string) []byte { 192 b, err := _escFSByte(useLocal, name) 193 if err != nil { 194 panic(err) 195 } 196 return b 197 } 198 199 // _escFSString is the string version of _escFSByte. 200 func _escFSString(useLocal bool, name string) (string, error) { 201 b, err := _escFSByte(useLocal, name) 202 return string(b), err 203 } 204 205 // _escFSMustString is the string version of _escFSMustByte. 206 func _escFSMustString(useLocal bool, name string) string { 207 return string(_escFSMustByte(useLocal, name)) 208 } 209 210 var _escData = map[string]*_escFile{ 211 212 "/schemas/metadata_schema_v0.1.json": { 213 name: "metadata_schema_v0.1.json", 214 local: "schemas/metadata_schema_v0.1.json", 215 size: 1916, 216 modtime: 1518458244, 217 compressed: ` 218 H4sIAAAAAAAC/7RUwY7iMAy99yuqsEegrLQnfgUh5G1dCKJJxjFIaMS/j9pAaaZpWoG4OvbLs/38vpM0 219 TVPxx+YHrECsU3FgNussO1qtFi661LTPCoKSF6t/mYvNxNxVyqIuqpChAIade91dVsu/yxrikcZXg3Wi 220 /n/EnB9RQ9ogsUQr1qmj0sQVVOhFPAzLJNX+jtG+lpoq4KYDbblBaBNuz1xxQbJSq1H4YHGBNidpOAaw 221 8aLNS5Cx6/R8OgkvvA1+XPdjDeT4Gu8KpGKQCskOAwARXH+PVTJW/RonGsKyrptlBZZSyXoqNnt+5fd1 222 CxIzQKj446TcN4OEkg4tQfh1loSFt0onyYCMmsj2Xtr50hd0Zyi9Tt0FDQ5xHp6Ld0jPcYYPKn5Yo0oK 223 LK6twQrkaRRyE3yN30bkRtpbCVd1vMDR63cyWZrT9nXP/eQ2Rlvt215sb8OG8pYchtz1LdCYe00yjAnG 224 8aKrhQUVlZgzm+SW/AQAAP//m8slr3wHAAA= 225 `, 226 }, 227 228 "/schemas/metadata_schema_v0.2.json": { 229 name: "metadata_schema_v0.2.json", 230 local: "schemas/metadata_schema_v0.2.json", 231 size: 1732, 232 modtime: 1518458244, 233 compressed: ` 234 H4sIAAAAAAAC/7RUzY7yMAy89ymq8B0LRZ/2xKsghLzUBSOSdB2DhFa8+6oNf9mmP2LFdZyxx/bE30ma 235 pqn65zY71KAWqdqJVIs83ztrph6dWd7mBUMp0/lH7rGJyjyTipqkUaAAgbWPrk/z2f9ZneL2TM4V1g/t 236 5x43ckMrthWyEDq1SL2UBjegMUCCHE6YzFbdg5fswTwhO7LmNXKBbsNUSV+CZYA2kWvKrB0xx8NBBfAq 237 WlgDGQEyyK5bOTDD+VcVRYK6zfE7ZSxr3iQvsCRDdVsuf5QKhV2iwipgNPJ2Ub5Mp6DkSZZi/DoSYxHs 238 wjsm4oMGWV2pTyVDvz0NpdWpN3jnELP4XAKfP8YZ93u/7wctHFncnYMa6DCYchmN9pu7x+R3s8dZqrSs 239 QepWvLx2J6OtOW5f17fv3MZgqzvrpMk4am9dd+xPZug7M6N+9ogf/uL5iW++1wv+KiSX5CcAAP//f4Kg 240 RsQGAAA= 241 `, 242 }, 243 244 "/schemas": { 245 name: "schemas", 246 local: `schemas`, 247 isDir: true, 248 }, 249 } 250 251 var _escDirs = map[string][]os.FileInfo{ 252 253 "schemas": { 254 _escData["/schemas/metadata_schema_v0.1.json"], 255 _escData["/schemas/metadata_schema_v0.2.json"], 256 }, 257 }