system.secrets.createReferencedSecretConfig
New in 8.3.8
This function is used in Python Scripting.
Description​
Creates a new Referenced SecretConfig instance given the name of the secret provider and the name of the secret stored in the provider.
Syntax​
system.secrets.createReferencedSecretConfig(providerName, secretName)
Parameters​
| Type | Parameter | Description |
|---|---|---|
| String | providerName | The name of the secret provider. |
| String | secretName | The name of the secret. |
Returns​
PyObject - A Dictionary containing the JSON representation of a Referenced SecretConfig instance with the provider and secret names.
Raises​
ValueError - Throws a ValueError if the providerName or secretName parameters do not have any values.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Code Snippet
# This example will take a user-specified secret and use it as a referenced password
# in the creation of an S7-1200 device using the Siemens Enhanced driver.
# Set the referenced secret
myProviderName = "mySecrets"
mySecretName = "coolSecret"
referencedConfig = system.secrets.createReferencedSecretConfig(myProviderName, mySecretName)
# Create the Siemens device with our referenced password
system.device.addDevice(
deviceType='com.inductiveautomation.ignition.siemens',
deviceName='siemensEnhanced',
deviceProps={
'hostname': '0.0.0.0',
'deviceType': 'S7_1200',
'password': referencedConfig
}
)