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\Wlm\CreateQueryGroup;
19: use OpenSearch\Endpoints\Wlm\DeleteQueryGroup;
20: use OpenSearch\Endpoints\Wlm\GetQueryGroup;
21: use OpenSearch\Endpoints\Wlm\UpdateQueryGroup;
22:
23: /**
24: * Class WlmNamespace
25: *
26: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
27: */
28: class WlmNamespace extends AbstractNamespace
29: {
30: /**
31: * Creates a new query group and sets the resource limits for the new query group.
32: *
33: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
34: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
35: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
36: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
37: * $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 `-`.
38: *
39: * @param array $params Associative array of parameters
40: * @return array
41: */
42: public function createQueryGroup(array $params = [])
43: {
44: $body = $this->extractArgument($params, 'body');
45:
46: $endpoint = $this->endpointFactory->getEndpoint(CreateQueryGroup::class);
47: $endpoint->setParams($params);
48: $endpoint->setBody($body);
49:
50: return $this->performRequest($endpoint);
51: }
52:
53: /**
54: * Deletes the specified query group.
55: *
56: * $params['name'] = (string) The name of the query group.
57: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
58: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
59: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
60: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
61: * $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 `-`.
62: *
63: * @param array $params Associative array of parameters
64: * @return array
65: */
66: public function deleteQueryGroup(array $params = [])
67: {
68: $name = $this->extractArgument($params, 'name');
69:
70: $endpoint = $this->endpointFactory->getEndpoint(DeleteQueryGroup::class);
71: $endpoint->setParams($params);
72: $endpoint->setName($name);
73:
74: return $this->performRequest($endpoint);
75: }
76:
77: /**
78: * Retrieves the specified query group. If no query group is specified, all query groups in the cluster are retrieved.
79: *
80: * $params['name'] = (string) The name of the query group.
81: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
82: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
83: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
84: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
85: * $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 `-`.
86: *
87: * @param array $params Associative array of parameters
88: * @return array
89: */
90: public function getQueryGroup(array $params = [])
91: {
92: $name = $this->extractArgument($params, 'name');
93:
94: $endpoint = $this->endpointFactory->getEndpoint(GetQueryGroup::class);
95: $endpoint->setParams($params);
96: $endpoint->setName($name);
97:
98: return $this->performRequest($endpoint);
99: }
100:
101: /**
102: * Updates the specified query group.
103: *
104: * $params['name'] = (string) The name of the query group.
105: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
106: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
107: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
108: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
109: * $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 `-`.
110: *
111: * @param array $params Associative array of parameters
112: * @return array
113: */
114: public function updateQueryGroup(array $params = [])
115: {
116: $name = $this->extractArgument($params, 'name');
117: $body = $this->extractArgument($params, 'body');
118:
119: $endpoint = $this->endpointFactory->getEndpoint(UpdateQueryGroup::class);
120: $endpoint->setParams($params);
121: $endpoint->setName($name);
122: $endpoint->setBody($body);
123:
124: return $this->performRequest($endpoint);
125: }
126:
127: }
128: