go.ligato.io/vpp-agent/v3@v3.5.0/plugins/restapi/bindata.go (about)

     1  //  Copyright (c) 2018 Cisco and/or its affiliates.
     2  //
     3  //  Licensed under the Apache License, Version 2.0 (the "License");
     4  //  you may not use this file except in compliance with the License.
     5  //  You may obtain a copy of the License at:
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  //  Unless required by applicable law or agreed to in writing, software
    10  //  distributed under the License is distributed on an "AS IS" BASIS,
    11  //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //  See the License for the specific language governing permissions and
    13  //  limitations under the License.
    14  
    15  // Code generated by go-bindata.
    16  // sources:
    17  // templates/index.tmpl
    18  // DO NOT EDIT!
    19  
    20  package restapi
    21  
    22  import (
    23  	"bytes"
    24  	"compress/gzip"
    25  	"fmt"
    26  	"io"
    27  	"io/ioutil"
    28  	"os"
    29  	"path/filepath"
    30  	"strings"
    31  	"time"
    32  )
    33  
    34  func bindataRead(data []byte, name string) ([]byte, error) {
    35  	gz, err := gzip.NewReader(bytes.NewBuffer(data))
    36  	if err != nil {
    37  		return nil, fmt.Errorf("Read %q: %v", name, err)
    38  	}
    39  
    40  	var buf bytes.Buffer
    41  	_, err = io.Copy(&buf, gz)
    42  	clErr := gz.Close()
    43  
    44  	if err != nil {
    45  		return nil, fmt.Errorf("Read %q: %v", name, err)
    46  	}
    47  	if clErr != nil {
    48  		return nil, err
    49  	}
    50  
    51  	return buf.Bytes(), nil
    52  }
    53  
    54  type asset struct {
    55  	bytes []byte
    56  	info  os.FileInfo
    57  }
    58  
    59  type bindataFileInfo struct {
    60  	name    string
    61  	size    int64
    62  	mode    os.FileMode
    63  	modTime time.Time
    64  }
    65  
    66  func (fi bindataFileInfo) Name() string {
    67  	return fi.name
    68  }
    69  func (fi bindataFileInfo) Size() int64 {
    70  	return fi.size
    71  }
    72  func (fi bindataFileInfo) Mode() os.FileMode {
    73  	return fi.mode
    74  }
    75  func (fi bindataFileInfo) ModTime() time.Time {
    76  	return fi.modTime
    77  }
    78  func (fi bindataFileInfo) IsDir() bool {
    79  	return false
    80  }
    81  func (fi bindataFileInfo) Sys() interface{} {
    82  	return nil
    83  }
    84  
    85  var _templatesIndexTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x90\x41\x4b\x03\x31\x10\x85\xef\xf9\x15\xe3\xd2\xa3\x34\xd0\xde\xca\x6c\x2e\xda\x43\x0f\x6a\x0f\x5e\x3c\x8e\x64\x6c\x8a\xd9\x28\x4b\x04\x97\x61\xfe\xbb\xcc\xa6\xed\xe2\x69\x78\x8f\xf7\xbd\xf0\x82\x77\x8f\x2f\x0f\xaf\x6f\xc7\x3d\xa4\x3a\xe4\xe0\xd0\x0e\x64\x2a\xa7\xbe\xe3\xd2\x99\xc1\x14\x83\x03\x00\xc0\x7a\xae\x99\xc3\xa1\x44\xfe\x45\xdf\x84\x43\xdf\x02\xf8\xfe\x15\x27\x8b\x6f\x5a\x60\x87\x3e\x6d\x82\xc3\x9f\x1c\x9c\xc8\x48\xe5\xc4\xb0\xfa\xe4\xe9\x1e\x56\x91\x2a\xc1\xae\x87\xf5\xa1\xf2\xf0\x44\xdf\xaa\xad\x3e\x6d\x83\x88\x65\x54\x8d\xde\xb6\x57\x6f\xb0\x61\xfb\x52\xc7\xc9\xd8\x59\x5d\xc0\x19\xce\xe7\x70\x13\xb3\x41\x90\x46\xfe\xe8\x3b\x91\x85\x5c\x1f\xa9\x26\xd5\x2e\xfc\x33\x9f\x69\x60\x55\xf4\xb4\x34\xa0\xbf\xf6\x89\x70\x89\xaa\xee\x7a\xd1\xdb\x22\xf4\x97\xb9\xbe\x7d\xdb\x5f\x00\x00\x00\xff\xff\xdb\x95\x2c\xc1\x47\x01\x00\x00")
    86  
    87  func templatesIndexTmplBytes() ([]byte, error) {
    88  	return bindataRead(
    89  		_templatesIndexTmpl,
    90  		"templates/index.tmpl",
    91  	)
    92  }
    93  
    94  func templatesIndexTmpl() (*asset, error) {
    95  	bytes, err := templatesIndexTmplBytes()
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  
   100  	info := bindataFileInfo{name: "templates/index.tmpl", size: 327, mode: os.FileMode(420), modTime: time.Unix(1533194427, 0)}
   101  	a := &asset{bytes: bytes, info: info}
   102  	return a, nil
   103  }
   104  
   105  // Asset loads and returns the asset for the given name.
   106  // It returns an error if the asset could not be found or
   107  // could not be loaded.
   108  func Asset(name string) ([]byte, error) {
   109  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   110  	if f, ok := _bindata[cannonicalName]; ok {
   111  		a, err := f()
   112  		if err != nil {
   113  			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
   114  		}
   115  		return a.bytes, nil
   116  	}
   117  	return nil, fmt.Errorf("Asset %s not found", name)
   118  }
   119  
   120  // MustAsset is like Asset but panics when Asset would return an error.
   121  // It simplifies safe initialization of global variables.
   122  func MustAsset(name string) []byte {
   123  	a, err := Asset(name)
   124  	if err != nil {
   125  		panic("asset: Asset(" + name + "): " + err.Error())
   126  	}
   127  
   128  	return a
   129  }
   130  
   131  // AssetInfo loads and returns the asset info for the given name.
   132  // It returns an error if the asset could not be found or
   133  // could not be loaded.
   134  func AssetInfo(name string) (os.FileInfo, error) {
   135  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   136  	if f, ok := _bindata[cannonicalName]; ok {
   137  		a, err := f()
   138  		if err != nil {
   139  			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
   140  		}
   141  		return a.info, nil
   142  	}
   143  	return nil, fmt.Errorf("AssetInfo %s not found", name)
   144  }
   145  
   146  // AssetNames returns the names of the assets.
   147  func AssetNames() []string {
   148  	names := make([]string, 0, len(_bindata))
   149  	for name := range _bindata {
   150  		names = append(names, name)
   151  	}
   152  	return names
   153  }
   154  
   155  // _bindata is a table, holding each asset generator, mapped to its name.
   156  var _bindata = map[string]func() (*asset, error){
   157  	"templates/index.tmpl": templatesIndexTmpl,
   158  }
   159  
   160  // AssetDir returns the file names below a certain
   161  // directory embedded in the file by go-bindata.
   162  // For example if you run go-bindata on data/... and data contains the
   163  // following hierarchy:
   164  //     data/
   165  //       foo.txt
   166  //       img/
   167  //         a.png
   168  //         b.png
   169  // then AssetDir("data") would return []string{"foo.txt", "img"}
   170  // AssetDir("data/img") would return []string{"a.png", "b.png"}
   171  // AssetDir("foo.txt") and AssetDir("notexist") would return an error
   172  // AssetDir("") will return []string{"data"}.
   173  func AssetDir(name string) ([]string, error) {
   174  	node := _bintree
   175  	if len(name) != 0 {
   176  		cannonicalName := strings.Replace(name, "\\", "/", -1)
   177  		pathList := strings.Split(cannonicalName, "/")
   178  		for _, p := range pathList {
   179  			node = node.Children[p]
   180  			if node == nil {
   181  				return nil, fmt.Errorf("Asset %s not found", name)
   182  			}
   183  		}
   184  	}
   185  	if node.Func != nil {
   186  		return nil, fmt.Errorf("Asset %s not found", name)
   187  	}
   188  	rv := make([]string, 0, len(node.Children))
   189  	for childName := range node.Children {
   190  		rv = append(rv, childName)
   191  	}
   192  	return rv, nil
   193  }
   194  
   195  type bintree struct {
   196  	Func     func() (*asset, error)
   197  	Children map[string]*bintree
   198  }
   199  
   200  var _bintree = &bintree{nil, map[string]*bintree{
   201  	"templates": &bintree{nil, map[string]*bintree{
   202  		"index.tmpl": &bintree{templatesIndexTmpl, map[string]*bintree{}},
   203  	}},
   204  }}
   205  
   206  // RestoreAsset restores an asset under the given directory
   207  func RestoreAsset(dir, name string) error {
   208  	data, err := Asset(name)
   209  	if err != nil {
   210  		return err
   211  	}
   212  	info, err := AssetInfo(name)
   213  	if err != nil {
   214  		return err
   215  	}
   216  	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
   217  	if err != nil {
   218  		return err
   219  	}
   220  	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
   221  	if err != nil {
   222  		return err
   223  	}
   224  	return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
   225  }
   226  
   227  // RestoreAssets restores an asset under the given directory recursively
   228  func RestoreAssets(dir, name string) error {
   229  	children, err := AssetDir(name)
   230  	// File
   231  	if err != nil {
   232  		return RestoreAsset(dir, name)
   233  	}
   234  	// Dir
   235  	for _, child := range children {
   236  		err = RestoreAssets(dir, filepath.Join(name, child))
   237  		if err != nil {
   238  			return err
   239  		}
   240  	}
   241  	return nil
   242  }
   243  
   244  func _filePath(dir, name string) string {
   245  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   246  	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
   247  }