| 1 |
# Licensed to Elasticsearch B.V. under one or more contributor |
| 2 |
# license agreements. See the NOTICE file distributed with |
| 3 |
# this work for additional information regarding copyright |
| 4 |
# ownership. Elasticsearch B.V. licenses this file to you under |
| 5 |
# the Apache License, Version 2.0 (the "License"); you may |
| 6 |
# not use this file except in compliance with the License. |
| 7 |
# You may obtain a copy of the License at |
| 8 |
# |
| 9 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
# |
| 11 |
# Unless required by applicable law or agreed to in writing, |
| 12 |
# software distributed under the License is distributed on an |
| 13 |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 |
# KIND, either express or implied. See the License for the |
| 15 |
# specific language governing permissions and limitations |
| 16 |
# under the License. |
| 17 |
|
| 18 |
package Search::Elasticsearch::Client::8_0::Direct::Watcher; |
| 19 |
$Search::Elasticsearch::Client::8_0::Direct::Watcher::VERSION = '8.12'; |
| 20 |
use Moo; |
| 21 |
with 'Search::Elasticsearch::Client::8_0::Role::API'; |
| 22 |
with 'Search::Elasticsearch::Role::Client::Direct'; |
| 23 |
use namespace::clean; |
| 24 |
|
| 25 |
__PACKAGE__->_install_api('watcher'); |
| 26 |
|
| 27 |
1; |
| 28 |
|
| 29 |
=pod |
| 30 |
|
| 31 |
=encoding UTF-8 |
| 32 |
|
| 33 |
=head1 NAME |
| 34 |
|
| 35 |
Search::Elasticsearch::Client::8_0::Direct::Watcher - Plugin providing Watcher API for Search::Elasticsearch 8.x |
| 36 |
|
| 37 |
=head1 VERSION |
| 38 |
|
| 39 |
version 8.12 |
| 40 |
|
| 41 |
=head1 SYNOPSIS |
| 42 |
|
| 43 |
my $response = $es->watcher->start(); |
| 44 |
|
| 45 |
=head2 DESCRIPTION |
| 46 |
|
| 47 |
This class extends the L<Search::Elasticsearch> client with a C<watcher> |
| 48 |
namespace, to support the |
| 49 |
L<Watcher APIs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api.html>. |
| 50 |
|
| 51 |
=head1 METHODS |
| 52 |
|
| 53 |
The full documentation for the Watcher feature is available here: |
| 54 |
L<https://www.elastic.co/guide/en/x-pack/current/xpack-alerting.html> |
| 55 |
|
| 56 |
=head2 C<put_watch()> |
| 57 |
|
| 58 |
$response = $es->watcher->put_watch( |
| 59 |
id => $watch_id, # required |
| 60 |
body => {...} |
| 61 |
); |
| 62 |
|
| 63 |
The C<put_watch()> method is used to register a new watcher or to update |
| 64 |
an existing watcher. |
| 65 |
|
| 66 |
See the L<put_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html> |
| 67 |
for more information. |
| 68 |
|
| 69 |
Query string parameters: |
| 70 |
C<active>, |
| 71 |
C<error_trace>, |
| 72 |
C<human>, |
| 73 |
C<if_primary_term>, |
| 74 |
C<if_seq_no>, |
| 75 |
C<master_timeout>, |
| 76 |
C<version> |
| 77 |
|
| 78 |
=head2 C<get_watch()> |
| 79 |
|
| 80 |
$response = $es->watcher->get_watch( |
| 81 |
id => $watch_id, # required |
| 82 |
); |
| 83 |
|
| 84 |
The C<get_watch()> method is used to retrieve a watch by ID. |
| 85 |
|
| 86 |
See the L<get_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html> |
| 87 |
for more information. |
| 88 |
|
| 89 |
Query string parameters: |
| 90 |
C<error_trace>, |
| 91 |
C<human> |
| 92 |
|
| 93 |
=head2 C<delete_watch()> |
| 94 |
|
| 95 |
$response = $es->watcher->delete_watch( |
| 96 |
id => $watch_id, # required |
| 97 |
); |
| 98 |
|
| 99 |
The C<delete_watch()> method is used to delete a watch by ID. |
| 100 |
|
| 101 |
Query string parameters: |
| 102 |
C<error_trace>, |
| 103 |
C<force>, |
| 104 |
C<human>, |
| 105 |
C<master_timeout> |
| 106 |
|
| 107 |
See the L<delete_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-delete-watch.html> |
| 108 |
for more information. |
| 109 |
|
| 110 |
=head2 C<execute_watch()> |
| 111 |
|
| 112 |
$response = $es->watcher->execute_watch( |
| 113 |
id => $watch_id, # optional |
| 114 |
body => {...} # optional |
| 115 |
); |
| 116 |
|
| 117 |
The C<execute_watch()> method forces the execution of a previously |
| 118 |
registered watch. Optional parameters may be passed in the C<body>. |
| 119 |
|
| 120 |
Query string parameters: |
| 121 |
C<debug>, |
| 122 |
C<error_trace>, |
| 123 |
C<human> |
| 124 |
|
| 125 |
See the L<execute_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html> |
| 126 |
for more information. |
| 127 |
|
| 128 |
=head2 C<ack_watch()> |
| 129 |
|
| 130 |
$response = $es->watcher->ack_watch( |
| 131 |
watch_id => $watch_id, # required |
| 132 |
action_id => $action_id | \@action_ids # optional |
| 133 |
); |
| 134 |
|
| 135 |
The C<ack_watch()> method is used to manually throttle the execution of |
| 136 |
a watch. |
| 137 |
|
| 138 |
Query string parameters: |
| 139 |
C<error_trace>, |
| 140 |
C<human>, |
| 141 |
C<master_timeout> |
| 142 |
|
| 143 |
See the L<ack_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html> |
| 144 |
for more information. |
| 145 |
|
| 146 |
=head2 C<activate_watch()> |
| 147 |
|
| 148 |
$response = $es->watcher->activate_watch( |
| 149 |
watch_id => $watch_id, # required |
| 150 |
); |
| 151 |
|
| 152 |
The C<activate_watch()> method is used to activate a deactive watch. |
| 153 |
|
| 154 |
Query string parameters: |
| 155 |
C<error_trace>, |
| 156 |
C<human>, |
| 157 |
C<master_timeout> |
| 158 |
|
| 159 |
See the L<activate_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html> |
| 160 |
for more information. |
| 161 |
|
| 162 |
=head2 C<deactivate_watch()> |
| 163 |
|
| 164 |
$response = $es->watcher->deactivate_watch( |
| 165 |
watch_id => $watch_id, # required |
| 166 |
); |
| 167 |
|
| 168 |
The C<deactivate_watch()> method is used to deactivate an active watch. |
| 169 |
|
| 170 |
Query string parameters: |
| 171 |
C<error_trace>, |
| 172 |
C<human>, |
| 173 |
C<master_timeout> |
| 174 |
|
| 175 |
See the L<deactivate_watch docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html> |
| 176 |
for more information. |
| 177 |
|
| 178 |
=head2 C<stats()> |
| 179 |
|
| 180 |
$response = $es->watcher->stats( |
| 181 |
metric => $metric # optional |
| 182 |
); |
| 183 |
|
| 184 |
The C<stats()> method returns information about the status of the watcher plugin. |
| 185 |
|
| 186 |
See the L<stats docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html> |
| 187 |
for more information. |
| 188 |
|
| 189 |
Query string parameters: |
| 190 |
C<error_trace>, |
| 191 |
C<human> |
| 192 |
|
| 193 |
=head2 C<stop()> |
| 194 |
|
| 195 |
$response = $es->watcher->stop(); |
| 196 |
|
| 197 |
The C<stop()> method stops the watcher service if it is running. |
| 198 |
|
| 199 |
See the L<stop docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html> |
| 200 |
for more information. |
| 201 |
|
| 202 |
Query string parameters: |
| 203 |
C<error_trace>, |
| 204 |
C<human> |
| 205 |
|
| 206 |
=head2 C<start()> |
| 207 |
|
| 208 |
$response = $es->watcher->start(); |
| 209 |
|
| 210 |
The C<start()> method starts the watcher service if it is not already running. |
| 211 |
|
| 212 |
See the L<start docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html> |
| 213 |
for more information. |
| 214 |
|
| 215 |
Query string parameters: |
| 216 |
C<error_trace>, |
| 217 |
C<human> |
| 218 |
|
| 219 |
=head2 C<restart()> |
| 220 |
|
| 221 |
$response = $es->watcher->restart(); |
| 222 |
|
| 223 |
The C<restart()> method stops then starts the watcher service. |
| 224 |
|
| 225 |
See the L<restart docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-restart.html> |
| 226 |
for more information. |
| 227 |
|
| 228 |
Query string parameters: |
| 229 |
C<error_trace>, |
| 230 |
C<human> |
| 231 |
|
| 232 |
=head1 AUTHOR |
| 233 |
|
| 234 |
Enrico Zimuel <[email protected]> |
| 235 |
|
| 236 |
=head1 COPYRIGHT AND LICENSE |
| 237 |
|
| 238 |
This software is Copyright (c) 2024 by Elasticsearch BV. |
| 239 |
|
| 240 |
This is free software, licensed under: |
| 241 |
|
| 242 |
The Apache License, Version 2.0, January 2004 |
| 243 |
|
| 244 |
=cut |
| 245 |
|
| 246 |
__END__ |
| 247 |
|
| 248 |
# ABSTRACT: Plugin providing Watcher API for Search::Elasticsearch 8.x |
| 249 |
|