github.com/m3db/m3@v1.5.0/src/query/generated/assets/openapi/assets.go (about) 1 // Code generated by "esc -modtime 12345 -prefix openapi/ -pkg openapi -ignore .go -o openapi/assets.go ."; DO NOT EDIT. 2 3 // Copyright (c) 2021 Uber Technologies, Inc. 4 // 5 // Permission is hereby granted, free of charge, to any person obtaining a copy 6 // of this software and associated documentation files (the "Software"), to deal 7 // in the Software without restriction, including without limitation the rights 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 // copies of the Software, and to permit persons to whom the Software is 10 // furnished to do so, subject to the following conditions: 11 // 12 // The above copyright notice and this permission notice shall be included in 13 // all copies or substantial portions of the Software. 14 // 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 // THE SOFTWARE. 22 23 package openapi 24 25 import ( 26 "bytes" 27 "compress/gzip" 28 "encoding/base64" 29 "fmt" 30 "io" 31 "io/ioutil" 32 "net/http" 33 "os" 34 "path" 35 "sync" 36 "time" 37 ) 38 39 type _escLocalFS struct{} 40 41 var _escLocal _escLocalFS 42 43 type _escStaticFS struct{} 44 45 var _escStatic _escStaticFS 46 47 type _escDirectory struct { 48 fs http.FileSystem 49 name string 50 } 51 52 type _escFile struct { 53 compressed string 54 size int64 55 modtime int64 56 local string 57 isDir bool 58 59 once sync.Once 60 data []byte 61 name string 62 } 63 64 func (_escLocalFS) Open(name string) (http.File, error) { 65 f, present := _escData[path.Clean(name)] 66 if !present { 67 return nil, os.ErrNotExist 68 } 69 return os.Open(f.local) 70 } 71 72 func (_escStaticFS) prepare(name string) (*_escFile, error) { 73 f, present := _escData[path.Clean(name)] 74 if !present { 75 return nil, os.ErrNotExist 76 } 77 var err error 78 f.once.Do(func() { 79 f.name = path.Base(name) 80 if f.size == 0 { 81 return 82 } 83 var gr *gzip.Reader 84 b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed)) 85 gr, err = gzip.NewReader(b64) 86 if err != nil { 87 return 88 } 89 f.data, err = ioutil.ReadAll(gr) 90 }) 91 if err != nil { 92 return nil, err 93 } 94 return f, nil 95 } 96 97 func (fs _escStaticFS) Open(name string) (http.File, error) { 98 f, err := fs.prepare(name) 99 if err != nil { 100 return nil, err 101 } 102 return f.File() 103 } 104 105 func (dir _escDirectory) Open(name string) (http.File, error) { 106 return dir.fs.Open(dir.name + name) 107 } 108 109 func (f *_escFile) File() (http.File, error) { 110 type httpFile struct { 111 *bytes.Reader 112 *_escFile 113 } 114 return &httpFile{ 115 Reader: bytes.NewReader(f.data), 116 _escFile: f, 117 }, nil 118 } 119 120 func (f *_escFile) Close() error { 121 return nil 122 } 123 124 func (f *_escFile) Readdir(count int) ([]os.FileInfo, error) { 125 if !f.isDir { 126 return nil, fmt.Errorf(" escFile.Readdir: '%s' is not directory", f.name) 127 } 128 129 fis, ok := _escDirs[f.local] 130 if !ok { 131 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) 132 } 133 limit := count 134 if count <= 0 || limit > len(fis) { 135 limit = len(fis) 136 } 137 138 if len(fis) == 0 && count > 0 { 139 return nil, io.EOF 140 } 141 142 return fis[0:limit], nil 143 } 144 145 func (f *_escFile) Stat() (os.FileInfo, error) { 146 return f, nil 147 } 148 149 func (f *_escFile) Name() string { 150 return f.name 151 } 152 153 func (f *_escFile) Size() int64 { 154 return f.size 155 } 156 157 func (f *_escFile) Mode() os.FileMode { 158 return 0 159 } 160 161 func (f *_escFile) ModTime() time.Time { 162 return time.Unix(f.modtime, 0) 163 } 164 165 func (f *_escFile) IsDir() bool { 166 return f.isDir 167 } 168 169 func (f *_escFile) Sys() interface{} { 170 return f 171 } 172 173 // FS returns a http.Filesystem for the embedded assets. If useLocal is true, 174 // the filesystem's contents are instead used. 175 func FS(useLocal bool) http.FileSystem { 176 if useLocal { 177 return _escLocal 178 } 179 return _escStatic 180 } 181 182 // Dir returns a http.Filesystem for the embedded assets on a given prefix dir. 183 // If useLocal is true, the filesystem's contents are instead used. 184 func Dir(useLocal bool, name string) http.FileSystem { 185 if useLocal { 186 return _escDirectory{fs: _escLocal, name: name} 187 } 188 return _escDirectory{fs: _escStatic, name: name} 189 } 190 191 // FSByte returns the named file from the embedded assets. If useLocal is 192 // true, the filesystem's contents are instead used. 193 func FSByte(useLocal bool, name string) ([]byte, error) { 194 if useLocal { 195 f, err := _escLocal.Open(name) 196 if err != nil { 197 return nil, err 198 } 199 b, err := ioutil.ReadAll(f) 200 _ = f.Close() 201 return b, err 202 } 203 f, err := _escStatic.prepare(name) 204 if err != nil { 205 return nil, err 206 } 207 return f.data, nil 208 } 209 210 // FSMustByte is the same as FSByte, but panics if name is not present. 211 func FSMustByte(useLocal bool, name string) []byte { 212 b, err := FSByte(useLocal, name) 213 if err != nil { 214 panic(err) 215 } 216 return b 217 } 218 219 // FSString is the string version of FSByte. 220 func FSString(useLocal bool, name string) (string, error) { 221 b, err := FSByte(useLocal, name) 222 return string(b), err 223 } 224 225 // FSMustString is the string version of FSMustByte. 226 func FSMustString(useLocal bool, name string) string { 227 return string(FSMustByte(useLocal, name)) 228 } 229 230 var _escData = map[string]*_escFile{ 231 232 "/asset-gen.sh": { 233 name: "asset-gen.sh", 234 local: "asset-gen.sh", 235 size: 238, 236 modtime: 12345, 237 compressed: ` 238 H4sIAAAAAAAC/0zKz0rEMBDH8Xue4rfTnBbSsP45LR5EfAHrTUTWdpIO0hlJIgjiu0sr6M5l4PP9dbv4 239 Khrr7NztMNw/vgwPdzf+4JIVCERB/s8p7o+YzAGAJOzwhDDBC56PaDPrFtYbTZvoB2+QxG2fx9lAmZXL 240 qYlmpGILvNBvrSPCYlOThUGHi8ura0J4L5zkE+S/pOv28Tuu9pb/gRAkqxVGnw3BzqanWrnVPhuBenKT 241 KbufAAAA//9BiTev7gAAAA== 242 `, 243 }, 244 245 "/index.html": { 246 name: "index.html", 247 local: "openapi/index.html", 248 size: 636, 249 modtime: 12345, 250 compressed: ` 251 H4sIAAAAAAAC/0ySQW/bMAyF7/kVjC+9RJaHDtiQyd6wpceuQ9DLblUk2lYrS55IpzC2/ffBUdLlRr4n 252 fXwgqNa7h2+PP3/cQc+Db1ZqLcTq+8Pj3Rb2U4CnQb8gaCJk0WEQvyZM8xO4FuY4QTbDDKbXoUMCjsC9 253 I2idx/VKiGalMhZA9ajtUgAoduyxub/dfYU97qJRMivZHZD1QkyEXBcTt+JjIa+9oAesi6PD1zEmLsDE 254 wBi4Ll6d5b62eHQGxanZgAuOnfaCjPZYvyvOIO/CC/QJ27romUfaStnGwFR2MXYe9eioNHGQhuhzqwfn 255 5/p+8TElzdvbqtq8r6rNh6r6s4+HyPFaKiChrwvi2SP1iHwZelJyDXCIdobf5wZg0KlzYQvVpzdp1Na6 256 0F1pfzNHvoGUvKxVLbzznIQ2GqARjZiSr2/iiEGPThJrdkYuRjkP/qZR8vT0Es8kNzJQMv+XYmwon8mi 257 d8dUBmQZxiF/+uI1I7E8TMF6pCyWxDpY7WPA8pmKZsl6ouawOaOS+Sj+BQAA//8by2IcfAIAAA== 258 `, 259 }, 260 261 "/spec.yml": { 262 name: "spec.yml", 263 local: "openapi/spec.yml", 264 size: 26055, 265 modtime: 12345, 266 compressed: ` 267 H4sIAAAAAAAC/+xdX3PbuBF/16dAdX3oPUR07PQ6ozfJ8jmaOo7Hzt1M76YPELGkcCUBFgDjJDf97h2C 268 lPgPJEFK/qMM9RKbWiyWi/3tb7GEGR4BwxGdo4vZ2ex8QpnH5xOEFFUBzNG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 295 c0R4vAmgnGuOrNf00pveiPCpVOXAsUNnNrCS6O8r+nowcPoOPQt+xYTQZGlxcNdAi/3riPoJ7553kHZ/ 296 OoLa1DzoOU/lT6Z6VH15Yt69DrRmK2UKfGPUUaYuzsv30NPwXSfp6Vd4nc00LbJwUkX/jF3FRfdtszh8 297 2GJBZLcolVrSJpu5seKfQXyipmKz1fM/vSvM94Em2zGbCUP8RRv3AGpN2qfcuazvmpJOgqKSBxpP+p2y 298 neLfOOsuxR+B+lvV7URgJOKUqU6FsmG1sRD4a7HxqSDsEYja+9PyLBaLkXz2by3tMj3iQtmt7bC90fey 299 xEd0qF7WI7ixei9SYQW2aT1FdjKiEGA8Fi6su1csS0W3mHE5PBclWjzvACX5PZS9WbIWWBwW+7fr2/Wn 300 9eJm/dv69rpwefHrYn2zWN5cFa7dXC1+3Um1NKcOJ7AD80QFofmCely4YFlSGHpcr/fGejCsqQYpcHqS 301 d2x5vbWcMTfkLF0YAP5Mmb/ePy0b5kszWDEjlGB1AoFXOj/wuqOw2NvuaWmSp+Pi/Om4abpuuROhqNu4 302 vMYnM0O3Trc27KYvTjo7guWkm2bTgLs4qFxzg1iqYZXzE+O61O4x19xNTR5bCl7uBkxLVcbxA/g930Xt 303 smqjZZAoGwfAlwhcBeRB/y8XSWzq0kregXjPYzGM49/zpyg5MSECpDxCMffiBexTON38rHRoYundGzIe 304 jRjeuCiq+38AAAD//3KwMhXHZQAA 305 `, 306 }, 307 308 "/": { 309 name: "/", 310 local: `.`, 311 isDir: true, 312 }, 313 314 "/openapi": { 315 name: "openapi", 316 local: `openapi`, 317 isDir: true, 318 }, 319 } 320 321 var _escDirs = map[string][]os.FileInfo{ 322 323 ".": { 324 _escData["/asset-gen.sh"], 325 _escData["/openapi"], 326 }, 327 328 "openapi": { 329 _escData["/index.html"], 330 _escData["/spec.yml"], 331 }, 332 }