Documentation ¶
Index ¶
- Constants
- Variables
- func CallApi(httpMethod, url string, parameters map[string]interface{}, respObj interface{}, ...) error
- func CheckFileIsExist(filename string) bool
- func ComputeBinMd5(bin []byte) string
- func ComputeMd5(filePath string) (string, error)
- func ComputeStrMd5(str string) string
- func CopyDir(srcPath string, destPath string) error
- func ExeCmd(cmd string) (error, string, string)
- func ExeCmdNoWait(cmd string) (error, int)
- func FileExist(path string) bool
- func GetAzoneId() string
- func GetCachePath() (string, error)
- func GetClientReportService() string
- func GetConfigPath() (string, error)
- func GetConnectDetectService() string
- func GetCrossVersionConfigPath() (string, error)
- func GetCurrentPath() (string, error)
- func GetDeRegisterService() string
- func GetDeamonUrl() string
- func GetErrorOutputService() string
- func GetFetchSessionTaskListService() string
- func GetFetchTaskListService() string
- func GetFinishOutputService() string
- func GetGshellCheckService() string
- func GetHTTPTransport() *http.Transport
- func GetHybridPath() (string, error)
- func GetInstanceId() string
- func GetInvalidTaskService() string
- func GetMachineID() (string, error)
- func GetMetricsService() string
- func GetParam(name string) (string, error)
- func GetPingService() string
- func GetPluginHealthService() string
- func GetPluginListService() string
- func GetPluginPath() (string, error)
- func GetPluginUpdateCheckService() string
- func GetProxyFunc() func(*http.Request) (*url.URL, error)
- func GetPutInstanceStateReportService() string
- func GetPutInventoryService() string
- func GetRegionId() string
- func GetRoleName() (string, error)
- func GetRunningOutputService() string
- func GetScriptPath() (string, error)
- func GetSecretParam(name string) (string, error)
- func GetSelfhostedPath() (string, error)
- func GetServerHost() string
- func GetSessionStatusService() string
- func GetStateConfigService() string
- func GetStoppedOutputService() string
- func GetTempPath() (string, error)
- func GetTemplateService() string
- func GetTimeoutOutputService() string
- func GetUpdateService() string
- func GetVerifiedTaskService() string
- func HasCmdInLinux(cmd string) bool
- func HttpDownloadWithTimeout(url string, filePath string, timeout time.Duration) error
- func HttpDownlod(url string, FilePath string) error
- func HttpGet(url string) (error, string)
- func HttpGetWithTimeout(url string, timeout time.Duration, noLog bool) (error, string)
- func HttpPost(url string, data string, contentType string) (string, error)
- func HttpPostWithTimeout(url string, data string, contentType string, timeout time.Duration, noLog bool) (string, error)
- func InitUserAgentValue()
- func IsDirectory(path string) bool
- func IsFile(path string) bool
- func IsHybrid() bool
- func IsSelfHosted() bool
- func IsServiceExist(ServiceName string) bool
- func IsServiceRunning(ServiceName string) bool
- func IsSysVLinux() bool
- func IsSystemdLinux() bool
- func IsUpstartLinux() bool
- func IsVerboseMode() bool
- func MakeSurePath(path string) error
- func MockMetaServer(region_id string)
- func ReplaceAllParameterStore(param string) (string, error)
- func RsaSign(data string, keyBytes string) string
- func RsaSignWithMD5(data []byte, keyBytes []byte) []byte
- func SetCurrentEnvPath() bool
- func SetScriptPath(path string)
- func SetVerboseMode(mode bool)
- func StartService(ServiceName string) error
- func StopService(ServiceName string) error
- func Unzip(zipFile string, destDir string) error
- func WriteStringToFile(path string, content string) error
- type CancelFlag
- type ChanneledCancelFlag
- type HttpErrorCode
- type State
Constants ¶
const ( HYBRID_DOMAIN = ".axt.aliyuncs.com" HYBRID_DOMAIN_VPC = ".axt.aliyun.com" )
const (
UserAgentHeader = "User-Agent"
)
Variables ¶
var ( UserAgentValue string CrtPath string NilRequest *atomicutil.AtomicBoolean CaCertPool *x509.CertPool )
var (
ErrHTTPCode = errors.New("http code error")
)
var G_IsWindows bool
Functions ¶
func CheckFileIsExist ¶
func ComputeBinMd5 ¶
func ComputeMd5 ¶
func ComputeStrMd5 ¶
func ExeCmdNoWait ¶
func GetAzoneId ¶
func GetAzoneId() string
func GetCachePath ¶
func GetClientReportService ¶
func GetClientReportService() string
func GetConfigPath ¶
func GetConnectDetectService ¶
func GetConnectDetectService() string
func GetCurrentPath ¶
func GetDeRegisterService ¶
func GetDeRegisterService() string
func GetDeamonUrl ¶
func GetDeamonUrl() string
func GetErrorOutputService ¶
func GetErrorOutputService() string
func GetFetchSessionTaskListService ¶
func GetFetchSessionTaskListService() string
func GetFetchTaskListService ¶
func GetFetchTaskListService() string
func GetFinishOutputService ¶
func GetFinishOutputService() string
func GetGshellCheckService ¶
func GetGshellCheckService() string
func GetHTTPTransport ¶
func GetHybridPath ¶
func GetInstanceId ¶
func GetInstanceId() string
func GetMachineID ¶
func GetMetricsService ¶
func GetMetricsService() string
func GetPingService ¶
func GetPingService() string
func GetPluginHealthService ¶
func GetPluginHealthService() string
func GetPluginListService ¶
func GetPluginListService() string
func GetPluginPath ¶
func GetPluginUpdateCheckService ¶
func GetPluginUpdateCheckService() string
func GetPutInstanceStateReportService ¶
func GetPutInstanceStateReportService() string
func GetPutInventoryService ¶
func GetPutInventoryService() string
func GetRegionId ¶
func GetRegionId() string
GetRegionId should be always successful since InitRegionId should be called before. However, it's hard to terminate the agent under this case since even panic could only terminate the calling goroutine
func GetRoleName ¶
func GetRunningOutputService ¶
func GetRunningOutputService() string
func GetScriptPath ¶
func GetSecretParam ¶
func GetSelfhostedPath ¶
func GetServerHost ¶
func GetServerHost() string
GetServerHost returns empty string when region id is invalid as error handling
func GetSessionStatusService ¶
func GetSessionStatusService() string
func GetStateConfigService ¶
func GetStateConfigService() string
func GetStoppedOutputService ¶
func GetStoppedOutputService() string
func GetTempPath ¶
func GetTemplateService ¶
func GetTemplateService() string
func GetTimeoutOutputService ¶
func GetTimeoutOutputService() string
func GetUpdateService ¶
func GetUpdateService() string
func GetVerifiedTaskService ¶
func GetVerifiedTaskService() string
func HasCmdInLinux ¶
func HttpDownloadWithTimeout ¶
HttpDownloadWithTimeout downloads a file from url to filePath with specified timeout. Check if returned error is of type *url.Error and whether url.Error.Timeout method returns true for timeout request.
func HttpDownlod ¶
func HttpGetWithTimeout ¶
func HttpPostWithTimeout ¶
func InitUserAgentValue ¶
func InitUserAgentValue()
func IsDirectory ¶
func IsSelfHosted ¶
func IsSelfHosted() bool
func IsServiceExist ¶
func IsServiceRunning ¶
func IsSysVLinux ¶
func IsSysVLinux() bool
func IsSystemdLinux ¶
func IsSystemdLinux() bool
func IsUpstartLinux ¶
func IsUpstartLinux() bool
func IsVerboseMode ¶
func IsVerboseMode() bool
func MakeSurePath ¶
func MockMetaServer ¶
func MockMetaServer(region_id string)
func RsaSignWithMD5 ¶
func SetCurrentEnvPath ¶
func SetCurrentEnvPath() bool
func SetScriptPath ¶
func SetScriptPath(path string)
func SetVerboseMode ¶
func SetVerboseMode(mode bool)
func StartService ¶
func StopService ¶
func WriteStringToFile ¶
Types ¶
type CancelFlag ¶
type CancelFlag interface { // Canceled returns true if a cancel or Shutdown has been requested, false otherwise. // This method should be called periodically in the job. Canceled() bool // Set sets the state of this flag and wakes up waiting callers. Set(state State) // ShutDown returns true if a ShutDown has been requested, false otherwise. // This method should be called periodically in the job. ShutDown() bool // State returns the current flag state State() State // Wait blocks the caller until either a cancel has been requested or the // task has completed normally. Returns Canceled if cancel has been requested, // or Completed if the task completed normally. // This is intended to be used to wake up a job that may be waiting on some resources, as follows: // The main job starts a go routine that calls Wait. The main job then does its processing. // During processing the job may be waiting on certain events/conditions. // In the go routine, once Wait returns, if the return value indicates that a cancel // request has been received, the go routine wakes up the running job. Wait() (state State) }
CancelFlag is an object that is passed to any job submitted to a task in order to communicated job cancellation. Job cancellation has to be cooperative.
type ChanneledCancelFlag ¶
type ChanneledCancelFlag struct {
// contains filtered or unexported fields
}
ChanneledCancelFlag is a default implementation of the task.CancelFlag interface.
func NewChanneledCancelFlag ¶
func NewChanneledCancelFlag() *ChanneledCancelFlag
NewChanneledCancelFlag creates a new instance of ChanneledCancelFlag.
func (*ChanneledCancelFlag) Canceled ¶
func (t *ChanneledCancelFlag) Canceled() bool
Canceled returns true if this flag has been set to Cancel state, false otherwise.
func (*ChanneledCancelFlag) Set ¶
func (t *ChanneledCancelFlag) Set(state State)
Set sets the state of this flag and wakes up waiting callers.
func (*ChanneledCancelFlag) ShutDown ¶
func (t *ChanneledCancelFlag) ShutDown() bool
ShutDown returns true if this flag has been set to ShutDown state, false otherwise.
func (*ChanneledCancelFlag) State ¶
func (t *ChanneledCancelFlag) State() State
State returns the current flag state.
func (*ChanneledCancelFlag) Wait ¶
func (t *ChanneledCancelFlag) Wait() (state State)
Wait blocks until the flag is set to either Cancel or Completed state. Returns the state.
type HttpErrorCode ¶
type HttpErrorCode struct {
// contains filtered or unexported fields
}
func (*HttpErrorCode) Error ¶
func (e *HttpErrorCode) Error() string
func (*HttpErrorCode) GetCode ¶
func (e *HttpErrorCode) GetCode() int