Skip to main content
Version: 8.3

system.config.create

New in 8.3.8


This function is used in Python Scripting.

Description​

Creates a new resource of the specified type.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.config.create(*moduleId, typeId, [name], [collection], [config], [backupConfig], [files], [description], [enabled], [attributes], [actor])

tip

An asterisk indicates that all parameters following it are expecting keywords when the function is being called in your script. This means that, when using an asterisk-marked parameter, both the parameter and argument must be specified. For example, moduleId="ignition".

Parameters​

TypeParameterDescription
String*moduleIdThe module ID portion of the resource type identifier.
String*typeIdThe type ID portion of the resource type identifier.
String*nameThe name of the resource. Required for named resources, but must be omitted for singleton resources. [Optional]
String*collectionThe collection containing the resource. If omitted, uses the active definition. [Optional]
Dictionary*configA dictionary representing the resoure configuration, matching the resource type's JSON schema. If not provided, the files argument must be provided. [Optional]
Dictionary*backupConfigA dictionary representing the backup configuration for resources that support backup data. [Optional]
Dictionary*filesA dictionary of additional files to include with the resource. Keys are filenames, values can be byte arrays, strings, lists, or dictionaries. If not provided, the config argument must be provided. [Optional]
String*descriptionA description for the resource. [Optional]
Boolean*enabledWhether the resource should be enabled. If omitted, the resource will be enabled when created. [Optional]
Dictionary*attributesA dictionary of resource attributes to set. [Optional]
String*actorA string identifying the actor performing the operation. If not specified, an identifier will be automatically generated. [Optional]

Returns​

PyResource - A PyResource containing the specified parameter attributes of your newly created Gateway resource, which can also be read as plain Python properties.

Scope​

Gateway

Code Examples​

Code Snippet
# This example creates a new database connection within the active collection.
# Declare our create() variables
moduleId = "ignition"
typeId = "databasse-connection"
name = "coolSQL"
config = {
"connectURL": "jdbc:mysql://localhost:3306/test",
"connectionProps": "zeroDateTimeBehavior\u003dCONVERT_TO_NULL;connectTimeout\u003d120000;socketTimeout\u003d120000;useSSL\u003dfalse;allowPublicKeyRetrieval\u003dtrue;rewriteBatchedStatements\u003dtrue;disableMariaDbDriver",
"connectionResetParams": "",
"defaultTransactionLevel": "DEFAULT",
"driver": "MySQL",
"evictionRate": -1,
"evictionTests": 3,
"evictionTime": 1800000,
"failoverMode": "STANDARD",
"failoverProfile": "",
"includeSchemaInTableName": false,
"poolInitSize": 0,
"poolMaxActive": 8,
"poolMaxIdle": 8,
"poolMaxWait": 5000,
"poolMinIdle": 0,
"slowQueryLogThreshold": 60000,
"testOnBorrow": true,
"testOnReturn": false,
"testWhileIdle": false,
"translator": "MYSQL",
"username": "root",
"validationQuery": "SELECT 1",
"validationSleepTime": 10000
}

# Call the create() function
system.config.create(moduleId=moduleId, typeId=typeId, name=name, config=config)