From bd0c5b08fe397d459cc6c2485a813f9d63a84603 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 6 Mar 2022 18:11:31 +0100 Subject: [PATCH] model: add wrap_info to data response model --- CHANGELOG.md | 1 + pom.xml | 2 +- .../model/response/VaultDataResponse.java | 12 ++++ .../model/response/embedded/WrapInfo.java | 68 +++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/main/java/de/stklcode/jvault/connector/model/response/embedded/WrapInfo.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 48b5921..d600fa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Improvements * Add `migration`, `recovery_seal` and `storage_type` fields to `SealReponse` model +* Add support for `wrap_info` in data response models ### Test * Tested against Vault 1.9.4 diff --git a/pom.xml b/pom.xml index 419293b..12c6810 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.stklcode.jvault jvault-connector - 1.0.2-SNAPSHOT + 1.1.0-SNAPSHOT jar diff --git a/src/main/java/de/stklcode/jvault/connector/model/response/VaultDataResponse.java b/src/main/java/de/stklcode/jvault/connector/model/response/VaultDataResponse.java index 7d174bb..5fa96c5 100644 --- a/src/main/java/de/stklcode/jvault/connector/model/response/VaultDataResponse.java +++ b/src/main/java/de/stklcode/jvault/connector/model/response/VaultDataResponse.java @@ -18,6 +18,7 @@ package de.stklcode.jvault.connector.model.response; import com.fasterxml.jackson.annotation.JsonProperty; import de.stklcode.jvault.connector.exception.InvalidResponseException; +import de.stklcode.jvault.connector.model.response.embedded.WrapInfo; import java.util.List; import java.util.Map; @@ -41,6 +42,9 @@ public abstract class VaultDataResponse implements VaultResponse { @JsonProperty("warnings") private List warnings; + @JsonProperty("wrap_info") + private WrapInfo wrapInfo; + /** * Set data. To be implemented in the specific subclasses, as data can be of arbitrary structure. * @@ -77,4 +81,12 @@ public abstract class VaultDataResponse implements VaultResponse { public final List getWarnings() { return warnings; } + + /** + * @return Wrapping information + * @since 1.1 + */ + public final WrapInfo getWrapInfo() { + return wrapInfo; + } } diff --git a/src/main/java/de/stklcode/jvault/connector/model/response/embedded/WrapInfo.java b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/WrapInfo.java new file mode 100644 index 0000000..07c3b0d --- /dev/null +++ b/src/main/java/de/stklcode/jvault/connector/model/response/embedded/WrapInfo.java @@ -0,0 +1,68 @@ +/* + * Copyright 2016-2022 Stefan Kalscheuer + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package de.stklcode.jvault.connector.model.response.embedded; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Wrapping information object. + * + * @author Stefan Kalscheuer + * @since 1.1 + */ +public class WrapInfo { + + @JsonProperty("token") + private String token; + + @JsonProperty("ttl") + private Integer ttl; + + @JsonProperty("creation_time") + private String creationTime; + + @JsonProperty("creation_path") + private String creationPath; + + /** + * @return Token + */ + public String getToken() { + return token; + } + + /** + * @return TTL (in seconds) + */ + public Integer getTtl() { + return ttl; + } + + /** + * @return Creation time + */ + public String getCreationTime() { + return creationTime; + } + + /** + * @return Creation path + */ + public String getCreationPath() { + return creationPath; + } +}