roryqi commented on code in PR #12366:
URL: https://github.com/apache/gravitino/pull/12366#discussion_r3756141064
##########
core/src/main/java/org/apache/gravitino/secret/SecretManager.java:
##########
@@ -141,78 +242,153 @@ public List<SecretUrn> getSecretBindingUrns(
}
/**
- * Writes plaintext secrets from {@code secretBindings} values into the
write-through providers
- * for {@code secretUrns} (e.g. Vault).
+ * Writes plaintext secrets into the write-through providers for each {@link
SecretMaterial} (e.g.
+ * Vault).
*
- * <p>{@code secretUrns} must come from {@link #getSecretBindingUrns}. On
failure, already-written
- * URNs are rolled back. Callers must put URN strings into properties
themselves (e.g. via {@link
- * SecretPropertyUtils#applySecretUrns}).
+ * <p>{@code secretMaterials} must come from {@link #assembleSecretUrns}. On
failure,
+ * already-written URNs are rolled back. When using {@link
#assembleSecretUrns}, URN strings are
+ * already in properties; otherwise callers must put them themselves (e.g.
via {@link
+ * SecretPropertyUtils#putSecretUrns}).
*
- * @param secretBindings property key → write-through binding
- * @param secretUrns write-through URNs from {@link #getSecretBindingUrns}
+ * @param secretMaterials write-through secret materials (empty is a no-op;
must not be null)
*/
- public void writeSecrets(Map<String, SecretBinding> secretBindings,
List<SecretUrn> secretUrns) {
- Preconditions.checkArgument(
- secretBindings != null && !secretBindings.isEmpty(),
- "secretBindings must not be null or empty");
- Preconditions.checkArgument(
- secretUrns != null && !secretUrns.isEmpty(), "secretUrns must not be
null or empty");
- validateSecretBindings(secretBindings);
+ public void writeSecrets(List<SecretMaterial> secretMaterials) {
Review Comment:
The logic isn't clear enough.
You can use similar steps
```
urns = buildReferenceSecretUrns(references)
putUrnsToProps(urns)
buildSecretMaterials(bindings)
putUrnsToProps(bindings:urn::toList)
writeSecretMmaterials(materials)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]