Revert "Add a storage client method for checking wheter a user has a stored manifest."

This reverts commit 8b6012f8a8.
This commit is contained in:
Jon Chambers
2021-03-18 13:12:11 -04:00
committed by Jon Chambers
parent a7bad20eae
commit a816aa0186
2 changed files with 0 additions and 70 deletions

View File

@@ -30,19 +30,14 @@ public class SecureStorageClient {
private final ExternalServiceCredentialGenerator storageServiceCredentialGenerator;
private final URI deleteUri;
private final URI getManifestUri;
private final FaultTolerantHttpClient httpClient;
@VisibleForTesting
static final String DELETE_PATH = "/v1/storage";
@VisibleForTesting
static final String GET_MANIFEST_PATH = "/v1/storage/manifest";
public SecureStorageClient(final ExternalServiceCredentialGenerator storageServiceCredentialGenerator, final Executor executor, final SecureStorageServiceConfiguration configuration) throws CertificateException {
this.storageServiceCredentialGenerator = storageServiceCredentialGenerator;
this.deleteUri = URI.create(configuration.getUri()).resolve(DELETE_PATH);
this.getManifestUri = URI.create(configuration.getUri()).resolve(GET_MANIFEST_PATH);
this.httpClient = FaultTolerantHttpClient.newBuilder()
.withCircuitBreaker(configuration.getCircuitBreakerConfiguration())
.withRetry(configuration.getRetryConfiguration())
@@ -73,24 +68,4 @@ public class SecureStorageClient {
throw new RuntimeException("Failed to delete storage service data: " + response.statusCode());
});
}
public CompletableFuture<Boolean> hasStoredData(final UUID accountUuid) {
final ExternalServiceCredentials credentials = storageServiceCredentialGenerator.generateFor(accountUuid.toString());
final HttpRequest request = HttpRequest.newBuilder()
.uri(getManifestUri)
.GET()
.header("Authorization", "Basic " + Base64.encodeBytes((credentials.getUsername() + ":" + credentials.getPassword()).getBytes(StandardCharsets.UTF_8)))
.build();
return httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString()).thenApply(response -> {
if (response.statusCode() >= 200 && response.statusCode() < 300) {
return true;
} else if (response.statusCode() == 404) {
return false;
}
throw new RuntimeException("Failed to check for presence of manifest: " + response.statusCode());
});
}
}