Class SecretConfig
java.lang.Object
com.inductiveautomation.ignition.gateway.secrets.SecretConfig
- Direct Known Subclasses:
SecretConfig.Embedded
,SecretConfig.Referenced
public abstract sealed class SecretConfig
extends Object
permits SecretConfig.Embedded, SecretConfig.Referenced
Configuration describing a secret. There are two types:
- Embedded - ciphertext secret is embedded within this config
- Referenced - reference to a named secret in a secret provider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
An EmbeddedSecretConfig
which encapsulates the ciphertext secret value encrypted using theSystemEncryptionService
static class
AJsonSerializer
andJsonDeserializer
implementation for JSON-serializing and deserializing instances ofSecretConfig
using Gsonstatic final class
A ReferencedSecretConfig
which encapsulates the name of the SecretProvider and the name of the Secret within the Secret Provider where the secret value lives.static enum
The type of SecretConfig: Embedded or Referenced -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SecretConfig.Embedded
embedded
(com.inductiveautomation.ignition.common.gson.JsonElement ciphertext) Factory method for creating a new instance of anSecretConfig.Embedded
secret config given the ciphertext secret retrieved from a call toSystemEncryptionService.encryptToJson(Plaintext)
.static SecretConfig
fromJsonTree
(com.inductiveautomation.ignition.common.gson.JsonElement jsonElement) Decode a newSecretConfig
instance from aJsonElement
static com.inductiveautomation.ignition.common.gson.JsonObject
abstract SecretConfig.Type
getType()
boolean
boolean
static SecretConfig.Referenced
referenced
(String providerName, String secretName) Factory method for creating a new instance of aSecretConfig.Referenced
secret config given the name of the secret provider and the name of the secret stored in the provider.com.inductiveautomation.ignition.common.gson.JsonElement
-
Field Details
-
TYPE
- See Also:
-
DATA
- See Also:
-
PROVIDER_NAME
- See Also:
-
SECRET_NAME
- See Also:
-
-
Constructor Details
-
SecretConfig
public SecretConfig()
-
-
Method Details
-
getType
- Returns:
- the
SecretConfig.Type
of thisSecretConfig
instance. never null.
-
isEmbedded
public boolean isEmbedded()- Returns:
- true if this
SecretConfig
is an instance ofSecretConfig.Embedded
-
getAsEmbedded
- Returns:
- this
SecretConfig
as an instance ofSecretConfig.Embedded
. never null. - Throws:
UnsupportedOperationException
- if thisSecretConfig
is not an instance ofSecretConfig.Embedded
-
isReferenced
public boolean isReferenced()- Returns:
- true if this
SecretConfig
is an instance ofSecretConfig.Referenced
-
getAsReferenced
- Returns:
- this
SecretConfig
as an instance ofSecretConfig.Referenced
. never null. - Throws:
UnsupportedOperationException
- if thisSecretConfig
is not an instance ofSecretConfig.Referenced
-
toJsonTree
public com.inductiveautomation.ignition.common.gson.JsonElement toJsonTree()- Returns:
- this
SecretConfig
encoded as aJsonElement
. never null.
-
fromJsonTree
public static SecretConfig fromJsonTree(com.inductiveautomation.ignition.common.gson.JsonElement jsonElement) Decode a newSecretConfig
instance from aJsonElement
- Parameters:
jsonElement
- theJsonElement
to parse. must not be null.- Returns:
- a new instance of
SecretConfig
parsed from the givenJsonElement
. never null. - Throws:
com.inductiveautomation.ignition.common.gson.JsonParseException
- if the givenJsonElement
could not be parsed into a new instance ofSecretConfig
UnsupportedOperationException
- if the givenJsonElement
could not be parsed into a new instance ofSecretConfig
-
embedded
public static SecretConfig.Embedded embedded(com.inductiveautomation.ignition.common.gson.JsonElement ciphertext) Factory method for creating a new instance of anSecretConfig.Embedded
secret config given the ciphertext secret retrieved from a call toSystemEncryptionService.encryptToJson(Plaintext)
.- Parameters:
ciphertext
- the ciphertext secret. cannot be null.- Returns:
- a new instance of an
SecretConfig.Embedded
secret config with the given ciphertext secret. never null. - Throws:
NullPointerException
- if the given ciphertext argument is null
-
referenced
Factory method for creating a new instance of aSecretConfig.Referenced
secret config given the name of the secret provider and the name of the secret stored in the provider.- Parameters:
providerName
- the name of the secret provider where the secret is stored. cannot be null.secretName
- the name of the secret stored in the secret provider. cannot be null.- Returns:
- a new instance of a
SecretConfig.Referenced
secret config pointing to the target secret provider and secret. never null. - Throws:
NullPointerException
- if either the providerName or secretNames arguments are null
-
getJsonSchema
public static com.inductiveautomation.ignition.common.gson.JsonObject getJsonSchema()- Returns:
- a new copy of the JSON Schema for the
SecretConfig
. never null.
-