smartinspectpython.siconnectionsbuilder

Module: siconnectionsbuilder.py

Revision History

Date Version Description
2023/05/30 3.0.0.0 Initial Version.

@export
class SIConnectionsBuilder:

Assists in building a SmartInspect connections string.

This class assists in creating connections strings as used by the SmartInspect.Connections property. For general information about connections strings, please refer to the SmartInspect.Connections property.

SIConnectionsBuilder()

Initializes a new instance of the class.

Connections: bool

Get the Connections property value.

This read-only property returns the connections string which has previously been built with the BeginProtocol, AddOption and EndProtocol methods.

def AddOptionBool(self, key: str, value: bool) -> None:

Adds a new boolean option to the current protocol section.

Arguments:
  • key (str): Option key name to add.
  • value (bool): Option key boolean value to add.
def AddOptionFileRotate( self, key: str, value: smartinspectpython.sifilerotate.SIFileRotate) -> None:

Adds a new file rotate option to the current protocol section.

Arguments:
  • key (str): Option key name to add.
  • value (SIFileRotate): Option key SIFileRotate value to add.
def AddOptionInteger(self, key: str, value: int) -> None:

Adds a new integer option to the current protocol section.

Arguments:
  • key (str): Option key name to add.
  • value (int): Option key integer value to add.
def AddOptionLevel(self, key: str, value: smartinspectpython.silevel.SILevel) -> None:

Adds a new level option to the current protocol section.

Arguments:
  • key (str): Option key name to add.
  • value (SILevel): Option key Level value to add.
def AddOptionString(self, key: str, value: str) -> None:

Adds a new string option to the current protocol section.

Arguments:
  • key (str): Option key name to add.
  • value (str): Option key string value to add.

This method adds a new string option to the current protocol section. The supplied value argument is properly escaped if necessary.

def BeginProtocol(self, protocolName: str) -> None:

Begins a new protocol section.

Arguments:
  • protocolName (str): The protocol name (e.g. file, text, tcp, etc).

This method begins a new protocol with the supplied name. All subsequent protocol options are added to this protocol until the new protocol section is closed by calling the EndProtocol method.

def Clear(self) -> None:

Clears this instance by removing all protocols and their options.

After this method has been called, the Connections property returns an empty string.

def EndProtocol(self) -> None:

Ends the current protocol section. This method ends the current protocol. To begin a new protocol section, use the BeginProtocol method.

def Escape(self, value: str) -> str:

Replaces any backslash characters in the value with double-backslash characters.

Arguments:
  • value (str): The value to escape.
Returns:

The escaped value.