This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to using a SecretVersion to represent a particular version o…
…f a secret
- Loading branch information
Jesse Peirce
committed
Aug 15, 2016
1 parent
d493466
commit b3fa5d1
Showing
7 changed files
with
99 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
api/src/main/java/keywhiz/api/model/SecretSeriesAndVersions.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package keywhiz.api.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAnyGetter; | ||
import com.google.auto.value.AutoValue; | ||
import com.google.common.base.MoreObjects; | ||
import com.google.common.collect.ImmutableMap; | ||
import javax.annotation.Nullable; | ||
import keywhiz.api.ApiDate; | ||
|
||
import static com.google.common.base.Strings.nullToEmpty; | ||
|
||
/** | ||
* Contains all relevant information on a version of a secret (note that this does | ||
* not contain the contents of a secret). | ||
*/ | ||
@AutoValue | ||
public abstract class SecretVersion { | ||
public static SecretVersion of(long secretId, long versionId, String name, @Nullable String description, ApiDate createdAt, | ||
@Nullable String createdBy, ApiDate updatedAt, @Nullable String updatedBy, | ||
ImmutableMap<String, String> metadata, @Nullable String type, long expiry) { | ||
return new AutoValue_SecretVersion(secretId, versionId, name, nullToEmpty(description), | ||
createdAt, nullToEmpty(createdBy), updatedAt, | ||
nullToEmpty(updatedBy), metadata, type, expiry); | ||
} | ||
|
||
public abstract long secretId(); | ||
public abstract long versionId(); | ||
public abstract String name(); | ||
public abstract String description(); | ||
public abstract ApiDate createdAt(); | ||
public abstract String createdBy(); | ||
public abstract ApiDate updatedAt(); | ||
public abstract String updatedBy(); | ||
@JsonAnyGetter public abstract ImmutableMap<String, String> metadata(); | ||
public abstract String type(); | ||
public abstract long expiry(); | ||
|
||
@Override public String toString() { | ||
return MoreObjects.toStringHelper(this) | ||
.add("secretId", secretId()) | ||
.add("name", name()) | ||
.add("description", description()) | ||
.add("createdAt", createdAt()) | ||
.add("createdBy", createdBy()) | ||
.add("updatedAt", updatedAt()) | ||
.add("updatedBy", updatedBy()) | ||
.add("metadata", metadata()) | ||
.add("type", type()) | ||
.add("expiry", expiry()) | ||
.omitNullValues().toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters