Managing Properties in CLI - DSS 6 | Data Source Solutions Documentation
Documentation: Managing Properties in CLI - DSS 6 | Data Source Solutions Documentation
Managing Properties in CLI
A property specifies the characteristics/attributes of the DSS components like Alerts, Hub, Location, User, etc. The properties can be managed using User Interface (UI), Command Line Interface (CLI), and REST API. This section explains how properties can be managed from CLI.
Certain properties in DSS can store multiple values. The categories of properties that can store multiple values are:
- Map - can store key value pairs
- Nested map - can store maps within a map
- Array - can store a list of values (not paired)
- Array with map in it - can store a list and each list item can store key value pairs
Command names ending with *config are used for managing the DSS properties from CLI.
Quoting in Command Line
For DSS commands, quotes (single on Linux/Unix and double on Windows) are required when there is a space in the value supplied or if any shell/command line reserved character (e.g symbol > for output redirect) is used.
When symbol @ is used on the right side of the symbol = (as a value), quoting is not required. For example, while setting email related properties.
{% tabs %}
{% tab label="Linux Examples" %}
dssreposconfig 'Agent_Client_Public_Certificate>@file_name.pub_cert'
dsshubconfig myhub 'Description=My new hub'
dsshubconfig myhub Description='My new hub'
{% /tab %}
{% tab label="Windows Examples" %}
dssreposconfig "Agent_Client_Public_Certificate>@file_name.pub_cert"
dsshubconfig myhub "Description=My new hub"
dsshubconfig myhub Description="My new hub"
{% /tab %}
{% /tabs %}
Set Property
Set value for a property:
<em>dsscommand</em> <em>property</em><b>=</b><em>value</em>
Example: Set value for the property Description
{% tabs %}
{% tab label="Linux" %}
dsshubconfig myhub 'Description=My new hub'
{% /tab %}
{% tab label="Windows" %}
dsshubconfig myhub "Description=My new hub"
{% /tab %}
{% /tabs %}
Read Value from Command Prompt
Set value for a property by reading the value from a prompt displayed. This method is recommended when setting values that may contain secure information like a password:
<em>dsscommand property</em><b>=@prompt</b>
Example: Set value for the property Database_Password
dsshubserverconfig Database_Password=@prompt
The above command will display a prompt asking to supply the value (password) for the property:
Enter Value for Database_Password:
Read Value from File
Set value for a property by reading the value from a file instead of directly specifying it on the command line:
<em>dsscommand property</em><b>=@</b><em>file_name</em>
Example 1: Set value for the property Description from a text file named mydescription.txt
dsshubconfig myhub Description=@mydescription.txt
Certain commands also have option -i to set multiple properties from a JSON file.
Show Property Value
Show/display the value set for a property:
<em>dsscommand</em> <em>property</em>
If 'not set' is displayed in the command output, it indicates the property does not have an explicitly assigned value. In such cases, if the property has a default value, that applies.
Example: Show the value that is set for the property Description
dsshubconfig myhub Description
Sample output:
Description=My new hub
Write Property Value into File
Write the property value into a file instead of directly displaying it on the command line:
<em>dsscommand</em> <b>'</b><em>property</em><b>>@</b><em>file_name</em><b>'</b>
Example: Create a public certificate file named mycertificate.pub_cert
{% tabs %}
{% tab label="Linux" %}
dssreposconfig 'Agent_Client_Public_Certificate>@mycertificate.pub_cert'
{% /tab %}
{% tab label="Windows" %}
dssreposconfig "Agent_Client_Public_Certificate>@mycertificate.pub_cert"
{% /tab %}
{% /tabs %}
Certain commands also have option -o to write the value of multiple properties into a JSON file.
Unset/Delete Property
Unset/delete a property's value:
<em>dsscommand</em> <em>property</em><b>=</b>
Example: Unset the property Auto_Open
dsswalletconfig Auto_Open=
Array Properties
An array property can store more than one value in it.
Set Array Property
When a property contains an array of values, it is required to specify the array position in square brackets [number] while setting a value for this property type. When setting an array property for the first time, it is recommended to begin the array position with 0. If you begin with any other position, DSS will automatically save it at position 0.
<em>dsscommand</em> <em>property</em><b>[0]=</b><em>value </em><em>property</em><b>[1]=</b><em>value</em> ...<em>property</em><b>[</b><em>n</em><b>]</b><em>=value</em>
Example: Set values for the property Email_Recipients
dssalertconfig myhub myalert Email_Recipients[0]=jane@mycorp.com Email_Recipients[1]=mike@mycorp.com
Add Value to Existing Array Property
Add/append value(s) to the end of array. It is not required to specify the array position when ++ is used for appending value(s):
<em>dsscommand property</em><b>[++]=</b><em>value</em>...<em>property</em><b>[++]=</b><em>value</em>...
Example: Add emails to an existing alert myalert
dssalertconfig -a myhub myalert Email_Recipients[++]=sam@mycorp.com Email_Recipients[++]=john@mycorp.com
Unset Array Property
Unset/delete all values in array property:
<em>dsscommand property</em><b>=</b>
Example: Unset/delete all values in the property Email_Recipients
dssalertconfig myhub myalert Email_Recipients=
Unset Array Property Value at Specific Position
Unset/delete an array value at a specific position:
<em>dsscommand property</em><b>[</b><em>n</em><b>]=</b>
Example: Unset/delete an array value at position 1 in the property Email_Recipients
dssalertconfig myhub myalert Email_Recipients[1]=
Map Properties
A map property can store more than one value in it.
Set Map Property
Set value for a property that allows you to set multiple key value pairs.
<em>dsscommand property</em><b>={</b><em>key1</em><b>:{</b><em>key11</em><b>:</b><em>value</em><b>},</b> <em>key2</em><b>:{</b><em>key21</em><b>:</b><em>value</em><b>}</b> ... <em>keyn</em><b>:{</b><em>keyn1</em><b>:</b><em>value</em><b>}}</b>
<em>dsscommand property</em><b>={</b><em>key1</em><b>:</b><em>value1</em><b>,</b> <em>key2</em><b>:</b><em>value2</em> ... <em>keyn</em><b>:</b><em>valuen</em><b>}</b>
Example 1: Set values for the property User_Access
{% tabs %}
{% tab label="Linux" %}
dssagentconfig 'User_Access={"user1":{"level":"AgentAdmin"},"user2":{"level":"AgentAdmin"}}'
{% /tab %}
{% tab label="Windows" %}
dssagentconfig "User_Access={\"user1\":{\"level\":\"AgentAdmin\"},\"user2\":{\"level\":\"AgentAdmin\"}}"
{% /tab %}
{% /tabs %}
Example 2: Set values for the property Worker_Environment
{% tabs %}
{% tab label="Linux" %}
dsshubserverconfig Worker_Environment='{"DSS_SQL_TRACE":"1","DSS_PROC_TRACE":"2"}'
{% /tab %}
{% tab label="Windows" %}
dsshubserverconfig Worker_Environment="{\"DSS_SQL_TRACE\":\"1\",\"DSS_PROC_TRACE\":\"2\"}"
{% /tab %}
{% /tabs %}
Example 3: Set a value for the keys name.surname and level in the property User_Access
{% tabs %}
{% tab label="Linux" %}
dssagentconfig 'User_Access."name.surname".level=AgentAdmin'
{% /tab %}
{% tab label="Windows" %}
dssagentconfig "User_Access.\"name.surname\".level=AgentAdmin"
{% /tab %}
{% /tabs %}
Set Value for Specific Key
Set a value for a specific key in a property that allows you to set multiple key value pairs:
<em>dsscommand property.key</em><b>=</b><em>value</em>
Example: Set a value for the property User_Access
{% tabs %}
{% tab label="Linux" %}
dssagentconfig 'User_Access.user1={"level":"AgentAdmin"}'
{% /tab %}
{% tab label="Windows" %}
dssagentconfig "User_Access.user1={\"level\":\"AgentAdmin\"}"
{% /tab %}
{% /tabs %}
Show Value for Specific Key
If a property supports/allows you to save multiple key values in it, then use the following format for displaying a specific key's value:
<em>dsscommand property.key</em>
Example: Show the value that is set for the key user1 in the property User_Access
dssagentconfig User_Access.user1
Sample Output:
User_Access.user1={"level":"AgentAdmin"}
Matching Patterns for Showing Keys and Values
Show the value(s) of all matching keys:
<em>dsscommand property</em><b>.</b><em>key</em><b>*</b>
Example: Show the values of all keys (in the property User_Access) containing the substring user
dssagentconfig User_Access.user*
Sample output:
dssagentconfig: Matching pattern 'User_Access.*user*':
User_Access.user1={"level":"AgentAdmin"}
User_Access.user2={"level":"AgentAdmin"}
Matching Patterns for Showing Keys Only
Show all matching keys only (not values).
<em>dsscommand property</em><b>.</b><em>key</em><b>*.</b>
Example: Show all keys (in the property User_Access) containing the substring user
dssagentconfig User_Access.user*.
Sample output:
dssagentconfig: Matching pattern 'User_Access.*user*':
User_Access.user1
User_Access.user2