Documentation ¶
Index ¶
- Constants
- func CancelStateManagerTimer() error
- func ConfigCacheFilePath() (path string, err error)
- func GetRateInSeconds(expr string) (seconds int, err error)
- func InitStateManagerTimer() error
- func IsStateConfigTimerRunning() bool
- func IsStateManagerTimerRunning() bool
- func LastCheckpoint() string
- func LoadTemplateCache(name string, version string) (content []byte, err error)
- func NewResourceState(state StateDef) (rs resources.ResourceState, err error)
- func ParseResourceState(data []byte, userParameters string) (rs []resources.ResourceState, err error)
- func PutInstanceStateReport(stateConfigurationId, status, extraInfo, mode, clientToken string) error
- func Resolve(orig string, paramMap map[string]interface{}) (v interface{})
- func ResolveParameterValue(params map[string]ParamProp, userParams map[string]interface{}) (result map[string]interface{})
- func TemplateCachePath(name string, version string) (p string, err error)
- func WriteConfigCache(config *ListInstanceStateConfigurationsResult) error
- func WriteTemplateCache(name string, version string, data []byte) (err error)
- type ApiResponse
- type GetTemplateResponse
- type GetTemplateResult
- type ListInstanceStateConfigurationsResp
- type ListInstanceStateConfigurationsResult
- type ParamDef
- type ParamProp
- type StateConfigTimer
- type StateConfiguration
- type StateDef
- type StateTemplate
Constants ¶
View Source
const ( // Cron schedule type, expression format is defined in https://help.aliyun.com/document_detail/169784.html Cron = "cron" // Rate schedule type, expression format examples: "5 minutes" "1 hour" Rate = "rate" // Cron is triggered with a drift, after the expected time // This helps to reduce concurrency MaxCronDriftSeconds = 15 * 60 )
View Source
const ( // DefaultRefreshIntervalSeconds is the default interval of refresh state configurations in seconds DefaultRefreshIntervalSeconds = 1800 // MaxInitTimerDriftSeconds is the default max seconds to delay when initializing state manager timer MaxInitTimerDriftSeconds = 3 * 60 )
View Source
const ( // Agent applies the configuration and does nothing further // unless the configuration (template and parameters) is updated. // After initial application of a new configuration, // agent does not check for drift from a previously configured state. // Agent will attempt to apply the configuration until it is successful before ApplyOnly takes effect. ApplyOnly = "ApplyOnly" // Agent applies any new configurations. // After initial application of a new configuration, if the instance drifts from the desired state, // reports the discrepancy to server. // Agent will attempt to apply the configuration until it is successful before ApplyAndMonitor takes effect. ApplyAndMonitor = "ApplyAndMonitor" // Agent applies any new configurations. After initial application of a new configuration, // if the instance drifts from the desired state, reports the discrepancy to server, // and then re-applies the current configuration. ApplyAndAutoCorrect = "ApplyAndAutoCorrect" )
View Source
const ( Apply = "Apply" Monitor = "Monitor" Skip = "Skip" )
View Source
const ( Compliant = "Compliant" NotCompliant = "NotCompliant" Failed = "Failed" )
Variables ¶
This section is empty.
Functions ¶
func CancelStateManagerTimer ¶
func CancelStateManagerTimer() error
func ConfigCacheFilePath ¶
func GetRateInSeconds ¶
func InitStateManagerTimer ¶
func InitStateManagerTimer() error
InitStateManagerTimer starts timer for state manage feature
func IsStateConfigTimerRunning ¶
func IsStateConfigTimerRunning() bool
func IsStateManagerTimerRunning ¶
func IsStateManagerTimerRunning() bool
func LastCheckpoint ¶
func LastCheckpoint() string
func LoadTemplateCache ¶
func NewResourceState ¶
func NewResourceState(state StateDef) (rs resources.ResourceState, err error)
func ParseResourceState ¶
func ParseResourceState(data []byte, userParameters string) (rs []resources.ResourceState, err error)
func PutInstanceStateReport ¶
func Resolve ¶
Resolve resolves final value for string contains parameter reference for example, "ecs.{{ regionId }}.aliyuncs.com" with parameter regionId="cn-zhangjiakou" will get ecs.cn-zhangjiakou.aliyuncs.com
"{{id}}" with parameter id=1 will get number 1
func ResolveParameterValue ¶
func WriteConfigCache ¶
func WriteConfigCache(config *ListInstanceStateConfigurationsResult) error
WriteConfigCache saves state configurations to local cache file
Types ¶
type ApiResponse ¶
type GetTemplateResponse ¶
type GetTemplateResponse struct { ApiResponse Result *GetTemplateResult `json:"result"` }
func GetTemplate ¶
func GetTemplate(templateName, templateVersion string) (*GetTemplateResponse, error)
type GetTemplateResult ¶
type ListInstanceStateConfigurationsResp ¶
type ListInstanceStateConfigurationsResp struct { ApiResponse Result *ListInstanceStateConfigurationsResult `json:"result"` }
func ListInstanceStateConfigurations ¶
func ListInstanceStateConfigurations(lastCheckpoint, agentName, agentVersion, computerName, platformName, platformType, platformVersion, ipAddress, ramRole string) (*ListInstanceStateConfigurationsResp, error)
ListInstanceStateConfigurations lists state configurations from server and report agent info
type ListInstanceStateConfigurationsResult ¶
type ListInstanceStateConfigurationsResult struct { RequestId string Interval int Changed bool Checkpoint string StateConfigurations []StateConfiguration }
func LoadConfigCache ¶
func LoadConfigCache() (r *ListInstanceStateConfigurationsResult, err error)
LoadConfigCache loads state configurations from local cache files
type StateConfigTimer ¶
type StateConfigTimer struct {
// contains filtered or unexported fields
}
type StateConfiguration ¶
type StateTemplate ¶
type StateTemplate struct { FormatVersion string Parameters map[string]ParamProp States []StateDef }
func ParseStateTemplate ¶
func ParseStateTemplate(data []byte) (t StateTemplate, err error)
ParseStateTemplate parses template data to state and parameter definitions
Click to show internal directories.
Click to hide internal directories.