mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(secretsmanager): return KmsKeyId in DescribeSecret and improve ListSecrets (#195)
This commit is contained in:
1 parent
ecf25d4736
commit
1e44f39c7c
3 files changed
+69
-2
No files matched your search
+19
-1
@@ -127,13 +127,18 @@ public class SecretsManagerJsonHandler {
|
||||
|
||||
Secret secret = service.updateSecret(secretId, description, kmsKeyId, region);
|
||||
|
||||
String versionId = null;
|
||||
if (secretString != null || secretBinary != null) {
|
||||
service.putSecretValue(secretId, secretString, secretBinary, region);
|
||||
SecretVersion version = service.putSecretValue(secretId, secretString, secretBinary, region);
|
||||
versionId = version.getVersionId();
|
||||
}
|
||||
|
||||
ObjectNode response = objectMapper.createObjectNode();
|
||||
response.put("ARN", secret.getArn());
|
||||
response.put("Name", secret.getName());
|
||||
if (versionId != null) {
|
||||
response.put("VersionId", versionId);
|
||||
}
|
||||
return Response.ok(response).build();
|
||||
}
|
||||
|
||||
@@ -147,6 +152,9 @@ public class SecretsManagerJsonHandler {
|
||||
if (secret.getDescription() != null) {
|
||||
response.put("Description", secret.getDescription());
|
||||
}
|
||||
if (secret.getKmsKeyId() != null) {
|
||||
response.put("KmsKeyId", secret.getKmsKeyId());
|
||||
}
|
||||
response.put("RotationEnabled", secret.isRotationEnabled());
|
||||
if (secret.getCreatedDate() != null) {
|
||||
response.put("CreatedDate", secret.getCreatedDate().toEpochMilli() / 1000.0);
|
||||
@@ -196,9 +204,19 @@ public class SecretsManagerJsonHandler {
|
||||
if (secret.getDescription() != null) {
|
||||
node.put("Description", secret.getDescription());
|
||||
}
|
||||
if (secret.getKmsKeyId() != null) {
|
||||
node.put("KmsKeyId", secret.getKmsKeyId());
|
||||
}
|
||||
node.put("RotationEnabled", secret.isRotationEnabled());
|
||||
if (secret.getCreatedDate() != null) {
|
||||
node.put("CreatedDate", secret.getCreatedDate().toEpochMilli() / 1000.0);
|
||||
}
|
||||
if (secret.getLastChangedDate() != null) {
|
||||
node.put("LastChangedDate", secret.getLastChangedDate().toEpochMilli() / 1000.0);
|
||||
}
|
||||
if (secret.getLastAccessedDate() != null) {
|
||||
node.put("LastAccessedDate", secret.getLastAccessedDate().toEpochMilli() / 1000.0);
|
||||
}
|
||||
ArrayNode tagsArray = objectMapper.createArrayNode();
|
||||
if (secret.getTags() != null) {
|
||||
for (Secret.Tag tag : secret.getTags()) {
|
||||
|
||||
Reference in new issue
Block a user