Managing Properties in CLI
A property specifies the characteristics/attributes of the HVR 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 HVR 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 HVR properties from CLI.
Quoting in Command Line
For HVR 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.
hvrreposconfig 'Agent_Client_Public_Certificate>@file_name.pub_cert'
hvrhubconfig myhub 'Description=My new hub'
hvrhubconfig myhub Description='My new hub'
Set Property
Set value for a property:
hvrcommand property=value
Example: Set value for the property Description
hvrhubconfig myhub 'Description=My new hub'
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:
hvrcommand property=@prompt
Example: Set value for the property Database_Password
hvrhubserverconfig 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:
hvrcommand property=@file_name
Example 1: Set value for the property Description from a text file named mydescription.txt
hvrhubconfig 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:
hvrcommand property
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
hvrhubconfig 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:
hvrcommand 'property>@file_name'
Example: Create a public certificate file named mycertificate.pub_cert
hvrreposconfig 'Agent_Client_Public_Certificate>@mycertificate.pub_cert'
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:
hvrcommand property=
Example: Unset the property Auto_Open
hvrwalletconfig 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, HVR will automatically save it at position 0.
hvrcommand property[0]=value property[1]=value ...property[n]=value
Example: Set values for the property Email_Recipients
hvralertconfig 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):
hvrcommand property[++]=value...property[++]=value...
Example: Add emails to an existing alert myalert
hvralertconfig -a myhub myalert Email_Recipients[++]=sam@mycorp.com Email_Recipients[++]=john@mycorp.com
Unset Array Property
Unset/delete all values in array property:
hvrcommand property=
Example: Unset/delete all values in the property Email_Recipients
hvralertconfig myhub myalert Email_Recipients=
Unset Array Property Value at Specific Position
Unset/delete an array value at a specific position:
hvrcommand property[n]=
Example: Unset/delete an array value at position 1 in the property Email_Recipients
hvralertconfig 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.
hvrcommand property={key1:{key11:value}, key2:{key21:value} ... keyn:{keyn1:value}}
hvrcommand property={key1:value1, key2:value2 ... keyn:valuen}
Example 1: Set values for the property User_Access
hvragentconfig 'User_Access={"user1":{"level":"AgentAdmin"},"user2":{"level":"AgentAdmin"}}'
Example 2: Set values for the property Worker_Environment
hvrhubserverconfig Worker_Environment='{"HVR_SQL_TRACE":"1","HVR_PROC_TRACE":"2"}'
Example 3: Set a value for the keys name.surname and level in the property User_Access
hvragentconfig 'User_Access."name.surname".level=AgentAdmin'
Set Value for Specific Key
Set a value for a specific key in a property that allows you to set multiple key value pairs:
hvrcommand property.key=value
Example: Set a value for the property User_Access
hvragentconfig 'User_Access.user1={"level":"AgentAdmin"}'
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:
hvrcommand property.key
Example: Show the value that is set for the key user1 in the property User_Access
hvragentconfig 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:
hvrcommand property.key*
Example: Show the values of all keys (in the property User_Access) containing the substring user
hvragentconfig User_Access.user*
Sample output:
hvragentconfig: 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).
hvrcommand property.key*.
Example: Show all keys (in the property User_Access) containing the substring user
hvragentconfig User_Access.user*.
Sample output:
hvragentconfig: Matching pattern 'User_Access.*user*': User_Access.user1 User_Access.user2