JVM is in development for v1. Interested in contributing or chatting with us?Get in touch!
JVM - secret()
Creates a reference to a secret in the secrets manager.
import io.nitric.Nitric;
import io.nitric.resources.SecretPermission;
public class Application {
public static void main(String[] args) {
var secrets = Nitric.INSTANCE.secret("apiKey").with(SecretPermission.Access);
Nitric.INSTANCE.run();
}
}
Parameters
- Name
name
- Required
- Required
- Type
- String
- Description
The unique name of this secret within the secrets manager.
Access
All Nitric resources provide access permissions you can use to specify the level of access your code needs to the resource. See here for details Access Control documentation.
Available permissions:
SecretPermission.Put
This permission allows your code to set a new latest value for a secret.
SecretPermission.Access
This permission allows your code to retrieve secret values.
Examples
Create a reference to 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("apiKey").with(SecretPermission.Put);
Nitric.INSTANCE.run();
}
}