All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.vault.runtime.client.dto.transit.VaultTransitKeyVersionData Maven / Gradle / Ivy

There is a newer version: 2.5.4.Final
Show newest version
package io.quarkus.vault.runtime.client.dto.transit;

import java.io.IOException;
import java.time.Instant;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import io.quarkus.vault.runtime.client.dto.VaultModel;

public class VaultTransitKeyVersionData implements VaultModel {

    public String name;
    @JsonProperty("creation_time")
    public OffsetDateTime creationTime;
    @JsonProperty("public_key")
    public String publicKey;

    static class Deserializer extends JsonDeserializer {

        Deserializer() {
        }

        @Override
        public VaultTransitKeyVersionData deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
            if (p.hasToken(JsonToken.VALUE_NUMBER_INT)) {
                long timestamp = p.readValueAs(Long.class);
                VaultTransitKeyVersionData data = new VaultTransitKeyVersionData();
                data.creationTime = Instant.ofEpochSecond(timestamp).atOffset(ZoneOffset.UTC);
                return data;
            } else {
                return p.readValueAs(VaultTransitKeyVersionData.class);
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy