Search in sources :

Example 1 with APPLICATION_JSON

use of com.azure.core.http.ContentType.APPLICATION_JSON 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);
}
Also used : HttpResponse(com.azure.core.http.HttpResponse) java.util(java.util) GZIPInputStream(java.util.zip.GZIPInputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Nullable(reactor.util.annotation.Nullable) Function(java.util.function.Function) Supplier(java.util.function.Supplier) ObjectReader(com.fasterxml.jackson.databind.ObjectReader) APPLICATION_JSON(com.azure.core.http.ContentType.APPLICATION_JSON) ByteArrayInputStream(java.io.ByteArrayInputStream) com.github.nagyesta.lowkeyvault.http.management(com.github.nagyesta.lowkeyvault.http.management) URI(java.net.URI) HttpHeaders(org.apache.http.HttpHeaders) VAULT_MODEL_LIST_TYPE_REF(com.github.nagyesta.lowkeyvault.http.management.impl.ResponseEntity.VAULT_MODEL_LIST_TYPE_REF) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) NonNull(lombok.NonNull) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) StandardCharsets(java.nio.charset.StandardCharsets) Slf4j(lombok.extern.slf4j.Slf4j) HttpRequest(com.azure.core.http.HttpRequest) HttpClient(com.azure.core.http.HttpClient) HttpMethod(com.azure.core.http.HttpMethod) GZIPOutputStream(java.util.zip.GZIPOutputStream) HttpRequest(com.azure.core.http.HttpRequest) URI(java.net.URI)

Aggregations

APPLICATION_JSON (com.azure.core.http.ContentType.APPLICATION_JSON)1 HttpClient (com.azure.core.http.HttpClient)1 HttpMethod (com.azure.core.http.HttpMethod)1 HttpRequest (com.azure.core.http.HttpRequest)1 HttpResponse (com.azure.core.http.HttpResponse)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectReader (com.fasterxml.jackson.databind.ObjectReader)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 com.github.nagyesta.lowkeyvault.http.management (com.github.nagyesta.lowkeyvault.http.management)1 VAULT_MODEL_LIST_TYPE_REF (com.github.nagyesta.lowkeyvault.http.management.impl.ResponseEntity.VAULT_MODEL_LIST_TYPE_REF)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 URI (java.net.URI)1 StandardCharsets (java.nio.charset.StandardCharsets)1 java.util (java.util)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 GZIPInputStream (java.util.zip.GZIPInputStream)1