JVM - secret.version()
Returns a reference to a known version of a secret.
import io.nitric.Nitric;import io.nitric.resources.SecretPermission;public class Application {public static void main(String[] args) {var secrets = Nitric.INSTANCE.secret("encryptionKey").with(SecretPermission.Access);var keyVersion = secrets.version("the-version-id");Nitric.INSTANCE.run();}}
Parameters
- Name
version
- Required
- Required
- Type
- String
- Description
The version ID. This value is returned from secret.put().
Examples
Return a reference to a known secret version
import io.nitric.Nitric;import io.nitric.resources.SecretPermission;public class Application {public static void main(String[] args) {var secrets = Nitric.INSTANCE.secret("encryptionKey").with(SecretPermission.Access);var keyVersion = secrets.version("the-version-id");Nitric.INSTANCE.run();}}
Access the value of a known secret version
import io.nitric.Nitric;import io.nitric.resources.SecretPermission;public class Application {public static void main(String[] args) {var secrets = Nitric.INSTANCE.secret("encryptionKey").with(SecretPermission.Access);var contents = secrets.version("the-version-id").access();System.out.println(contents.toString());Nitric.INSTANCE.run();}}
See also
Last updated on Dec 19, 2024