1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * SPDX-License-Identifier: Apache-2.0 |
7: | * |
8: | * The OpenSearch Contributors require contributions made to |
9: | * this file be licensed under the Apache-2.0 license or a |
10: | * compatible open source license. |
11: | * |
12: | * Modifications Copyright OpenSearch Contributors. See |
13: | * GitHub history for details. |
14: | */ |
15: | |
16: | namespace OpenSearch\Namespaces; |
17: | |
18: | use OpenSearch\Endpoints\Ism\AddPolicy; |
19: | use OpenSearch\Endpoints\Ism\ChangePolicy; |
20: | use OpenSearch\Endpoints\Ism\DeletePolicy; |
21: | use OpenSearch\Endpoints\Ism\ExistsPolicy; |
22: | use OpenSearch\Endpoints\Ism\ExplainPolicy; |
23: | use OpenSearch\Endpoints\Ism\GetPolicies; |
24: | use OpenSearch\Endpoints\Ism\GetPolicy; |
25: | use OpenSearch\Endpoints\Ism\PutPolicies; |
26: | use OpenSearch\Endpoints\Ism\PutPolicy; |
27: | use OpenSearch\Endpoints\Ism\RefreshSearchAnalyzers; |
28: | use OpenSearch\Endpoints\Ism\RemovePolicy; |
29: | use OpenSearch\Endpoints\Ism\RetryIndex; |
30: | |
31: | /** |
32: | * Class IsmNamespace |
33: | * |
34: | * NOTE: This file is autogenerated using util/GenerateEndpoints.php |
35: | */ |
36: | class IsmNamespace extends AbstractNamespace |
37: | { |
38: | /** |
39: | * Adds a policy to an index. |
40: | * |
41: | * $params['index'] = (string) |
42: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
43: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
44: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
45: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
46: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
47: | * |
48: | * @param array $params Associative array of parameters |
49: | * @return array |
50: | */ |
51: | public function addPolicy(array $params = []) |
52: | { |
53: | $index = $this->extractArgument($params, 'index'); |
54: | $body = $this->extractArgument($params, 'body'); |
55: | |
56: | $endpoint = $this->endpointFactory->getEndpoint(AddPolicy::class); |
57: | $endpoint->setParams($params); |
58: | $endpoint->setIndex($index); |
59: | $endpoint->setBody($body); |
60: | |
61: | return $this->performRequest($endpoint); |
62: | } |
63: | |
64: | /** |
65: | * Updates the managed index policy to a new policy. |
66: | * |
67: | * $params['index'] = (string) |
68: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
69: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
70: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
71: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
72: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
73: | * |
74: | * @param array $params Associative array of parameters |
75: | * @return array |
76: | */ |
77: | public function changePolicy(array $params = []) |
78: | { |
79: | $index = $this->extractArgument($params, 'index'); |
80: | $body = $this->extractArgument($params, 'body'); |
81: | |
82: | $endpoint = $this->endpointFactory->getEndpoint(ChangePolicy::class); |
83: | $endpoint->setParams($params); |
84: | $endpoint->setIndex($index); |
85: | $endpoint->setBody($body); |
86: | |
87: | return $this->performRequest($endpoint); |
88: | } |
89: | |
90: | /** |
91: | * Deletes a policy. |
92: | * |
93: | * $params['policy_id'] = (string) (Required) |
94: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
95: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
96: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
97: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
98: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
99: | * |
100: | * @param array $params Associative array of parameters |
101: | * @return array |
102: | */ |
103: | public function deletePolicy(array $params = []) |
104: | { |
105: | $policy_id = $this->extractArgument($params, 'policy_id'); |
106: | |
107: | $endpoint = $this->endpointFactory->getEndpoint(DeletePolicy::class); |
108: | $endpoint->setParams($params); |
109: | $endpoint->setPolicyId($policy_id); |
110: | |
111: | return $this->performRequest($endpoint); |
112: | } |
113: | |
114: | /** |
115: | * Checks for the existence of a policy. |
116: | * |
117: | * $params['policy_id'] = (string) (Required) |
118: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
119: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
120: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
121: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
122: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
123: | * |
124: | * @param array $params Associative array of parameters |
125: | * @return bool |
126: | */ |
127: | public function existsPolicy(array $params = []): bool |
128: | { |
129: | $policy_id = $this->extractArgument($params, 'policy_id'); |
130: | |
131: | // Legacy option to manually make this verbose so we can check status code. |
132: | // @todo remove in 3.0.0 |
133: | $params['client']['verbose'] = true; |
134: | |
135: | $endpoint = $this->endpointFactory->getEndpoint(ExistsPolicy::class); |
136: | $endpoint->setParams($params); |
137: | $endpoint->setPolicyId($policy_id); |
138: | |
139: | return BooleanRequestWrapper::sendRequest($endpoint, $this->httpTransport); |
140: | } |
141: | |
142: | /** |
143: | * Retrieves the currently applied policy on the specified indexes. |
144: | * |
145: | * $params['index'] = (string) |
146: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
147: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
148: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
149: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
150: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
151: | * |
152: | * @param array $params Associative array of parameters |
153: | * @return array |
154: | */ |
155: | public function explainPolicy(array $params = []) |
156: | { |
157: | $index = $this->extractArgument($params, 'index'); |
158: | $body = $this->extractArgument($params, 'body'); |
159: | |
160: | $endpoint = $this->endpointFactory->getEndpoint(ExplainPolicy::class); |
161: | $endpoint->setParams($params); |
162: | $endpoint->setIndex($index); |
163: | $endpoint->setBody($body); |
164: | |
165: | return $this->performRequest($endpoint); |
166: | } |
167: | |
168: | /** |
169: | * Retrieves the policies. |
170: | * |
171: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
172: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
173: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
174: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
175: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
176: | * |
177: | * @param array $params Associative array of parameters |
178: | * @return array |
179: | */ |
180: | public function getPolicies(array $params = []) |
181: | { |
182: | $endpoint = $this->endpointFactory->getEndpoint(GetPolicies::class); |
183: | $endpoint->setParams($params); |
184: | |
185: | return $this->performRequest($endpoint); |
186: | } |
187: | |
188: | /** |
189: | * Retrieves a specific policy. |
190: | * |
191: | * $params['policy_id'] = (string) (Required) |
192: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
193: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
194: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
195: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
196: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
197: | * |
198: | * @param array $params Associative array of parameters |
199: | * @return array |
200: | */ |
201: | public function getPolicy(array $params = []) |
202: | { |
203: | $policy_id = $this->extractArgument($params, 'policy_id'); |
204: | |
205: | $endpoint = $this->endpointFactory->getEndpoint(GetPolicy::class); |
206: | $endpoint->setParams($params); |
207: | $endpoint->setPolicyId($policy_id); |
208: | |
209: | return $this->performRequest($endpoint); |
210: | } |
211: | |
212: | /** |
213: | * Creates or updates policies. |
214: | * |
215: | * $params['if_primary_term'] = (number) Only perform the operation if the document has this primary term. |
216: | * $params['if_seq_no'] = (integer) Only perform the operation if the document has this sequence number. |
217: | * $params['policyID'] = (string) |
218: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
219: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
220: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
221: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
222: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
223: | * |
224: | * @param array $params Associative array of parameters |
225: | * @return array |
226: | */ |
227: | public function putPolicies(array $params = []) |
228: | { |
229: | $body = $this->extractArgument($params, 'body'); |
230: | |
231: | $endpoint = $this->endpointFactory->getEndpoint(PutPolicies::class); |
232: | $endpoint->setParams($params); |
233: | $endpoint->setBody($body); |
234: | |
235: | return $this->performRequest($endpoint); |
236: | } |
237: | |
238: | /** |
239: | * Creates or updates a policy. |
240: | * |
241: | * $params['policy_id'] = (string) (Required) |
242: | * $params['if_primary_term'] = (number) Only perform the operation if the document has this primary term. |
243: | * $params['if_seq_no'] = (integer) Only perform the operation if the document has this sequence number. |
244: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
245: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
246: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
247: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
248: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
249: | * |
250: | * @param array $params Associative array of parameters |
251: | * @return array |
252: | */ |
253: | public function putPolicy(array $params = []) |
254: | { |
255: | $policy_id = $this->extractArgument($params, 'policy_id'); |
256: | $body = $this->extractArgument($params, 'body'); |
257: | |
258: | $endpoint = $this->endpointFactory->getEndpoint(PutPolicy::class); |
259: | $endpoint->setParams($params); |
260: | $endpoint->setPolicyId($policy_id); |
261: | $endpoint->setBody($body); |
262: | |
263: | return $this->performRequest($endpoint); |
264: | } |
265: | |
266: | /** |
267: | * Refreshes search analyzers in real time. |
268: | * |
269: | * $params['index'] = (string) (Required) |
270: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
271: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
272: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
273: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
274: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
275: | * |
276: | * @param array $params Associative array of parameters |
277: | * @return array |
278: | */ |
279: | public function refreshSearchAnalyzers(array $params = []) |
280: | { |
281: | $index = $this->extractArgument($params, 'index'); |
282: | |
283: | $endpoint = $this->endpointFactory->getEndpoint(RefreshSearchAnalyzers::class); |
284: | $endpoint->setParams($params); |
285: | $endpoint->setIndex($index); |
286: | |
287: | return $this->performRequest($endpoint); |
288: | } |
289: | |
290: | /** |
291: | * Removes a policy from an index. |
292: | * |
293: | * $params['index'] = (string) |
294: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
295: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
296: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
297: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
298: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
299: | * |
300: | * @param array $params Associative array of parameters |
301: | * @return array |
302: | */ |
303: | public function removePolicy(array $params = []) |
304: | { |
305: | $index = $this->extractArgument($params, 'index'); |
306: | |
307: | $endpoint = $this->endpointFactory->getEndpoint(RemovePolicy::class); |
308: | $endpoint->setParams($params); |
309: | $endpoint->setIndex($index); |
310: | |
311: | return $this->performRequest($endpoint); |
312: | } |
313: | |
314: | /** |
315: | * Retries the failed action for an index. |
316: | * |
317: | * $params['index'] = (string) |
318: | * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false) |
319: | * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false) |
320: | * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false) |
321: | * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. |
322: | * $params['filter_path'] = (any) A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. |
323: | * |
324: | * @param array $params Associative array of parameters |
325: | * @return array |
326: | */ |
327: | public function retryIndex(array $params = []) |
328: | { |
329: | $index = $this->extractArgument($params, 'index'); |
330: | $body = $this->extractArgument($params, 'body'); |
331: | |
332: | $endpoint = $this->endpointFactory->getEndpoint(RetryIndex::class); |
333: | $endpoint->setParams($params); |
334: | $endpoint->setIndex($index); |
335: | $endpoint->setBody($body); |
336: | |
337: | return $this->performRequest($endpoint); |
338: | } |
339: | |
340: | } |
341: |