use of io.cdap.cdap.securestore.spi.secret.SecretMetadata in project cdap by caskdata.
the class SecretManagerSecureStoreService method get.
@Override
public SecureStoreData get(String namespace, String name) throws Exception {
validate(namespace);
try {
Secret secret = secretManager.get(namespace, name);
SecretMetadata metadata = secret.getMetadata();
return new SecureStoreData(new SecureStoreMetadata(metadata.getName(), metadata.getDescription(), metadata.getCreationTimeMs(), metadata.getProperties()), secret.getData());
} catch (SecretNotFoundException e) {
throw new SecureKeyNotFoundException(new SecureKeyId(namespace, name), e);
}
}
use of io.cdap.cdap.securestore.spi.secret.SecretMetadata in project cdap by caskdata.
the class SecretManagerSecureStoreService method list.
@Override
public List<SecureStoreMetadata> list(String namespace) throws Exception {
validate(namespace);
List<SecureStoreMetadata> metadataList = new ArrayList<>();
for (SecretMetadata metadata : secretManager.list(namespace)) {
metadataList.add(new SecureStoreMetadata(metadata.getName(), metadata.getDescription(), metadata.getCreationTimeMs(), metadata.getProperties()));
}
return metadataList;
}
use of io.cdap.cdap.securestore.spi.secret.SecretMetadata in project cdap by caskdata.
the class CloudSecretManager method list.
@Override
public Collection<SecretMetadata> list(String namespace) throws IOException {
Collection<SecretInfo> secretInfos = store.list(namespace, encoderDecoder);
List<SecretMetadata> metadataList = new ArrayList<>();
for (SecretInfo secretInfo : secretInfos) {
metadataList.add(new SecretMetadata(secretInfo.getName(), secretInfo.getDescription(), secretInfo.getCreationTimeMs(), secretInfo.getProperties()));
}
return metadataList;
}
use of io.cdap.cdap.securestore.spi.secret.SecretMetadata in project cdap by caskdata.
the class CloudSecretManager method get.
@Override
public Secret get(String namespace, String name) throws SecretNotFoundException, IOException {
SecretInfo secretInfo = store.get(namespace, name, encoderDecoder);
byte[] decrypted = client.decrypt(CRYPTO_KEY_PREFIX + namespace, secretInfo.getSecretData());
return new Secret(decrypted, new SecretMetadata(secretInfo.getName(), secretInfo.getDescription(), secretInfo.getCreationTimeMs(), secretInfo.getProperties()));
}
use of io.cdap.cdap.securestore.spi.secret.SecretMetadata in project cdap by caskdata.
the class SecretManagerSecureStoreService method put.
@Override
public void put(String namespace, String name, String data, @Nullable String description, Map<String, String> properties) throws Exception {
validate(namespace);
secretManager.store(namespace, new Secret(data.getBytes(StandardCharsets.UTF_8), new SecretMetadata(name, description, System.currentTimeMillis(), ImmutableMap.copyOf(properties))));
}
Aggregations