Documentation ¶
Index ¶
- Constants
- Variables
- func CallApi(httpMethod, url string, parameters map[string]interface{}, respObj interface{}, ...) error
- func ComputeBinMd5(bin []byte) string
- func ComputeMd5(filePath string) (string, error)
- func ComputeStrMd5(str string) string
- func ExeCmd(cmd string) (error, string, string)
- func ExeCmdNoWait(cmd string) (error, int)
- func ExeCmdWithContext(ctx context.Context, cmd string) (error, string, string)
- func FileExist(path string) bool
- func GetAzoneId() string
- func GetClientReportService() string
- func GetConnectDetectService() string
- func GetDeRegisterService() string
- func GetErrorOutputService() string
- func GetFetchSessionTaskListService() string
- func GetFetchTaskListService() string
- func GetFinishOutputService() string
- func GetGshellCheckService() string
- func GetHTTPTransport() *http.Transport
- func GetInstanceId() string
- func GetInvalidTaskService() string
- func GetMetricsService() string
- func GetParam(name string) (string, error)
- func GetPingService() string
- func GetPluginHealthService() string
- func GetPluginListService() string
- func GetPluginUpdateCheckService() string
- func GetPutInstanceStateReportService() string
- func GetPutInventoryService() string
- func GetRegionId() string
- func GetRegisterService(region, networkmode string) string
- func GetRoleName() (string, error)
- func GetRoleNameTtl(ttl time.Duration) (string, error)
- func GetRunningOutputService() string
- func GetSecretParam(name string) (string, error)
- func GetServerHost() string
- func GetSessionStatusService() string
- func GetStateConfigService() string
- func GetStoppedOutputService() string
- func GetTemplateService() string
- func GetTimeoutOutputService() string
- func GetUpdateService() string
- func GetVerifiedTaskService() string
- func HasCmdInLinux(cmd string) bool
- func HttpDownloadContext(ctx context.Context, url string, FilePath string) error
- 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 IsDirectory(path string) bool
- func IsFile(path string) 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 ReplaceAllParameterStore(param string) (string, error)
- func SetVerboseMode(mode bool)
- func StartService(ServiceName string) error
- func StopService(ServiceName string) error
- type CancelFlag
- type ChanneledCancelFlag
- type State
Constants ¶
const ( HYBRID_DOMAIN = ".axt.aliyuncs.com" HYBRID_DOMAIN_VPC = ".axt.aliyun.com" )
Variables ¶
var ( ErrRoleNameFailed = errors.New("RoleNameFailed") ErrParameterStoreNotAccessible = errors.New("ParameterStoreNotAccessible") ErrParameterFailed = errors.New("ParameterFailed") )
var (
ErrHTTPCode = errors.New("http code error")
)
var G_IsWindows bool
var (
NilRequest *atomicutil.AtomicBoolean
)
Functions ¶
func ComputeBinMd5 ¶
func ComputeMd5 ¶
func ComputeStrMd5 ¶
func ExeCmdNoWait ¶
func ExeCmdWithContext ¶
Execute a command with timeout limit
func GetAzoneId ¶
func GetAzoneId() string
func GetClientReportService ¶
func GetClientReportService() string
func GetConnectDetectService ¶
func GetConnectDetectService() string
func GetDeRegisterService ¶
func GetDeRegisterService() 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 GetInstanceId ¶
func GetInstanceId() string
func GetMetricsService ¶
func GetMetricsService() string
func GetPingService ¶
func GetPingService() string
GetPingService returns heart-beat API but without the scheme part, unlike other API address provider function
func GetPluginHealthService ¶
func GetPluginHealthService() string
func GetPluginListService ¶
func GetPluginListService() string
func GetPluginUpdateCheckService ¶
func GetPluginUpdateCheckService() string
func GetPutInstanceStateReportService ¶
func GetPutInstanceStateReportService() string
func GetPutInventoryService ¶
func GetPutInventoryService() string
func GetRegionId ¶
func GetRegionId() string
func GetRegisterService ¶
func GetRoleName ¶
func GetRunningOutputService ¶
func GetRunningOutputService() string
func GetSecretParam ¶
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 GetTemplateService ¶
func GetTemplateService() string
func GetTimeoutOutputService ¶
func GetTimeoutOutputService() string
func GetUpdateService ¶
func GetUpdateService() string
func GetVerifiedTaskService ¶
func GetVerifiedTaskService() string
func HasCmdInLinux ¶
func HttpDownloadContext ¶
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 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 SetVerboseMode ¶
func SetVerboseMode(mode bool)
func StartService ¶
func StopService ¶
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.