Documentation
¶
Overview ¶
Run a watch. This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.
For testing and debugging purposes, you also have fine-grained control on how the watch runs. You can run the watch without running all of its actions or alternatively by simulating them. You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.
You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. This serves as great tool for testing and debugging your watches prior to adding them to Watcher.
When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. If your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.
When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.
Index ¶
- Variables
- type ExecuteWatch
- func (r *ExecuteWatch) ActionModes(actionmodes map[string]actionexecutionmode.ActionExecutionMode) *ExecuteWatch
- func (r *ExecuteWatch) AlternativeInput(alternativeinput map[string]json.RawMessage) *ExecuteWatch
- func (r *ExecuteWatch) Debug(debug bool) *ExecuteWatch
- func (r ExecuteWatch) Do(providedCtx context.Context) (*Response, error)
- func (r *ExecuteWatch) ErrorTrace(errortrace bool) *ExecuteWatch
- func (r *ExecuteWatch) FilterPath(filterpaths ...string) *ExecuteWatch
- func (r *ExecuteWatch) Header(key, value string) *ExecuteWatch
- func (r *ExecuteWatch) HttpRequest(ctx context.Context) (*http.Request, error)
- func (r *ExecuteWatch) Human(human bool) *ExecuteWatch
- func (r *ExecuteWatch) Id(id string) *ExecuteWatch
- func (r *ExecuteWatch) IgnoreCondition(ignorecondition bool) *ExecuteWatch
- func (r ExecuteWatch) Perform(providedCtx context.Context) (*http.Response, error)
- func (r *ExecuteWatch) Pretty(pretty bool) *ExecuteWatch
- func (r *ExecuteWatch) Raw(raw io.Reader) *ExecuteWatch
- func (r *ExecuteWatch) RecordExecution(recordexecution bool) *ExecuteWatch
- func (r *ExecuteWatch) Request(req *Request) *ExecuteWatch
- func (r *ExecuteWatch) SimulatedActions(simulatedactions *types.SimulatedActions) *ExecuteWatch
- func (r *ExecuteWatch) TriggerData(triggerdata *types.ScheduleTriggerEvent) *ExecuteWatch
- func (r *ExecuteWatch) Watch(watch *types.Watch) *ExecuteWatch
- type NewExecuteWatch
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")
ErrBuildPath is returned in case of missing parameters within the build of the request.
Functions ¶
This section is empty.
Types ¶
type ExecuteWatch ¶
type ExecuteWatch struct {
// contains filtered or unexported fields
}
func New ¶
func New(tp elastictransport.Interface) *ExecuteWatch
Run a watch. This API can be used to force execution of the watch outside of its triggering logic or to simulate the watch execution for debugging purposes.
For testing and debugging purposes, you also have fine-grained control on how the watch runs. You can run the watch without running all of its actions or alternatively by simulating them. You can also force execution by ignoring the watch condition and control whether a watch record would be written to the watch history after it runs.
You can use the run watch API to run watches that are not yet registered by specifying the watch definition inline. This serves as great tool for testing and debugging your watches prior to adding them to Watcher.
When Elasticsearch security features are enabled on your cluster, watches are run with the privileges of the user that stored the watches. If your user is allowed to read index `a`, but not index `b`, then the exact same set of rules will apply during execution of a watch.
When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.
https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-execute-watch
func (*ExecuteWatch) ActionModes ¶ added in v8.9.0
func (r *ExecuteWatch) ActionModes(actionmodes map[string]actionexecutionmode.ActionExecutionMode) *ExecuteWatch
ActionModes Determines how to handle the watch actions as part of the watch execution. API name: action_modes
func (*ExecuteWatch) AlternativeInput ¶ added in v8.9.0
func (r *ExecuteWatch) AlternativeInput(alternativeinput map[string]json.RawMessage) *ExecuteWatch
AlternativeInput When present, the watch uses this object as a payload instead of executing its own input. API name: alternative_input
func (*ExecuteWatch) Debug ¶
func (r *ExecuteWatch) Debug(debug bool) *ExecuteWatch
Debug Defines whether the watch runs in debug mode. API name: debug
func (ExecuteWatch) Do ¶
func (r ExecuteWatch) Do(providedCtx context.Context) (*Response, error)
Do runs the request through the transport, handle the response and returns a executewatch.Response
func (*ExecuteWatch) ErrorTrace ¶ added in v8.14.0
func (r *ExecuteWatch) ErrorTrace(errortrace bool) *ExecuteWatch
ErrorTrace When set to `true` Elasticsearch will include the full stack trace of errors when they occur. API name: error_trace
func (*ExecuteWatch) FilterPath ¶ added in v8.14.0
func (r *ExecuteWatch) FilterPath(filterpaths ...string) *ExecuteWatch
FilterPath Comma-separated list of filters in dot notation which reduce the response returned by Elasticsearch. API name: filter_path
func (*ExecuteWatch) Header ¶
func (r *ExecuteWatch) Header(key, value string) *ExecuteWatch
Header set a key, value pair in the ExecuteWatch headers map.
func (*ExecuteWatch) HttpRequest ¶
HttpRequest returns the http.Request object built from the given parameters.
func (*ExecuteWatch) Human ¶ added in v8.14.0
func (r *ExecuteWatch) Human(human bool) *ExecuteWatch
Human When set to `true` will return statistics in a format suitable for humans. For example `"exists_time": "1h"` for humans and `"eixsts_time_in_millis": 3600000` for computers. When disabled the human readable values will be omitted. This makes sense for responses being consumed only by machines. API name: human
func (*ExecuteWatch) Id ¶
func (r *ExecuteWatch) Id(id string) *ExecuteWatch
Id The watch identifier. API Name: id
func (*ExecuteWatch) IgnoreCondition ¶ added in v8.9.0
func (r *ExecuteWatch) IgnoreCondition(ignorecondition bool) *ExecuteWatch
IgnoreCondition When set to `true`, the watch execution uses the always condition. This can also be specified as an HTTP parameter. API name: ignore_condition
func (ExecuteWatch) Perform ¶ added in v8.7.0
Perform runs the http.Request through the provided transport and returns an http.Response.
func (*ExecuteWatch) Pretty ¶ added in v8.14.0
func (r *ExecuteWatch) Pretty(pretty bool) *ExecuteWatch
Pretty If set to `true` the returned JSON will be "pretty-formatted". Only use this option for debugging only. API name: pretty
func (*ExecuteWatch) Raw ¶
func (r *ExecuteWatch) Raw(raw io.Reader) *ExecuteWatch
Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.
func (*ExecuteWatch) RecordExecution ¶ added in v8.9.0
func (r *ExecuteWatch) RecordExecution(recordexecution bool) *ExecuteWatch
RecordExecution When set to `true`, the watch record representing the watch execution result is persisted to the `.watcher-history` index for the current time. In addition, the status of the watch is updated, possibly throttling subsequent runs. This can also be specified as an HTTP parameter. API name: record_execution
func (*ExecuteWatch) Request ¶
func (r *ExecuteWatch) Request(req *Request) *ExecuteWatch
Request allows to set the request property with the appropriate payload.
func (*ExecuteWatch) SimulatedActions ¶ added in v8.9.0
func (r *ExecuteWatch) SimulatedActions(simulatedactions *types.SimulatedActions) *ExecuteWatch
API name: simulated_actions
func (*ExecuteWatch) TriggerData ¶ added in v8.9.0
func (r *ExecuteWatch) TriggerData(triggerdata *types.ScheduleTriggerEvent) *ExecuteWatch
TriggerData This structure is parsed as the data of the trigger event that will be used during the watch execution. API name: trigger_data
func (*ExecuteWatch) Watch ¶ added in v8.9.0
func (r *ExecuteWatch) Watch(watch *types.Watch) *ExecuteWatch
Watch When present, this watch is used instead of the one specified in the request. This watch is not persisted to the index and `record_execution` cannot be set. API name: watch
type NewExecuteWatch ¶
type NewExecuteWatch func() *ExecuteWatch
NewExecuteWatch type alias for index.
func NewExecuteWatchFunc ¶
func NewExecuteWatchFunc(tp elastictransport.Interface) NewExecuteWatch
NewExecuteWatchFunc returns a new instance of ExecuteWatch with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.
type Request ¶
type Request struct { // ActionModes Determines how to handle the watch actions as part of the watch execution. ActionModes map[string]actionexecutionmode.ActionExecutionMode `json:"action_modes,omitempty"` // AlternativeInput When present, the watch uses this object as a payload instead of executing // its own input. AlternativeInput map[string]json.RawMessage `json:"alternative_input,omitempty"` // IgnoreCondition When set to `true`, the watch execution uses the always condition. This can // also be specified as an HTTP parameter. IgnoreCondition *bool `json:"ignore_condition,omitempty"` // RecordExecution When set to `true`, the watch record representing the watch execution result // is persisted to the `.watcher-history` index for the current time. // In addition, the status of the watch is updated, possibly throttling // subsequent runs. // This can also be specified as an HTTP parameter. RecordExecution *bool `json:"record_execution,omitempty"` SimulatedActions *types.SimulatedActions `json:"simulated_actions,omitempty"` // TriggerData This structure is parsed as the data of the trigger event that will be used // during the watch execution. TriggerData *types.ScheduleTriggerEvent `json:"trigger_data,omitempty"` // Watch When present, this watch is used instead of the one specified in the request. // This watch is not persisted to the index and `record_execution` cannot be // set. Watch *types.Watch `json:"watch,omitempty"` }
Request holds the request body struct for the package executewatch
type Response ¶ added in v8.7.0
type Response struct { // Id_ The watch record identifier as it would be stored in the `.watcher-history` // index. Id_ string `json:"_id"` // WatchRecord The watch record document as it would be stored in the `.watcher-history` // index. WatchRecord types.WatchRecord `json:"watch_record"` }
Response holds the response body struct for the package executewatch