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\Sm\CreatePolicy;
19: use OpenSearch\Endpoints\Sm\DeletePolicy;
20: use OpenSearch\Endpoints\Sm\ExplainPolicy;
21: use OpenSearch\Endpoints\Sm\GetPolicies;
22: use OpenSearch\Endpoints\Sm\GetPolicy;
23: use OpenSearch\Endpoints\Sm\StartPolicy;
24: use OpenSearch\Endpoints\Sm\StopPolicy;
25: use OpenSearch\Endpoints\Sm\UpdatePolicy;
26:
27: /**
28: * Class SmNamespace
29: *
30: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
31: */
32: class SmNamespace extends AbstractNamespace
33: {
34: /**
35: * Creates a snapshot management policy.
36: *
37: * $params['policy_name'] = (string) The name of the snapshot management policy to create.
38: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
39: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
40: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
41: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
42: * $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 `-`.
43: *
44: * @param array $params Associative array of parameters
45: * @return array
46: */
47: public function createPolicy(array $params = [])
48: {
49: $policy_name = $this->extractArgument($params, 'policy_name');
50: $body = $this->extractArgument($params, 'body');
51:
52: $endpoint = $this->endpointFactory->getEndpoint(CreatePolicy::class);
53: $endpoint->setParams($params);
54: $endpoint->setPolicyName($policy_name);
55: $endpoint->setBody($body);
56:
57: return $this->performRequest($endpoint);
58: }
59:
60: /**
61: * Deletes a snapshot management policy.
62: *
63: * $params['policy_name'] = (string) The name of the snapshot management policy to delete.
64: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
65: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
66: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
67: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
68: * $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 `-`.
69: *
70: * @param array $params Associative array of parameters
71: * @return array
72: */
73: public function deletePolicy(array $params = [])
74: {
75: $policy_name = $this->extractArgument($params, 'policy_name');
76:
77: $endpoint = $this->endpointFactory->getEndpoint(DeletePolicy::class);
78: $endpoint->setParams($params);
79: $endpoint->setPolicyName($policy_name);
80:
81: return $this->performRequest($endpoint);
82: }
83:
84: /**
85: * Explains the state of the snapshot management policy.
86: *
87: * $params['policy_name'] = (string) The name of the snapshot management policy to explain.
88: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
89: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
90: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
91: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
92: * $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 `-`.
93: *
94: * @param array $params Associative array of parameters
95: * @return array
96: */
97: public function explainPolicy(array $params = [])
98: {
99: $policy_name = $this->extractArgument($params, 'policy_name');
100:
101: $endpoint = $this->endpointFactory->getEndpoint(ExplainPolicy::class);
102: $endpoint->setParams($params);
103: $endpoint->setPolicyName($policy_name);
104:
105: return $this->performRequest($endpoint);
106: }
107:
108: /**
109: * Retrieves all snapshot management policies with optional pagination and filtering.
110: *
111: * $params['from'] = (integer) The starting index from which to retrieve snapshot management policies. (Default = 0)
112: * $params['queryString'] = (string) The query string to filter the returned snapshot management policies.
113: * $params['size'] = (integer) The number of snapshot management policies to return.
114: * $params['sortField'] = (string) The name of the field to sort the snapshot management policies by.
115: * $params['sortOrder'] = (enum) The order to sort the snapshot management policies. (Options = asc,desc)
116: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
117: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
118: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
119: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
120: * $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 `-`.
121: *
122: * @param array $params Associative array of parameters
123: * @return array
124: */
125: public function getPolicies(array $params = [])
126: {
127: $endpoint = $this->endpointFactory->getEndpoint(GetPolicies::class);
128: $endpoint->setParams($params);
129:
130: return $this->performRequest($endpoint);
131: }
132:
133: /**
134: * Retrieves a specific snapshot management policy by name.
135: *
136: * $params['policy_name'] = (string) The name of the snapshot management policy to retrieve.
137: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
138: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
139: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
140: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
141: * $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 `-`.
142: *
143: * @param array $params Associative array of parameters
144: * @return array
145: */
146: public function getPolicy(array $params = [])
147: {
148: $policy_name = $this->extractArgument($params, 'policy_name');
149:
150: $endpoint = $this->endpointFactory->getEndpoint(GetPolicy::class);
151: $endpoint->setParams($params);
152: $endpoint->setPolicyName($policy_name);
153:
154: return $this->performRequest($endpoint);
155: }
156:
157: /**
158: * Starts a snapshot management policy.
159: *
160: * $params['policy_name'] = (string) The name of the snapshot management policy to start.
161: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
162: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
163: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
164: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
165: * $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 `-`.
166: *
167: * @param array $params Associative array of parameters
168: * @return array
169: */
170: public function startPolicy(array $params = [])
171: {
172: $policy_name = $this->extractArgument($params, 'policy_name');
173:
174: $endpoint = $this->endpointFactory->getEndpoint(StartPolicy::class);
175: $endpoint->setParams($params);
176: $endpoint->setPolicyName($policy_name);
177:
178: return $this->performRequest($endpoint);
179: }
180:
181: /**
182: * Stops a snapshot management policy.
183: *
184: * $params['policy_name'] = (string) The name of the snapshot management policy to stop.
185: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
186: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
187: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
188: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
189: * $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 `-`.
190: *
191: * @param array $params Associative array of parameters
192: * @return array
193: */
194: public function stopPolicy(array $params = [])
195: {
196: $policy_name = $this->extractArgument($params, 'policy_name');
197:
198: $endpoint = $this->endpointFactory->getEndpoint(StopPolicy::class);
199: $endpoint->setParams($params);
200: $endpoint->setPolicyName($policy_name);
201:
202: return $this->performRequest($endpoint);
203: }
204:
205: /**
206: * Updates an existing snapshot management policy. Requires `if_seq_no` and `if_primary_term`.
207: *
208: * $params['policy_name'] = (string) The name of the snapshot management policy to update.
209: * $params['if_primary_term'] = (integer) The primary term of the policy to update.
210: * $params['if_seq_no'] = (integer) The sequence number of the policy to update.
211: * $params['pretty'] = (boolean) Whether to pretty-format the returned JSON response. (Default = false)
212: * $params['human'] = (boolean) Whether to return human-readable values for statistics. (Default = false)
213: * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. (Default = false)
214: * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
215: * $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 `-`.
216: *
217: * @param array $params Associative array of parameters
218: * @return array
219: */
220: public function updatePolicy(array $params = [])
221: {
222: $policy_name = $this->extractArgument($params, 'policy_name');
223: $body = $this->extractArgument($params, 'body');
224:
225: $endpoint = $this->endpointFactory->getEndpoint(UpdatePolicy::class);
226: $endpoint->setParams($params);
227: $endpoint->setPolicyName($policy_name);
228: $endpoint->setBody($body);
229:
230: return $this->performRequest($endpoint);
231: }
232:
233: }
234: