utils

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug = log.New(os.Stderr, "DEBUG: ", log.Ltime|log.Lshortfile)
	Warn  = log.New(os.Stderr, "WARN:  ", log.Ltime|log.Lshortfile)
	Info  = log.New(os.Stderr, "INFO:  ", log.Ltime|log.Lshortfile)
	Error = log.New(os.Stderr, "ERROR: ", log.Ltime|log.Lshortfile)
)

Functions

func Command

func Command(name string, args ...string) (string, int, error)

func IsJsonHttpClientError

func IsJsonHttpClientError(err error) bool

func IsJsonHttpClientErrorWithResponseText

func IsJsonHttpClientErrorWithResponseText(err error, containsText string) bool

func RandomString

func RandomString(n int) string

Types

type ISCSIUtils

type ISCSIUtils struct {
	// contains filtered or unexported fields
}

func NewISCSIUtils

func NewISCSIUtils() *ISCSIUtils

func (*ISCSIUtils) GenerateDeviceName

func (u *ISCSIUtils) GenerateDeviceName(portalIP string, portalPort int, target string) (string, error)

func (*ISCSIUtils) GetHostNumber

func (u *ISCSIUtils) GetHostNumber(target string, portalAddress string) (int, error)

func (*ISCSIUtils) GetISCSIPortalHostMapForTarget

func (u *ISCSIUtils) GetISCSIPortalHostMapForTarget(targetIqn string) (map[string]int, error)

https://github.com/kubernetes/kubernetes GetISCSIPortalHostMapForTarget given a target iqn, find all the scsi hosts logged into that target. Returns a map of iSCSI portals (string) to SCSI host numbers (integers).

For example: {
   "192.168.30.7:3260": 2,
   "192.168.30.8:3260": 3,
}

func (*ISCSIUtils) Login

func (u *ISCSIUtils) Login(portalIP string, portalPort int, target string) error

func (*ISCSIUtils) Logout

func (u *ISCSIUtils) Logout(portalIP string, portalPort int, target string) error

func (*ISCSIUtils) ParseDeviceName

func (u *ISCSIUtils) ParseDeviceName(deviceName string) (string, int, string, error)

func (*ISCSIUtils) Rescan

func (u *ISCSIUtils) Rescan(target string) error

func (*ISCSIUtils) ScanLUN

func (u *ISCSIUtils) ScanLUN(hostNumber int, lunNumber int) error

https://github.com/kubernetes/kubernetes

type JsonHttpClient

type JsonHttpClient struct {
	// contains filtered or unexported fields
}

func NewJsonHttpClient

func NewJsonHttpClient(opts ...JsonHttpClientOption) *JsonHttpClient

func (*JsonHttpClient) Delete

func (c *JsonHttpClient) Delete(ctx context.Context, path string, input interface{}, output interface{}) error

func (*JsonHttpClient) Get

func (c *JsonHttpClient) Get(ctx context.Context, path string, input interface{}, output interface{}) error

func (*JsonHttpClient) Patch

func (c *JsonHttpClient) Patch(ctx context.Context, path string, input interface{}, output interface{}) error

func (*JsonHttpClient) Post

func (c *JsonHttpClient) Post(ctx context.Context, path string, input interface{}, output interface{}) error

func (*JsonHttpClient) Put

func (c *JsonHttpClient) Put(ctx context.Context, path string, input interface{}, output interface{}) error

type JsonHttpClientError

type JsonHttpClientError struct {
	Message      string
	StatusCode   int
	ResponseBody string
}

func NewJsonHttpClientError

func NewJsonHttpClientError(message string, args ...interface{}) JsonHttpClientError

func NewJsonHttpClientRequestError

func NewJsonHttpClientRequestError(statusCode int, responseBody string, message string, args ...interface{}) JsonHttpClientError

func (JsonHttpClientError) Error

func (e JsonHttpClientError) Error() string

type JsonHttpClientHttpClientConfigurationFn

type JsonHttpClientHttpClientConfigurationFn = func(*http.Client)

type JsonHttpClientRequestTransformerFn

type JsonHttpClientRequestTransformerFn = func(*http.Request) error

type MountUtils

type MountUtils struct {
	// contains filtered or unexported fields
}

func NewMountUtils

func NewMountUtils() *MountUtils

func (*MountUtils) ByteFilesystemStats

func (u *MountUtils) ByteFilesystemStats(volumePath string) (totalBytes int64, usedBytes int64, availableBytes int64, err error)

func (*MountUtils) FormatAndMountDevice

func (u *MountUtils) FormatAndMountDevice(device string, target string, fstype string) error

func (*MountUtils) GetDeviceNameFromMount

func (u *MountUtils) GetDeviceNameFromMount(path string) (string, int, error)

func (*MountUtils) INodeFilesystemStats

func (u *MountUtils) INodeFilesystemStats(volumePath string) (total int64, used int64, free int64, err error)

func (*MountUtils) ResizeDevice

func (u *MountUtils) ResizeDevice(device string, target string) error

func (*MountUtils) UnmountDevice

func (u *MountUtils) UnmountDevice(target string) error

Jump to

Keyboard shortcuts

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