utils

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_AKID      = "/etc/.volumeak/akId"
	USER_AKSECRET  = "/etc/.volumeak/akSecret"
	METADATA_URL   = "http://100.100.100.200/latest/meta-data/"
	REGIONID_TAG   = "region-id"
	INSTANCEID_TAG = "instance-id"
)

Variables

This section is empty.

Functions

func CreateDest

func CreateDest(dest string) error

func Finish

func Finish(result Result)

func FinishError

func FinishError(message string)

func GetDefaultAK

func GetDefaultAK() (string, string, string)

read default ak from local file or from STS

func GetLocalAK

func GetLocalAK() (string, string)

read ossfs ak from local or from secret file

func GetMetaData

func GetMetaData(resource string) (string, error)

get metadata

func GetRegionAndInstanceId

func GetRegionAndInstanceId() (string, string, error)

Get regionid instanceid;

func GetRegionIdAndInstanceId

func GetRegionIdAndInstanceId(nodeName string) (string, string, error)

func GetSTSAK

func GetSTSAK() (string, string, string)

get STS AK

func IsFileExisting

func IsFileExisting(filename string) bool

check file exist in volume driver;

func IsMounted

func IsMounted(mountPath string) bool

func ReadJsonFile

func ReadJsonFile(file string) (map[string]string, error)

parse json to struct

func Run

func Run(cmd string) (string, error)

run shell command

func Umount

func Umount(mountPath string) bool

func WriteJosnFile

func WriteJosnFile(obj interface{}, file string) error

save json data to file

Types

type DefaultOptions

type DefaultOptions struct {
	Global struct {
		KubernetesClusterTag string
		AccessKeyID          string `json:"accessKeyID"`
		AccessKeySecret      string `json:"accessKeySecret"`
		Region               string `json:"region"`
	}
}

used for global ak

type Result

type Result struct {
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
	Device  string `json:"device,omitempty"`
}

Result

func Fail

func Fail(a ...interface{}) Result

func NotSupport

func NotSupport(a ...interface{}) Result

func Succeed

func Succeed(a ...interface{}) Result

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL