use of com.azure.core.http.HttpRequest in project lowkey-vault by nagyesta.
the class LowkeyVaultManagementClientImpl method timeShift.
@Override
public void timeShift(@NonNull final TimeShiftContext context) {
final Map<String, String> parameters = new TreeMap<>();
parameters.put(SECONDS_QUERY_PARAM, Integer.toString(context.getSeconds()));
final Optional<URI> optionalURI = Optional.ofNullable(context.getVaultBaseUri());
optionalURI.ifPresent(uri -> parameters.put(BASE_URI_QUERY_PARAM, uri.toString()));
final String path = optionalURI.map(u -> MANAGEMENT_VAULT_TIME_PATH).orElse(MANAGEMENT_VAULT_TIME_ALL_PATH);
final URI uri = UriUtil.uriBuilderForPath(vaultUrl, path, parameters);
final HttpRequest request = new HttpRequest(HttpMethod.PUT, uri.toString()).setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON);
sendRaw(request);
}
Aggregations