Package io.nitric.api.secret
Class SecretVersion
- java.lang.Object
-
- io.nitric.api.secret.SecretVersion
-
public class SecretVersion extends Object
Provides a Secret Version class. The Secret Version is used to specify a particular secret version stored with the Secret API. To obtain the latest secret version value use the
Secret.latest().access()
methods.- See Also:
Secrets
,Secret
,SecretValue
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecretValue
access()
Return the version's secret value if found, or throws an exception otherwise.Secret
getSecret()
Return the version secret.String
getVersion()
Return the secret version.String
toString()
Return the string representation of this object.
-
-
-
Field Detail
-
LATEST
public static final String LATEST
The"latest"
secret version number.- See Also:
- Constant Field Values
-
-
Method Detail
-
getSecret
public Secret getSecret()
Return the version secret.- Returns:
- the version secret
-
getVersion
public String getVersion()
Return the secret version.- Returns:
- the secret version
-
access
public SecretValue access()
Return the version's secret value if found, or throws an exception otherwise.
String keyVersion = ... SecretValue secretValue = Secrets.secret("encryption.key") .version(keyVersion) .access(); byte[] keyData = secretValue.get();
- Returns:
- the version's secret value if found, or throws an exception otherwise
- Throws:
io.grpc.StatusRuntimeException
- if the secret value was not found
-
-