Skip to content

Commit d5c2b66

Browse files
committed
Added alternative routes that don't take policy or index in the URL.
Signed-off-by: dblock <[email protected]>
1 parent df6d5c5 commit d5c2b66

File tree

6 files changed

+266
-23
lines changed

6 files changed

+266
-23
lines changed

spec/namespaces/ism.yaml

+196-16
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,46 @@ paths:
1414
responses:
1515
'200':
1616
$ref: '#/components/responses/ism.get_policies@200'
17+
put:
18+
operationId: ism.put_policies.0
19+
x-operation-group: ism.put_policies
20+
description: Gets the policies.
21+
externalDocs:
22+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy
23+
requestBody:
24+
$ref: '#/components/requestBodies/ism.put_policies'
25+
parameters:
26+
- $ref: '#/components/parameters/ism.put_policies::query.if_primary_term'
27+
- $ref: '#/components/parameters/ism.put_policies::query.if_seq_no'
28+
- $ref: '#/components/parameters/ism.put_policies::query.policyID'
29+
responses:
30+
'200':
31+
$ref: '#/components/responses/ism.put_policies@200'
1732
/_plugins/_ism/policies/{policy_id}:
1833
get:
1934
operationId: ism.get_policy.0
2035
x-operation-group: ism.get_policy
21-
description: Gets the policy.
36+
description: Creates or updates a policy.
2237
externalDocs:
23-
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy
38+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#put-policy
2439
parameters:
2540
- $ref: '#/components/parameters/ism.get_policy::path.policy_id'
2641
responses:
2742
'200':
2843
$ref: '#/components/responses/ism.get_policy@200'
2944
head:
30-
operationId: ism.head_policy.0
31-
x-operation-group: ism.head_policy
45+
operationId: ism.exists_policy.0
46+
x-operation-group: ism.exists_policy
3247
description: Checks whether the policy exists.
3348
externalDocs:
3449
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy
3550
parameters:
36-
- $ref: '#/components/parameters/ism.head_policy::path.policy_id'
51+
- $ref: '#/components/parameters/ism.exists_policy::path.policy_id'
3752
responses:
3853
'200':
39-
$ref: '#/components/responses/ism.head_policy@200'
54+
$ref: '#/components/responses/ism.exists_policy@200'
4055
'404':
41-
$ref: '#/components/responses/ism.head_policy@404'
56+
$ref: '#/components/responses/ism.exists_policy@404'
4257
put:
4358
operationId: ism.put_policy.0
4459
x-operation-group: ism.put_policy
@@ -67,6 +82,20 @@ paths:
6782
responses:
6883
'200':
6984
$ref: '#/components/responses/ism.delete_policy@200'
85+
/_plugins/_ism/add:
86+
post:
87+
operationId: ism.add.0
88+
x-operation-group: ism.add
89+
description: Adds a policy to an index.
90+
externalDocs:
91+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy
92+
parameters:
93+
- $ref: '#/components/parameters/ism.add::query.index'
94+
requestBody:
95+
$ref: '#/components/requestBodies/ism.add'
96+
responses:
97+
'200':
98+
$ref: '#/components/responses/ism.add@200'
7099
/_plugins/_ism/add/{index}:
71100
post:
72101
operationId: ism.add_policy.0
@@ -81,6 +110,18 @@ paths:
81110
responses:
82111
'200':
83112
$ref: '#/components/responses/ism.add_policy@200'
113+
/_plugins/_ism/remove:
114+
post:
115+
operationId: ism.remove.0
116+
x-operation-group: ism.remove
117+
description: Removes a policy from an index.
118+
externalDocs:
119+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy
120+
parameters:
121+
- $ref: '#/components/parameters/ism.remove::query.index'
122+
responses:
123+
'200':
124+
$ref: '#/components/responses/ism.remove@200'
84125
/_plugins/_ism/remove/{index}:
85126
post:
86127
operationId: ism.remove_policy.0
@@ -93,6 +134,20 @@ paths:
93134
responses:
94135
'200':
95136
$ref: '#/components/responses/ism.remove_policy@200'
137+
/_plugins/_ism/change_policy:
138+
post:
139+
operationId: ism.change.0
140+
x-operation-group: ism.change
141+
description: Updates the managed index policy to a new policy.
142+
externalDocs:
143+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy
144+
parameters:
145+
- $ref: '#/components/parameters/ism.change::query.index'
146+
requestBody:
147+
$ref: '#/components/requestBodies/ism.change'
148+
responses:
149+
'200':
150+
$ref: '#/components/responses/ism.change@200'
96151
/_plugins/_ism/change_policy/{index}:
97152
post:
98153
operationId: ism.change_policy.0
@@ -117,18 +172,41 @@ paths:
117172
responses:
118173
'200':
119174
$ref: '#/components/responses/ism.explain@200'
175+
post:
176+
operationId: ism.explain.1
177+
x-operation-group: ism.explain
178+
description: Gets the currently applied policy on all indices.
179+
externalDocs:
180+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index
181+
responses:
182+
'200':
183+
$ref: '#/components/responses/ism.explain@200'
120184
/_plugins/_ism/explain/{index}:
121185
get:
122-
operationId: ism.explain_index.1
123-
x-operation-group: ism.explain_index
186+
operationId: ism.explain_policy.0
187+
x-operation-group: ism.explain_policy
124188
description: Gets the currently applied policy on an index.
125189
externalDocs:
126190
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index
127191
parameters:
128-
- $ref: '#/components/parameters/ism.explain_index::path.index'
192+
- $ref: '#/components/parameters/ism.explain_policy::path.index'
129193
responses:
130194
'200':
131-
$ref: '#/components/responses/ism.explain_index@200'
195+
$ref: '#/components/responses/ism.explain_policy@200'
196+
/_plugins/_ism/retry:
197+
post:
198+
operationId: ism.retry.0
199+
x-operation-group: ism.retry
200+
description: Retry the failed action for an index.
201+
externalDocs:
202+
url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index
203+
parameters:
204+
- $ref: '#/components/parameters/ism.retry::query.index'
205+
requestBody:
206+
$ref: '#/components/requestBodies/ism.retry'
207+
responses:
208+
'200':
209+
$ref: '#/components/responses/ism.retry@200'
132210
/_plugins/_ism/retry/{index}:
133211
post:
134212
operationId: ism.retry_index.0
@@ -157,32 +235,52 @@ paths:
157235
$ref: '#/components/responses/ism.refresh_search_analyzers@200'
158236
components:
159237
requestBodies:
238+
ism.put_policies:
239+
content:
240+
application/json:
241+
schema:
242+
$ref: '../schemas/ism._common.yaml#/components/schemas/PutPolicyRequest'
160243
ism.put_policy:
161244
content:
162245
application/json:
163246
schema:
164247
$ref: '../schemas/ism._common.yaml#/components/schemas/PutPolicyRequest'
248+
ism.add:
249+
content:
250+
application/json:
251+
schema:
252+
$ref: '../schemas/ism._common.yaml#/components/schemas/AddPolicyRequest'
165253
ism.add_policy:
166254
content:
167255
application/json:
168256
schema:
169257
$ref: '../schemas/ism._common.yaml#/components/schemas/AddPolicyRequest'
258+
ism.change:
259+
content:
260+
application/json:
261+
schema:
262+
$ref: '../schemas/ism._common.yaml#/components/schemas/ChangePolicyRequest'
170263
ism.change_policy:
171264
content:
172265
application/json:
173266
schema:
174267
$ref: '../schemas/ism._common.yaml#/components/schemas/ChangePolicyRequest'
268+
ism.retry:
269+
content:
270+
application/json:
271+
schema:
272+
$ref: '../schemas/ism._common.yaml#/components/schemas/RetryIndexRequest'
175273
ism.retry_index:
176274
content:
177275
application/json:
178276
schema:
179277
$ref: '../schemas/ism._common.yaml#/components/schemas/RetryIndexRequest'
180278
responses:
181-
ism.head_policy@200:
279+
ism.exists_policy@200:
182280
content:
183281
application/json:
184282
schema: {}
185-
ism.head_policy@404:
283+
ism.exists_policy@404:
186284
content:
187285
application/json:
188286
schema: {}
@@ -201,6 +299,11 @@ components:
201299
application/json:
202300
schema:
203301
$ref: '../schemas/ism._common.yaml#/components/schemas/PutPolicyResponse'
302+
ism.put_policies@200:
303+
content:
304+
application/json:
305+
schema:
306+
$ref: '../schemas/ism._common.yaml#/components/schemas/PutPolicyResponse'
204307
ism.put_policy@200:
205308
content:
206309
application/json:
@@ -211,16 +314,31 @@ components:
211314
application/json:
212315
schema:
213316
$ref: '../schemas/ism._common.yaml#/components/schemas/DeletePolicyResponse'
317+
ism.add@200:
318+
content:
319+
application/json:
320+
schema:
321+
$ref: '../schemas/ism._common.yaml#/components/schemas/AddPolicyResponse'
214322
ism.add_policy@200:
215323
content:
216324
application/json:
217325
schema:
218326
$ref: '../schemas/ism._common.yaml#/components/schemas/AddPolicyResponse'
327+
ism.remove@200:
328+
content:
329+
application/json:
330+
schema:
331+
$ref: '../schemas/ism._common.yaml#/components/schemas/RemovePolicyResponse'
219332
ism.remove_policy@200:
220333
content:
221334
application/json:
222335
schema:
223336
$ref: '../schemas/ism._common.yaml#/components/schemas/RemovePolicyResponse'
337+
ism.change@200:
338+
content:
339+
application/json:
340+
schema:
341+
$ref: '../schemas/ism._common.yaml#/components/schemas/ChangePolicyResponse'
224342
ism.change_policy@200:
225343
content:
226344
application/json:
@@ -231,11 +349,16 @@ components:
231349
application/json:
232350
schema:
233351
$ref: '../schemas/ism._common.yaml#/components/schemas/ExplainResponse'
234-
ism.explain_index@200:
352+
ism.explain_policy@200:
235353
content:
236354
application/json:
237355
schema:
238356
$ref: '../schemas/ism._common.yaml#/components/schemas/ExplainIndexResponse'
357+
ism.retry@200:
358+
content:
359+
application/json:
360+
schema:
361+
$ref: '../schemas/ism._common.yaml#/components/schemas/RetryIndexResponse'
239362
ism.retry_index@200:
240363
content:
241364
application/json:
@@ -247,7 +370,7 @@ components:
247370
schema:
248371
$ref: '../schemas/ism._common.yaml#/components/schemas/RefreshSearchAnalyzersResponse'
249372
parameters:
250-
ism.head_policy::path.policy_id:
373+
ism.exists_policy::path.policy_id:
251374
name: policy_id
252375
in: path
253376
required: true
@@ -295,6 +418,24 @@ components:
295418
schema:
296419
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
297420
style: simple
421+
ism.change::query.index:
422+
name: index
423+
in: query
424+
description: |-
425+
Comma-separated list of data streams, indices, and aliases.
426+
Supports wildcards (`*`).
427+
required: true
428+
schema:
429+
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
430+
ism.remove::query.index:
431+
name: index
432+
in: query
433+
description: |-
434+
Comma-separated list of data streams, indices, and aliases.
435+
Supports wildcards (`*`).
436+
required: true
437+
schema:
438+
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
298439
ism.remove_policy::path.index:
299440
name: index
300441
in: path
@@ -315,7 +456,7 @@ components:
315456
schema:
316457
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
317458
style: simple
318-
ism.explain_index::path.index:
459+
ism.explain_policy::path.index:
319460
name: index
320461
in: path
321462
description: |-
@@ -325,6 +466,15 @@ components:
325466
schema:
326467
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
327468
style: simple
469+
ism.retry::query.index:
470+
name: index
471+
in: query
472+
description: |-
473+
Comma-separated list of data streams, indices, and aliases.
474+
Supports wildcards (`*`).
475+
required: true
476+
schema:
477+
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
328478
ism.retry_index::path.index:
329479
name: index
330480
in: path
@@ -345,3 +495,33 @@ components:
345495
schema:
346496
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
347497
style: simple
498+
ism.put_policies::query.policyID:
499+
name: policyID
500+
in: query
501+
required: true
502+
schema:
503+
type: string
504+
style: form
505+
ism.put_policies::query.if_primary_term:
506+
name: if_primary_term
507+
in: query
508+
description: Only perform the operation if the document has this primary term.
509+
schema:
510+
type: number
511+
style: form
512+
ism.put_policies::query.if_seq_no:
513+
name: if_seq_no
514+
in: query
515+
description: Only perform the operation if the document has this sequence number.
516+
schema:
517+
$ref: '../schemas/_common.yaml#/components/schemas/SequenceNumber'
518+
style: form
519+
ism.add::query.index:
520+
name: index
521+
in: query
522+
description: |-
523+
Comma-separated list of data streams, indices, and aliases.
524+
Supports wildcards (`*`).
525+
required: true
526+
schema:
527+
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'

tests/default/ism/add.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,22 @@ prologues:
2121
output:
2222
id: payload._id
2323
chapters:
24-
- synopsis: Add a rollover policy to the books index.
24+
- synopsis: Add a rollover policy to the books index with the index in path.
2525
path: /_plugins/_ism/add/{index}
2626
method: POST
2727
parameters:
2828
index: books
2929
request:
3030
payload:
3131
policy_id: ${policy.id}
32+
- synopsis: Add a rollover policy to the books index with the index in a query parameter.
33+
path: /_plugins/_ism/add
34+
method: POST
35+
parameters:
36+
index: books
37+
request:
38+
payload:
39+
policy_id: ${policy.id}
3240
epilogues:
3341
- path: /_plugins/_ism/policies/rollover
3442
method: DELETE

0 commit comments

Comments
 (0)