github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/pkg/cli/cmd/auth/utils/bindata.go (about)

     1  /*
     2  Copyright (C) 2022-2023 ApeCloud Co., Ltd
     3  
     4  This file is part of KubeBlocks project
     5  
     6  This program is free software: you can redistribute it and/or modify
     7  it under the terms of the GNU Affero General Public License as published by
     8  the Free Software Foundation, either version 3 of the License, or
     9  (at your option) any later version.
    10  
    11  This program is distributed in the hope that it will be useful
    12  but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  GNU Affero General Public License for more details.
    15  
    16  You should have received a copy of the GNU Affero General Public License
    17  along with this program.  If not, see <http://www.gnu.org/licenses/>.
    18  */
    19  
    20  // Code generated for package auth by go-bindata DO NOT EDIT. (@generated)
    21  // sources:
    22  // config/config.enc
    23  package utils
    24  
    25  import (
    26  	"fmt"
    27  	"io/ioutil"
    28  	"os"
    29  	"path/filepath"
    30  	"strings"
    31  	"time"
    32  )
    33  
    34  type asset struct {
    35  	bytes []byte
    36  	info  os.FileInfo
    37  }
    38  
    39  type bindataFileInfo struct {
    40  	name    string
    41  	size    int64
    42  	mode    os.FileMode
    43  	modTime time.Time
    44  }
    45  
    46  // Name return file name
    47  func (fi bindataFileInfo) Name() string {
    48  	return fi.name
    49  }
    50  
    51  // Size return file size
    52  func (fi bindataFileInfo) Size() int64 {
    53  	return fi.size
    54  }
    55  
    56  // Mode return file mode
    57  func (fi bindataFileInfo) Mode() os.FileMode {
    58  	return fi.mode
    59  }
    60  
    61  // Mode return file modify time
    62  func (fi bindataFileInfo) ModTime() time.Time {
    63  	return fi.modTime
    64  }
    65  
    66  // IsDir return file whether a directory
    67  func (fi bindataFileInfo) IsDir() bool {
    68  	return fi.mode&os.ModeDir != 0
    69  }
    70  
    71  // Sys return file is sys mode
    72  func (fi bindataFileInfo) Sys() interface{} {
    73  	return nil
    74  }
    75  
    76  const clientID = "64e42ca02df49bffa50719a9"
    77  
    78  var clientIDJSON = fmt.Sprintf(`{"client_id": "%s"}`, clientID)
    79  
    80  func configConfigEnc() (*asset, error) {
    81  	info := bindataFileInfo{name: "config/config.enc", size: 53, mode: os.FileMode(0420), modTime: time.Unix(1688544460, 0)}
    82  	a := &asset{bytes: []byte(clientIDJSON), info: info}
    83  	return a, nil
    84  }
    85  
    86  // Asset loads and returns the asset for the given name.
    87  // It returns an error if the asset could not be found or
    88  // could not be loaded.
    89  func Asset(name string) ([]byte, error) {
    90  	cannonicalName := strings.Replace(name, "\\", "/", -1)
    91  	if f, ok := _bindata[cannonicalName]; ok {
    92  		a, err := f()
    93  		if err != nil {
    94  			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
    95  		}
    96  		return a.bytes, nil
    97  	}
    98  	return nil, fmt.Errorf("Asset %s not found", name)
    99  }
   100  
   101  // MustAsset is like Asset but panics when Asset would return an error.
   102  // It simplifies safe initialization of global variables.
   103  func MustAsset(name string) []byte {
   104  	a, err := Asset(name)
   105  	if err != nil {
   106  		panic("asset: Asset(" + name + "): " + err.Error())
   107  	}
   108  
   109  	return a
   110  }
   111  
   112  // AssetInfo loads and returns the asset info for the given name.
   113  // It returns an error if the asset could not be found or
   114  // could not be loaded.
   115  func AssetInfo(name string) (os.FileInfo, error) {
   116  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   117  	if f, ok := _bindata[cannonicalName]; ok {
   118  		a, err := f()
   119  		if err != nil {
   120  			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
   121  		}
   122  		return a.info, nil
   123  	}
   124  	return nil, fmt.Errorf("AssetInfo %s not found", name)
   125  }
   126  
   127  // AssetNames returns the names of the assets.
   128  func AssetNames() []string {
   129  	names := make([]string, 0, len(_bindata))
   130  	for name := range _bindata {
   131  		names = append(names, name)
   132  	}
   133  	return names
   134  }
   135  
   136  // _bindata is a table, holding each asset generator, mapped to its name.
   137  var _bindata = map[string]func() (*asset, error){
   138  	"config/config.enc": configConfigEnc,
   139  }
   140  
   141  // AssetDir returns the file names below a certain
   142  // directory embedded in the file by go-bindata.
   143  // For example if you run go-bindata on data/... and data contains the
   144  // following hierarchy:
   145  //
   146  //	data/
   147  //	  foo.txt
   148  //	  img/
   149  //	    a.png
   150  //	    b.png
   151  //
   152  // then AssetDir("data") would return []string{"foo.txt", "img"}
   153  // AssetDir("data/img") would return []string{"a.png", "b.png"}
   154  // AssetDir("foo.txt") and AssetDir("notexist") would return an error
   155  // AssetDir("") will return []string{"data"}.
   156  func AssetDir(name string) ([]string, error) {
   157  	node := _bintree
   158  	if len(name) != 0 {
   159  		cannonicalName := strings.Replace(name, "\\", "/", -1)
   160  		pathList := strings.Split(cannonicalName, "/")
   161  		for _, p := range pathList {
   162  			node = node.Children[p]
   163  			if node == nil {
   164  				return nil, fmt.Errorf("Asset %s not found", name)
   165  			}
   166  		}
   167  	}
   168  	if node.Func != nil {
   169  		return nil, fmt.Errorf("Asset %s not found", name)
   170  	}
   171  	rv := make([]string, 0, len(node.Children))
   172  	for childName := range node.Children {
   173  		rv = append(rv, childName)
   174  	}
   175  	return rv, nil
   176  }
   177  
   178  type bintree struct {
   179  	Func     func() (*asset, error)
   180  	Children map[string]*bintree
   181  }
   182  
   183  var _bintree = &bintree{nil, map[string]*bintree{
   184  	"config": {nil, map[string]*bintree{
   185  		"config.enc": {configConfigEnc, map[string]*bintree{}},
   186  	}},
   187  }}
   188  
   189  // RestoreAsset restores an asset under the given directory
   190  func RestoreAsset(dir, name string) error {
   191  	data, err := Asset(name)
   192  	if err != nil {
   193  		return err
   194  	}
   195  	info, err := AssetInfo(name)
   196  	if err != nil {
   197  		return err
   198  	}
   199  	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
   200  	if err != nil {
   201  		return err
   202  	}
   203  	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
   204  	if err != nil {
   205  		return err
   206  	}
   207  	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
   208  	if err != nil {
   209  		return err
   210  	}
   211  	return nil
   212  }
   213  
   214  // RestoreAssets restores an asset under the given directory recursively
   215  func RestoreAssets(dir, name string) error {
   216  	children, err := AssetDir(name)
   217  	// File
   218  	if err != nil {
   219  		return RestoreAsset(dir, name)
   220  	}
   221  	// Dir
   222  	for _, child := range children {
   223  		err = RestoreAssets(dir, filepath.Join(name, child))
   224  		if err != nil {
   225  			return err
   226  		}
   227  	}
   228  	return nil
   229  }
   230  
   231  func _filePath(dir, name string) string {
   232  	cannonicalName := strings.Replace(name, "\\", "/", -1)
   233  	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
   234  }