Skip to content

Commit

Permalink
Fix: /_cat/snapshots takes a repository in the query. (#700)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock authored Dec 2, 2024
1 parent 441577f commit 1ef6968
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed `/_ingest/pipeline/{id}/_simulate` response `docs/_source` field schema ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))
- Fixed `/_scripts/painless/_execute` request and response schema ([#699](https://github.com/opensearch-project/opensearch-api-specification/pull/699))
- Fixed `fields` in `Hit` allowing primitive arrays ([#699](https://github.com/opensearch-project/opensearch-api-specification/pull/699))
- Added missing `repository` query parameter to `/_cat/snapshots` ([#700](https://github.com/opensearch-project/opensearch-api-specification/pull/700))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
13 changes: 13 additions & 0 deletions spec/namespaces/cat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ paths:
- $ref: '#/components/parameters/cat.snapshots::query.help'
- $ref: '#/components/parameters/cat.snapshots::query.ignore_unavailable'
- $ref: '#/components/parameters/cat.snapshots::query.master_timeout'
- $ref: '#/components/parameters/cat.snapshots::query.repository'
- $ref: '#/components/parameters/cat.snapshots::query.s'
- $ref: '#/components/parameters/cat.snapshots::query.time'
- $ref: '#/components/parameters/cat.snapshots::query.v'
Expand All @@ -658,6 +659,7 @@ paths:
- $ref: '#/components/parameters/cat.snapshots::query.help'
- $ref: '#/components/parameters/cat.snapshots::query.ignore_unavailable'
- $ref: '#/components/parameters/cat.snapshots::query.master_timeout'
- $ref: '#/components/parameters/cat.snapshots::query.repository'
- $ref: '#/components/parameters/cat.snapshots::query.s'
- $ref: '#/components/parameters/cat.snapshots::query.time'
- $ref: '#/components/parameters/cat.snapshots::query.v'
Expand Down Expand Up @@ -2544,6 +2546,17 @@ components:
type: boolean
default: false
description: Verbose mode. Display column headers.
cat.snapshots::query.repository:
in: query
name: repository
description: |-
A comma-separated list of snapshot repositories used to limit the request.
Accepts wildcard expressions.
`_all` returns all repositories.
If any repository fails during the request, OpenSearch returns an error.
required: true
schema:
$ref: '../schemas/_common.yaml#/components/schemas/Names'
cat.snapshots::path.repository:
in: path
name: repository
Expand Down
29 changes: 28 additions & 1 deletion tests/snapshot/cat/snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ $schema: ../../../json_schemas/test_story.schema.yaml

description: Test cat/snapshots endpoints.
epilogues:
- path: /_snapshot/my-fs-repository/my-test-snapshot
method: DELETE
status: [200, 404]
- path: /_snapshot/my-fs-repository
method: DELETE
status: [200, 404]
Expand All @@ -13,12 +16,36 @@ prologues:
type: fs
settings:
location: /tmp/opensearch/repo
- path: /_snapshot/my-fs-repository/my-test-snapshot
method: PUT
parameters:
wait_for_completion: true
request:
payload:
indices: '*'
ignore_unavailable: true
include_global_state: false
partial: true
chapters:
- synopsis: List all snapshots for a repository.
- synopsis: List all snapshots for a repository (query).
path: /_cat/snapshots
method: GET
parameters:
format: json
repository: my-fs-repository
response:
status: 200
payload:
- id: my-test-snapshot
status: SUCCESS
- synopsis: List all snapshots for a repository (path).
path: /_cat/snapshots/{repository}
method: GET
parameters:
format: json
repository: my-fs-repository
response:
status: 200
payload:
- id: my-test-snapshot
status: SUCCESS

0 comments on commit 1ef6968

Please sign in to comment.