@@ -29,11 +29,11 @@ import org.eclipse.apoapsis.ortserver.model.HierarchyId
2929 * A class providing convenient access to secrets based on a [SecretsProvider].
3030 *
3131 * This class takes care of the instantiation of a [SecretsProvider] based on the application configuration via the
32- * [createStorage] function. This provider is then wrapped, and a richer API to deal with [Secret ]s is implemented on
33- * top of it.
32+ * [createStorage] function. This provider is then wrapped, and a richer API to deal with [SecretValue ]s is implemented
33+ * on top of it.
3434 *
35- * The extended functionality compared to [SecretsProvider] is mainly related to the handling of missing [Secret ]s
36- * and exception handling. There are functions that require a [Secret ] to exist or throw an exception otherwise.
35+ * The extended functionality compared to [SecretsProvider] is mainly related to the handling of missing [SecretValue ]s
36+ * and exception handling. There are functions that require a [SecretValue ] to exist or throw an exception otherwise.
3737 * With regard to exception handling, in general all exceptions thrown by the underlying [SecretsProvider] are caught
3838 * and wrapped in a [SecretStorageException]; so, it should be sufficient to catch this exception type. Alternatively,
3939 * consumers can choose to use functions that return [Result] objects.
@@ -80,35 +80,36 @@ class SecretStorage(
8080 }
8181
8282 /* *
83- * Return the [Secret ] at the given [path] or `null` if the path cannot be resolved.
83+ * Return the [SecretValue ] at the given [path] or `null` if the path cannot be resolved.
8484 */
85- fun readSecret (path : Path ): Secret ? = wrapExceptions { provider.readSecret(path) }
85+ fun readSecret (path : Path ): SecretValue ? = wrapExceptions { provider.readSecret(path) }
8686
8787 /* *
88- * Return the [Secret] at the given [path] or fail with a [SecretStorageException] if the path cannot be resolved.
88+ * Return the [SecretValue] at the given [path] or fail with a [SecretStorageException] if the path cannot be
89+ * resolved.
8990 */
90- fun getSecret (path : Path ): Secret =
91+ fun getSecret (path : Path ): SecretValue =
9192 readSecret(path) ? : throw SecretStorageException (" No secret found at path '$path '." )
9293
9394 /* *
94- * Return a [Result] with a nullable [Secret ] found at the given [path]. This function works like [readSecret],
95+ * Return a [Result] with a nullable [SecretValue ] found at the given [path]. This function works like [readSecret],
9596 * but wraps an occurring exception inside a [Result]. Exceptions from the underlying [SecretsProvider] are
9697 * wrapped in a [SecretStorageException].
9798 */
98- fun readSecretCatching (path : Path ): Result <Secret ?> = runCatching { readSecret(path) }
99+ fun readSecretCatching (path : Path ): Result <SecretValue ?> = runCatching { readSecret(path) }
99100
100101 /* *
101- * Return a [Result] with the [Secret ] found at the given [path]. This function works like [getSecret], but
102+ * Return a [Result] with the [SecretValue ] found at the given [path]. This function works like [getSecret], but
102103 * wraps an occurring exception inside a [Result]. Exceptions from the underlying [SecretsProvider] are wrapped
103104 * in a [SecretStorageException]. If the given [path] cannot be resolved, a failed [Result] is returned as well.
104105 */
105- fun getSecretCatching (path : Path ): Result <Secret > = runCatching { getSecret(path) }
106+ fun getSecretCatching (path : Path ): Result <SecretValue > = runCatching { getSecret(path) }
106107
107108 /* *
108109 * Store the given [secret] under the given [path] in the underlying [SecretsProvider]. Throw a
109110 * [SecretStorageException] if this fails.
110111 */
111- fun writeSecret (path : Path , secret : Secret ) {
112+ fun writeSecret (path : Path , secret : SecretValue ) {
112113 wrapExceptions { provider.writeSecret(path, secret) }
113114 }
114115
@@ -117,18 +118,19 @@ class SecretStorage(
117118 * the outcome of the operation. Exceptions thrown by the [SecretsProvider] are wrapped in a
118119 * [SecretStorageException] and returned in the [Result].
119120 */
120- fun writeSecretCatching (path : Path , secret : Secret ): Result <Unit > = runCatching { writeSecret(path, secret) }
121+ fun writeSecretCatching (path : Path , secret : SecretValue ): Result <Unit > = runCatching { writeSecret(path, secret) }
121122
122123 /* *
123- * Remove the [Secret ] under the given [path]. Throw a [SecretStorageException] if this fails.
124+ * Remove the [SecretValue ] under the given [path]. Throw a [SecretStorageException] if this fails.
124125 */
125126 fun removeSecret (path : Path ) {
126127 wrapExceptions { provider.removeSecret(path) }
127128 }
128129
129130 /* *
130- * Remove the [Secret] under the given [path] and return a [Result] for the outcome of the operation. Exceptions
131- * thrown by the [SecretsProvider] are wrapped in a [SecretStorageException] and returned in the [Result].
131+ * Remove the [SecretValue] under the given [path] and return a [Result] for the outcome of the operation.
132+ * Exceptions thrown by the [SecretsProvider] are wrapped in a [SecretStorageException] and returned in the
133+ * [Result].
132134 */
133135 fun removeSecretCatching (path : Path ): Result <Unit > = runCatching { removeSecret(path) }
134136
0 commit comments