// Code generated by go-bindata.
// sources:
// fixtures/key.crt
// fixtures/key.key
// DO NOT EDIT!

package sinks_test

import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"time"
)

type asset struct {
	bytes []byte
	info  os.FileInfo
}

type bindataFileInfo struct {
	name    string
	size    int64
	mode    os.FileMode
	modTime time.Time
}

func (fi bindataFileInfo) Name() string {
	return fi.name
}
func (fi bindataFileInfo) Size() int64 {
	return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
	return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
	return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
	return false
}
func (fi bindataFileInfo) Sys() interface{} {
	return nil
}

var _keyCrt = []byte(`-----BEGIN CERTIFICATE-----
MIIDSDCCAjCgAwIBAgIRAOvw7rkV2Mt52ZHsvVH9orowDQYJKoZIhvcNAQELBQAw
PjEMMAoGA1UEBhMDVVNBMRYwFAYDVQQKEw1DbG91ZCBGb3VuZHJ5MRYwFAYDVQQD
Ew1sb2dncmVnYXRvckNBMB4XDTE3MDUwMjIwMTEyN1oXDTE4MDUwMjIwMTEyN1ow
QDEMMAoGA1UEBhMDVVNBMRYwFAYDVQQKEw1DbG91ZCBGb3VuZHJ5MRgwFgYDVQQD
Ew9yZXZlcnNlbG9ncHJveHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
AQDW67NWPCQCtcXxlNJ+urmQa1peV/Hxmx9un/0FWkE0BBEiowxpFdKgdzI8xufv
O6kbABMg7X3W8x0MFIsVhK7yoejCjaFkHXDp2P0cHSva5Vm3XmqmtECHIS9qqapH
of3toRMf80tK8IKEa7Fgt1sWPllnEhSnjgYbJpJfoIWXqqXSqjSQpNchW3ZB/P7c
GCsKUy2gTdtyZeTigfynfas3G+H7Wu+rHR/Mxt/NPvmAjZLo9ttmhKIthglhXwCw
O/4xyLEWXrtJXPhXalrY6lnZ8YRlJ45dQFuM/TfAnLFU5JseC3/rsZVO/o1exhyn
aCic8cvRnO365+DOgWntiBs9AgMBAAGjPzA9MA4GA1UdDwEB/wQEAwIFoDAdBgNV
HSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADANBgkqhkiG
9w0BAQsFAAOCAQEAZXLwtKsTIj3UtUWGjjDrNcWaZCxX/v/rgf3dSPZwbUapLsBB
u5LRMc7NJkRX8dqLtDnwIdnKk+IrRbmjNztHkTzhsVQdQ2ve2uei+KkiRzr7cSk7
qqfHzdLV5aywvrdw1rj1HlIo1G7HCBLkEUMFaeeYxTa676yPCtfwS+66uLxFIs0W
vv1kKTy87znbCgKfjuNZmLnx1DxUzlsvTcPMu9fDMStUjmxRUcQslnoHApkn8ocr
cN5TQvZRGbcEtp+zW0rgPBvSmic3GTJiQL2qKBqIPqd4vL+HALnSQxXwcIqRUB8l
nwvqJLuWQUILDoXw5uOJJEatEebMG0QvlHQscg==
-----END CERTIFICATE-----`)

func keyCrtBytes() ([]byte, error) {
	return _keyCrt, nil
}

func keyCrt() (*asset, error) {
	bytes, err := keyCrtBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "key.crt", size: 570, mode: os.FileMode(420), modTime: time.Unix(1466470346, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

var _keyKey = []byte(`-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA1uuzVjwkArXF8ZTSfrq5kGtaXlfx8Zsfbp/9BVpBNAQRIqMM
aRXSoHcyPMbn7zupGwATIO191vMdDBSLFYSu8qHowo2hZB1w6dj9HB0r2uVZt15q
prRAhyEvaqmqR6H97aETH/NLSvCChGuxYLdbFj5ZZxIUp44GGyaSX6CFl6ql0qo0
kKTXIVt2Qfz+3BgrClMtoE3bcmXk4oH8p32rNxvh+1rvqx0fzMbfzT75gI2S6Pbb
ZoSiLYYJYV8AsDv+McixFl67SVz4V2pa2OpZ2fGEZSeOXUBbjP03wJyxVOSbHgt/
67GVTv6NXsYcp2gonP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ELJBqfN
BrcZJ2ECgYANwW6+aI1lQDGArPitqv2BP1Q9/9/pxU9c/bLVgmoGXOLzLXXKiMmc
4fTdjI2qM0lpv0bgXQQ4EeUT0JIfiCcJKlrag2NJz4sZS4tSHXQLisaGLA1OZS1F
VP1VnYc8mXwc50gCwnJQ6q8Zr7ocpxAMY9dmZUJHKaNX+sm2A9U8Ag==
-----END RSA PRIVATE KEY-----`)

func keyKeyBytes() ([]byte, error) {
	return _keyKey, nil
}

func keyKey() (*asset, error) {
	bytes, err := keyKeyBytes()
	if err != nil {
		return nil, err
	}

	info := bindataFileInfo{name: "key.key", size: 497, mode: os.FileMode(420), modTime: time.Unix(1466470346, 0)}
	a := &asset{bytes: bytes, info: info}
	return a, nil
}

// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
		}
		return a.bytes, nil
	}
	return nil, fmt.Errorf("Asset %s not found", name)
}

// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
	a, err := Asset(name)
	if err != nil {
		panic("asset: Asset(" + name + "): " + err.Error())
	}

	return a
}

// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
		}
		return a.info, nil
	}
	return nil, fmt.Errorf("AssetInfo %s not found", name)
}

// AssetNames returns the names of the assets.
func AssetNames() []string {
	names := make([]string, 0, len(_bindata))
	for name := range _bindata {
		names = append(names, name)
	}
	return names
}

// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
	"key.crt": keyCrt,
	"key.key": keyKey,
}

// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
//     data/
//       foo.txt
//       img/
//         a.png
//         b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
	node := _bintree
	if len(name) != 0 {
		cannonicalName := strings.Replace(name, "\\", "/", -1)
		pathList := strings.Split(cannonicalName, "/")
		for _, p := range pathList {
			node = node.Children[p]
			if node == nil {
				return nil, fmt.Errorf("Asset %s not found", name)
			}
		}
	}
	if node.Func != nil {
		return nil, fmt.Errorf("Asset %s not found", name)
	}
	rv := make([]string, 0, len(node.Children))
	for childName := range node.Children {
		rv = append(rv, childName)
	}
	return rv, nil
}

type bintree struct {
	Func     func() (*asset, error)
	Children map[string]*bintree
}

var _bintree = &bintree{nil, map[string]*bintree{
	"key.crt": {keyCrt, map[string]*bintree{}},
	"key.key": {keyKey, map[string]*bintree{}},
}}

// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
	data, err := Asset(name)
	if err != nil {
		return err
	}
	info, err := AssetInfo(name)
	if err != nil {
		return err
	}
	err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
	if err != nil {
		return err
	}
	err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
	if err != nil {
		return err
	}
	err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
	if err != nil {
		return err
	}
	return nil
}

// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
	children, err := AssetDir(name)
	// File
	if err != nil {
		return RestoreAsset(dir, name)
	}
	// Dir
	for _, child := range children {
		err = RestoreAssets(dir, filepath.Join(name, child))
		if err != nil {
			return err
		}
	}
	return nil
}

func _filePath(dir, name string) string {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}
