mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-24 17:09:48 +00:00
Get snapshot rest client cleanups (#31740)
This is a followup to #31537. It makes a number of changes requested by a review that came after the PR was merged. These are mostly cleanups and doc improvements.
This commit is contained in:
parent
c0b2ef55b8
commit
a5f5ea8422
@ -2122,13 +2122,21 @@ public class RequestConvertersTests extends ESTestCase {
|
||||
getSnapshotsRequest.snapshots(Arrays.asList(snapshot1, snapshot2).toArray(new String[0]));
|
||||
setRandomMasterTimeout(getSnapshotsRequest, expectedParams);
|
||||
|
||||
boolean ignoreUnavailable = randomBoolean();
|
||||
getSnapshotsRequest.ignoreUnavailable(ignoreUnavailable);
|
||||
expectedParams.put("ignore_unavailable", Boolean.toString(ignoreUnavailable));
|
||||
if (randomBoolean()) {
|
||||
boolean ignoreUnavailable = randomBoolean();
|
||||
getSnapshotsRequest.ignoreUnavailable(ignoreUnavailable);
|
||||
expectedParams.put("ignore_unavailable", Boolean.toString(ignoreUnavailable));
|
||||
} else {
|
||||
expectedParams.put("ignore_unavailable", Boolean.FALSE.toString());
|
||||
}
|
||||
|
||||
boolean verbose = randomBoolean();
|
||||
getSnapshotsRequest.verbose(verbose);
|
||||
expectedParams.put("verbose", Boolean.toString(verbose));
|
||||
if (randomBoolean()) {
|
||||
boolean verbose = randomBoolean();
|
||||
getSnapshotsRequest.verbose(verbose);
|
||||
expectedParams.put("verbose", Boolean.toString(verbose));
|
||||
} else {
|
||||
expectedParams.put("verbose", Boolean.TRUE.toString());
|
||||
}
|
||||
|
||||
Request request = RequestConverters.getSnapshots(getSnapshotsRequest);
|
||||
assertThat(endpoint, equalTo(request.getEndpoint()));
|
||||
|
@ -48,7 +48,10 @@ import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.repositories.fs.FsRepository;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.snapshots.SnapshotId;
|
||||
import org.elasticsearch.snapshots.SnapshotInfo;
|
||||
import org.elasticsearch.snapshots.SnapshotShardFailure;
|
||||
import org.elasticsearch.snapshots.SnapshotState;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -496,7 +499,14 @@ public class SnapshotClientDocumentationIT extends ESRestHighLevelClientTestCase
|
||||
// end::get-snapshots-execute
|
||||
|
||||
// tag::get-snapshots-response
|
||||
List<SnapshotInfo> snapshotsInfos = response.getSnapshots(); // <1>
|
||||
List<SnapshotInfo> snapshotsInfos = response.getSnapshots();
|
||||
SnapshotInfo snapshotInfo = snapshotsInfos.get(0);
|
||||
RestStatus restStatus = snapshotInfo.status(); // <1>
|
||||
SnapshotId snapshotId = snapshotInfo.snapshotId(); // <2>
|
||||
SnapshotState snapshotState = snapshotInfo.state(); // <3>
|
||||
List<SnapshotShardFailure> snapshotShardFailures = snapshotInfo.shardFailures(); // <4>
|
||||
long startTime = snapshotInfo.startTime(); // <5>
|
||||
long endTime = snapshotInfo.endTime(); // <6>
|
||||
// end::get-snapshots-response
|
||||
assertEquals(1, snapshotsInfos.size());
|
||||
}
|
||||
|
@ -93,11 +93,16 @@ argument.
|
||||
[[java-rest-high-snapshot-get-snapshots-response]]
|
||||
==== Get Snapshots Response
|
||||
|
||||
Use the `GetSnapshotsResponse` to retrieve information about the evaluated
|
||||
request:
|
||||
The returned `GetSnapshotsResponse` allows the retrieval of information about the requested
|
||||
snapshots:
|
||||
|
||||
["source","java",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[get-snapshots-response]
|
||||
--------------------------------------------------
|
||||
<1> Indicates the node has started the request.
|
||||
<1> The REST status of a snapshot
|
||||
<2> The snapshot id
|
||||
<3> The current state of the snapshot
|
||||
<4> Information about failures that occurred during the shard snapshot process.
|
||||
<5> The snapshot start time
|
||||
<6> The snapshot end time
|
@ -112,9 +112,9 @@ public class SnapshotShardFailure implements ShardOperationFailedException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns REST status corresponding to this failure
|
||||
* Returns {@link RestStatus} corresponding to this failure
|
||||
*
|
||||
* @return REST STATUS
|
||||
* @return REST status
|
||||
*/
|
||||
@Override
|
||||
public RestStatus status() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user