Compare commits

..

11 Commits

32 changed files with 488 additions and 402 deletions

View File

@@ -1,7 +1,14 @@
# cgpcli
[![Go Reference](https://pkg.go.dev/badge/git.vsu.ru/ai/cgpcli.svg)](https://pkg.go.dev/git.vsu.ru/ai/cgpcli)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE.md)
`cgpcli` is a Go client library for the **CommuniGate Pro** CLI. It provides a reliable bridge between CGP's unique syntax and native Go types with a focus on efficiency and correct type mapping.
## Documentation
Full API documentation and usage examples are available at [pkg.go.dev](https://pkg.go.dev/git.vsu.ru/ai/cgpcli).
## Installation
```bash

View File

@@ -58,7 +58,7 @@ func (t AccountType) String() string {
// CheckAccountPassword verifies if the provided password matches the Account's password.
//
// Parameters:
// - account: the name of the Account to check.
// - account: the Account name.
// - password: the plain-text password to verify against the server record.
//
// This is a helper method that performs a client-side comparison by retrieving
@@ -90,11 +90,8 @@ func (cli *Cli) CheckAccountPassword(account, password string) (bool, error) {
// CreateAccount creates a new Account.
//
// Parameters:
// - account: the name for the new Account. The name can contain the @ symbol
// followed by the Domain name; otherwise, the Account is created in the
// administrator Domain.
// - settings: an optional dictionary with the initial Account settings.
// If specified, it is used to modify the Template settings for the target Domain.
// - account: the Account name. The name can include the Domain name.
// - settings: an optional dictionary of initial Account settings.
// - accType: an optional Account type (e.g., MultiMailbox, MailDirMailbox).
// If [TypeDefault] is used, a MultiMailbox-type Account is created.
// - storage: an optional "storage mount point" directory for the Account data
@@ -130,7 +127,7 @@ func (cli *Cli) CreateAccount(account string, settings map[string]any, accType A
// DeleteAccount removes an existing Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// This method executes the DELETEACCOUNT CLI command.
//
@@ -146,7 +143,7 @@ func (cli *Cli) DeleteAccount(account string) error {
// DeleteAccountMailRule removes a Mail Rule from an existing Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - rule: the name of the [MailRule] to be removed.
//
// If the specified Mail Rule does not exist, the command does nothing and
@@ -166,7 +163,7 @@ func (cli *Cli) DeleteAccountMailRule(account, rule string) error {
// DeleteAccountSignalRule removes a Signal Rule from an existing Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - rule: the name of the [SignalRule] to be removed.
//
// If the specified Signal Rule does not exist, the command does nothing and
@@ -186,7 +183,7 @@ func (cli *Cli) DeleteAccountSignalRule(account, rule string) error {
// GetAccountACL retrieves the Access Control Lists (ACLs) for an Account.
//
// Parameters:
// - account: the name of an existing Account (target Account).
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - authAccount: an optional name of an Account on whose behalf the operation
// is executed. If specified, the ACL info is returned only if that Account
@@ -213,7 +210,7 @@ func (cli *Cli) GetAccountACL(account, authAccount string) (map[string]any, erro
// GetAccountACLRights retrieves the effective access rights for a specific Account.
//
// Parameters:
// - account: the name of an existing Account (target Account).
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - authAccount: the name of an Account whose effective access rights for the
// target Account should be retrieved.
@@ -233,7 +230,7 @@ func (cli *Cli) GetAccountACLRights(account, authAccount string) (string, error)
// GetAccountAccessModes retrieves the enabled services (AccessModes) for an Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// The AccessMode setting specifies Enabled Services. The returned slice of strings
// represents the names of the enabled services.
@@ -283,7 +280,7 @@ func (cli *Cli) GetAccountAccessModes(account string) ([]string, error) {
// GetAccountAliases retrieves the list of Account aliases.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// This method executes the GETACCOUNTALIASES CLI command.
//
@@ -300,7 +297,7 @@ func (cli *Cli) GetAccountAliases(account string) ([]string, error) {
// GetAccountEffectivePrefs retrieves the effective Account Preferences.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// Both the explicitly set and the default preferences are included in the result.
//
@@ -321,8 +318,8 @@ func (cli *Cli) GetAccountEffectivePrefs(account string) (map[string]any, error)
// GetAccountEffectiveSettings retrieves the effective Account settings.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// The single asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name. The name can include the Domain name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
//
// Both the explicitly set and the default Account settings are included in the result.
//
@@ -343,8 +340,8 @@ func (cli *Cli) GetAccountEffectiveSettings(account string) (map[string]any, err
// GetAccountInfo retrieves multiple elements from the Account "info" dictionary.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// The single asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name. The name can include the Domain name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - keys: an optional slice of info key names to retrieve (e.g., "LastLogin", "LastAddress").
// If empty, the entire "info" dictionary is returned.
//
@@ -374,7 +371,7 @@ func (cli *Cli) GetAccountInfo(account string, keys []string) (map[string]any, e
// GetAccountLocation retrieves the storage path for an Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// The path is relative to the file directory of the Account Domain. For multi-mailbox
// Accounts it points to the Account file directory; for single-mailbox Accounts it
@@ -395,7 +392,7 @@ func (cli *Cli) GetAccountLocation(account string) (string, error) {
// GetAccountMailRules retrieves the list of Account Queue Mail Rules.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// This method executes the GETACCOUNTMAILRULES CLI command.
//
@@ -412,8 +409,8 @@ func (cli *Cli) GetAccountMailRules(account string) ([]MailRule, error) {
// GetAccountOneInfo retrieves a single element from the Account "info" dictionary.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// The single asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name. The name can include the Domain name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - key: the name of the requested "info" element. The key name is case-sensitive.
// Do NOT include the hash (#) symbol.
//
@@ -436,8 +433,8 @@ func (cli *Cli) GetAccountOneInfo(account, key string) (any, error) {
// GetAccountOneSetting retrieves a single setting from the effective Account settings list.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// The single asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name. The name can include the Domain name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - key: the name of the setting to read.
//
// The command produces an object which can be a string, an array, a dictionary,
@@ -460,7 +457,7 @@ func (cli *Cli) GetAccountOneSetting(account, key string) (any, error) {
// GetAccountPlainPassword retrieves the clear-text password for an Account.
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name.
// - method: an optional authentication method. Supported values are "SIP" and "RADIUS".
// If empty, the main Account password is retrieved.
//
@@ -489,7 +486,7 @@ func (cli *Cli) GetAccountPlainPassword(account string, method string) (string,
// GetAccountPrefs retrieves the Account Preferences.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// Only the explicitly set (non-default) preferences are included in the result.
// To get the combined set of explicit and default preferences, use
@@ -512,7 +509,7 @@ func (cli *Cli) GetAccountPrefs(account string) (map[string]any, error) {
// GetAccountPresence retrieves the current "presence" status of an Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// The method returns the presence information in one of the following formats:
// - []any (array of two strings): the first element is the presence status
@@ -535,7 +532,7 @@ func (cli *Cli) GetAccountPresence(account string) (any, error) {
// GetAccountRIMAPs retrieves the list of Account RIMAP (Remote IMAP) records.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// RIMAP records are used to poll external mailboxes and fetch messages into the local Account.
//
@@ -554,7 +551,7 @@ func (cli *Cli) GetAccountRIMAPs(account string) (map[string]any, error) {
// GetAccountRPOPs retrieves the list of Account RPOP (Remote POP) records.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// RPOP records are used to collect mail from external POP3 servers into the local Account.
//
@@ -573,7 +570,7 @@ func (cli *Cli) GetAccountRPOPs(account string) (map[string]any, error) {
// GetAccountRSIPs retrieves the list of Account RSIP (Remote SIP) records.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// RSIP records are used for registering on remote SIP servers or managing remote
// SIP-related configurations for the Account.
@@ -593,7 +590,7 @@ func (cli *Cli) GetAccountRSIPs(account string) (map[string]any, error) {
// GetAccountRights retrieves the access rights granted to the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// The method produces an array listing all Account Server or Domain Access rights.
// These rights determine what administrative or service-level actions the user
@@ -614,8 +611,8 @@ func (cli *Cli) GetAccountRights(account string) ([]string, error) {
// GetAccountSettings retrieves the explicitly set Account settings.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// The single asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name. The name can include the Domain name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
//
// Only the explicitly set (non-default) settings are included in the result.
// To get the combined set of explicit and default settings, use
@@ -638,7 +635,7 @@ func (cli *Cli) GetAccountSettings(account string) (map[string]any, error) {
// GetAccountSignalRules retrieves the list of Account Signal Rules.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// Signal Rules are used to manage real-time communication events.
//
@@ -657,7 +654,7 @@ func (cli *Cli) GetAccountSignalRules(account string) ([]SignalRule, error) {
// GetAccountTelnums retrieves the list of telephone numbers assigned to the Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// These numbers are used for telephony services such as PBX routing or SMS.
//
@@ -676,7 +673,7 @@ func (cli *Cli) GetAccountTelnums(account string) ([]string, error) {
// IsAccountExists checks for the existence of an account on the server.
//
// Parameters:
// - account: the name of the account to check. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// This is a helper method that does not correspond to a single CLI command.
// It internally calls GetAccountLocation to verify existence. If the account
@@ -701,7 +698,7 @@ func (cli *Cli) IsAccountExists(account string) (bool, error) {
// KillAccountSessions interrupts all active sessions for the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
//
// This command immediately terminates all active connections and sessions
// associated with the account, including POP, IMAP, FTP, WebUser,
@@ -721,7 +718,7 @@ func (cli *Cli) KillAccountSessions(account string) error {
// ModifyAccountTelnums changes the telephone numbers assigned to the Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - params: a dictionary specifying the operation to perform.
//
// The params dictionary must contain an "op" key with one of the following values:
@@ -771,7 +768,8 @@ func (cli *Cli) RenameAccount(oldName, newName, storage string) error {
// SetAccountACL modifies the Access Control List (ACL) for Account Access Rights.
//
// Parameters:
// - account: the name of the target Account. Use "*" for the current authenticated user.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - acl: a dictionary where keys are identifiers (e.g., "anyone" or "user@domain")
// and values are strings with access right symbols.
// - authAccount: an optional name of an Account on whose behalf the operation
@@ -803,7 +801,7 @@ func (cli *Cli) SetAccountACL(account string, acl map[string]any, authAccount st
// SetAccountAccessModes updates the allowed access protocols/modes for an Account.
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name.
// - modes: a slice of strings representing allowed protocols (e.g., "IMAP", "POP", "HTTP").
//
// Behavior:
@@ -841,7 +839,7 @@ func (cli *Cli) SetAccountAccessModes(account string, modes []string) error {
// SetAccountAliases sets the list of aliases for the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - aliases: a slice of strings containing the new Account alias names.
//
// This is an "all-or-nothing" operation: all existing aliases for the Account are
@@ -862,7 +860,7 @@ func (cli *Cli) SetAccountAliases(account string, aliases []string) error {
// SetAccountMailRules sets the list of Account Queue Mail Rules.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - rules: a slice of [MailRule] structures containing the new rules.
//
// This command replaces all existing Mail Rules for the account with the provided set.
@@ -885,7 +883,7 @@ func (cli *Cli) SetAccountMailRules(account string, rules []MailRule) error {
// SetAccountPassword updates the password for the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - password: the new password string. If empty and a tag is provided, the
// corresponding application-specific password is removed.
// - method: an optional Account Access Mode. "SIP" modifies the Alternative SIP Password;
@@ -923,8 +921,8 @@ func (cli *Cli) SetAccountPassword(account, password, method, tag string, check
// SetAccountPrefs sets the Preferences for the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - settings: a dictionary containing the new preference settings.
// - account: the Account name. The name can include the Domain name.
// - settings: a dictionary of Account Preferences.
//
// This command completely replaces all existing Account Preferences with the provided ones.
// Preferences typically include user interface settings (WebUser), language parameters,
@@ -944,7 +942,7 @@ func (cli *Cli) SetAccountPrefs(account string, settings map[string]any) error {
// SetAccountRIMAPs sets the Account RIMAP records.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - records: a dictionary containing the Account RIMAP records.
//
// All existing Account RIMAP records are removed and replaced with the provided dictionary.
@@ -963,7 +961,7 @@ func (cli *Cli) SetAccountRIMAPs(account string, records map[string]any) error {
// SetAccountRPOPs sets the Account RPOP records.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - records: a dictionary containing the Account RPOP records.
//
// All existing Account RPOP records are removed and replaced with the provided dictionary.
@@ -982,7 +980,7 @@ func (cli *Cli) SetAccountRPOPs(account string, records map[string]any) error {
// SetAccountRSIPs sets the Account RSIP records.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - records: a dictionary containing the Account RSIP records.
//
// All existing Account RSIP records are removed and replaced with the provided dictionary.
@@ -1001,8 +999,8 @@ func (cli *Cli) SetAccountRSIPs(account string, records map[string]any) error {
// SetAccountSettings changes the Account settings.
//
// Parameters:
// - account: the name of an existing Account.
// - settings: a dictionary used to replace the Account settings dictionary.
// - account: the Account name.
// - settings: a dictionary of Account settings.
//
// All existing Account settings are removed and replaced with the provided dictionary.
//
@@ -1020,7 +1018,7 @@ func (cli *Cli) SetAccountSettings(account string, settings map[string]any) erro
// SetAccountSignalRules sets the Account Signal Rules.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - rules: a slice of [SignalRule] structures containing the new Signal Rules.
//
// All existing Account Signal Rules are removed and replaced with the provided slice.
@@ -1039,7 +1037,7 @@ func (cli *Cli) SetAccountSignalRules(account string, rules []SignalRule) error
// SetAccountTelnums assigns telephone numbers to the Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - telnums: a slice containing the telephone number strings.
//
// All existing numbers assigned to the Account are removed and replaced with the provided slice.
@@ -1058,7 +1056,7 @@ func (cli *Cli) SetAccountTelnums(account string, telnums []string) error {
// SetAccountType changes the Account type.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - accType: the new Account type (e.g., MultiMailbox, AGrade).
//
// Note: the current Account type must also belong to the target type set for the
@@ -1078,7 +1076,7 @@ func (cli *Cli) SetAccountType(account string, accType AccountType) error {
// UpdateAccountInfo updates the Account "info" fields.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - info: a dictionary containing the Account "info" fields to be updated or added.
//
// This method performs a partial update of the Account "info" dictionary.
@@ -1099,7 +1097,7 @@ func (cli *Cli) UpdateAccountInfo(account string, info map[string]any) error {
// UpdateAccountMailRule updates or creates a specific Mail Rule for the Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - rule: a [MailRule] structure containing the rule definition.
//
// Behavior depends on the content of the rule structure:
@@ -1123,8 +1121,8 @@ func (cli *Cli) UpdateAccountMailRule(account string, rule MailRule) error {
// UpdateAccountPrefs modifies the Account Preferences.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - settings: a dictionary containing the preference settings to update.
// - account: the Account name. The name can include the Domain name.
// - settings: a dictionary of Account Preferences.
//
// This method performs a partial update of the Account Preferences. Omitted elements
// remain unmodified. If a value is set to the string "default", that specific
@@ -1145,8 +1143,8 @@ func (cli *Cli) UpdateAccountPrefs(account string, settings map[string]any) erro
// UpdateAccountSettings updates the Account settings.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - settings: a dictionary containing the settings to be updated.
// - account: the Account name. The name can include the Domain name.
// - settings: a dictionary of Account settings.
//
// This method performs a partial update of the Account settings dictionary. Omitted
// settings remain unmodified. If a setting value is specified as the string "default",
@@ -1167,7 +1165,7 @@ func (cli *Cli) UpdateAccountSettings(account string, settings map[string]any) e
// UpdateAccountSignalRule updates or creates a specific Signal Rule for the Account.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - rule: a [SignalRule] structure containing the rule definition.
//
// Behavior depends on the content of the rule structure:
@@ -1192,7 +1190,7 @@ func (cli *Cli) UpdateAccountSignalRule(account string, rule SignalRule) error {
// UpdateScheduledTask sets the Account Scheduled Task record.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - task: a dictionary containing the Scheduled Task data (id, program/script, etc.).
//
// Behavior:
@@ -1217,7 +1215,7 @@ func (cli *Cli) UpdateScheduledTask(account string, task map[string]any) error {
// 'From:' header value.
//
// Parameters:
// - account: the name of an existing Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// - identity: the 'From:' header value to verify (e.g., "Name <user@domain.com>").
//
// This method executes the VERIFYACCOUNTIDENTITY CLI command.
@@ -1236,7 +1234,7 @@ func (cli *Cli) VerifyAccountIdentity(account, identity string) (bool, error) {
// VerifyAccountPassword verifies the Account password.
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name. The name can include the Domain name.
// - password: the password to check (clear text).
//
// This method executes the VERIFYACCOUNTPASSWORD CLI command.

View File

@@ -17,9 +17,8 @@ import (
// GetAccountAlerts retrieves the Account Alerts.
//
// Parameters:
// - account: the name of an existing Account.
// The asterisk (*) symbol can be used to specify the current
// authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
//
// This method executes the GETACCOUNTALERTS CLI command.
//
@@ -35,7 +34,7 @@ func (cli *Cli) GetAccountAlerts(account string) (map[string]string, error) {
return cli.getMapString("GETACCOUNTALERTS", Atom(account))
}
// GetClusterAlerts retrieves the cluster-wide Alerts.
// GetClusterAlerts retrieves the Cluster-wide Alerts.
//
// This method executes the GETCLUSTERALERTS CLI command.
//
@@ -50,7 +49,7 @@ func (cli *Cli) GetClusterAlerts() (map[string]string, error) {
// GetDomainAlerts retrieves the domain-wide Alerts.
//
// Parameters:
// - domain: an optional name of an existing Domain.
// - domain: an optional Domain name.
// If an empty string is provided, the command typically targets the
// current domain context.
//
@@ -64,7 +63,7 @@ func (cli *Cli) GetDomainAlerts(domain string) (map[string]string, error) {
return cli.getMapString("GETDOMAINALERTS", Atom(domain))
}
// GetServerAlerts retrieves the server-wide Alerts.
// GetServerAlerts retrieves the Server-wide Alerts.
//
// This method executes the GETSERVERALERTS CLI command.
//
@@ -79,9 +78,8 @@ func (cli *Cli) GetServerAlerts() (map[string]string, error) {
// PostAccountAlert posts an alert message to a specific Account.
//
// Parameters:
// - account: the name of an existing Account.
// The asterisk (*) symbol can be used to specify the current
// authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - alert: the text of the alert to be posted.
//
// This method executes the POSTACCOUNTALERT CLI command.
@@ -97,7 +95,7 @@ func (cli *Cli) PostAccountAlert(account, alert string) error {
return cli.QueryNV("POSTACCOUNTALERT", Atom(account), "ALERT", alert)
}
// PostClusterAlert posts a cluster-wide Alert message.
// PostClusterAlert posts a Cluster-wide Alert message.
//
// Parameters:
// - alert: the text of the alert to be posted.
@@ -118,7 +116,7 @@ func (cli *Cli) PostClusterAlert(alert string) error {
// PostDomainAlert posts a domain-wide Alert message.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
// - alert: the text of the alert to be posted.
//
// This method executes the POSTDOMAINALERT CLI command.
@@ -134,7 +132,7 @@ func (cli *Cli) PostDomainAlert(domain, alert string) error {
return cli.QueryNV("POSTDOMAINALERT", domain, "ALERT", alert)
}
// PostServerAlert posts a server-wide Alert message.
// PostServerAlert posts a Server-wide Alert message.
//
// Parameters:
// - alert: the text of the alert to be posted.
@@ -155,9 +153,8 @@ func (cli *Cli) PostServerAlert(alert string) error {
// RemoveAccountAlert removes a specific alert message from an Account.
//
// Parameters:
// - account: the name of an existing Account.
// The asterisk (*) symbol can be used to specify the current
// authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - timeStamp: the exact timestamp string of the alert to be removed,
// as retrieved by GetAccountAlerts.
//
@@ -174,10 +171,10 @@ func (cli *Cli) RemoveAccountAlert(account, timeStamp string) error {
return cli.QueryNV("REMOVEACCOUNTALERT", Atom(account), "ALERT", timeStamp)
}
// RemoveClusterAlert removes a specific cluster-wide alert message.
// RemoveClusterAlert removes a specific Cluster-wide alert message.
//
// Parameters:
// - timeStamp: the exact timestamp string of the cluster-wide alert
// - timeStamp: the exact timestamp string of the Cluster-wide alert
// to be removed, as retrieved by GetClusterAlerts.
//
// This method executes the REMOVECLUSTERALERT CLI command.
@@ -196,7 +193,7 @@ func (cli *Cli) RemoveClusterAlert(timeStamp string) error {
// RemoveDomainAlert removes a specific domain-wide alert message.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
// - timeStamp: the exact timestamp string of the domain alert
// to be removed, as retrieved by GetDomainAlerts.
//
@@ -213,10 +210,10 @@ func (cli *Cli) RemoveDomainAlert(domain, timeStamp string) error {
return cli.QueryNV("REMOVEDOMAINALERT", domain, "ALERT", timeStamp)
}
// RemoveServerAlert removes a specific server-wide alert message.
// RemoveServerAlert removes a specific Server-wide alert message.
//
// Parameters:
// - timeStamp: the exact timestamp string of the server-wide alert
// - timeStamp: the exact timestamp string of the Server-wide alert
// to be removed, as retrieved by GetServerAlerts.
//
// This method executes the REMOVESERVERALERT CLI command.
@@ -235,9 +232,8 @@ func (cli *Cli) RemoveServerAlert(timeStamp string) error {
// SetAccountAlerts replaces the entire Account alert dictionary.
//
// Parameters:
// - account: the name of an existing Account.
// The asterisk (*) symbol can be used to specify the current
// authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - alerts: a dictionary used to replace the current Account alert dictionary.
//
// This method executes the SETACCOUNTALERTS CLI command.
@@ -253,7 +249,7 @@ func (cli *Cli) SetAccountAlerts(account string, alerts map[string]any) error {
return cli.QueryNV("SETACCOUNTALERTS", Atom(account), alerts)
}
// SetClusterAlerts replaces the entire cluster-wide Alert dictionary.
// SetClusterAlerts replaces the entire Cluster-wide Alert dictionary.
//
// Parameters:
// - alerts: a dictionary used to replace the current Cluster alert dictionary.
@@ -270,7 +266,7 @@ func (cli *Cli) SetClusterAlerts(alerts map[string]any) error {
// SetDomainAlerts replaces the entire Domain alert dictionary.
//
// Parameters:
// - domain: an optional name of an existing Domain.
// - domain: an optional Domain name.
// If an empty string is provided, the command targets the current domain context.
// - alerts: a dictionary used to replace the current Domain alert dictionary.
//
@@ -283,7 +279,7 @@ func (cli *Cli) SetDomainAlerts(domain string, alerts map[string]any) error {
return cli.QueryNV("SETDOMAINALERTS", Atom(domain), alerts)
}
// SetServerAlerts replaces the entire server-wide Alert dictionary.
// SetServerAlerts replaces the entire Server-wide Alert dictionary.
//
// Parameters:
// - alerts: a dictionary used to replace the current Server alert dictionary.

4
build
View File

@@ -40,12 +40,12 @@ elif [ "$1" == "sandbox-test-one" ]; then
echo ""
echo "--- Running tests on sandbox ---"
ssh "${REMOTE_HOST}" "cd ${REMOTE_PATH} && ./build test-once $2"
ssh "${REMOTE_HOST}" "cd ${REMOTE_PATH} && ./build test-one $2"
elif [ "$1" == "test" ]; then
. .env
go test -v
elif [ "$1" == "test-once" ]; then
elif [ "$1" == "test-one" ]; then
. .env
go test -v -run $2
elif [ "$1" == "bench" ]; then

View File

@@ -20,7 +20,7 @@ func main() {
if mode == "ro" {
suffix = "_RO"
defaultAccount = "testadmin@vsu.ru" // или любой другой боевой
defaultAccount = "testadmin@domain.name"
fmt.Println(">>> MODE: READ-ONLY (PRODUCTION) <<<")
} else {
fmt.Println(">>> MODE: LOCAL TEST <<<")

View File

@@ -36,8 +36,6 @@ func main() {
// 2. Читаем алерты
fmt.Println("\n--- GETSERVERALERTS (Checking types) ---")
// Пока используем GetServerAlerts, который возвращает map[string]any (или уже map[string]string?)
// Чтобы увидеть "сырые" типы от парсера, проверим через Any.
res, err := cli.Query("GETSERVERALERTS")
if err != nil {
log.Fatalf("Get error: %v", err)

View File

@@ -32,7 +32,6 @@ func main() {
}
fmt.Println("\n--- Directory Integration ---")
// Настройки интеграции (LDAP, Active Directory и т.д.)
integration, err := cli.Query("GETDIRECTORYINTEGRATION")
if err != nil {
fmt.Printf("GetIntegration error: %v\n", err)

View File

@@ -28,7 +28,6 @@ func main() {
fmt.Println("--- Testing LISTDOMAINOBJECTS with Enum Flags ---")
// 3. Вызов функции с использованием битовой маски
// Например: запрашиваем Аккаунты и Форвардеры, игнорируя Алиасы
mask := cgpcli.TypeAccount | cgpcli.TypeForwarder | cgpcli.TypeAlias
res, err := cli.ListDomainObjects("test.domain.name", 100, "", mask, "")
@@ -36,14 +35,13 @@ func main() {
log.Fatalf("ListDomainObjects error: %v", err)
}
// 4. Красивый вывод через нашу утилиту
// 4. Красивый вывод
fmt.Println("\nStructure via PrettyPrint:")
cgpcli.PrettyPrint(res)
// 5. Демонстрация работы с типизированными данными
fmt.Printf("\n--- Summary (Total: %d, Cookie: '%s') ---\n", res.Total, res.Cookie)
// Сортируем ключи для красивого вывода в консоль
keys := make([]string, 0, len(res.Objects))
for k := range res.Objects {
keys = append(keys, k)
@@ -53,7 +51,6 @@ func main() {
for _, name := range keys {
obj := res.Objects[name]
// Благодаря Enum мы можем делать чистые проверки
typeLabel := obj.Type.String()
if len(obj.Targets) > 0 {

View File

@@ -10,7 +10,6 @@ import (
)
func main() {
// Используем переменные окружения из ваших тестов
cgpuser := os.Getenv("CGPUSER")
cgppass := os.Getenv("CGPPASS")
@@ -18,7 +17,6 @@ func main() {
log.Fatal("Error: please set CGPUSER and CGPPASS environment variables")
}
// Используем ваш конструктор New (APOP, без TLS для теста на 127.0.0.1)
cli, err := cgpcli.New("127.0.0.1", cgpuser, cgppass, cgpcli.APOP, false)
if err != nil {
log.Fatalf("Failed to connect: %v", err)
@@ -28,13 +26,11 @@ func main() {
fmt.Println("Connected to 127.0.0.1. Enumerating OIDs...")
fmt.Println(strings.Repeat("-", 40))
// Запрашиваем список
stats, err := cli.ListAllStats()
if err != nil {
log.Fatalf("Error during enumeration: %v", err)
}
// Выводим с порядковыми номерами
for i, name := range stats {
fmt.Printf("%04d | %s\n", i+1, name)
}

View File

@@ -18,7 +18,6 @@ func main() {
}
// 2. Инициализация клиента
// Используем ваш конструктор New
cli, err := cgpcli.New("127.0.0.1", cgpuser, cgppass, cgpcli.APOP, false)
if err != nil {
log.Fatalf("Failed to connect: %v", err)
@@ -31,7 +30,6 @@ func main() {
fmt.Printf("Updating RealName for %s to: %s\n", targetAccount, russianName)
// 1. Устанавливаем русское имя
// UpdateAccountSettings отправляет данные через Marshal
err = cli.UpdateAccountSettings(targetAccount, map[string]any{
"RealName": russianName,
})

View File

@@ -236,10 +236,11 @@ func (d *decodeState) dictionaryInterface() any {
}
func (d *decodeState) arrayInterface() any {
count := 1
commas := 0
depth := 1
ts := d.span
data := d.data
empty := true
for ts < len(data) {
f := cgpCharTable[data[ts]]
@@ -252,20 +253,20 @@ func (d *decodeState) arrayInterface() any {
break
}
} else if f&isCgpComma != 0 && depth == 1 {
count++
commas++
}
}
if f&isCgpSpace == 0 {
empty = false
}
ts++
}
// Если мы нашли элементы (или хотя бы один), count должен быть корректным.
// Для пустого массива () count останется 0. Для (1) - тоже 0, надо +1 если не пусто.
// Но проще: если мы встретили хотя бы один символ до закрытия, это 1 элемент или больше.
if ts > d.span { // Если между ( и ) что-то было
count++
capacity := 0
if !empty {
capacity = commas + 1
}
res := make([]any, 0, count)
res := make([]any, 0, capacity)
for d.span < d.len {
d.skipSpaces()
@@ -616,11 +617,13 @@ func parseIPSB(v any) net.IP {
return net.ParseIP(s)
}
var ipsbsaReplacer = strings.NewReplacer("[", "", "]", "")
func parseIPSBSA(s string) []net.IP {
if s == "" {
return []net.IP{}
}
s = strings.NewReplacer("[", "", "]", "").Replace(s)
s = ipsbsaReplacer.Replace(s)
parts := strings.Split(s, ",")
res := make([]net.IP, 0, len(parts))
for _, p := range parts {

View File

@@ -156,3 +156,81 @@ func TestDecodeDataBlock(t *testing.T) {
})
}
}
// TestArrayCounting проверяет корректность подсчёта элементов в arrayInterface.
func TestArrayCounting(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{"Empty", "()", 0},
{"One", "(a)", 1},
{"Two", "(a,b)", 2},
{"Three", "(a,b,c)", 3},
{"Nested", "(a,(b,c),d)", 3},
{"NestedDict", "(a,{k=v;},c)", 3},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var got any
if err := Unmarshal([]byte(tt.input), &got); err != nil {
t.Fatalf("Unmarshal() error = %v", err)
}
arr, ok := got.([]any)
if !ok {
if tt.want == 0 {
return
}
t.Fatalf("expected []any, got %T: %v", got, got)
}
if len(arr) != tt.want {
t.Errorf("len=%d, want %d, got %v", len(arr), tt.want, arr)
}
})
}
}
// TestParseCGPSizeQuotes проверяет нужен ли strings.Trim в parseCGPSize.
func TestParseCGPSizeQuotes(t *testing.T) {
tests := []struct {
name string
input string
want any
}{
{"NoQuotes", "10K", int64(10 * 1024)},
{"WithQuotes", `"10K"`, int64(10 * 1024)},
{"Unlimited", "unlimited", int64(-1)},
{"Plain", "1024", int64(1024)},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := parseCGPSize(tt.input)
if got != tt.want {
t.Errorf("parseCGPSize(%q) = %v (%T), want %v (%T)", tt.input, got, got, tt.want, tt.want)
}
})
}
}
// TestParseIPSBSA проверяет parseIPSBSA.
func TestParseIPSBSA(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{"Empty", "", 0},
{"Single", "[192.168.1.1]", 1},
{"Multiple", "[192.168.1.1], [10.0.0.1]", 2},
{"IPv6", "[::1], [fe80::1]", 2},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := parseIPSBSA(tt.input)
if len(got) != tt.want {
t.Errorf("parseIPSBSA(%q) = %d IPs, want %d: %v", tt.input, len(got), tt.want, got)
}
})
}
}

View File

@@ -35,7 +35,7 @@ type DirAccessRight struct {
// Parameters:
// - unit: the new Unit name.
// - mountPoint: the new Unit mount point (mount DN).
// - shared: if true, a cluster-wide Directory Unit is created.
// - shared: if true, a Cluster-wide Directory Unit is created.
// - remote: if true, a Remote (LDAP-based) Directory Unit is created,
// otherwise a Local (File-based) Directory Unit is created.
//
@@ -64,7 +64,7 @@ func (cli *Cli) CreateDirectoryUnit(unit, mountPoint string, shared, remote bool
//
// Parameters:
// - unit: the Directory Unit name.
// - shared: if true, this is a cluster-wide Directory Unit name.
// - shared: if true, this is a Cluster-wide Directory Unit name.
//
// This method executes the DELETEDIRECTORYUNIT CLI command.
//
@@ -86,7 +86,7 @@ func (cli *Cli) DeleteDirectoryUnit(unit string, shared bool) error {
// GetDirectoryAccessRights retrieves the Directory Access Rights.
//
// Parameters:
// - shared: if true, the cluster-wide Access Rights are retrieved.
// - shared: if true, the Cluster-wide Access Rights are retrieved.
//
// This method executes the GETDIRECTORYACCESSRIGHTS CLI command.
//
@@ -149,7 +149,7 @@ func (cli *Cli) GetDirectoryAccessRights(shared bool) ([]DirAccessRight, error)
//
// Parameters:
// - unit: the Directory Unit name.
// - shared: if true, this is a cluster-wide Directory Unit name.
// - shared: if true, this is a Cluster-wide Directory Unit name.
//
// This method executes the GETDIRECTORYUNIT CLI command.
//
@@ -172,7 +172,7 @@ func (cli *Cli) GetDirectoryUnit(unit string, shared bool) (map[string]any, erro
// ListDirectoryUnits retrieves the list of all created Directory units.
//
// Parameters:
// - shared: if true, the cluster-wide Units are listed.
// - shared: if true, the Cluster-wide Units are listed.
//
// This method executes the LISTDIRECTORYUNITS CLI command.
//
@@ -207,7 +207,7 @@ func (cli *Cli) ListDirectoryUnits(shared bool) (map[string]string, error) {
// Parameters:
// - unit: the Directory Unit name.
// - mountPoint: the new mount point (mount DN).
// - shared: if true, this is a cluster-wide Directory Unit name.
// - shared: if true, this is a Cluster-wide Directory Unit name.
//
// This method executes the RELOCATEDIRECTORYUNIT CLI command.
//
@@ -229,7 +229,7 @@ func (cli *Cli) RelocateDirectoryUnit(unit, mountPoint string, shared bool) erro
// SetDirectoryAccessRights sets the Directory Access Rights.
//
// Parameters:
// - shared: if true, the cluster-wide Access Rights are set.
// - shared: if true, the Cluster-wide Access Rights are set.
// - rights: a slice of [DirAccessRight] structures specifying the new ACLs.
//
// This method executes the SETDIRECTORYACCESSRIGHTS CLI command.
@@ -261,8 +261,8 @@ func (cli *Cli) SetDirectoryAccessRights(shared bool, rights []DirAccessRight) e
//
// Parameters:
// - unit: the Directory Unit name.
// - shared: if true, this is a cluster-wide Directory Unit name.
// - settings: a dictionary specifying the new Directory Unit settings.
// - shared: if true, this is a Cluster-wide Directory Unit name.
// - settings: a dictionary of Directory Unit settings.
//
// This method executes the SETDIRECTORYUNIT CLI command.
//

View File

@@ -66,25 +66,20 @@ func (cli *Cli) CreateAccountStorage(domain, storage string) error {
// DeleteDirectoryRecords deletes Domain object records from the Directory.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the authenticated user Domain.
// - domain: an optional Domain name. If empty, applies to the authenticated user Domain.
//
// This method executes the DELETEDIRECTORYRECORDS CLI command.
//
// Returns:
// - error: an error if the command fails.
func (cli *Cli) DeleteDirectoryRecords(domain string) error {
const cmd = "DELETEDIRECTORYRECORDS"
if domain != "" {
return cli.QueryNV(cmd, domain)
} else {
return cli.QueryNV(cmd)
}
return cli.QueryNV("DELETEDIRECTORYRECORDS", Atom(domain))
}
// GetAccountDefaultPrefs retrieves the Default Account Preferences for the specified Domain.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the administrator Domain.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
//
// This method executes the GETACCOUNTDEFAULTPREFS CLI command.
//
@@ -98,7 +93,7 @@ func (cli *Cli) GetAccountDefaultPrefs(domain string) (map[string]any, error) {
// GetAccountDefaults retrieves the default Account settings for the specified Domain.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the administrator Domain.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
//
// This method executes the GETACCOUNTDEFAULTS CLI command.
//
@@ -126,7 +121,7 @@ func (cli *Cli) GetAccountTemplate(domain string) (map[string]any, error) {
// GetDomainAliases retrieves the list of Domain Aliases.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
//
// This method executes the GETDOMAINALIASES CLI command.
//
@@ -143,7 +138,7 @@ func (cli *Cli) GetDomainAliases(domain string) ([]string, error) {
// GetDomainEffectiveSettings retrieves both explicitly set and default Domain settings.
//
// Parameters:
// - domain: the name of an existing Domain. If empty, uses the current context.
// - domain: an optional Domain name.
//
// This method executes the GETDOMAINEFFECTIVESETTINGS CLI command.
//
@@ -157,7 +152,7 @@ func (cli *Cli) GetDomainEffectiveSettings(domain string) (map[string]any, error
// GetDomainLocation retrieves the Domain file directory path relative to the Server base.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the administrator Domain.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
//
// This method executes the GETDOMAINLOCATION CLI command.
//
@@ -171,7 +166,7 @@ func (cli *Cli) GetDomainLocation(domain string) (string, error) {
// GetDomainMailRules retrieves the list of Domain Queue Mail Rules.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
//
// This method executes the GETDOMAINMAILRULES CLI command.
//
@@ -188,7 +183,7 @@ func (cli *Cli) GetDomainMailRules(domain string) ([]MailRule, error) {
// GetDomainSettings retrieves explicitly set (non-default) Domain settings.
//
// Parameters:
// - domain: the name of an existing Domain. If empty, uses the current context.
// - domain: an optional Domain name.
//
// This method executes the GETDOMAINSETTINGS CLI command.
//
@@ -202,7 +197,7 @@ func (cli *Cli) GetDomainSettings(domain string) (map[string]any, error) {
// GetDomainSignalRules retrieves the list of Domain Signal Rules.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
//
// This method executes the GETDOMAINSIGNALRULES CLI command.
//
@@ -219,7 +214,7 @@ func (cli *Cli) GetDomainSignalRules(domain string) ([]SignalRule, error) {
// InsertDirectoryRecords inserts records for Domain objects into the Directory.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the authenticated user Domain.
// - domain: an optional Domain name. If empty, applies to the authenticated user Domain.
//
// This method executes the INSERTDIRECTORYRECORDS CLI command.
//
@@ -232,7 +227,7 @@ func (cli *Cli) InsertDirectoryRecords(domain string) error {
// IsDomainExists checks if a domain exists by attempting to retrieve its location.
//
// Parameters:
// - domain: the name of the domain to check.
// - domain: the Domain name.
//
// Returns:
// - bool: true if the domain exists.
@@ -410,7 +405,7 @@ func (cli *Cli) ListDomainTelnums(domain, filter string, limit int) (map[string]
// ResumeDomain resumes a suspended Domain so Accounts can be opened.
//
// Parameters:
// - domain: the name of the Domain to be resumed.
// - domain: the Domain name.
//
// This method executes the RESUMEDOMAIN CLI command.
//
@@ -426,8 +421,8 @@ func (cli *Cli) ResumeDomain(domain string) error {
// SetAccountDefaultPrefs replaces the Default Account Preferences for the Domain.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the authenticated user Domain.
// - settings: a dictionary used to replace the Default Account Preferences.
// - domain: an optional Domain name. If empty, applies to the authenticated user Domain.
// - settings: a dictionary of Default Account Preferences.
//
// This method executes the SETACCOUNTDEFAULTPREFS CLI command.
//
@@ -444,7 +439,7 @@ func (cli *Cli) SetAccountDefaultPrefs(domain string, settings map[string]any) e
//
// Parameters:
// - domain: an optional Domain name.
// - settings: a dictionary used to replace the Domain Default Account settings.
// - settings: a dictionary of Default Account settings.
//
// This method executes the SETACCOUNTDEFAULTS CLI command.
//
@@ -461,7 +456,7 @@ func (cli *Cli) SetAccountDefaults(domain string, settings map[string]any) error
//
// Parameters:
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
// - settings: a dictionary used to replace the Domain Account Template.
// - settings: a dictionary of Account Template settings.
//
// This method executes the SETACCOUNTTEMPLATE CLI command.
//
@@ -477,7 +472,7 @@ func (cli *Cli) SetAccountTemplate(domain string, settings map[string]any) error
// SetDomainAliases sets the Domain aliases, replacing all existing ones.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
// - aliases: an array of Domain alias name strings.
//
// This method executes the SETDOMAINALIASES CLI command.
@@ -494,7 +489,7 @@ func (cli *Cli) SetDomainAliases(domain string, aliases []string) error {
// SetDomainMailRules sets the Domain Queue Mail Rules, replacing all old ones.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
// - rules: an array containing the new Domain Queue Rules.
//
// This method executes the SETDOMAINMAILRULES CLI command.
@@ -511,8 +506,8 @@ func (cli *Cli) SetDomainMailRules(domain string, rules []MailRule) error {
// SetDomainSettings replaces the entire Domain settings dictionary.
//
// Parameters:
// - domain: the name of an existing Domain.
// - settings: a dictionary used to replace the Domain settings.
// - domain: the Domain name.
// - settings: a dictionary of Domain settings.
//
// This method executes the SETDOMAINSETTINGS CLI command.
//
@@ -528,7 +523,7 @@ func (cli *Cli) SetDomainSettings(domain string, settings map[string]any) error
// SetDomainSignalRules sets the Domain Signal Rules, replacing all old ones.
//
// Parameters:
// - domain: the name of an existing Domain.
// - domain: the Domain name.
// - rules: an array containing the new Domain Signal Rules.
//
// This method executes the SETDOMAINSIGNALRULES CLI command.
@@ -545,7 +540,7 @@ func (cli *Cli) SetDomainSignalRules(domain string, rules []SignalRule) error {
// SuspendDomain suspends a Domain, closing active accounts and preventing new ones.
//
// Parameters:
// - domain: the name of the Domain to be suspended.
// - domain: the Domain name.
//
// This method executes the SUSPENDDOMAIN CLI command.
//
@@ -561,8 +556,8 @@ func (cli *Cli) SuspendDomain(domain string) error {
// UpdateAccountDefaultPrefs modifies the Domain Default Account Preferences.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the authenticated user Domain.
// - settings: a dictionary used to modify the Domain Default Account Preferences.
// - domain: an optional Domain name. If empty, applies to the authenticated user Domain.
// - settings: a dictionary of Default Account Preferences.
//
// This method executes the UPDATEACCOUNTDEFAULTPREFS CLI command.
//
@@ -578,8 +573,8 @@ func (cli *Cli) UpdateAccountDefaultPrefs(domain string, settings map[string]any
// UpdateAccountDefaults modifies the Default Account settings for the specified Domain.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the administrator Domain.
// - settings: a dictionary used to modify the Domain Default Account settings.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
// - settings: a dictionary of Default Account settings.
//
// This method executes the UPDATEACCOUNTDEFAULTS CLI command.
//
@@ -595,8 +590,8 @@ func (cli *Cli) UpdateAccountDefaults(domain string, settings map[string]any) er
// UpdateAccountTemplate modifies the Account Template settings for the Domain.
//
// Parameters:
// - domain: the Domain name. If empty, applies to the administrator Domain.
// - settings: a dictionary used to modify the Domain Account Template.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
// - settings: a dictionary of Account Template settings.
//
// This method executes the UPDATEACCOUNTTEMPLATE CLI command.
//
@@ -612,8 +607,8 @@ func (cli *Cli) UpdateAccountTemplate(domain string, settings map[string]any) er
// UpdateDomainSettings updates specific Domain settings without modifying others.
//
// Parameters:
// - domain: the name of an existing Domain. If empty, uses the current context.
// - settings: a dictionary containing the settings to update.
// - domain: an optional Domain name.
// - settings: a dictionary of Domain settings.
//
// This method executes the UPDATEDOMAINSETTINGS CLI command.
//

View File

@@ -129,6 +129,12 @@ func TestDomainAdministration(t *testing.T) {
if err := cli.DeleteDirectoryRecords(targetDomain); err != nil {
t.Errorf("DeleteDirectoryRecords failed: %v", err)
}
if err := cli.InsertDirectoryRecords(""); err != nil {
t.Errorf("InsertDirectoryRecords failed: %v", err)
}
if err := cli.DeleteDirectoryRecords(""); err != nil {
t.Errorf("DeleteDirectoryRecords failed: %v", err)
}
})
// 7. Состояние домена

View File

@@ -26,8 +26,8 @@ import (
// This operation is allowed only when the Directory-based Domains are enabled.
//
// Parameters:
// - domain: the Domain name to create.
// - settings: an optional dictionary specifying the Domain settings.
// - domain: the Domain name.
// - settings: an optional dictionary of Domain settings.
//
// This method executes the CREATEDIRECTORYDOMAIN CLI command.
//
@@ -49,10 +49,10 @@ func (cli *Cli) CreateDirectoryDomain(domain string, settings map[string]any) er
// CreateDomain creates a new secondary Domain.
//
// Parameters:
// - domain: the Domain name to create.
// - domain: the Domain name.
// - shared: if true, creates a Cluster-wide Domain (Dynamic Cluster only).
// - storage: an optional "storage mount point" directory name (without .mnt suffix).
// - settings: an optional dictionary specifying the initial Domain settings.
// - settings: an optional dictionary of initial Domain settings.
//
// This method executes the CREATEDOMAIN CLI command.
//
@@ -103,7 +103,7 @@ func (cli *Cli) CreateDomainStorage(storage string, shared bool) error {
// DeleteDomain removes an existing Domain.
//
// Parameters:
// - domain: the name of the Domain to be removed.
// - domain: the Domain name.
// - force: if true, removes the Domain even if it contains accounts or other objects.
//
// This method executes the DELETEDOMAIN CLI command.
@@ -123,7 +123,7 @@ func (cli *Cli) DeleteDomain(domain string, force bool) error {
}
}
// GetClusterAccountDefaults retrieves the cluster-wide Default Account settings.
// GetClusterAccountDefaults retrieves the Cluster-wide Default Account settings.
//
// This method executes the GETCLUSTERACCOUNTDEFAULTS CLI command.
//
@@ -134,7 +134,7 @@ func (cli *Cli) GetClusterAccountDefaults() (map[string]any, error) {
return cli.getMapAny("GETCLUSTERACCOUNTDEFAULTS")
}
// GetClusterAccountPrefs retrieves the cluster-wide Default Account Preferences.
// GetClusterAccountPrefs retrieves the Cluster-wide Default Account Preferences.
//
// This method executes the GETCLUSTERACCOUNTPREFS CLI command.
//
@@ -145,7 +145,7 @@ func (cli *Cli) GetClusterAccountPrefs() (map[string]any, error) {
return cli.getMapAny("GETCLUSTERACCOUNTPREFS")
}
// GetClusterDirectoryIntegration retrieves the cluster-wide Directory Integration settings.
// GetClusterDirectoryIntegration retrieves the Cluster-wide Directory Integration settings.
//
// This method executes the GETCLUSTERDIRECTORYINTEGRATION CLI command.
//
@@ -156,18 +156,18 @@ func (cli *Cli) GetClusterDirectoryIntegration() (map[string]any, error) {
return cli.getMapAny("GETCLUSTERDIRECTORYINTEGRATION")
}
// GetClusterDomainDefaults retrieves the cluster-wide default Domain Settings.
// GetClusterDomainDefaults retrieves the Cluster-wide default Domain Settings.
//
// This method executes the GETCLUSTERDOMAINDEFAULTS CLI command.
//
// Returns:
// - map[string]any: a dictionary with the cluster-wide default Domain Settings.
// - map[string]any: a dictionary with the Cluster-wide default Domain Settings.
// - error: an error if the command fails.
func (cli *Cli) GetClusterDomainDefaults() (map[string]any, error) {
return cli.getMapAny("GETCLUSTERDOMAINDEFAULTS")
}
// GetClusterTrustedCerts retrieves the cluster-wide set of Trusted Certificates.
// GetClusterTrustedCerts retrieves the Cluster-wide set of Trusted Certificates.
//
// This method executes the GETCLUSTERTRUSTEDCERTS CLI command.
//
@@ -178,7 +178,7 @@ func (cli *Cli) GetClusterTrustedCerts() ([]string, error) {
return cli.getTrustedCerts("GETCLUSTERTRUSTEDCERTS")
}
// GetDirectoryIntegration retrieves the server-wide Directory Integration settings.
// GetDirectoryIntegration retrieves the Server-wide Directory Integration settings.
//
// This method executes the GETDIRECTORYINTEGRATION CLI command.
//
@@ -189,7 +189,7 @@ func (cli *Cli) GetDirectoryIntegration() (map[string]any, error) {
return cli.getMapAny("GETDIRECTORYINTEGRATION")
}
// GetDomainDefaults retrieves the server-wide default Domain Settings.
// GetDomainDefaults retrieves the Server-wide default Domain Settings.
//
// This method executes the GETDOMAINDEFAULTS CLI command.
//
@@ -200,7 +200,7 @@ func (cli *Cli) GetDomainDefaults() (map[string]any, error) {
return cli.getMapAny("GETDOMAINDEFAULTS")
}
// GetServerAccountDefaults retrieves the server-wide Default Account settings.
// GetServerAccountDefaults retrieves the Server-wide Default Account settings.
//
// This method executes the GETSERVERACCOUNTDEFAULTS CLI command.
//
@@ -211,7 +211,7 @@ func (cli *Cli) GetServerAccountDefaults() (map[string]any, error) {
return cli.getMapAny("GETSERVERACCOUNTDEFAULTS")
}
// GetServerAccountPrefs retrieves the server-wide Default Account Preferences.
// GetServerAccountPrefs retrieves the Server-wide Default Account Preferences.
//
// This method executes the GETSERVERACCOUNTPREFS CLI command.
//
@@ -222,7 +222,7 @@ func (cli *Cli) GetServerAccountPrefs() (map[string]any, error) {
return cli.getMapAny("GETSERVERACCOUNTPREFS")
}
// GetServerTrustedCerts retrieves the server-wide set of Trusted Certificates.
// GetServerTrustedCerts retrieves the Server-wide set of Trusted Certificates.
//
// This method executes the GETSERVERTRUSTEDCERTS CLI command.
//
@@ -339,10 +339,10 @@ func (cli *Cli) RenameDomain(oldName, newName string, storage string) error {
}
}
// SetClusterAccountDefaults replaces the cluster-wide Default Account settings.
// SetClusterAccountDefaults replaces the Cluster-wide Default Account settings.
//
// Parameters:
// - settings: a dictionary used to replace the Default Account settings.
// - settings: a dictionary of Default Account settings.
//
// This method executes the SETCLUSTERACCOUNTDEFAULTS CLI command.
//
@@ -355,10 +355,10 @@ func (cli *Cli) SetClusterAccountDefaults(settings map[string]any) error {
return cli.QueryNV("SETCLUSTERACCOUNTDEFAULTS", settings)
}
// SetClusterAccountPrefs replaces the cluster-wide Default Account Preferences.
// SetClusterAccountPrefs replaces the Cluster-wide Default Account Preferences.
//
// Parameters:
// - settings: a dictionary used to replace the Default Account Preferences.
// - settings: a dictionary of Default Account Preferences.
//
// This method executes the SETCLUSTERACCOUNTPREFS CLI command.
//
@@ -371,10 +371,10 @@ func (cli *Cli) SetClusterAccountPrefs(settings map[string]any) error {
return cli.QueryNV("SETCLUSTERACCOUNTPREFS", settings)
}
// SetClusterDirectoryIntegration replaces the cluster-wide Directory Integration settings.
// SetClusterDirectoryIntegration replaces the Cluster-wide Directory Integration settings.
//
// Parameters:
// - settings: a dictionary used to replace the Directory Integration settings.
// - settings: a dictionary of Directory Integration settings.
//
// This method executes the SETCLUSTERDIRECTORYINTEGRATION CLI command.
//
@@ -387,10 +387,10 @@ func (cli *Cli) SetClusterDirectoryIntegration(settings map[string]any) error {
return cli.QueryNV("SETCLUSTERDIRECTORYINTEGRATION", settings)
}
// SetClusterDomainDefaults replaces the cluster-wide default Domain settings.
// SetClusterDomainDefaults replaces the Cluster-wide default Domain settings.
//
// Parameters:
// - settings: a dictionary used to replace the default Domain settings.
// - settings: a dictionary of default Domain settings.
//
// This method executes the SETCLUSTERDOMAINDEFAULTS CLI command.
//
@@ -403,7 +403,7 @@ func (cli *Cli) SetClusterDomainDefaults(settings map[string]any) error {
return cli.QueryNV("SETCLUSTERDOMAINDEFAULTS", settings)
}
// SetClusterTrustedCerts replaces the cluster-wide list of Trusted Certificates.
// SetClusterTrustedCerts replaces the Cluster-wide list of Trusted Certificates.
//
// Parameters:
// - certs: an array of Base64-encoded X.509 certificate data or PEM.
@@ -419,10 +419,10 @@ func (cli *Cli) SetClusterTrustedCerts(certs []string) error {
return cli.setTrustedCerts("SETCLUSTERTRUSTEDCERTS", certs)
}
// SetDirectoryIntegration replaces the server-wide Directory Integration settings.
// SetDirectoryIntegration replaces the Server-wide Directory Integration settings.
//
// Parameters:
// - settings: a dictionary used to replace the Directory Integration settings.
// - settings: a dictionary of Directory Integration settings.
//
// This method executes the SETDIRECTORYINTEGRATION CLI command.
//
@@ -435,10 +435,10 @@ func (cli *Cli) SetDirectoryIntegration(settings map[string]any) error {
return cli.QueryNV("SETDIRECTORYINTEGRATION", settings)
}
// SetDomainDefaults replaces the server-wide default Domain settings.
// SetDomainDefaults replaces the Server-wide default Domain settings.
//
// Parameters:
// - settings: a dictionary used to replace the default Domain settings.
// - settings: a dictionary of default Domain settings.
//
// This method executes the SETDOMAINDEFAULTS CLI command.
//
@@ -451,10 +451,10 @@ func (cli *Cli) SetDomainDefaults(settings map[string]any) error {
return cli.QueryNV("SETDOMAINDEFAULTS", settings)
}
// SetServerAccountDefaults replaces the server-wide Default Account settings.
// SetServerAccountDefaults replaces the Server-wide Default Account settings.
//
// Parameters:
// - settings: a dictionary used to replace the Default Account settings.
// - settings: a dictionary of Default Account settings.
//
// This method executes the SETSERVERACCOUNTDEFAULTS CLI command.
//
@@ -467,10 +467,10 @@ func (cli *Cli) SetServerAccountDefaults(settings map[string]any) error {
return cli.QueryNV("SETSERVERACCOUNTDEFAULTS", settings)
}
// SetServerAccountPrefs replaces the server-wide Default Account Preferences.
// SetServerAccountPrefs replaces the Server-wide Default Account Preferences.
//
// Parameters:
// - settings: a dictionary used to replace the Default Account Preferences.
// - settings: a dictionary of Default Account Preferences.
//
// This method executes the SETSERVERACCOUNTPREFS CLI command.
//
@@ -483,7 +483,7 @@ func (cli *Cli) SetServerAccountPrefs(settings map[string]any) error {
return cli.QueryNV("SETSERVERACCOUNTPREFS", settings)
}
// SetServerTrustedCerts replaces the server-wide list of Trusted Certificates.
// SetServerTrustedCerts replaces the Server-wide list of Trusted Certificates.
//
// Parameters:
// - certs: an array of Base64-encoded X.509 certificate data or PEM.
@@ -499,10 +499,10 @@ func (cli *Cli) SetServerTrustedCerts(certs []string) error {
return cli.setTrustedCerts("SETSERVERTRUSTEDCERTS", certs)
}
// UpdateClusterAccountDefaults modifies specific cluster-wide Default Account settings.
// UpdateClusterAccountDefaults modifies specific Cluster-wide Default Account settings.
//
// Parameters:
// - settings: a dictionary containing settings to update.
// - settings: a dictionary of Default Account settings.
//
// This method executes the UPDATECLUSTERACCOUNTDEFAULTS CLI command.
//
@@ -515,10 +515,10 @@ func (cli *Cli) UpdateClusterAccountDefaults(settings map[string]any) error {
return cli.QueryNV("UPDATECLUSTERACCOUNTDEFAULTS", settings)
}
// UpdateClusterAccountPrefs modifies specific cluster-wide Default Account Preferences.
// UpdateClusterAccountPrefs modifies specific Cluster-wide Default Account Preferences.
//
// Parameters:
// - settings: a dictionary containing preferences to update.
// - settings: a dictionary of Account Preferences.
//
// This method executes the UPDATECLUSTERACCOUNTPREFS CLI command.
//
@@ -531,10 +531,10 @@ func (cli *Cli) UpdateClusterAccountPrefs(settings map[string]any) error {
return cli.QueryNV("UPDATECLUSTERACCOUNTPREFS", settings)
}
// UpdateClusterDomainDefaults modifies specific cluster-wide default Domain settings.
// UpdateClusterDomainDefaults modifies specific Cluster-wide default Domain settings.
//
// Parameters:
// - settings: a dictionary containing settings to update.
// - settings: a dictionary of default Domain settings.
//
// This method executes the UPDATECLUSTERDOMAINDEFAULTS CLI command.
//
@@ -547,10 +547,10 @@ func (cli *Cli) UpdateClusterDomainDefaults(settings map[string]any) error {
return cli.QueryNV("UPDATECLUSTERDOMAINDEFAULTS", settings)
}
// UpdateDomainDefaults modifies specific server-wide default Domain settings.
// UpdateDomainDefaults modifies specific Server-wide default Domain settings.
//
// Parameters:
// - settings: a dictionary containing settings to update.
// - settings: a dictionary of default Domain settings.
//
// This method executes the UPDATEDOMAINDEFAULTS CLI command.
//
@@ -563,10 +563,10 @@ func (cli *Cli) UpdateDomainDefaults(settings map[string]any) error {
return cli.QueryNV("UPDATEDOMAINDEFAULTS", settings)
}
// UpdateServerAccountDefaults modifies specific server-wide Default Account settings.
// UpdateServerAccountDefaults modifies specific Server-wide Default Account settings.
//
// Parameters:
// - settings: a dictionary containing settings to update.
// - settings: a dictionary of Default Account settings.
//
// This method executes the UPDATESERVERACCOUNTDEFAULTS CLI command.
//
@@ -579,10 +579,10 @@ func (cli *Cli) UpdateServerAccountDefaults(settings map[string]any) error {
return cli.QueryNV("UPDATESERVERACCOUNTDEFAULTS", settings)
}
// UpdateServerAccountPrefs modifies specific server-wide Default Account Preferences.
// UpdateServerAccountPrefs modifies specific Server-wide Default Account Preferences.
//
// Parameters:
// - settings: a dictionary containing preferences to update.
// - settings: a dictionary of Account Preferences.
//
// This method executes the UPDATESERVERACCOUNTPREFS CLI command.
//

View File

@@ -39,8 +39,9 @@ type StorageFileInfo struct {
// DeleteStorageFile removes a file or a file directory from the Account File Storage.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - file: the name of the existing File Storage file or directory.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - file: the file name or directory.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
// This method executes the DELETESTORAGEFILE CLI command.
@@ -63,7 +64,8 @@ func (cli *Cli) DeleteStorageFile(account, file, authAccount string) error {
// GetFileSubscription retrieves the list of Account "subscribed files".
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
//
// This method executes the GETFILESUBSCRIPTION CLI command.
//
@@ -80,7 +82,8 @@ func (cli *Cli) GetFileSubscription(account string) ([]string, error) {
// GetStorageFileInfo retrieves statistical information about all files in the Account File Storage.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - path: an optional name of the File Storage subdirectory.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
@@ -123,7 +126,8 @@ func (cli *Cli) GetStorageFileInfo(account, path, authAccount string) (*StorageF
// ListStorageFiles lists all files in the File Storage directory or its subdirectories.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - path: an optional name of the File Storage subdirectory.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
@@ -156,8 +160,9 @@ func (cli *Cli) ListStorageFiles(account, path, authAccount string) (map[string]
// ReadStorageFile retrieves a file or its slice from the Account File Storage.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - file: the name of the File Storage file to be retrieved.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - file: the file name.
// - offset: file position to start reading from.
// - size: maximum number of data bytes to return. Use 0 for no limit.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
@@ -215,8 +220,9 @@ func (cli *Cli) ReadStorageFile(account, file string, offset, size int64, authAc
// ReadStorageFileAttr reads attributes of an Account File Storage file or directory.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - file: the name of the file or directory.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - file: the file name or directory.
// - attrs: an optional array of attribute names to retrieve.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
@@ -244,7 +250,8 @@ func (cli *Cli) ReadStorageFileAttr(account, file string, attrs []string, authAc
// RenameStorageFile renames a file or a file directory in the Account File Storage.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - oldName: the name of the existing File Storage file or directory.
// - newName: the new name for the file or directory.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
@@ -269,7 +276,8 @@ func (cli *Cli) RenameStorageFile(account, oldName, newName, authAccount string)
// SetFileSubscription sets the Account "subscribed files" list.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - subs: an array of strings where each element is a file name.
//
// This method executes the SETFILESUBSCRIPTION CLI command.
@@ -286,8 +294,9 @@ func (cli *Cli) SetFileSubscription(account string, subs []string) error {
// UpdateStorageFileAttr updates attributes of an Account File Storage file or directory.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - file: the name of an existing file or directory.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - file: the file name or directory.
// - attrs: an array of XML elements representing the new attribute values.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
@@ -311,8 +320,9 @@ func (cli *Cli) UpdateStorageFileAttr(account, file string, attrs []any, authAcc
// WriteStorageFile stores a file or creates a directory in the Account File Storage.
//
// Parameters:
// - account: the name of an existing Account. Use "*" for current authenticated Account.
// - file: the name for the File Storage file (ends with "/" to create a directory).
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - file: the file name. Append "/" to create a directory instead.
// - offset: write position. Can be int (position), or string ("BEG", "END", "NEW").
// - data: datablock containing the file content. Must be empty for directory creation.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.

View File

@@ -87,7 +87,7 @@ func (cli *Cli) GetForwarder(forwarder string) (string, error) {
// ListForwarders retrieves the list of all Forwarders in the Domain.
//
// Parameters:
// - domain: an optional Domain name. If not specified, the command applies to the administrator Domain.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
//
// This method executes the LISTFORWARDERS CLI command.
//

View File

@@ -30,7 +30,7 @@ type GroupResult struct {
// Parameters:
// - group: the name for the new Group. The name can include the Domain name, in this case the Group is created in the specified Domain.
// If the Domain name is not specified, the command applies to the administrator Domain.
// - settings: an optional initial Group settings and the members list.
// - settings: an optional dictionary of initial Group settings and members.
//
// This method executes the CREATEGROUP CLI command.
//
@@ -128,7 +128,7 @@ func (cli *Cli) IsGroupExists(group string) (bool, error) {
// ListGroups retrieves the list of all Groups in the Domain.
//
// Parameters:
// - domain: an optional Domain name. If the Domain name is not specified, the command applies to the administrator Domain.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
//
// This method executes the LISTGROUPS CLI command.
//
@@ -160,7 +160,7 @@ func (cli *Cli) RenameGroup(oldName, newName string) error {
//
// Parameters:
// - group: the name of an existing Group. The name can include the Domain name.
// - settings: this dictionary is used to replace the Group settings dictionary.
// - settings: a dictionary of Group settings.
// - members: an optional list of group members to be included in the settings dictionary.
//
// This method executes the SETGROUP CLI command.

View File

@@ -24,7 +24,8 @@ import (
// CreateMailbox creates a Mailbox in the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name for the new Mailbox.
// - class: mailbox class for the new Mailbox.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
@@ -52,7 +53,8 @@ func (cli *Cli) CreateMailbox(account, mailbox, class, authAccount string) error
// DeleteMailbox removes a Mailbox from the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name of the Mailbox to be deleted.
// - recursive: if true, the keyword MAILBOXES is used, and all nested Mailboxes (submailboxes) are deleted, too.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
@@ -80,7 +82,8 @@ func (cli *Cli) DeleteMailbox(account, mailbox string, recursive bool, authAccou
// GetMailboxACL retrieves the access control list for the Account Mailbox.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name of an existing Mailbox in the specified Account.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
@@ -105,7 +108,8 @@ func (cli *Cli) GetMailboxACL(account, mailbox, authAccount string) (map[string]
// GetMailboxAliases retrieves the Account Mailbox aliases.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
//
// This method executes the GETMAILBOXALIASES CLI command.
//
@@ -122,7 +126,8 @@ func (cli *Cli) GetMailboxAliases(account string) (map[string]string, error) {
// GetMailboxInfo retrieves the internal information about the Account Mailbox.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name of an existing Mailbox in the specified Account.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
//
@@ -147,7 +152,8 @@ func (cli *Cli) GetMailboxInfo(account, mailbox, authAccount string) (map[string
// GetMailboxRights retrieves the effective Mailbox access rights based on the Mailbox ACL for the given authAccountName.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name of an existing Mailbox in the specified Account.
// - authAccount: the name of an Account whose access rights should be retrieved.
//
@@ -166,7 +172,8 @@ func (cli *Cli) GetMailboxRights(account, mailbox, authAccount string) (string,
// GetMailboxSubscription retrieves the list of Account "subscribed Mailboxes".
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
//
// This method executes the GETMAILBOXSUBSCRIPTION CLI command.
//
@@ -183,7 +190,8 @@ func (cli *Cli) GetMailboxSubscription(account string) ([]string, error) {
// ListMailboxes retrieves the list of Account Mailboxes.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - filter: an optional filter string for Account Mailbox names (wildcards "*" and "%" are supported).
// - authAccount: an optional name of an Account on whose behalf the LIST operation is executed.
//
@@ -211,7 +219,8 @@ func (cli *Cli) ListMailboxes(account, filter, authAccount string) (map[string]a
// RenameMailbox renames a Mailbox in the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - oldName: the name of the Mailbox to be renamed.
// - newName: the new name for the Mailbox.
// - recursive: if true, the keyword MAILBOXES is used, and all nested Mailboxes (submailboxes) are renamed, too.
@@ -241,7 +250,8 @@ func (cli *Cli) RenameMailbox(account, oldName, newName string, recursive bool,
// SetMailboxACL modifies the access control list for the Account Mailbox.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name of an existing Mailbox in the specified Account.
// - acl: the access right elements to be modified. Use "+" or "-" prefixes to add or remove rights.
// - authAccount: an optional name of an Account on whose behalf the operation is executed.
@@ -266,7 +276,8 @@ func (cli *Cli) SetMailboxACL(account, mailbox string, acl map[string]string, au
// SetMailboxAliases sets the Account Mailbox aliases.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - aliases: the set of new Mailbox aliases.
//
// This method executes the SETMAILBOXALIASES CLI command.
@@ -283,7 +294,8 @@ func (cli *Cli) SetMailboxAliases(account string, aliases map[string]string) err
// SetMailboxClass sets the "class" of an Account Mailbox.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - mailbox: the name of an existing Mailbox in the specified Account.
// - class: the Mailbox class.
// - authAccount: an optional name of an Account whose Mailbox access rights should be used.
@@ -308,7 +320,8 @@ func (cli *Cli) SetMailboxClass(account, mailbox, class, authAccount string) err
// SetMailboxSubscription sets the Account "subscribed Mailboxes" list.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can be used to specify the current authenticated Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - subs: the list of subscribed Mailboxes. Each array element should be a string with a Mailbox name.
//
// This method executes the SETMAILBOXSUBSCRIPTION CLI command.

View File

@@ -352,7 +352,7 @@ func (cli *Cli) SetPostingMode(list, subscriber string, mode any) error {
//
// Parameters:
// - list: the name of an existing mailing list. It can include the Domain name. If the Domain name is not specified, the user Domain is used by default.
// - settings: this dictionary is used to update the mailing list settings dictionary. The omitted settings will be left unmodified.
// - settings: a dictionary of mailing list settings.
//
// This method executes the UPDATELIST CLI command.
//

View File

@@ -21,7 +21,7 @@ import (
"fmt"
)
// CreateClusterPBX creates the cluster-wide Real-Time Application Environment or its national subset.
// CreateClusterPBX creates the Cluster-wide Real-Time Application Environment or its national subset.
//
// Parameters:
// - language: a national subset name.
@@ -76,7 +76,7 @@ func (cli *Cli) CreateServerPBX(language string) error {
return cli.QueryNV("CREATESERVERPBX", language)
}
// DeleteClusterPBX removes a national subset from the cluster-wide Real-Time Application Environment.
// DeleteClusterPBX removes a national subset from the Cluster-wide Real-Time Application Environment.
//
// Parameters:
// - language: a national subset name.
@@ -92,7 +92,7 @@ func (cli *Cli) DeleteClusterPBX(language string) error {
return cli.QueryNV("DELETECLUSTERPBX", language)
}
// DeleteClusterPBXFile removes a specific file from the cluster-wide Real-Time Application Environment.
// DeleteClusterPBXFile removes a specific file from the Cluster-wide Real-Time Application Environment.
//
// Parameters:
// - file: the file name. For national subsets, specify "language/fileName".
@@ -174,7 +174,7 @@ func (cli *Cli) DeleteServerPBXFile(file string) error {
return cli.QueryNV("STORESERVERPBXFILE", file, "DELETE")
}
// ListClusterPBXFiles lists files in the cluster-wide Real-Time Application Environment.
// ListClusterPBXFiles lists files in the Cluster-wide Real-Time Application Environment.
//
// Parameters:
// - language: an optional national subset name.
@@ -195,7 +195,7 @@ func (cli *Cli) ListClusterPBXFiles(language string) (map[string]*FileInfo, erro
// ListDomainPBXFiles lists files in the Domain Real-Time Application Environment.
//
// Parameters:
// - domain: an optional Domain name. If not specified, the administrator Domain is used.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
// - language: an optional national subset name.
//
// This method executes the LISTDOMAINPBXFILES CLI command.
@@ -254,7 +254,7 @@ func (cli *Cli) ListStockPBXFiles(language string) (map[string]*FileInfo, error)
return parseFileInfoMap(raw), nil
}
// ReadClusterPBXFile reads a file from the cluster-wide Real-Time Application Environment.
// ReadClusterPBXFile reads a file from the Cluster-wide Real-Time Application Environment.
//
// Parameters:
// - file: the file name. For national subsets, specify "language/fileName".
@@ -323,12 +323,12 @@ func (cli *Cli) ReadStockPBXFile(file string) ([]byte, error) {
return cli.getSliceByte("READSTOCKPBXFILE", file)
}
// StoreClusterPBXFile stores a file into the cluster-wide Real-Time Application Environment.
// StoreClusterPBXFile stores a file into the Cluster-wide Real-Time Application Environment.
// Available in the Dynamic Cluster only.
//
// Parameters:
// - file: the file name. For national subsets, specify "language/fileName".
// - data: a datablock with the file contents.
// - data: the file content.
//
// Note: If the environment contains a file with the specified name, the old file is replaced.
// The file is automatically removed from the Environment cache on all cluster members.
@@ -349,7 +349,7 @@ func (cli *Cli) StoreClusterPBXFile(file string, data []byte) error {
// Parameters:
// - domain: the Domain name.
// - file: the file name. For national subsets, specify "language/fileName".
// - data: a datablock with the file contents.
// - data: the file content.
//
// Note: If the environment contains a file with the specified name, the old file is replaced.
// The file is automatically removed from the Environment cache.
@@ -370,7 +370,7 @@ func (cli *Cli) StoreDomainPBXFile(domain, file string, data []byte) error {
//
// Parameters:
// - file: the file name. For national subsets, specify "language/fileName".
// - data: a datablock with the file contents.
// - data: the file content.
//
// Note: If the environment contains a file with the specified name, the old file is replaced.
// The file is automatically removed from the Environment cache.

View File

@@ -81,7 +81,7 @@ func (cli *Cli) SendTaskEvent(taskID, event string, param any) error {
// StartPBXTask starts a new PBX Task on behalf of the specified Account.
//
// Parameters:
// - account: the name of the Account. The name can include the Domain name.
// - account: the Account name. The name can include the Domain name.
// If the Domain name is not specified, the current user Domain is used.
// - program: the name of the program (the .sppr file) to start.
// - entry: an optional program entry point. If empty, "main" is used.

View File

@@ -2,7 +2,7 @@
//
// The Access Rights section handles the assignment of administrative privileges to accounts.
// In CommuniGate Pro, "Rights" represent a set of permissions that grant an account
// authority over server-wide or domain-specific administrative tasks.
// authority over Server-wide or domain-specific administrative tasks.
//
// Key capabilities include:
// - Privilege Management: using [Cli.SetAccountRights] to define a specific set
@@ -18,7 +18,7 @@ import (
// SetAccountRights sets the Account Server Access rights.
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name. The name can include the Domain name.
// The name can include the Domain name.
// - rights: this array should contain the Access Right codes.
//

View File

@@ -27,8 +27,8 @@ import (
// and returns the result object directly.
//
// Parameters:
// - account: the name of the Account. The script is started on this Account behalf.
// The name can include the Domain name. If the Domain name is not specified, the current user Domain is used.
// - account: the Account name. The name can include the Domain name.
// The script is executed on behalf of this Account.
// - prog: the name of the script file (the .scgp file) to start.
// - entry: an optional script entry point. If empty, "main" is used.
// - param: an optional map of parameters passed to the script.

View File

@@ -2,7 +2,7 @@
//
// The Server Settings section is the core of the library, providing comprehensive
// access to the CommuniGate Pro configuration engine. It allows for the
// management of both node-local and cluster-wide parameters, ensuring
// management of both node-local and Cluster-wide parameters, ensuring
// consistency across multi-server environments.
//
// Key capabilities include:
@@ -29,7 +29,7 @@ type BannedLines struct {
HeaderLines []string // banned strings in the message headers.
}
// GetBanned retrieves the server-wide Banned Message Lines settings.
// GetBanned retrieves the Server-wide Banned Message Lines settings.
//
// This method executes the GETBANNED CLI command.
//
@@ -40,7 +40,7 @@ func (cli *Cli) GetBanned() (*BannedLines, error) {
return cli.getBannedGeneric("GETBANNED")
}
// GetBlacklistedIPs retrieves the server-wide Blacklisted IP Addresses.
// GetBlacklistedIPs retrieves the Server-wide Blacklisted IP Addresses.
//
// This method executes the GETBLACKLISTEDIPS CLI command.
//
@@ -51,7 +51,7 @@ func (cli *Cli) GetBlacklistedIPs() (IPList, error) {
return cli.getIPList("GETBLACKLISTEDIPS")
}
// GetClientIPs retrieves the server-wide Client (trusted) IP Addresses.
// GetClientIPs retrieves the Server-wide Client (trusted) IP Addresses.
//
// This method executes the GETCLIENTIPS CLI command.
//
@@ -238,7 +238,7 @@ func (cli *Cli) GetClusterWhiteHoleIPs() (IPList, error) {
return cli.getIPList("GETCLUSTERWHITEHOLEIPS")
}
// GetDebugIPs retrieves the server-wide Debug IP Addresses.
// GetDebugIPs retrieves the Server-wide Debug IP Addresses.
//
// This method executes the GETDEBUGIPS CLI command.
//
@@ -249,7 +249,7 @@ func (cli *Cli) GetDebugIPs() (IPList, error) {
return cli.getIPList("GETDEBUGIPS")
}
// GetDeniedIPs retrieves the server-wide Denied IP Addresses.
// GetDeniedIPs retrieves the Server-wide Denied IP Addresses.
//
// This method executes the GETDENIEDIPS CLI command.
//
@@ -338,7 +338,7 @@ func (cli *Cli) GetModule(name string) (map[string]any, error) {
return cli.getMapAny("GETMODULE", name)
}
// GetNatedIPs retrieves the server-wide NATed IP Addresses.
// GetNatedIPs retrieves the Server-wide NATed IP Addresses.
//
// This method executes the GETNATEDIPS CLI command.
//
@@ -349,7 +349,7 @@ func (cli *Cli) GetNatedIPs() (IPList, error) {
return cli.getIPList("GETNATEDIPS")
}
// GetNatSiteIPs retrieves the server-wide NAT Site IP Addresses.
// GetNatSiteIPs retrieves the Server-wide NAT Site IP Addresses.
//
// This method executes the GETNATSITEIPS CLI command.
//
@@ -481,7 +481,7 @@ func (cli *Cli) GetSMTPSendProfiles() (map[string]any, error) {
return cli.getMapAny("GETSMTPSENDPROFILES")
}
// GetWhiteHoleIPs retrieves the server-wide WhiteHole IP Addresses.
// GetWhiteHoleIPs retrieves the Server-wide WhiteHole IP Addresses.
//
// This method executes the GETWHITEHOLEIPS CLI command.
//
@@ -517,7 +517,7 @@ func (cli *Cli) RefreshOSData() error {
//
// Parameters:
// - address: the e-mail address to be processed.
// - mode: an optional the routing type (mail, access, or signal).
// - mode: an optional routing type (mail, access, or signal).
// Defaults to access.
//
// This method executes the ROUTE CLI command.
@@ -533,10 +533,10 @@ func (cli *Cli) Route(address string, mode string) ([]string, error) {
}
}
// SetBanned sets the server-wide Banned Message Lines settings.
// SetBanned sets the Server-wide Banned Message Lines settings.
//
// Parameters:
// - settings: new server Banned settings.
// - settings: a pointer to a [BannedLines] structure with the Banned Message Lines settings.
//
// This method executes the SETBANNED CLI command.
//
@@ -546,7 +546,7 @@ func (cli *Cli) SetBanned(settings *BannedLines) error {
return cli.setBannedGeneric("SETBANNED", settings)
}
// SetBlacklistedIPs updates the server-wide Blacklisted IP Addresses.
// SetBlacklistedIPs updates the Server-wide Blacklisted IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -559,7 +559,7 @@ func (cli *Cli) SetBlacklistedIPs(list IPList) error {
return cli.QueryNV("SETBLACKLISTEDIPS", list)
}
// SetClientIPs updates the server-wide Client IP Addresses.
// SetClientIPs updates the Server-wide Client IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -575,7 +575,7 @@ func (cli *Cli) SetClientIPs(list IPList) error {
// SetClusterBanned sets the Cluster-wide Banned Message Lines settings.
//
// Parameters:
// - settings: new cluster-wide Banned settings.
// - settings: a pointer to a [BannedLines] structure with the Banned Message Lines settings.
//
// This method executes the SETCLUSTERBANNED CLI command.
//
@@ -640,7 +640,7 @@ func (cli *Cli) SetClusterDeniedIPs(list IPList) error {
// SetClusterIntercept updates the Cluster-wide Lawful Intercept settings.
//
// Parameters:
// - settings: a dictionary containing the new Intercept settings.
// - settings: a dictionary of Intercept settings.
//
// This method executes the SETCLUSTERINTERCEPT CLI command.
//
@@ -711,7 +711,7 @@ func (cli *Cli) SetClusterNatSiteIPs(list IPList) error {
// SetClusterNetwork updates the Cluster-wide Network settings.
//
// Parameters:
// - settings: a dictionary containing the new network settings.
// - settings: a dictionary of Network settings.
//
// This method executes the SETCLUSTERNETWORK CLI command.
//
@@ -727,7 +727,7 @@ func (cli *Cli) SetClusterNetwork(settings map[string]any) error {
// SetClusterRouterSettings updates the Cluster-wide Router settings.
//
// Parameters:
// - settings: a dictionary containing new Router settings.
// - settings: a dictionary of Router settings.
//
// This method executes the SETCLUSTERROUTERSETTINGS CLI command.
//
@@ -756,7 +756,7 @@ func (cli *Cli) SetClusterRouterTable(table RouterList) error {
// SetClusterSettings sets the Cluster-wide settings.
//
// Parameters:
// - settings: a dictionary containing the new Cluster settings.
// - settings: a dictionary of Cluster settings.
//
// This method executes the SETCLUSTERSETTINGS CLI command.
//
@@ -798,7 +798,7 @@ func (cli *Cli) SetClusterWhiteHoleIPs(list IPList) error {
return cli.QueryNV("SETCLUSTERWHITEHOLEIPS", list)
}
// SetDebugIPs updates the server-wide Debug IP Addresses.
// SetDebugIPs updates the Server-wide Debug IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -811,7 +811,7 @@ func (cli *Cli) SetDebugIPs(list IPList) error {
return cli.QueryNV("SETDEBUGIPS", list)
}
// SetDeniedIPs updates the server-wide Denied IP Addresses.
// SetDeniedIPs updates the Server-wide Denied IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -827,7 +827,7 @@ func (cli *Cli) SetDeniedIPs(list IPList) error {
// SetDNRSettings updates the DNR (Domain Name Resolver) settings.
//
// Parameters:
// - settings: a dictionary containing new DNR settings.
// - settings: a dictionary of DNR settings.
//
// This method executes the SETDNRSETTINGS CLI command.
//
@@ -856,7 +856,7 @@ func (cli *Cli) SetLANIPs(list IPList) error {
// SetMediaServerSettings sets the Media Server component settings.
//
// Parameters:
// - settings: a dictionary containing new Media Server settings.
// - settings: a dictionary of Media Server settings.
//
// This method executes the SETMEDIASERVERSETTINGS CLI command.
//
@@ -873,7 +873,7 @@ func (cli *Cli) SetMediaServerSettings(settings map[string]any) error {
//
// Parameters:
// - module: the name of a CommuniGate Pro Server module.
// - settings: a dictionary containing the new module settings.
// - settings: a dictionary of module settings.
//
// This method executes the SETMODULE CLI command.
//
@@ -886,7 +886,7 @@ func (cli *Cli) SetModule(module string, settings map[string]any) error {
return cli.QueryNV("SETMODULE", module, settings)
}
// SetNatedIPs updates the server-wide NATed IP Addresses.
// SetNatedIPs updates the Server-wide NATed IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -899,7 +899,7 @@ func (cli *Cli) SetNatedIPs(list IPList) error {
return cli.QueryNV("SETNATEDIPS", list)
}
// SetNatSiteIPs updates the server-wide NAT Site IP Addresses.
// SetNatSiteIPs updates the Server-wide NAT Site IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -915,7 +915,7 @@ func (cli *Cli) SetNatSiteIPs(list IPList) error {
// SetNetwork updates the Server Network settings.
//
// Parameters:
// - settings: a dictionary containing new network settings.
// - settings: a dictionary of Network settings.
//
// This method executes the SETNETWORK CLI command.
//
@@ -931,7 +931,7 @@ func (cli *Cli) SetNetwork(settings map[string]any) error {
// SetQueueSettings sets the Queue settings.
//
// Parameters:
// - settings: a dictionary containing new Queue settings.
// - settings: a dictionary of Queue settings.
//
// This method executes the SETQUEUESETTINGS CLI command.
//
@@ -947,7 +947,7 @@ func (cli *Cli) SetQueueSettings(settings map[string]any) error {
// SetRouterSettings updates the Router settings.
//
// Parameters:
// - settings: a dictionary containing new Router settings.
// - settings: a dictionary of Router settings.
//
// This method executes the SETROUTERSETTINGS CLI command.
//
@@ -976,7 +976,7 @@ func (cli *Cli) SetRouterTable(table RouterList) error {
// SetServerIntercept updates the Lawful Intercept settings.
//
// Parameters:
// - settings: a dictionary containing new Intercept settings.
// - settings: a dictionary of Intercept settings.
//
// This method executes the SETSERVERINTERCEPT CLI command.
//
@@ -1024,7 +1024,7 @@ func (cli *Cli) SetServerSignalRules(rules []SignalRule) error {
// SetSessionSettings sets the user Sessions settings.
//
// Parameters:
// - settings: a dictionary containing new Sessions settings.
// - settings: a dictionary of Sessions settings.
//
// This method executes the SETSESSIONSETTINGS CLI command.
//
@@ -1040,7 +1040,7 @@ func (cli *Cli) SetSessionSettings(settings map[string]any) error {
// SetSignalSettings sets the Signal component settings.
//
// Parameters:
// - settings: a dictionary containing new component settings.
// - settings: a dictionary of component settings.
//
// This method executes the SETSIGNALSETTINGS CLI command.
//
@@ -1056,7 +1056,7 @@ func (cli *Cli) SetSignalSettings(settings map[string]any) error {
// SetSMTPSendProfiles sets the Target Host Profiles of the SMTP module.
//
// Parameters:
// - settings: a dictionary containing the new profile settings.
// - settings: a dictionary of profile settings.
//
// This method executes the SETSMTPSENDPROFILES CLI command.
//
@@ -1069,7 +1069,7 @@ func (cli *Cli) SetSMTPSendProfiles(settings map[string]any) error {
return cli.QueryNV("SETSMTPSENDPROFILES", settings)
}
// SetWhiteHoleIPs updates the server-wide WhiteHole IP Addresses.
// SetWhiteHoleIPs updates the Server-wide WhiteHole IP Addresses.
//
// Parameters:
// - list: the new set of IP addresses and ranges.
@@ -1085,7 +1085,7 @@ func (cli *Cli) SetWhiteHoleIPs(list IPList) error {
// UpdateLogSettings modifies the Main Log settings.
//
// Parameters:
// - settings: a dictionary containing settings to be updated.
// - settings: a dictionary of Log settings.
//
// This method executes the UPDATELOGSETTINGS CLI command.
//
@@ -1102,7 +1102,7 @@ func (cli *Cli) UpdateLogSettings(settings map[string]any) error {
//
// Parameters:
// - module: the name of a CommuniGate Pro Server module.
// - settings: a dictionary containing settings to be updated.
// - settings: a dictionary of module settings.
//
// This method executes the UPDATEMODULE CLI command.
//
@@ -1118,7 +1118,7 @@ func (cli *Cli) UpdateModule(module string, settings map[string]any) error {
// UpdateServerSettings modifies the "other" Server settings.
//
// Parameters:
// - settings: a dictionary containing settings to be updated.
// - settings: a dictionary of Server settings.
//
// This method executes the UPDATESERVERSETTINGS CLI command.
//

View File

@@ -23,7 +23,8 @@ import (
// Balance manages Account Billing Balances.
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - params: a dictionary containing the "op" string element (list, reserve, release,
// charge, credit, read, readAll, history, remove) and operation-specific data.
@@ -44,7 +45,8 @@ func (cli *Cli) Balance(account string, params map[string]any) (map[string]any,
//
// Parameters:
//
// - account: the name of an existing Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - params: a dictionary containing:
// subsetName: (string) Target dataset or dataset subset;
@@ -73,7 +75,8 @@ func (cli *Cli) Dataset(account string, params map[string]any) (map[string]any,
// RemoveAccountSubset removes a specific Account "dataset" by name.
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - subset: the name of an existing data subset in the specified Account.
//
@@ -91,7 +94,8 @@ func (cli *Cli) RemoveAccountSubset(account, subset string) error {
// Roster manages the Account contact list (IM/Presence).
//
// Parameters:
// - account: the name of an existing Account.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - params: a dictionary containing the "what" string element (List, Update,
// remove, Presence, probe) and operation-specific elements.

View File

@@ -22,9 +22,9 @@ import (
// GetAccountStat retrieves statistics data about the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can
// be used to specify the current authenticated Account.
// - key: an optional the name of the statistical entry to retrieve.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - key: an optional name of the statistical entry to retrieve.
//
// This method executes the GETACCOUNTSTAT CLI command.
//
@@ -49,9 +49,9 @@ func (cli *Cli) GetAccountStat(account string, key string) (any, error) {
// GetDomainStat retrieves statistics data about the specified Domain.
//
// Parameters:
// - domain: the name of an existing Domain. The asterisk (*) symbol can
// - domain: the Domain name. The asterisk (*) symbol can
// be used to specify the Domain of the current authenticated Account.
// - key: an optional the name of the statistical entry to retrieve.
// - key: an optional name of the statistical entry to retrieve.
//
// This method executes the GETDOMAINSTAT CLI command.
//
@@ -75,9 +75,9 @@ func (cli *Cli) GetDomainStat(domain string, key string) (any, error) {
// ResetAccountStat resets statistics data about the specified Account.
//
// Parameters:
// - account: the name of an existing Account. The asterisk (*) symbol can
// be used to specify the current authenticated Account.
// - key: an optional the name of the statistical entry to reset.
// - account: the Account name.
// The asterisk (*) symbol can be used to specify the current authenticated Account.
// - key: an optional name of the statistical entry to reset.
// If the key is not specified, all Account statistical entries are reset.
//
// This method executes the RESETACCOUNTSTAT CLI command.
@@ -100,9 +100,9 @@ func (cli *Cli) ResetAccountStat(account string, key string) error {
// ResetDomainStat resets statistics data about the specified Domain.
//
// Parameters:
// - domain: the name of an existing Domain. The asterisk (*) symbol can
// - domain: the Domain name. The asterisk (*) symbol can
// be used to specify the Domain of the current authenticated Account.
// - key: an optional the name of the statistical entry to reset.
// - key: an optional name of the statistical entry to reset.
// If the key is not specified, all Domain statistical entries are reset.
//
// This method executes the RESETDOMAINSTAT CLI command.

View File

@@ -97,8 +97,7 @@ func (cli *Cli) ListAccountNamedTasks(account string) (map[string]any, error) {
// ListDomainNamedTasks retrieves the list of all Named Tasks in the Domain.
//
// Parameters:
// - domain: an optional Domain name. If the Domain name is not specified,
// the command applies to the administrator Domain.
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
//
// This method executes the LISTDOMAINNAMEDTASKS CLI command.
//
@@ -131,7 +130,7 @@ func (cli *Cli) RenameNamedTask(oldTask, newTask string) error {
//
// Parameters:
// - task: the name of an existing Named Task. The name can include the Domain name.
// - settings: a dictionary used to update the Named Task settings dictionary.
// - settings: a dictionary of Named Task settings.
//
// This method executes the UPDATENAMEDTASK CLI command.
//

View File

@@ -82,29 +82,20 @@ func (c CGPIP) String() string {
}
// writeCGP формирует данные для отправки на сервер CGP напрямую в буфер.
func (c CGPIP) writeCGP(w encodeWriter) (err error) {
func (c CGPIP) writeCGP(w encodeWriter) error {
if c.IsZero() {
_, err = w.WriteString("#NULL#")
return
_, err := w.WriteString("#NULL#")
return err
}
if _, err = w.WriteString("#I["); err != nil {
return
}
if _, err = w.WriteString(c.IP.String()); err != nil {
return
}
if err = w.WriteByte(']'); err != nil {
return
}
w.WriteString("#I[")
w.WriteString(c.IP.String())
w.WriteByte(']')
if c.Port > 0 {
if err = w.WriteByte(':'); err != nil {
return
w.WriteByte(':')
w.WriteString(strconv.Itoa(c.Port))
}
if _, err = w.WriteString(strconv.Itoa(c.Port)); err != nil {
return
}
}
return
return nil
}

View File

@@ -47,9 +47,9 @@ const (
//
// Parameters:
// - sessionID: the Session ID.
// - secret: an optional the one-time secret used with Two-factor
// - secret: an optional one-time secret used with Two-factor
// Authentication.
// - account: an optional the name of the Account the session belongs to.
// - account: an optional Account name the session belongs to.
//
// This method executes the BLESSSESSION CLI command.
//
@@ -75,7 +75,7 @@ func (cli *Cli) BlessSession(sessionID string, secret, account string) error {
//
// Parameters:
// - addr: the IP address and port of the client browser.
// - origAddr: an optional the original IP address of the client
// - origAddr: an optional original IP address of the client
// browser, if the client connects via a proxy.
//
// This method executes the CREATELITESESSION CLI command.
@@ -101,9 +101,9 @@ func (cli *Cli) CreateLiteSession(addr, origAddr string) (string, error) {
// Parameters:
// - account: the Account name.
// - addr: the IP address and port of the client browser.
// - origAddr: an optional the original IP address of the client
// - origAddr: an optional original IP address of the client
// browser, if the client connects via a proxy.
// - skin: an optional the Skin to use for the newly created session.
// - skin: an optional Skin name to use for the newly created session.
//
// This method executes the CREATEWEBUSERSESSION CLI command.
//
@@ -132,7 +132,7 @@ func (cli *Cli) CreateWebUserSession(account, addr, origAddr, skin string) (stri
// Parameters:
// - account: the Account name.
// - addr: the IP address and port of the client browser.
// - origAddr: an optional the original IP address of the client
// - origAddr: an optional original IP address of the client
// browser, if the client connects via a proxy.
//
// This method executes the CREATEXIMSSSESSION CLI command.
@@ -157,12 +157,12 @@ func (cli *Cli) CreateXimssSession(account, addr, origAddr string) (string, erro
//
// Parameters:
// - account: the Account name.
// - addr: an optional the IP address of the client browser.
// - origAddr: an optional the IP address of the client browser,
// - addr: an optional IP address of the client browser.
// - origAddr: an optional IP address of the client browser,
// if this browser is located behind an HTTP proxy.
// - protocol: an optional the Session protocol (WebUser, XIMSS, XMPP, etc.).
// - transport: an optional the Session transport (HTTP, XIMSS, XMPP, etc.).
// - client: an optional the Session client.
// - protocol: an optional Session protocol (WebUser, XIMSS, XMPP, etc.).
// - transport: an optional Session transport (HTTP, XIMSS, XMPP, etc.).
// - client: an optional Session client.
//
// This method executes the ADDRESS CLI command.
//
@@ -198,7 +198,7 @@ func (cli *Cli) FindAccountSession(account, addr, origAddr, protocol, transport,
//
// Parameters:
// - sessionID: the Session ID.
// - domain: an optional the name of Domain the session Account belongs to.
// - domain: an optional Domain name the session Account belongs to.
//
// This method executes the GETSESSION CLI command.
//
@@ -222,7 +222,7 @@ func (cli *Cli) GetSession(sessionID, domain string) (map[string]any, error) {
//
// Parameters:
// - sessionID: the Session ID.
// - domain: an optional the name of Domain the session Account belongs to.
// - domain: an optional Domain name the session Account belongs to.
//
// This method executes the KILLSESSION CLI command.
//
@@ -244,12 +244,12 @@ func (cli *Cli) KillSession(sessionID, domain string) error {
//
// Parameters:
// - account: the Account name.
// - addr: an optional the IP address of the client browser.
// - origAddr: an optional the IP address of the client browser,
// - addr: an optional IP address of the client browser.
// - origAddr: an optional IP address of the client browser,
// if this browser is located behind an HTTP proxy.
// - protocol: an optional the Session protocol (WebUser, XIMSS, XMPP, etc.).
// - transport: an optional the Session transport (HTTP, XIMSS, XMPP, etc.).
// - client: an optional the Session client.
// - protocol: an optional Session protocol (WebUser, XIMSS, XMPP, etc.).
// - transport: an optional Session transport (HTTP, XIMSS, XMPP, etc.).
// - client: an optional Session client.
//
// This method executes the ADDRESS CLI command.
//
@@ -284,8 +284,8 @@ func (cli *Cli) ListAccountSessions(account, addr, origAddr, protocol, transport
// ListLiteSessions retrieves all LITE sessions.
//
// Parameters:
// - addr: an optional the IP address of the client browser.
// - origAddr: an optional the IP address of the client browser,
// - addr: an optional IP address of the client browser.
// - origAddr: an optional IP address of the client browser,
// if this browser is located behind an HTTP proxy.
//
// This method executes the ADDRESS CLI command.
@@ -309,10 +309,10 @@ func (cli *Cli) ListLiteSessions(addr, origAddr string) ([]string, error) {
//
// Parameters:
// - sessionID: the Session ID.
// - domain: an optional the name of Domain the session Account belongs to.
// - file: the name for the File Storage file.
// - domain: an optional Domain name the session Account belongs to.
// - file: the file name.
// - uploadID: identifies a file in the "uploaded file set".
// - offset: an optional the file position. Can be a positive number,
// - offset: an optional file position. Can be a positive number,
// or constants OffsetBeg, OffsetEnd, OffsetNew.
//
// This method executes the DOMAIN CLI command.
@@ -351,18 +351,18 @@ func (cli *Cli) StoreSessionFile(sessionID, domain, file, uploadID string, offse
//
// Parameters:
// - sessionID: the Session ID.
// - domain: an optional the name of Domain the session Account belongs to.
// - data: the dictionary that lists new values for the attributes
// to be updated.
// - domain: an optional Domain name the session Account belongs to.
// - param: a dictionary of Session attribute names and their new values.
// Set a value to nil to remove the attribute.
//
// This method executes the UPDATESESSION CLI command.
//
// Returns:
// - error: an error if the command fails.
func (cli *Cli) UpdateSession(sessionID, domain string, data map[string]any) error {
func (cli *Cli) UpdateSession(sessionID, domain string, param map[string]any) error {
if domain != "" {
return cli.QueryNV("UPDATESESSION", sessionID, "DOMAIN", domain, data)
return cli.QueryNV("UPDATESESSION", sessionID, "DOMAIN", domain, param)
} else {
return cli.QueryNV("UPDATESESSION", sessionID, data)
return cli.QueryNV("UPDATESESSION", sessionID, param)
}
}

View File

@@ -26,7 +26,7 @@ import (
// CreateClusterSkin creates a custom Cluster Skin.
//
// Parameters:
// - skin: the name of the new Skin.
// - skin: the Skin name.
//
// This method executes the CREATECLUSTERSKIN CLI command.
//
@@ -42,9 +42,8 @@ func (cli *Cli) CreateClusterSkin(skin string) error {
// CreateDomainSkin creates a custom Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - skin: the name of the new Skin. To create the unnamed Domain
// Skin, specify an empty string.
// - domain: an optional Domain name.
// - skin: the Skin name. To create the unnamed Domain Skin, specify an empty string.
//
// This method executes the CREATEDOMAINSKIN CLI command.
//
@@ -62,7 +61,7 @@ func (cli *Cli) CreateDomainSkin(domain, skin string) error {
// CreateServerSkin creates a custom Server Skin.
//
// Parameters:
// - skin: the name of the new Skin.
// - skin: the Skin name.
//
// This method executes the CREATESERVERSKIN CLI command.
//
@@ -78,7 +77,7 @@ func (cli *Cli) CreateServerSkin(skin string) error {
// DeleteClusterSkin deletes a custom Cluster Skin.
//
// Parameters:
// - skin: the name of the Skin to be deleted.
// - skin: the Skin name.
//
// This method executes the DELETECLUSTERSKIN CLI command.
//
@@ -94,8 +93,8 @@ func (cli *Cli) DeleteClusterSkin(skin string) error {
// DeleteClusterSkinFile removes a file from a custom Cluster Skin.
//
// Parameters:
// - skin: the name of an existing Cluster Skin.
// - file: the Skin file name to be deleted.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the STORECLUSTERSKINFILE CLI command.
//
@@ -111,9 +110,8 @@ func (cli *Cli) DeleteClusterSkinFile(skin, file string) error {
// DeleteDomainSkin deletes a custom Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - skin: the name of the Skin to be deleted. To delete the
// unnamed Domain Skin, specify an empty string.
// - domain: an optional Domain name.
// - skin: the Skin name. To delete the unnamed Domain Skin, specify an empty string.
//
// This method executes the DELETEDOMAINSKIN CLI command.
//
@@ -131,9 +129,9 @@ func (cli *Cli) DeleteDomainSkin(domain, skin string) error {
// DeleteDomainSkinFile removes a file from a custom Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - skin: the name of an existing Domain Skin.
// - file: the Skin file name to be deleted.
// - domain: an optional Domain name.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the STOREDOMAINSKINFILE CLI command.
//
@@ -155,7 +153,7 @@ func (cli *Cli) DeleteDomainSkinFile(domain, skin, file string) error {
// DeleteServerSkin deletes a custom Server Skin.
//
// Parameters:
// - skin: the name of the Skin to be deleted.
// - skin: the Skin name.
//
// This method executes the DELETESERVERSKIN CLI command.
//
@@ -171,8 +169,8 @@ func (cli *Cli) DeleteServerSkin(skin string) error {
// DeleteServerSkinFile removes a file from a custom Server Skin.
//
// Parameters:
// - skin: the name of an existing Server Skin.
// - file: the Skin file name to be deleted.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the STORESERVERSKINFILE CLI command.
//
@@ -188,7 +186,7 @@ func (cli *Cli) DeleteServerSkinFile(skin, file string) error {
// ListClusterSkinFiles lists files in a custom Cluster Skin.
//
// Parameters:
// - skin: the name of an existing Cluster Skin.
// - skin: the Skin name.
//
// This method executes the LISTCLUSTERSKINFILES CLI command.
//
@@ -217,8 +215,8 @@ func (cli *Cli) ListClusterSkins() ([]string, error) {
// ListDomainSkinFiles lists files in a custom Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - skin: the name of an existing Domain Skin.
// - domain: an optional Domain name.
// - skin: the Skin name.
//
// This method executes the LISTDOMAINSKINFILES CLI command.
//
@@ -245,7 +243,7 @@ func (cli *Cli) ListDomainSkinFiles(domain, skin string) (map[string]*FileInfo,
// ListDomainSkins lists custom Domain Skins.
//
// Parameters:
// - domain: an optional the Domain name.
// - domain: an optional Domain name.
//
// This method executes the LISTDOMAINSKINS CLI command.
//
@@ -259,7 +257,7 @@ func (cli *Cli) ListDomainSkins(domain string) ([]string, error) {
// ListServerSkinFiles lists files in a custom Server Skin.
//
// Parameters:
// - skin: the name of an existing Server Skin.
// - skin: the Skin name.
//
// This method executes the LISTSERVERSKINFILES CLI command.
//
@@ -288,7 +286,7 @@ func (cli *Cli) ListServerSkins() ([]string, error) {
// ListStockSkinFiles lists files in a built-in (stock) Skin.
//
// Parameters:
// - skin: the name of a built-in Skin.
// - skin: the Skin name.
//
// This method executes the LISTSTOCKSKINFILES CLI command.
//
@@ -306,8 +304,8 @@ func (cli *Cli) ListStockSkinFiles(skin string) (map[string]*FileInfo, error) {
// ReadClusterSkinFile reads a file from a custom Cluster Skin.
//
// Parameters:
// - skin: the name of an existing Cluster Skin.
// - file: the name of an existing file in the specified Cluster Skin.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the READCLUSTERSKINFILE CLI command.
//
@@ -325,9 +323,9 @@ func (cli *Cli) ReadClusterSkinFile(skin, file string) ([]byte, time.Time, error
// ReadDomainSkinFile reads a file from a custom Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - skin: the name of an existing Domain Skin.
// - file: the name of an existing file in the Skin.
// - domain: an optional Domain name.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the READDOMAINSKINFILE CLI command.
//
@@ -370,8 +368,8 @@ func (cli *Cli) ReadDomainSkinFile(domain, skin, file string) ([]byte, time.Time
// ReadServerSkinFile reads a file from a custom Server Skin.
//
// Parameters:
// - skin: the name of an existing Server Skin.
// - file: the name of an existing file in the Skin.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the READSERVERSKINFILE CLI command.
//
@@ -406,8 +404,8 @@ func (cli *Cli) ReadServerSkinFile(skin, file string) ([]byte, time.Time, error)
// ReadStockSkinFile reads a file from a built-in (stock) Skin.
//
// Parameters:
// - skin: the name of an existing built-in Skin.
// - file: the name of an existing file in the Skin.
// - skin: the Skin name.
// - file: the file name.
//
// This method executes the READSTOCKSKINFILE CLI command.
//
@@ -442,8 +440,8 @@ func (cli *Cli) ReadStockSkinFile(skin, file string) ([]byte, time.Time, error)
// RenameClusterSkin renames a custom Cluster Skin.
//
// Parameters:
// - oldSkin: the name of an existing Skin.
// - newSkin: the new name for the Skin.
// - oldSkin: the Skin name.
// - newSkin: the new Skin name.
//
// This method executes the RENAMECLUSTERSKIN CLI command.
//
@@ -459,9 +457,9 @@ func (cli *Cli) RenameClusterSkin(oldSkin, newSkin string) error {
// RenameDomainSkin renames a custom named Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - oldSkin: the name of an existing named Skin.
// - newSkin: the new name for the Skin.
// - domain: an optional Domain name.
// - oldSkin: the Skin name.
// - newSkin: the new Skin name.
//
// This method executes the RENAMEDOMAINSKIN CLI command.
//
@@ -483,8 +481,8 @@ func (cli *Cli) RenameDomainSkin(domain, oldSkin, newSkin string) error {
// RenameServerSkin renames a custom Server Skin.
//
// Parameters:
// - oldSkin: the name of an existing Skin.
// - newSkin: the new name for the Skin.
// - oldSkin: the Skin name.
// - newSkin: the new Skin name.
//
// This method executes the RENAMESERVERSKIN CLI command.
//
@@ -500,8 +498,8 @@ func (cli *Cli) RenameServerSkin(oldSkin, newSkin string) error {
// StoreClusterSkinFile stores a file into a custom Cluster Skin.
//
// Parameters:
// - skin: the name of an existing Cluster Skin.
// - file: the Skin file name.
// - skin: the Skin name.
// - file: the file name.
// - data: the file content.
//
// This method executes the STORECLUSTERSKINFILE CLI command.
@@ -518,9 +516,9 @@ func (cli *Cli) StoreClusterSkinFile(skin, file string, data []byte) error {
// StoreDomainSkinFile stores a file into a custom Domain Skin.
//
// Parameters:
// - domain: an optional the Domain name.
// - skin: the name of an existing Domain Skin.
// - file: the Skin file name.
// - domain: an optional Domain name.
// - skin: the Skin name.
// - file: the file name.
// - data: the file content.
//
// This method executes the STOREDOMAINSKINFILE CLI command.
@@ -543,8 +541,8 @@ func (cli *Cli) StoreDomainSkinFile(domain, skin, file string, data []byte) erro
// StoreServerSkinFile stores a file into a custom Server Skin.
//
// Parameters:
// - skin: the name of an existing Server Skin.
// - file: the Skin file name.
// - skin: the Skin name.
// - file: the file name.
// - data: the file content.
//
// This method executes the STORESERVERSKINFILE CLI command.