utils

package
v0.0.0-...-4f17fb6 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 12 Imported by: 14

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"
)

const values

Variables

View Source
var (
	// VERSION should be updated by hand at each release
	VERSION = "v1.12.6"

	// GITCOMMIT will be overwritten automatically by the build system
	GITCOMMIT = "HEAD"
)

Functions

func CreateDest

func CreateDest(dest string) error

CreateDest create directory

func Finish

func Finish(result Result)

Finish finish call

func FinishError

func FinishError(message string)

FinishError print error info

func GetDefaultAK

func GetDefaultAK() (string, string, string)

GetDefaultAK read default ak from local file or from STS

func GetLocalAK

func GetLocalAK() (string, string)

GetLocalAK read ossfs ak from local or from secret file

func GetLocalSystemAK

func GetLocalSystemAK() (string, string)

GetLocalSystemAK get local access key

func GetMetaData

func GetMetaData(resource string) (string, error)

GetMetaData get metadata

func GetRegionAndInstanceId

func GetRegionAndInstanceId() (string, string, error)

GetRegionAndInstanceId Get regionid instanceid;

func GetRegionIdAndInstanceId

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

GetRegionIdAndInstanceId get region id instance id

func GetSTSAK

func GetSTSAK() (string, string, string)

GetSTSAK get STS AK

func IsFileExisting

func IsFileExisting(filename string) bool

IsFileExisting check file exist in volume driver;

func IsLikelyNotMountPoint

func IsLikelyNotMountPoint(file string) (bool, error)

IsLikelyNotMountPoint check is mountpoint or not

func IsMounted

func IsMounted(mountPath string) bool

IsMounted check directory is mounted or not.

func PathExists

func PathExists(path string) (bool, error)

PathExists returns true if the specified path exists.

func PluginVersion

func PluginVersion() string

PluginVersion

func ReadJsonFile

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

ReadJsonFile parse json to struct

func Run

func Run(cmd string) (string, error)

Run run shell command

func Umount

func Umount(mountPath string) bool

Umount umount path.

func Usage

func Usage()

Usage help

func WriteJosnFile

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

WriteJosnFile 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"`
	}
}

DefaultOptions used for global ak

type Result

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

Result of flexvolume

func Fail

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

Fail fail the flexvolume call

func NotSupport

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

NotSupport not support action

func Succeed

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

Succeed successful action

Jump to

Keyboard shortcuts

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