blob: 35ceb7081ead77d2ea1e07d6d0fef080cc75dfd2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.restapi;
import com.yahoo.restapi.SlimeJsonResponse;
import com.yahoo.slime.Cursor;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.archive.ArchiveUris;
import java.util.Map;
/**
* Returns tenant archive URIs.
*
* @author freva
*/
public class ArchiveResponse extends SlimeJsonResponse {
public ArchiveResponse(NodeRepository nodeRepository) {
ArchiveUris archiveUris = nodeRepository.archiveUriManager().archiveUris();
Cursor archivesArray = slime.setObject().setArray("archives");
archiveUris.tenantArchiveUris().entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.forEach(entry -> {
Cursor archiveObject = archivesArray.addObject();
archiveObject.setString("tenant", entry.getKey().value());
archiveObject.setString("uri", entry.getValue());
});
archiveUris.accountArchiveUris().entrySet().stream()
.sorted(Map.Entry.comparingByKey())
.forEach(entry -> {
Cursor archiveObject = archivesArray.addObject();
archiveObject.setString("account", entry.getKey().value());
archiveObject.setString("uri", entry.getValue());
});
}
}
|