util

package
Version: v0.0.0-...-112a489 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToQueryValues

func ConvertToQueryValues(ifc interface{}) url.Values

ConvertToQueryValues converts the struct to url.Values

func CreateRandomString

func CreateRandomString() string

CreateRandomString create random string

func CreateSignature

func CreateSignature(stringToSignature, accessKeySecret string) string

CreateSignature creates signature for string following Aliyun rules

func CreateSignatureForRequest

func CreateSignatureForRequest(method string, values *url.Values, accessKeySecret string) string

CreateSignatureForRequest creates signature for query string values

func Encode

func Encode(v url.Values) string

Encode encodes the values into “URL encoded” form ("acl&bar=baz&foo=quux") sorted by key.

func GenerateRandomECSPassword

func GenerateRandomECSPassword() string

tools for generating a random ECS instance password from 8 to 30 char MUST contain digit upper, case letter and upper case letter http://docs.aliyun.com/#/pub/ecs/open-api/instance&createinstance

func GetGMTime

func GetGMTime() string

func GetISO8601TimeStamp

func GetISO8601TimeStamp(ts time.Time) string

GetISO8601TimeStamp gets timestamp string in ISO8601 format

func SetQueryValues

func SetQueryValues(ifc interface{}, values *url.Values)

SetQueryValues sets the struct to existing url.Values following ECS encoding rules

Types

type Attempt

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

func (*Attempt) HasNext

func (a *Attempt) HasNext() bool

HasNext returns whether another attempt will be made if the current one fails. If it returns true, the following call to Next is guaranteed to return true.

func (*Attempt) Next

func (a *Attempt) Next() bool

Next waits until it is time to perform the next attempt or returns false if it is time to stop trying.

type AttemptStrategy

type AttemptStrategy struct {
	Total time.Duration // total duration of attempt.
	Delay time.Duration // interval between each try in the burst.
	Min   int           // minimum number of retries; overrides Total
}

AttemptStrategy represents a strategy for waiting for an action to complete successfully. This is an internal type used by the implementation of other packages.

func (AttemptStrategy) Start

func (s AttemptStrategy) Start() *Attempt

Start begins a new sequence of attempts for the given strategy.

type ISO6801Time

type ISO6801Time time.Time

A ISO6801Time represents a time in ISO8601 format

func NewISO6801Time

func NewISO6801Time(t time.Time) ISO6801Time

New constructs a new iso8601.Time instance from an existing time.Time instance. This causes the nanosecond field to be set to 0, and its time zone set to a fixed zone with no offset from UTC (but it is *not* UTC itself).

func (*ISO6801Time) IsDefault

func (it *ISO6801Time) IsDefault() bool

IsDefault checks if the time is default

func (ISO6801Time) MarshalJSON

func (it ISO6801Time) MarshalJSON() ([]byte, error)

MarshalJSON serializes the ISO6801Time into JSON string

func (ISO6801Time) String

func (it ISO6801Time) String() string

String returns the time in ISO6801Time format

func (*ISO6801Time) UnmarshalJSON

func (it *ISO6801Time) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes the ISO6801Time from JSON string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL