1<?php 2/** 3 * Elasticsearch PHP client 4 * 5 * @link https://github.com/elastic/elasticsearch-php/ 6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co) 7 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 8 * @license https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1 9 * 10 * Licensed to Elasticsearch B.V under one or more agreements. 11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or 12 * the GNU Lesser General Public License, Version 2.1, at your option. 13 * See the LICENSE file in the project root for more information. 14 */ 15declare(strict_types = 1); 16 17namespace Elasticsearch\Namespaces; 18 19use Elasticsearch\Namespaces\AbstractNamespace; 20 21/** 22 * Class WatcherNamespace 23 * 24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php 25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee) 26 */ 27class WatcherNamespace extends AbstractNamespace 28{ 29 30 /** 31 * Acknowledges a watch, manually throttling the execution of the watch's actions. 32 * 33 * $params['watch_id'] = (string) Watch ID (Required) 34 * $params['action_id'] = (list) A comma-separated list of the action ids to be acked 35 * 36 * @param array $params Associative array of parameters 37 * @return array 38 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html 39 */ 40 public function ackWatch(array $params = []) 41 { 42 $watch_id = $this->extractArgument($params, 'watch_id'); 43 $action_id = $this->extractArgument($params, 'action_id'); 44 45 $endpointBuilder = $this->endpoints; 46 $endpoint = $endpointBuilder('Watcher\AckWatch'); 47 $endpoint->setParams($params); 48 $endpoint->setWatchId($watch_id); 49 $endpoint->setActionId($action_id); 50 51 return $this->performRequest($endpoint); 52 } 53 /** 54 * Activates a currently inactive watch. 55 * 56 * $params['watch_id'] = (string) Watch ID 57 * 58 * @param array $params Associative array of parameters 59 * @return array 60 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html 61 */ 62 public function activateWatch(array $params = []) 63 { 64 $watch_id = $this->extractArgument($params, 'watch_id'); 65 66 $endpointBuilder = $this->endpoints; 67 $endpoint = $endpointBuilder('Watcher\ActivateWatch'); 68 $endpoint->setParams($params); 69 $endpoint->setWatchId($watch_id); 70 71 return $this->performRequest($endpoint); 72 } 73 /** 74 * Deactivates a currently active watch. 75 * 76 * $params['watch_id'] = (string) Watch ID 77 * 78 * @param array $params Associative array of parameters 79 * @return array 80 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html 81 */ 82 public function deactivateWatch(array $params = []) 83 { 84 $watch_id = $this->extractArgument($params, 'watch_id'); 85 86 $endpointBuilder = $this->endpoints; 87 $endpoint = $endpointBuilder('Watcher\DeactivateWatch'); 88 $endpoint->setParams($params); 89 $endpoint->setWatchId($watch_id); 90 91 return $this->performRequest($endpoint); 92 } 93 /** 94 * Removes a watch from Watcher. 95 * 96 * $params['id'] = (string) Watch ID 97 * 98 * @param array $params Associative array of parameters 99 * @return array 100 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html 101 */ 102 public function deleteWatch(array $params = []) 103 { 104 $id = $this->extractArgument($params, 'id'); 105 106 $endpointBuilder = $this->endpoints; 107 $endpoint = $endpointBuilder('Watcher\DeleteWatch'); 108 $endpoint->setParams($params); 109 $endpoint->setId($id); 110 111 return $this->performRequest($endpoint); 112 } 113 /** 114 * Forces the execution of a stored watch. 115 * 116 * $params['id'] = (string) Watch ID 117 * $params['debug'] = (boolean) indicates whether the watch should execute in debug mode 118 * $params['body'] = (array) Execution control 119 * 120 * @param array $params Associative array of parameters 121 * @return array 122 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html 123 */ 124 public function executeWatch(array $params = []) 125 { 126 $id = $this->extractArgument($params, 'id'); 127 $body = $this->extractArgument($params, 'body'); 128 129 $endpointBuilder = $this->endpoints; 130 $endpoint = $endpointBuilder('Watcher\ExecuteWatch'); 131 $endpoint->setParams($params); 132 $endpoint->setId($id); 133 $endpoint->setBody($body); 134 135 return $this->performRequest($endpoint); 136 } 137 /** 138 * Retrieves a watch by its ID. 139 * 140 * $params['id'] = (string) Watch ID 141 * 142 * @param array $params Associative array of parameters 143 * @return array 144 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html 145 */ 146 public function getWatch(array $params = []) 147 { 148 $id = $this->extractArgument($params, 'id'); 149 150 $endpointBuilder = $this->endpoints; 151 $endpoint = $endpointBuilder('Watcher\GetWatch'); 152 $endpoint->setParams($params); 153 $endpoint->setId($id); 154 155 return $this->performRequest($endpoint); 156 } 157 /** 158 * Creates a new watch, or updates an existing one. 159 * 160 * $params['id'] = (string) Watch ID 161 * $params['active'] = (boolean) Specify whether the watch is in/active by default 162 * $params['version'] = (number) Explicit version number for concurrency control 163 * $params['if_seq_no'] = (number) only update the watch if the last operation that has changed the watch has the specified sequence number 164 * $params['if_primary_term'] = (number) only update the watch if the last operation that has changed the watch has the specified primary term 165 * $params['body'] = (array) The watch 166 * 167 * @param array $params Associative array of parameters 168 * @return array 169 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html 170 */ 171 public function putWatch(array $params = []) 172 { 173 $id = $this->extractArgument($params, 'id'); 174 $body = $this->extractArgument($params, 'body'); 175 176 $endpointBuilder = $this->endpoints; 177 $endpoint = $endpointBuilder('Watcher\PutWatch'); 178 $endpoint->setParams($params); 179 $endpoint->setId($id); 180 $endpoint->setBody($body); 181 182 return $this->performRequest($endpoint); 183 } 184 /** 185 * Retrieves stored watches. 186 * 187 * $params['body'] = (array) From, size, query, sort and search_after 188 * 189 * @param array $params Associative array of parameters 190 * @return array 191 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-query-watches.html 192 */ 193 public function queryWatches(array $params = []) 194 { 195 $body = $this->extractArgument($params, 'body'); 196 197 $endpointBuilder = $this->endpoints; 198 $endpoint = $endpointBuilder('Watcher\QueryWatches'); 199 $endpoint->setParams($params); 200 $endpoint->setBody($body); 201 202 return $this->performRequest($endpoint); 203 } 204 /** 205 * Starts Watcher if it is not already running. 206 * 207 * 208 * @param array $params Associative array of parameters 209 * @return array 210 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html 211 */ 212 public function start(array $params = []) 213 { 214 215 $endpointBuilder = $this->endpoints; 216 $endpoint = $endpointBuilder('Watcher\Start'); 217 $endpoint->setParams($params); 218 219 return $this->performRequest($endpoint); 220 } 221 /** 222 * Retrieves the current Watcher metrics. 223 * 224 * $params['metric'] = (list) Controls what additional stat metrics should be include in the response 225 * $params['emit_stacktraces'] = (boolean) Emits stack traces of currently running watches 226 * 227 * @param array $params Associative array of parameters 228 * @return array 229 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html 230 */ 231 public function stats(array $params = []) 232 { 233 $metric = $this->extractArgument($params, 'metric'); 234 235 $endpointBuilder = $this->endpoints; 236 $endpoint = $endpointBuilder('Watcher\Stats'); 237 $endpoint->setParams($params); 238 $endpoint->setMetric($metric); 239 240 return $this->performRequest($endpoint); 241 } 242 /** 243 * Stops Watcher if it is running. 244 * 245 * 246 * @param array $params Associative array of parameters 247 * @return array 248 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html 249 */ 250 public function stop(array $params = []) 251 { 252 253 $endpointBuilder = $this->endpoints; 254 $endpoint = $endpointBuilder('Watcher\Stop'); 255 $endpoint->setParams($params); 256 257 return $this->performRequest($endpoint); 258 } 259} 260