utils

package
v0.0.0-...-af87c76 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BinaryType   = "binary"
	METADATA_URL = "http://100.100.100.200/latest/meta-data/"
	REGIONID_TAG = "region-id"
	RAM          = "ram/"
)

Variables

This section is empty.

Functions

func Contains

func Contains(list []string, s string) bool

func GetMetaData

func GetMetaData(resource string) (string, error)

GetMetaData get metadata

func GetRegion

func GetRegion() (string, error)

GetRegion Get regionid

func IsClusterNamespace

func IsClusterNamespace(s string) bool

func LogInterceptor

func LogInterceptor() grpc.UnaryServerInterceptor

LogInterceptor returns a new unary server interceptors that performs request and response logging.

func Remove

func Remove(list []string, s string) []string

func Retry

func Retry(interval time.Duration, maxRetries int, f ConditionFunc) error

Retry retries f every interval until after maxRetries. The interval won't be affected by how long f takes. For example, if interval is 3s, f takes 1s, another f will be called 2s later. However, if f takes longer than interval, it will be delayed.

Types

type ARN

type ARN struct {
	Partition string

	Service string

	Region string

	AccountID string

	Resource string
}

ARN captures the individual fields of an Alibaba Cloud Resource Name.

func ParseARN

func ParseARN(arn string) (ARN, error)

Parse parses an ARN into its constituent parts.

Some example ARNs: acs:ram::123456789012:user/tester acs:ram::123456789012:role/defaultrole

type ConditionFunc

type ConditionFunc func() (bool, error)

Jump to

Keyboard shortcuts

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