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\Query\DatasourceDelete;
19: use OpenSearch\Endpoints\Query\DatasourceRetrieve;
20: use OpenSearch\Endpoints\Query\DatasourcesCreate;
21: use OpenSearch\Endpoints\Query\DatasourcesList;
22: use OpenSearch\Endpoints\Query\DatasourcesUpdate;
23:
24: /**
25: * Class QueryNamespace
26: *
27: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
28: */
29: class QueryNamespace extends AbstractNamespace
30: {
31: /**
32: * Deletes specific datasource specified by name.
33: *
34: * $params['datasource_name'] = (string) The Name of the DataSource to delete.
35: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
36: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
37: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
38: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
39: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
40: *
41: * @param array $params Associative array of parameters
42: * @return array
43: */
44: public function datasourceDelete(array $params = [])
45: {
46: $datasource_name = $this->extractArgument($params, 'datasource_name');
47:
48: $endpoint = $this->endpointFactory->getEndpoint(DatasourceDelete::class);
49: $endpoint->setParams($params);
50: $endpoint->setDatasourceName($datasource_name);
51:
52: return $this->performRequest($endpoint);
53: }
54:
55: /**
56: * Retrieves specific datasource specified by name.
57: *
58: * $params['datasource_name'] = (string) The Name of the DataSource to retrieve.
59: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
60: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
61: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
62: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
63: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
64: *
65: * @param array $params Associative array of parameters
66: * @return array
67: */
68: public function datasourceRetrieve(array $params = [])
69: {
70: $datasource_name = $this->extractArgument($params, 'datasource_name');
71:
72: $endpoint = $this->endpointFactory->getEndpoint(DatasourceRetrieve::class);
73: $endpoint->setParams($params);
74: $endpoint->setDatasourceName($datasource_name);
75:
76: return $this->performRequest($endpoint);
77: }
78:
79: /**
80: * Creates a new query datasource.
81: *
82: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
83: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
84: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
85: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
86: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
87: *
88: * @param array $params Associative array of parameters
89: * @return array
90: */
91: public function datasourcesCreate(array $params = [])
92: {
93: $body = $this->extractArgument($params, 'body');
94:
95: $endpoint = $this->endpointFactory->getEndpoint(DatasourcesCreate::class);
96: $endpoint->setParams($params);
97: $endpoint->setBody($body);
98:
99: return $this->performRequest($endpoint);
100: }
101:
102: /**
103: * Retrieves list of all datasources.
104: *
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 = true)
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) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
110: *
111: * @param array $params Associative array of parameters
112: * @return array
113: */
114: public function datasourcesList(array $params = [])
115: {
116: $endpoint = $this->endpointFactory->getEndpoint(DatasourcesList::class);
117: $endpoint->setParams($params);
118:
119: return $this->performRequest($endpoint);
120: }
121:
122: /**
123: * Updates an existing query datasource.
124: *
125: * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. (Default = false)
126: * $params['human'] = (boolean) Whether to return human readable values for statistics. (Default = true)
127: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
128: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
129: * $params['filter_path'] = (any) Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
130: *
131: * @param array $params Associative array of parameters
132: * @return array
133: */
134: public function datasourcesUpdate(array $params = [])
135: {
136: $body = $this->extractArgument($params, 'body');
137:
138: $endpoint = $this->endpointFactory->getEndpoint(DatasourcesUpdate::class);
139: $endpoint->setParams($params);
140: $endpoint->setBody($body);
141:
142: return $this->performRequest($endpoint);
143: }
144:
145: }
146: