Documentation ¶
Overview ¶
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ################################################################################
Index ¶
- Constants
- func CopyExtensionToEmbeddedExtensionPath(extensionName string) error
- func DeleteFormerEmbeddedExtensions() error
- func GenerateTemplateFiles(extensionName string, extensionPath string) error
- func GenerateUIMetaDataTemplate(extensionName string, uiMetadataName string, langs []string) ([]byte, error)
- func GetExtensionsLogsPathCustom() string
- func GetExtensionsLogsPathEmbedded() string
- func GetExtensionsPath() string
- func GetExtensionsPathCustom() string
- func GetExtensionsPathEmbedded() string
- func GetIsRunningEndpoint(w http.ResponseWriter, req *http.Request)
- func GetMock() bool
- func GetMockEndpoint(w http.ResponseWriter, req *http.Request)
- func GetRegisteredExtensionPath(extensionName string) (string, error)
- func GetRelativeExtensionPath(extensionName string) string
- func GetRepoLocalPath() string
- func GetRootExtensionPath(rootDir string, extensionName string) string
- func GetStateEndpoint(w http.ResponseWriter, req *http.Request)
- func GetStateLogEndpoint(w http.ResponseWriter, req *http.Request)
- func GetStatesEndpoint(w http.ResponseWriter, req *http.Request)
- func GetUIMetaDataConfig(extensionName string, uiMetadataName string, langs []string) ([]byte, error)
- func GetUIMetaDataConfigs(extensionName string, namesOnly bool, langs []string) ([]byte, error)
- func GetUIMetadataTranslated(extensionPath string, langs []string) (cfg *config.Config, messagesNotFound []string, err error)
- func HandleEngine(w http.ResponseWriter, req *http.Request)
- func HandleExtension(w http.ResponseWriter, req *http.Request)
- func HandleExtensions(w http.ResponseWriter, req *http.Request)
- func HandleState(w http.ResponseWriter, req *http.Request)
- func HandleStates(w http.ResponseWriter, req *http.Request)
- func HandleTemplate(w http.ResponseWriter, req *http.Request)
- func HandleUIMetadata(w http.ResponseWriter, req *http.Request)
- func HandleUIMetadatas(w http.ResponseWriter, req *http.Request)
- func InitExtensions(embeddedExtensionsDescriptor string, embeddedExtensionsRepositoryPath string, ...)
- func IsCustomExtension(extensionName string) (bool, error)
- func IsCustomExtensionRegistered(filename string) bool
- func IsEmbeddedExtension(extensionName string) (bool, error)
- func IsEmbeddedExtensionRegistered(filename string) bool
- func IsExtensionRegistered(extensionName string) bool
- func PutDeleteStateStatesEndpoint(w http.ResponseWriter, req *http.Request)
- func PutInsertStateStatesEndpoint(w http.ResponseWriter, req *http.Request)
- func PutResetEngineEndpoint(w http.ResponseWriter, req *http.Request)
- func PutResetEngineExecutionInfoEndpoint(w http.ResponseWriter, req *http.Request)
- func PutSetStatusesStatesEndpoint(w http.ResponseWriter, req *http.Request)
- func PutStartEngineEndpoint(w http.ResponseWriter, req *http.Request)
- func PutStateEndpoint(w http.ResponseWriter, req *http.Request)
- func PutStatesEndpoint(w http.ResponseWriter, req *http.Request)
- func RegisterEmbededExtensions(force bool, runningToFailed bool) error
- func RegisterExtension(extensionName, zipPath string, force bool, runningToFailed bool) error
- func SetEmbeddedExtensionsRepositoryPath(_embeddedExtensionsRepositoryPath string) error
- func SetExtensionsEmbeddedFile(_extensionsEmbeddedFile string)
- func SetExtensionsLogsPath(_extensionsLogsPath string)
- func SetExtensionsPath(_extensionsPath string)
- func SetMock(mock bool)
- func SetMockEndpoint(w http.ResponseWriter, req *http.Request)
- func UnregisterExtension(extensionName string) error
- func Unzip(src, dest, extensionName string) error
- type CallState
- type Extension
- type Extensions
- type Mock
- type State
- type States
- func (sm *States) CalculateStatesToRun(fromState string, toState string) (map[string]string, error)
- func (sm *States) DeleteState(pos int, stateName string) error
- func (sm *States) Execute(fromState string, toState string, callerState *State, callerOutFile *os.File) error
- func (sm *States) GetLog(state string, position int64, length int64, bychar bool) ([]byte, error)
- func (sm *States) GetLogs(position int64, length int64, bychar bool) (string, error)
- func (sm *States) GetState(state string, langs []string) (*State, error)
- func (sm *States) GetStates(status string, extensionsOnly bool, recursive bool, langs []string) (*States, error)
- func (sm *States) InsertState(state State, referencePosition int, referenceStateName string, before bool, ...) error
- func (sm *States) InsertStateFromExtensionName(extensionName string, pos int, stateName string, before bool, overwrite bool) error
- func (sm *States) InsertStateFromString(stateDef string, pos int, stateName string, before bool, overwrite bool) error
- func (sm *States) IsRunning() (bool, error)
- func (sm *States) NextStatesIndexOf(currentState State, stateName string) int
- func (sm *States) ResetEngine() error
- func (sm *States) ResetEngineExecutionInfo() error
- func (sm *States) SetState(state string, status string, reason string, script string, scriptTimout int, ...) error
- func (sm *States) SetStates(states States, overwrite bool) error
- func (sm *States) SetStatesStatuses(status string, fromStateName string, fromIncluded bool, toStateName string, ...) error
- func (sm *States) Start() error
- type TraversePropertiesCallBack
Constants ¶
const COPYRIGHT string = `` /* 459-byte string literal not displayed */
const CustomExtensions = "custom"
const EmbeddedExtensions = "embedded"
const FirstState = "FirstState"
const LastState = "LastState"
const PhaseAtEachRun = "AtEachRun"
const StateFAILED = "FAILED"
const StatePREPROCESSING = "PREPROCESSING"
const StateREADY = "READY"
const StateRUNNING = "RUNNING"
const StateSKIP = "SKIP"
const StateSUCCEEDED = "SUCCEEDED"
const StatesFileErrorMessagePattern = "STATES_FILE_ERROR_MESSAGE:"
Variables ¶
This section is empty.
Functions ¶
func CopyExtensionToEmbeddedExtensionPath ¶
CopyExtensionToEmbeddedExtensionPath copy the extension to the extension directory
func DeleteFormerEmbeddedExtensions ¶
func DeleteFormerEmbeddedExtensions() error
DeleteFormerEmbeddedExtensions delete extensions which are not anymore defined in the extensionsEmbeddedFile
func GenerateTemplateFiles ¶
func GetExtensionsLogsPathCustom ¶
func GetExtensionsLogsPathCustom() string
GetExtensionLogsPathCustom retrieves the custom extensions logs path
func GetExtensionsLogsPathEmbedded ¶
func GetExtensionsLogsPathEmbedded() string
GetExtensionLogsPathEmbedded retrieves the embedded extensions logs path
func GetExtensionsPath ¶
func GetExtensionsPath() string
GetExtensionPath retrieves the extension path
func GetExtensionsPathCustom ¶
func GetExtensionsPathCustom() string
GetExtensionPathCustom retrieves the extension path for the custom extensions
func GetExtensionsPathEmbedded ¶
func GetExtensionsPathEmbedded() string
GetExtensionPathEmbedded retrieves the extension path for embedded extensions
func GetIsRunningEndpoint ¶
func GetIsRunningEndpoint(w http.ResponseWriter, req *http.Request)
Check if engine is running URL: /cr/v1/engine Method: GET
func GetMockEndpoint ¶
func GetMockEndpoint(w http.ResponseWriter, req *http.Request)
func GetRegisteredExtensionPath ¶
GetRegisteredExtensionPath gets the extension path for a given registered extension
func GetRelativeExtensionPath ¶
GetRelativeExtensionPath gets the relative extension path for a given registered extension
func GetRepoLocalPath ¶
func GetRepoLocalPath() string
GetRepoLocalPath retrieves the location of the embedded extensions packages
func GetRootExtensionPath ¶
GetRootExtensionPath gets the root extension path
func GetStateEndpoint ¶
func GetStateEndpoint(w http.ResponseWriter, req *http.Request)
Retrieve the state record of a state URL: /cr/v1/state/<state> Method: GET
func GetStateLogEndpoint ¶
func GetStateLogEndpoint(w http.ResponseWriter, req *http.Request)
Retrieve n lines of a log for a given state starting from line s URL: /cr/v1/log/state?first-line=s&lines=n Method: GET first-line default = 0 lines default = MaxInt64
func GetStatesEndpoint ¶
func GetStatesEndpoint(w http.ResponseWriter, req *http.Request)
Retrieve the states URL: /cr/v1/states Method: GET
func GetUIMetaDataConfig ¶
func GetUIMetaDataConfigs ¶
func GetUIMetadataTranslated ¶
func HandleEngine ¶
func HandleEngine(w http.ResponseWriter, req *http.Request)
handle Engine rest api requests
func HandleExtension ¶
func HandleExtension(w http.ResponseWriter, req *http.Request)
func HandleExtensions ¶
func HandleExtensions(w http.ResponseWriter, req *http.Request)
func HandleState ¶
func HandleState(w http.ResponseWriter, req *http.Request)
handle State rest api requests
func HandleStates ¶
func HandleStates(w http.ResponseWriter, req *http.Request)
handle States rest api requests
func HandleTemplate ¶
func HandleTemplate(w http.ResponseWriter, req *http.Request)
handle template rest api requests
func HandleUIMetadata ¶
func HandleUIMetadata(w http.ResponseWriter, req *http.Request)
handle BMXCOnfig rest api requests
func HandleUIMetadatas ¶
func HandleUIMetadatas(w http.ResponseWriter, req *http.Request)
handle BMXCOnfig rest api requests
func InitExtensions ¶
func InitExtensions(embeddedExtensionsDescriptor string, embeddedExtensionsRepositoryPath string, extensionsPath string, extensionsLogsPath string)
Init initialise the extensionManager package. embeddedExtensionDescriptor the path to the file listing the embedded extension names. embeddedExtensionsRepositoryPath the directory path where the extensions are located. This path will be extended with "embeded" or "custom" depending of the type of extension. extensionsPath the directory path where the extension will be copied by the registration process. This path will be extended with "embeded" or "custom" depending of the type of extension. extensionsLogsPath the directory path where the logs will be save. This path is relative to extension deployment location which is <extensionPath>/<embedded|custom>/<extensionName>. This path will be extended with "embeded" or "custom" depending of the type of extension.
func IsCustomExtension ¶
IsCustomExtension Checks if extensionName is a custom extension
func IsCustomExtensionRegistered ¶
IsCustomExtensionRegistered Check if an extension is register by browzing the extensions directory
func IsEmbeddedExtension ¶
IsEmbeddedExtension Checks if extensionName is a Embedded extension
func IsEmbeddedExtensionRegistered ¶
IsEmbeddedxtensionRegistered Check if an extension is register by browzing the extensions directory
func IsExtensionRegistered ¶
IsExtensionRegistered Check if an extension is register by browzing the extensions directory
func PutDeleteStateStatesEndpoint ¶
func PutDeleteStateStatesEndpoint(w http.ResponseWriter, req *http.Request)
PUT delete a state in a state file URL: /cr/v1/states?extension-name=<extension-name>&action=delete&pos=<int> Method: PUT
func PutInsertStateStatesEndpoint ¶
func PutInsertStateStatesEndpoint(w http.ResponseWriter, req *http.Request)
PUT insert a state in a state file URL: /cr/v1/states?extension-name=<extension-name>&action=insert&pos=<int>&before=<bool> Method: PUT
func PutResetEngineEndpoint ¶
func PutResetEngineEndpoint(w http.ResponseWriter, req *http.Request)
Reset the engine URL: /cr/v1/engine?action=<action> Method: PUT action: 'reset'
func PutResetEngineExecutionInfoEndpoint ¶
func PutResetEngineExecutionInfoEndpoint(w http.ResponseWriter, req *http.Request)
Reset the engine URL: /cr/v1/engine?action=<action> Method: PUT action: 'reset-execution-info'
func PutSetStatusesStatesEndpoint ¶
func PutSetStatusesStatesEndpoint(w http.ResponseWriter, req *http.Request)
PUT set a range of states to a specific status URL: /cr/v1/states?extension-name=<extension-name>&action=set-statuses&status=<status>&from-state-name=<state_from>&from-inclusive=<bool>&to-state-name=<state_to>&to-inclusive=<bool> Method: PUT
func PutStartEngineEndpoint ¶
func PutStartEngineEndpoint(w http.ResponseWriter, req *http.Request)
Start the engine URL: /cr/v1/egine?action=<action>&from_state=<from_state>&to_state=<to_state> Method: PUT action: 'start' first-state default = first state to-state default = last staten
func PutStateEndpoint ¶
func PutStateEndpoint(w http.ResponseWriter, req *http.Request)
Set the status for a state URL: /cr/v1/state/<state>?status=newStatus Method: PUT status: newStatus
func PutStatesEndpoint ¶
func PutStatesEndpoint(w http.ResponseWriter, req *http.Request)
PUT the states URL: /cr/v1/states?overwrite=<true|false> Method: GET
func RegisterEmbededExtensions ¶
registerEmbededExtension register all embeded extensions force: if true and already registered the extension is overwritten runningToFailed: if true and the extension is running then the running state will be set to FAILED
func RegisterExtension ¶
RegisterExtension register an extension force: if true and already registered the extension is overwritten runningToFailed: if true and the extension is running then the running state will be set to FAILED
func SetEmbeddedExtensionsRepositoryPath ¶
SetEmbeddedExtensionsRepositoryPath set the path where the embedded extension are stored
func SetExtensionsEmbeddedFile ¶
func SetExtensionsEmbeddedFile(_extensionsEmbeddedFile string)
SetExtensionEmbeddedFile sets the embedded extension path file descriptor
func SetExtensionsLogsPath ¶
func SetExtensionsLogsPath(_extensionsLogsPath string)
SetExtensionLogsPath set the path where the extensions logs are kept
func SetExtensionsPath ¶
func SetExtensionsPath(_extensionsPath string)
SetExtensionPath set the path where the extensions must be deployed
func SetMockEndpoint ¶
func SetMockEndpoint(w http.ResponseWriter, req *http.Request)
func UnregisterExtension ¶
UnregisterExtension delete and extension, deletion of Embedded extension is not permitted.
Types ¶
type Extension ¶
type Extension struct { Type string `yaml:"type" json:"type"` Version string `yaml:"version" json:"version"` CallState CallState `yaml:"call_state" json:"call_state"` ValidationConfigURL string `yaml:"validation_config_url" json:"validation_config_url"` GenerateConfigURL string `yaml:"generate_config_url" json:"generate_config_url"` ExtensionPath string `yaml:"-" json:"-"` //PersistedPaths The path listed in that array will be not erased between upgrades. //The states-file path is always added to that array. //The path is a pattern relative to the extension home directory. //The pattern syntax is described at https://golang.org/src/path/filepath/match.go?s=1226:1284#L34 PersistedPaths []string `yaml:"persisted_paths" json:"persisted_paths"` }
Extension structure
func ReadRegisteredExtension ¶
type Extensions ¶
Extensions is a map of Extension
func ListEmbeddedExtensions ¶
func ListEmbeddedExtensions() (*Extensions, error)
ListEmbeddedExtensions returns extensions by reading the resourceManager extension file.
func ListEmbeddedRegisteredExtensions ¶
func ListEmbeddedRegisteredExtensions() (*Extensions, error)
ListEmbeddedRegisteredExtensions lists the registered embedded exxtensions
func ListExtensions ¶
func ListExtensions(filter string, catalog bool) (*Extensions, error)
ListExtensions lists all extensions
func ListRegisteredCustomExtensions ¶
func ListRegisteredCustomExtensions() (*Extensions, error)
ListCustomExtensions returns extensions by reading the custom extension directory Custom extensions get be listed only if registered.
type State ¶
type State struct { //Name name of the state Name string `yaml:"name" json:"name"` //Phase If the value is set to "AtEachRun" then the state will be executed each time the commands-runner is launched and this independently of its status except if status is "SKIP" Phase string `yaml:"phase" json:"phase"` //Label A more human readable name for the state (default: name) Label string `yaml:"label" json:"label"` //LogPath Location of the file that will collect the stdin/stderr. (default: extensionPath+extenstionName.log) LogPath string `yaml:"log_path" json:"log_path"` //Status The current state status (default: READY) Status string `yaml:"status" json:"status"` //StartTime If not empty, it contains the last time when the state was executed StartTime string `yaml:"start_time" json:"start_time"` //EndTime if not empty, it contains the last end execution time of the state EndTime string `yaml:"end_time" json:"end_time"` //Reason if not empty, it contains the reason of execution failure Reason string `yaml:"reason" json:"reason"` //Script The command or script to execute. The path must be an absolute path Script string `yaml:"script" json:"script"` //ScriptTimeout The maximum duration of the state execution, after that duration a timeout error will be produced. ScriptTimeout int `yaml:"script_timeout" json:"script_timeout"` //Protected If true the commands-runner end-user will be not be able to delete the state. Protected bool `yaml:"protected" json:"protected"` //Deleted If true the corresponding state will be deleted when merging with an existing states file. Deleted bool `yaml:"deleted" json:"deleted"` //PrerequisiteStates if the current states is READY/FAILED then those listed will be set to READY too. //Each listed state must be before the current state. PrerequisiteStates []string `yaml:"prerequisite_states" json:"prerequisite_states"` //StatesToRerun if the current state is READY/FAILED then those listed will be set to READY too. //Each listed state must be after the current state. StatesToRerun []string `yaml:"states_to_rerun" json:"states_to_rerun"` //RerunOnRunOfStates if one state of this list is READY/FAILED then the current state will be set to READY. //Each listed state must be before the current state. RerunOnRunOfStates []string `yaml:"rerun_on_run_of_states" json:"rerun_on_run_of_states"` //CalculatedStatesToRerun (not-persisted/used internally) Calculated list of states to rerun CalculatedStatesToRerun []string `yaml:"-" json:"-"` //PreviousStates List of previous states, this is not taken into account for the topology sort. PreviousStates []string `yaml:"previous_states" json:"previous_states"` //NextStates List of next states, this determines the order in which the states will get executed. A topological sort is used to determine the order. //If this attribute is not defined in any state of the states file then the NextStates for each state will be set by default to the next state in the states file. NextStates []string `yaml:"next_states" json:"next_states"` //ExecutedByExtensionName is set at execution time with the value of sm.ExecutedByExtensionName. ExecutedByExtensionName string `yaml:"executed_by_extension_name" json:"executed_by_extension_name"` //The execution sequence id for that specific launch ExecutionID int `yaml:"execution_id" json:"execution_id"` //This is true if the state will run based on status, PrerequisiteStates, RerunOnRunOfStates and StatesToRerun NextRun bool `yaml:"next_run" json:"next_run"` //This is true when the state is a extension IsExtension bool `yaml:"is_extension" json:"is_extension"` }
type States ¶
type States struct { StateArray []State `yaml:"states" json:"states"` ExtensionName string `yaml:"extension_name" json:"extension_name"` //Parent extension name, this is set when the extension is inserted into another extension. //Empty if not inserted. ParentExtensionName string `yaml:"parent_extension_name" json:"parent_extension_name"` //ExecutedByExtensionName is set at execution time and contains the name of the extension which launch the current extension. //If extension A contains extension B contains extension C then it contains extension A name. //It is NOT the direct parent extension name. ExecutedByExtensionName string `yaml:"executed_by_extension_name" json:"executed_by_extension_name"` //The execution sequence id for that specific launch ExecutionID int `yaml:"execution_id" json:"execution_id"` //StartTime If not empty, it contains the last time when the state was executed StartTime string `yaml:"start_time" json:"start_time"` //EndTime if not empty, it contains the last end execution time of the state EndTime string `yaml:"end_time" json:"end_time"` //Status states status Status string `yaml:"status" json:"status"` StatesPath string `yaml:"-" json:"-"` // contains filtered or unexported fields }
func GetStatesManager ¶
Search for a stateManager and if not found create it
func (*States) CalculateStatesToRun ¶
func (*States) DeleteState ¶
DeleteState Delete a state at a given position or with a given name Array start in Go at 0 but here the pos 1 is the elem 0
func (*States) Execute ¶
func (sm *States) Execute(fromState string, toState string, callerState *State, callerOutFile *os.File) error
Execute states from state 'fromState' to state 'toState'
func (*States) GetLog ¶
GetLog Retrieve log of a given state. state: Look at the log of a given state. position: start at position (byte) in the log (default:0) len: number of byte to retrieve. Return a []byte containing the requested log or an error.
func (*States) GetLogs ¶
GetLogs Get logs from a given position, a given length. The length is the number of characters to return if bychar is true otherwize is the number of lines.
func (*States) GetStates ¶
func (sm *States) GetStates(status string, extensionsOnly bool, recursive bool, langs []string) (*States, error)
GetStates returns the list of states with a given status. if the status is an empty string then it returns all states.
func (*States) InsertState ¶
func (sm *States) InsertState(state State, referencePosition int, referenceStateName string, before bool, overwrite bool) error
InsertState Insert state at a given state position, before or after a given state. If the referencePosition is not 0, then that position will be used as reference for insertion If the referencePosition is equal 0 and the referenceStateName is provided, the position of the referenceStateName will be used as reference for insertion If the referencePosition is 0 and the referenceStateName is not provided then the state will be inserted taking into account the PreviousStates and NextStates of the inserted state. If the state is already present, then it is updated if overwrite is true Array start in Go at 0 but here the pos 1 is the elem 0
func (*States) InsertStateFromExtensionName ¶
func (*States) InsertStateFromString ¶
func (sm *States) InsertStateFromString(stateDef string, pos int, stateName string, before bool, overwrite bool) error
InsertStateFromString Insert state at a given position, before or after a given state. The state Def is provided as a string If the position is 0 and the stateName is not provided then the state will be inserted taking into account the PreviousStates and NextStates of the inserted state. Array start in Go at 0 but here the pos 1 is the elem 0
func (*States) NextStatesIndexOf ¶
NextStatesIndexOf return the index of a stateName in the NextStates
func (*States) ResetEngine ¶
ResetEngine Reset states, all non-skip state will be set to READY recursively No RUNNING state must be found.
func (*States) ResetEngineExecutionInfo ¶
ResetEngine Reset execution Info. This is not recursive yet. No RUNNING state must be found.
func (*States) SetState ¶
func (sm *States) SetState(state string, status string, reason string, script string, scriptTimout int, recursivelly bool) error
SetState Set a state status
func (*States) SetStates ¶
SetStates Set the current states with a new states. If overwrite is false, then the 2 states will be merged. States marked deleted in the new states will be removed for the current states.