-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add models for the
/_remotestore/_restore
API endpoint (#70)
* Add models for the `/_remotestore/_restore` API endpoint Signed-off-by: Thomas Farr <[email protected]> * Flag as unstable Signed-off-by: Thomas Farr <[email protected]> * Fix `test/scripts/operation-filter.py` to work with multiline ops list Signed-off-by: Thomas Farr <[email protected]> * Add example to PostRemoteStoreRestore operation Signed-off-by: Thomas Farr <[email protected]> * Create test for `/_remotestore/_restore` endpoint Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]>
- Loading branch information
Showing
9 changed files
with
387 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// The OpenSearch Contributors require contributions made to | ||
// this file be licensed under the Apache-2.0 license or a | ||
// compatible open source license. | ||
|
||
$version: "2" | ||
namespace OpenSearch | ||
|
||
@unstable | ||
@externalDocumentation( | ||
"OpenSearch Documentation": "https://opensearch.org/docs/latest/opensearch/remote/#restoring-from-a-backup" | ||
) | ||
|
||
@suppress(["HttpUriConflict"]) | ||
@http(method: "POST", uri: "/_remotestore/_restore") | ||
@documentation("Restore one or more indices from a remote backup.") | ||
operation PostRemoteStoreRestore{ | ||
input: PostRemoteStoreRestoreInput, | ||
output: PostRemoteStoreRestoreOutput | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// The OpenSearch Contributors require contributions made to | ||
// this file be licensed under the Apache-2.0 license or a | ||
// compatible open source license. | ||
|
||
$version: "2" | ||
namespace OpenSearch | ||
|
||
@unstable | ||
structure PostRemoteStoreRestoreInput { | ||
@httpQuery("cluster_manager_timeout") | ||
cluster_manager_timeout: Time, | ||
|
||
@httpQuery("wait_for_completion") | ||
wait_for_completion: Boolean, | ||
|
||
@required | ||
indices: IndexNameList | ||
} | ||
|
||
@unstable | ||
structure PostRemoteStoreRestoreOutput { | ||
accepted: Boolean, | ||
remote_store: RemoteStoreRestoreInfo | ||
} | ||
|
||
@unstable | ||
structure RemoteStoreRestoreInfo { | ||
snapshot: String, | ||
indices: IndexNameList, | ||
shards: RemoteStoreRestoreShardsInfo | ||
} | ||
|
||
@unstable | ||
structure RemoteStoreRestoreShardsInfo { | ||
total: Integer, | ||
failed: Integer, | ||
successful: Integer | ||
} | ||
|
||
apply PostRemoteStoreRestore @examples([ | ||
{ | ||
title: "Examples for Post Remote Storage Restore Operation.", | ||
input: { | ||
indices: ["books"] | ||
}, | ||
output: { | ||
remote_store: { | ||
indices: ["books"], | ||
shards: { | ||
total: 1, | ||
failed: 0, | ||
successful: 1 | ||
} | ||
} | ||
} | ||
} | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
{ | ||
"openapi": "3.0.2", | ||
"info": { | ||
"title": "OpenSearch", | ||
"version": "2021-11-23" | ||
}, | ||
"paths": { | ||
"/_remotestore/_restore": { | ||
"post": { | ||
"description": "Restore one or more indices from a remote backup.", | ||
"operationId": "PostRemoteStoreRestore", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/PostRemoteStoreRestoreRequestContent" | ||
}, | ||
"examples": { | ||
"PostRemoteStoreRestore_example1": { | ||
"summary": "Examples for Post Remote Storage Restore Operation.", | ||
"description": "", | ||
"value": { | ||
"indices": [ | ||
"books" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"parameters": [ | ||
{ | ||
"name": "cluster_manager_timeout", | ||
"in": "query", | ||
"schema": { | ||
"type": "string", | ||
"pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$" | ||
} | ||
}, | ||
{ | ||
"name": "wait_for_completion", | ||
"in": "query", | ||
"schema": { | ||
"type": "boolean" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "PostRemoteStoreRestore 200 response", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/PostRemoteStoreRestoreResponseContent" | ||
}, | ||
"examples": { | ||
"PostRemoteStoreRestore_example1": { | ||
"summary": "Examples for Post Remote Storage Restore Operation.", | ||
"description": "", | ||
"value": { | ||
"remote_store": { | ||
"indices": [ | ||
"books" | ||
], | ||
"shards": { | ||
"total": 1, | ||
"failed": 0, | ||
"successful": 1 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"PostRemoteStoreRestoreRequestContent": { | ||
"type": "object", | ||
"properties": { | ||
"indices": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"pattern": "^[^+_\\-\\.][^\\\\, /*?\"<>| ,#\\nA-Z]+$" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"indices" | ||
] | ||
}, | ||
"PostRemoteStoreRestoreResponseContent": { | ||
"type": "object", | ||
"properties": { | ||
"accepted": { | ||
"type": "boolean" | ||
}, | ||
"remote_store": { | ||
"$ref": "#/components/schemas/RemoteStoreRestoreInfo" | ||
} | ||
}, | ||
"example": { | ||
"remote_store": { | ||
"indices": [ | ||
"books" | ||
], | ||
"shards": { | ||
"total": 1, | ||
"failed": 0, | ||
"successful": 1 | ||
} | ||
} | ||
} | ||
}, | ||
"RemoteStoreRestoreInfo": { | ||
"type": "object", | ||
"properties": { | ||
"snapshot": { | ||
"type": "string" | ||
}, | ||
"indices": { | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"pattern": "^[^+_\\-\\.][^\\\\, /*?\"<>| ,#\\nA-Z]+$" | ||
} | ||
}, | ||
"shards": { | ||
"$ref": "#/components/schemas/RemoteStoreRestoreShardsInfo" | ||
} | ||
} | ||
}, | ||
"RemoteStoreRestoreShardsInfo": { | ||
"type": "object", | ||
"properties": { | ||
"total": { | ||
"type": "number" | ||
}, | ||
"failed": { | ||
"type": "number" | ||
}, | ||
"successful": { | ||
"type": "number" | ||
} | ||
} | ||
} | ||
}, | ||
"securitySchemes": { | ||
"smithy.api.httpBasicAuth": { | ||
"type": "http", | ||
"description": "HTTP Basic authentication", | ||
"scheme": "Basic" | ||
} | ||
} | ||
}, | ||
"security": [ | ||
{ | ||
"smithy.api.httpBasicAuth": [] | ||
} | ||
] | ||
} |
Oops, something went wrong.