| 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 a specific data source by name. |
| 33: | * |
| 34: | * $params['datasource_name'] = (string) The name of the data source 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 = false) |
| 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) 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 `-`. |
| 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 a specific data source by name. |
| 57: | * |
| 58: | * $params['datasource_name'] = (string) The name of the data source 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 = false) |
| 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) 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 `-`. |
| 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 data source. |
| 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 = false) |
| 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) 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 `-`. |
| 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 a list of all available data sources. |
| 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 = 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 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 data source. |
| 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 = false) |
| 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) 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 `-`. |
| 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: |