You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

The following API calls are available for the Azure Injector Module and can be executed within the Ignition Designer Script Console.

APIs

  • system.cirruslink.azure.createConfig(type, props) → void
    • Parameters
      • String type
        • The type of configuration to create with valid options:

          • Cert Files
          • IoT Hubs
          • IoT Edge
          • Event Hubs
          • Agents
          • Sets
      • Map props
        • Dictionary of properties making up the configuration with the following keys and datatypes:
          • Cert Files
            • Name (str)

            • FileName (str)

            • FileContents (str)

            • Description (str)

          • IoT Hubs
            • Id (long)

            • Name (str)

            • Enabled (str)

            • Protocol (str) "MQTT"

            • AzureSetId (long)

            • CertAuthEnabled (bool)

            • ConnectionString (str)

            • MqttHostname (str)

            • DeviceId (str)

            • CaCertFileId (long)

            • ClientCertFileId (long)

            • ClientPrivateKeyFileId (long)

            • ClientKeyPassword (str)

            • HistoryEnabled (bool)

            • HistoryStoreType (str) "In_Memory"

            • MessageCapacity (int)

            • FlushPeriod (long)

            • KeepAlive (int)

            • MaxSize (int)

            • Expiration (long)

            • ContentType (str) "NONE" or "APPLICATION_JSON"

            • ContentEncoding (str) "NONE", "UTF_8", "UTF_16", or "UTF_32"

            • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

            • CustomTopicExtension (str)

          •  IoT Edge
            • Id (long)

            • Name (str)

            • Enabled (str)

            • Protocol (str) "MQTT"

            • AzureSetId (long)

            • MqttServerUrl (str)

            • CertAuthEnabled (bool)

            • ConnectionString (str)

            • CaCertFileId (long)

            • ClientCertFileId (long)

            • ClientPrivateKeyFileId (long)

            • ClientKeyPassword (str)

            • HostnameVerification (bool)

            • MqttHostname (str)

            • DeviceId (str)

            • ModuleIdOption (str) "NONE", "ENVIRONMENT_VARIABLE" or "IGNITION_CONFIG"

            • ModuleId (str)

            • HistoryEnabled (bool)

            • HistoryStoreType (str) "In_Memory"

            • MessageCapacity (int)

            • FlushPeriod (long)

            • KeepAlive (int)

            • MaxSize (int)

            • Expiration (long)

            • ContentType (str) "NONE" or "APPLICATION_JSON"

            • ContentEncoding (str) "NONE", "UTF_8", "UTF_16", or "UTF_32"

            • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

            • CustomTopicExtension (str)

          • Event Hubs
            • Id (long)

            • Name (str)

            • Enabled (str)

            • ConnectionString (str)

            • HistoryEnabled (bool)

            • HistoryStoreType (str) "In_Memory"

            • MessageCapacity (int)

            • FlushPeriod (long)

            • MaxSize (int)

            • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

          • Agents
            • Id (long)

            • TagProvider (str)

            • TagPath (str)

            • PushTrigger (str) "EVENT_DRIVEN" or "PERIODIC"

            • TagPacingPeriod (long)

            • ConvertUdts (bool)

            • PublishUdtDefinitions (bool)

            • OptimizeUdts (bool)

            • AzureSetId (long)

            • AutoDiscover (bool)

            • GroupId (str)

            • EdgeNodeId (str)

            • DeviceId (str)

            • FilteredProperties (str)

          • Sets
            • Id (long)

            • Name (str)

            • Description (str)

            • PushPolicy (str) "PUSH_TO_ALL" or "PUSH_TO_ANY"

    • Return Value
      • None
  • system.cirruslink.azure.readConfig(type) → List
    • Parameters
      • String type
        • The type of configuration to read with valid options:

          • General
          • Cert Files
          • IoT Hubs
          • IoT Edge
          • Event Hubs
          • Agents
          • Sets
    • Return Value
      • A List of Dictionaries of properties making up the configurations with the following keys and datatypes:
        • General
          • Id (long)

          • Enabled (bool)

        • Cert Files
          • Name (str)

          • FileName (str)

          • FileContents (str)

          • Description (str)

        • IoT Hubs
          • Id (long)

          • Name (str)

          • Enabled (str)

          • Protocol (str) "MQTT"

          • AzureSetId (long)

          • CertAuthEnabled (bool)

          • ConnectionString (str)

          • MqttHostname (str)

          • DeviceId (str)

          • CaCertFileId (long)

          • ClientCertFileId (long)

          • ClientPrivateKeyFileId (long)

          • ClientKeyPassword (str)

          • HistoryEnabled (bool)

          • HistoryStoreType (str) "In_Memory"

          • MessageCapacity (int)

          • FlushPeriod (long)

          • KeepAlive (int)

          • MaxSize (int)

          • Expiration (long)

          • ContentType (str) "NONE" or "APPLICATION_JSON"

          • ContentEncoding (str) "NONE", "UTF_8", "UTF_16", or "UTF_32"

          • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

          • CustomTopicExtension (str)

        •  IoT Edge
          • Id (long)

          • Name (str)

          • Enabled (str)

          • Protocol (str) "MQTT"

          • AzureSetId (long)

          • MqttServerUrl (str)

          • CertAuthEnabled (bool)

          • ConnectionString (str)

          • CaCertFileId (long)

          • ClientCertFileId (long)

          • ClientPrivateKeyFileId (long)

          • ClientKeyPassword (str)

          • HostnameVerification (bool)

          • MqttHostname (str)

          • DeviceId (str)

          • ModuleIdOption (str) "NONE", "ENVIRONMENT_VARIABLE" or "IGNITION_CONFIG"

          • ModuleId (str)

          • HistoryEnabled (bool)

          • HistoryStoreType (str) "In_Memory"

          • MessageCapacity (int)

          • FlushPeriod (long)

          • KeepAlive (int)

          • MaxSize (int)

          • Expiration (long)

          • ContentType (str) "NONE" or "APPLICATION_JSON"

          • ContentEncoding (str) "NONE", "UTF_8", "UTF_16", or "UTF_32"

          • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

          • CustomTopicExtension (str)

        • Event Hubs
          • Id (long)

          • Name (str)

          • Enabled (str)

          • ConnectionString (str)

          • HistoryEnabled (bool)

          • HistoryStoreType (str) "In_Memory"

          • MessageCapacity (int)

          • FlushPeriod (long)

          • MaxSize (int)

          • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

        • Agents
          • Id (long)

          • TagProvider (str)

          • TagPath (str)

          • PushTrigger (str) "EVENT_DRIVEN" or "PERIODIC"

          • TagPacingPeriod (long)

          • ConvertUdts (bool)

          • PublishUdtDefinitions (bool)

          • OptimizeUdts (bool)

          • AzureSetId (long)

          • AutoDiscover (bool)

          • GroupId (str)

          • EdgeNodeId (str)

          • DeviceId (str)

          • FilteredProperties (str)

        • Sets
          • Id (long)

          • Name (str)

          • Description (str)

          • PushPolicy (str) "PUSH_TO_ALL" or "PUSH_TO_ANY"

  • system.cirruslink.azure.updateConfig(type, id, collisionPolicy, props) → void
    • Parameters
      • String type
        • The type of configuration to update with valid options:

          • General
          • Cert Files
          • IoT Hubs
          • IoT Edge
          • Event Hubs
          • Agents
          • Sets
      • Long id
        • The ID of the record to update
      • String collisionPolicy
        • "MergeOverwrite" or "Overwrite"
          • "MergeOverwrite" will replace the existing properties in the record ID with only those included in the call
          • "Overwrite" will replace all properties in the record ID with those in the call
      • Map props
        • Dictionary of properties making up the configuration with the following keys and datatypes:
          • General
            • Id (long)

            • Enabled (bool)

          • Cert Files
            • Name (str)

            • FileName (str)

            • FileContents (str)

            • Description (str)

          • IoT Hubs
            • Id (long)

            • Name (str)

            • Enabled (str)

            • Protocol (str) "MQTT"

            • AzureSetId (long)

            • CertAuthEnabled (bool)

            • ConnectionString (str)

            • MqttHostname (str)

            • DeviceId (str)

            • CaCertFileId (long)

            • ClientCertFileId (long)

            • ClientPrivateKeyFileId (long)

            • ClientKeyPassword (str)

            • HistoryEnabled (bool)

            • HistoryStoreType (str) "In_Memory"

            • MessageCapacity (int)

            • FlushPeriod (long)

            • KeepAlive (int)

            • MaxSize (int)

            • Expiration (long)

            • ContentType (str) "NONE" or "APPLICATION_JSON"

            • ContentEncoding (str) "NONE", "UTF_8", "UTF_16", or "UTF_32"

            • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

            • CustomTopicExtension (str)

          •  IoT Edge
            • Id (long)

            • Name (str)

            • Enabled (str)

            • Protocol (str) "MQTT"

            • AzureSetId (long)

            • MqttServerUrl (str)

            • CertAuthEnabled (bool)

            • ConnectionString (str)

            • CaCertFileId (long)

            • ClientCertFileId (long)

            • ClientPrivateKeyFileId (long)

            • ClientKeyPassword (str)

            • HostnameVerification (bool)

            • MqttHostname (str)

            • DeviceId (str)

            • ModuleIdOption (str) "NONE", "ENVIRONMENT_VARIABLE" or "IGNITION_CONFIG"

            • ModuleId (str)

            • HistoryEnabled (bool)

            • HistoryStoreType (str) "In_Memory"

            • MessageCapacity (int)

            • FlushPeriod (long)

            • KeepAlive (int)

            • MaxSize (int)

            • Expiration (long)

            • ContentType (str) "NONE" or "APPLICATION_JSON"

            • ContentEncoding (str) "NONE", "UTF_8", "UTF_16", or "UTF_32"

            • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

            • CustomTopicExtension (str)

          • Event Hubs
            • Id (long)

            • Name (str)

            • Enabled (str)

            • ConnectionString (str)

            • HistoryEnabled (bool)

            • HistoryStoreType (str) "In_Memory"

            • MessageCapacity (int)

            • FlushPeriod (long)

            • MaxSize (int)

            • AzureDateTimeFormat (str) "LONG_MS_SINCE_EPOCH" or "STRING_AZURE_COMPAT"

          • Agents
            • Id (long)

            • TagProvider (str)

            • TagPath (str)

            • PushTrigger (str) "EVENT_DRIVEN" or "PERIODIC"

            • TagPacingPeriod (long)

            • ConvertUdts (bool)

            • PublishUdtDefinitions (bool)

            • OptimizeUdts (bool)

            • AzureSetId (long)

            • AutoDiscover (bool)

            • GroupId (str)

            • EdgeNodeId (str)

            • DeviceId (str)

            • FilteredProperties (str)

          • Sets
            • Id (long)

            • Name (str)

            • Description (str)

            • PushPolicy (str) "PUSH_TO_ALL" or "PUSH_TO_ANY"

    • Return Value
      • None
  • system.cirruslink.azure.deleteConfig(type, id) → void
    • Parameters
      • String type
        • The type of configuration to delete with valid options:

          • Cert Files
          • IoT Hubs
          • IoT Edge
          • Event Hubs
          • Agents
          • Sets
      • Long id
        • The ID of the record to delete
    • Return Value
      • None

Sample Script


# Update Certificates
# Get Id for current certificate
savedCerts = system.cirruslink.azure.readConfig("Cert Files")
for config in savedCerts:
  if config["Name"] == "My current cert name":
    certId = config["Id"]

# Read New Cert File
deviceCaCertFilePath = "/path/to/your/certs/iot-edge-device-ca-CA.cert.pem"
deviceCaCert = open(deviceCaCertFilePath, 'r').read()

# Update existing cert config using MergeOverwrite
certProps = {}
certProps["FileContents"] = deviceCaCert
system.cirruslink.azure.updateConfig(“Cert Files”, certId, “MergeOverwrite”, certProps)
 
  • No labels