Compare commits
7 Commits
v1.0.0
...
a8f3fef483
| Author | SHA1 | Date | |
|---|---|---|---|
| a8f3fef483 | |||
| cb67420927 | |||
| dcabfc7afd | |||
| b176ba4996 | |||
| d18251ef44 | |||
| 7c45e1855f | |||
| 9250b12bcb |
@@ -1,7 +1,14 @@
|
|||||||
# cgpcli
|
# cgpcli
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/git.vsu.ru/ai/cgpcli)
|
||||||
|
[](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.
|
`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
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func (cli *Cli) GetClusterAlerts() (map[string]string, error) {
|
|||||||
// GetDomainAlerts retrieves the domain-wide Alerts.
|
// GetDomainAlerts retrieves the domain-wide Alerts.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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
|
// If an empty string is provided, the command typically targets the
|
||||||
// current domain context.
|
// current domain context.
|
||||||
//
|
//
|
||||||
@@ -118,7 +118,7 @@ func (cli *Cli) PostClusterAlert(alert string) error {
|
|||||||
// PostDomainAlert posts a domain-wide Alert message.
|
// PostDomainAlert posts a domain-wide Alert message.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
// - alert: the text of the alert to be posted.
|
// - alert: the text of the alert to be posted.
|
||||||
//
|
//
|
||||||
// This method executes the POSTDOMAINALERT CLI command.
|
// This method executes the POSTDOMAINALERT CLI command.
|
||||||
@@ -196,7 +196,7 @@ func (cli *Cli) RemoveClusterAlert(timeStamp string) error {
|
|||||||
// RemoveDomainAlert removes a specific domain-wide alert message.
|
// RemoveDomainAlert removes a specific domain-wide alert message.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
// - timeStamp: the exact timestamp string of the domain alert
|
// - timeStamp: the exact timestamp string of the domain alert
|
||||||
// to be removed, as retrieved by GetDomainAlerts.
|
// to be removed, as retrieved by GetDomainAlerts.
|
||||||
//
|
//
|
||||||
@@ -270,7 +270,7 @@ func (cli *Cli) SetClusterAlerts(alerts map[string]any) error {
|
|||||||
// SetDomainAlerts replaces the entire Domain alert dictionary.
|
// SetDomainAlerts replaces the entire Domain alert dictionary.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// If an empty string is provided, the command targets the current domain context.
|
||||||
// - alerts: a dictionary used to replace the current Domain alert dictionary.
|
// - alerts: a dictionary used to replace the current Domain alert dictionary.
|
||||||
//
|
//
|
||||||
|
|||||||
4
build
4
build
@@ -40,12 +40,12 @@ elif [ "$1" == "sandbox-test-one" ]; then
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "--- Running tests on sandbox ---"
|
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
|
elif [ "$1" == "test" ]; then
|
||||||
. .env
|
. .env
|
||||||
go test -v
|
go test -v
|
||||||
elif [ "$1" == "test-once" ]; then
|
elif [ "$1" == "test-one" ]; then
|
||||||
. .env
|
. .env
|
||||||
go test -v -run $2
|
go test -v -run $2
|
||||||
elif [ "$1" == "bench" ]; then
|
elif [ "$1" == "bench" ]; then
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ func main() {
|
|||||||
|
|
||||||
if mode == "ro" {
|
if mode == "ro" {
|
||||||
suffix = "_RO"
|
suffix = "_RO"
|
||||||
defaultAccount = "testadmin@vsu.ru" // или любой другой боевой
|
defaultAccount = "testadmin@domain.name"
|
||||||
fmt.Println(">>> MODE: READ-ONLY (PRODUCTION) <<<")
|
fmt.Println(">>> MODE: READ-ONLY (PRODUCTION) <<<")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(">>> MODE: LOCAL TEST <<<")
|
fmt.Println(">>> MODE: LOCAL TEST <<<")
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ func main() {
|
|||||||
|
|
||||||
// 2. Читаем алерты
|
// 2. Читаем алерты
|
||||||
fmt.Println("\n--- GETSERVERALERTS (Checking types) ---")
|
fmt.Println("\n--- GETSERVERALERTS (Checking types) ---")
|
||||||
// Пока используем GetServerAlerts, который возвращает map[string]any (или уже map[string]string?)
|
|
||||||
// Чтобы увидеть "сырые" типы от парсера, проверим через Any.
|
|
||||||
res, err := cli.Query("GETSERVERALERTS")
|
res, err := cli.Query("GETSERVERALERTS")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Get error: %v", err)
|
log.Fatalf("Get error: %v", err)
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("\n--- Directory Integration ---")
|
fmt.Println("\n--- Directory Integration ---")
|
||||||
// Настройки интеграции (LDAP, Active Directory и т.д.)
|
|
||||||
integration, err := cli.Query("GETDIRECTORYINTEGRATION")
|
integration, err := cli.Query("GETDIRECTORYINTEGRATION")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("GetIntegration error: %v\n", err)
|
fmt.Printf("GetIntegration error: %v\n", err)
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ func main() {
|
|||||||
fmt.Println("--- Testing LISTDOMAINOBJECTS with Enum Flags ---")
|
fmt.Println("--- Testing LISTDOMAINOBJECTS with Enum Flags ---")
|
||||||
|
|
||||||
// 3. Вызов функции с использованием битовой маски
|
// 3. Вызов функции с использованием битовой маски
|
||||||
// Например: запрашиваем Аккаунты и Форвардеры, игнорируя Алиасы
|
|
||||||
mask := cgpcli.TypeAccount | cgpcli.TypeForwarder | cgpcli.TypeAlias
|
mask := cgpcli.TypeAccount | cgpcli.TypeForwarder | cgpcli.TypeAlias
|
||||||
|
|
||||||
res, err := cli.ListDomainObjects("test.domain.name", 100, "", mask, "")
|
res, err := cli.ListDomainObjects("test.domain.name", 100, "", mask, "")
|
||||||
@@ -36,14 +35,13 @@ func main() {
|
|||||||
log.Fatalf("ListDomainObjects error: %v", err)
|
log.Fatalf("ListDomainObjects error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Красивый вывод через нашу утилиту
|
// 4. Красивый вывод
|
||||||
fmt.Println("\nStructure via PrettyPrint:")
|
fmt.Println("\nStructure via PrettyPrint:")
|
||||||
cgpcli.PrettyPrint(res)
|
cgpcli.PrettyPrint(res)
|
||||||
|
|
||||||
// 5. Демонстрация работы с типизированными данными
|
// 5. Демонстрация работы с типизированными данными
|
||||||
fmt.Printf("\n--- Summary (Total: %d, Cookie: '%s') ---\n", res.Total, res.Cookie)
|
fmt.Printf("\n--- Summary (Total: %d, Cookie: '%s') ---\n", res.Total, res.Cookie)
|
||||||
|
|
||||||
// Сортируем ключи для красивого вывода в консоль
|
|
||||||
keys := make([]string, 0, len(res.Objects))
|
keys := make([]string, 0, len(res.Objects))
|
||||||
for k := range res.Objects {
|
for k := range res.Objects {
|
||||||
keys = append(keys, k)
|
keys = append(keys, k)
|
||||||
@@ -53,7 +51,6 @@ func main() {
|
|||||||
for _, name := range keys {
|
for _, name := range keys {
|
||||||
obj := res.Objects[name]
|
obj := res.Objects[name]
|
||||||
|
|
||||||
// Благодаря Enum мы можем делать чистые проверки
|
|
||||||
typeLabel := obj.Type.String()
|
typeLabel := obj.Type.String()
|
||||||
|
|
||||||
if len(obj.Targets) > 0 {
|
if len(obj.Targets) > 0 {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Используем переменные окружения из ваших тестов
|
|
||||||
cgpuser := os.Getenv("CGPUSER")
|
cgpuser := os.Getenv("CGPUSER")
|
||||||
cgppass := os.Getenv("CGPPASS")
|
cgppass := os.Getenv("CGPPASS")
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ func main() {
|
|||||||
log.Fatal("Error: please set CGPUSER and CGPPASS environment variables")
|
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)
|
cli, err := cgpcli.New("127.0.0.1", cgpuser, cgppass, cgpcli.APOP, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to connect: %v", err)
|
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("Connected to 127.0.0.1. Enumerating OIDs...")
|
||||||
fmt.Println(strings.Repeat("-", 40))
|
fmt.Println(strings.Repeat("-", 40))
|
||||||
|
|
||||||
// Запрашиваем список
|
|
||||||
stats, err := cli.ListAllStats()
|
stats, err := cli.ListAllStats()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error during enumeration: %v", err)
|
log.Fatalf("Error during enumeration: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Выводим с порядковыми номерами
|
|
||||||
for i, name := range stats {
|
for i, name := range stats {
|
||||||
fmt.Printf("%04d | %s\n", i+1, name)
|
fmt.Printf("%04d | %s\n", i+1, name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. Инициализация клиента
|
// 2. Инициализация клиента
|
||||||
// Используем ваш конструктор New
|
|
||||||
cli, err := cgpcli.New("127.0.0.1", cgpuser, cgppass, cgpcli.APOP, false)
|
cli, err := cgpcli.New("127.0.0.1", cgpuser, cgppass, cgpcli.APOP, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to connect: %v", err)
|
log.Fatalf("Failed to connect: %v", err)
|
||||||
@@ -31,7 +30,6 @@ func main() {
|
|||||||
fmt.Printf("Updating RealName for %s to: %s\n", targetAccount, russianName)
|
fmt.Printf("Updating RealName for %s to: %s\n", targetAccount, russianName)
|
||||||
|
|
||||||
// 1. Устанавливаем русское имя
|
// 1. Устанавливаем русское имя
|
||||||
// UpdateAccountSettings отправляет данные через Marshal
|
|
||||||
err = cli.UpdateAccountSettings(targetAccount, map[string]any{
|
err = cli.UpdateAccountSettings(targetAccount, map[string]any{
|
||||||
"RealName": russianName,
|
"RealName": russianName,
|
||||||
})
|
})
|
||||||
|
|||||||
51
domains.go
51
domains.go
@@ -66,25 +66,20 @@ func (cli *Cli) CreateAccountStorage(domain, storage string) error {
|
|||||||
// DeleteDirectoryRecords deletes Domain object records from the Directory.
|
// DeleteDirectoryRecords deletes Domain object records from the Directory.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// This method executes the DELETEDIRECTORYRECORDS CLI command.
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// - error: an error if the command fails.
|
// - error: an error if the command fails.
|
||||||
func (cli *Cli) DeleteDirectoryRecords(domain string) error {
|
func (cli *Cli) DeleteDirectoryRecords(domain string) error {
|
||||||
const cmd = "DELETEDIRECTORYRECORDS"
|
return cli.QueryNV("DELETEDIRECTORYRECORDS", Atom(domain))
|
||||||
if domain != "" {
|
|
||||||
return cli.QueryNV(cmd, domain)
|
|
||||||
} else {
|
|
||||||
return cli.QueryNV(cmd)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAccountDefaultPrefs retrieves the Default Account Preferences for the specified Domain.
|
// GetAccountDefaultPrefs retrieves the Default Account Preferences for the specified Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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.
|
// GetAccountDefaults retrieves the default Account settings for the specified Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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.
|
// GetDomainAliases retrieves the list of Domain Aliases.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
//
|
//
|
||||||
// This method executes the GETDOMAINALIASES CLI command.
|
// 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.
|
// GetDomainEffectiveSettings retrieves both explicitly set and default Domain settings.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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.
|
// GetDomainLocation retrieves the Domain file directory path relative to the Server base.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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.
|
// GetDomainMailRules retrieves the list of Domain Queue Mail Rules.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
//
|
//
|
||||||
// This method executes the GETDOMAINMAILRULES CLI command.
|
// 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.
|
// GetDomainSettings retrieves explicitly set (non-default) Domain settings.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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.
|
// GetDomainSignalRules retrieves the list of Domain Signal Rules.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
//
|
//
|
||||||
// This method executes the GETDOMAINSIGNALRULES CLI command.
|
// 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.
|
// InsertDirectoryRecords inserts records for Domain objects into the Directory.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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.
|
// IsDomainExists checks if a domain exists by attempting to retrieve its location.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of the domain to check.
|
// - domain: the Domain name.
|
||||||
//
|
//
|
||||||
// Returns:
|
// Returns:
|
||||||
// - bool: true if the domain exists.
|
// - 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.
|
// ResumeDomain resumes a suspended Domain so Accounts can be opened.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of the Domain to be resumed.
|
// - domain: the Domain name.
|
||||||
//
|
//
|
||||||
// This method executes the RESUMEDOMAIN CLI command.
|
// This method executes the RESUMEDOMAIN CLI command.
|
||||||
//
|
//
|
||||||
@@ -426,7 +421,7 @@ func (cli *Cli) ResumeDomain(domain string) error {
|
|||||||
// SetAccountDefaultPrefs replaces the Default Account Preferences for the Domain.
|
// SetAccountDefaultPrefs replaces the Default Account Preferences for the Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
||||||
// - settings: a dictionary used to replace the Default Account Preferences.
|
// - settings: a dictionary used to replace the Default Account Preferences.
|
||||||
//
|
//
|
||||||
// This method executes the SETACCOUNTDEFAULTPREFS CLI command.
|
// This method executes the SETACCOUNTDEFAULTPREFS 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.
|
// SetDomainAliases sets the Domain aliases, replacing all existing ones.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
// - aliases: an array of Domain alias name strings.
|
// - aliases: an array of Domain alias name strings.
|
||||||
//
|
//
|
||||||
// This method executes the SETDOMAINALIASES CLI command.
|
// 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.
|
// SetDomainMailRules sets the Domain Queue Mail Rules, replacing all old ones.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
// - rules: an array containing the new Domain Queue Rules.
|
// - rules: an array containing the new Domain Queue Rules.
|
||||||
//
|
//
|
||||||
// This method executes the SETDOMAINMAILRULES CLI command.
|
// This method executes the SETDOMAINMAILRULES CLI command.
|
||||||
@@ -511,7 +506,7 @@ func (cli *Cli) SetDomainMailRules(domain string, rules []MailRule) error {
|
|||||||
// SetDomainSettings replaces the entire Domain settings dictionary.
|
// SetDomainSettings replaces the entire Domain settings dictionary.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
// - settings: a dictionary used to replace the Domain settings.
|
// - settings: a dictionary used to replace the Domain settings.
|
||||||
//
|
//
|
||||||
// This method executes the SETDOMAINSETTINGS CLI command.
|
// 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.
|
// SetDomainSignalRules sets the Domain Signal Rules, replacing all old ones.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain.
|
// - domain: the Domain name.
|
||||||
// - rules: an array containing the new Domain Signal Rules.
|
// - rules: an array containing the new Domain Signal Rules.
|
||||||
//
|
//
|
||||||
// This method executes the SETDOMAINSIGNALRULES CLI command.
|
// 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.
|
// SuspendDomain suspends a Domain, closing active accounts and preventing new ones.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of the Domain to be suspended.
|
// - domain: the Domain name.
|
||||||
//
|
//
|
||||||
// This method executes the SUSPENDDOMAIN CLI command.
|
// This method executes the SUSPENDDOMAIN CLI command.
|
||||||
//
|
//
|
||||||
@@ -561,7 +556,7 @@ func (cli *Cli) SuspendDomain(domain string) error {
|
|||||||
// UpdateAccountDefaultPrefs modifies the Domain Default Account Preferences.
|
// UpdateAccountDefaultPrefs modifies the Domain Default Account Preferences.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
||||||
// - settings: a dictionary used to modify the Domain Default Account Preferences.
|
// - settings: a dictionary used to modify the Domain Default Account Preferences.
|
||||||
//
|
//
|
||||||
// This method executes the UPDATEACCOUNTDEFAULTPREFS CLI command.
|
// This method executes the UPDATEACCOUNTDEFAULTPREFS CLI command.
|
||||||
@@ -578,7 +573,7 @@ func (cli *Cli) UpdateAccountDefaultPrefs(domain string, settings map[string]any
|
|||||||
// UpdateAccountDefaults modifies the Default Account settings for the specified Domain.
|
// UpdateAccountDefaults modifies the Default Account settings for the specified Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the Domain name. If empty, applies to the administrator Domain.
|
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
|
||||||
// - settings: a dictionary used to modify the Domain Default Account settings.
|
// - settings: a dictionary used to modify the Domain Default Account settings.
|
||||||
//
|
//
|
||||||
// This method executes the UPDATEACCOUNTDEFAULTS CLI command.
|
// This method executes the UPDATEACCOUNTDEFAULTS CLI command.
|
||||||
@@ -595,7 +590,7 @@ func (cli *Cli) UpdateAccountDefaults(domain string, settings map[string]any) er
|
|||||||
// UpdateAccountTemplate modifies the Account Template settings for the Domain.
|
// UpdateAccountTemplate modifies the Account Template settings for the Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the Domain name. If empty, applies to the administrator Domain.
|
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
|
||||||
// - settings: a dictionary used to modify the Domain Account Template.
|
// - settings: a dictionary used to modify the Domain Account Template.
|
||||||
//
|
//
|
||||||
// This method executes the UPDATEACCOUNTTEMPLATE CLI command.
|
// This method executes the UPDATEACCOUNTTEMPLATE CLI command.
|
||||||
@@ -612,7 +607,7 @@ func (cli *Cli) UpdateAccountTemplate(domain string, settings map[string]any) er
|
|||||||
// UpdateDomainSettings updates specific Domain settings without modifying others.
|
// UpdateDomainSettings updates specific Domain settings without modifying others.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the name of an existing Domain. If empty, uses the current context.
|
// - domain: an optional Domain name.
|
||||||
// - settings: a dictionary containing the settings to update.
|
// - settings: a dictionary containing the settings to update.
|
||||||
//
|
//
|
||||||
// This method executes the UPDATEDOMAINSETTINGS CLI command.
|
// This method executes the UPDATEDOMAINSETTINGS CLI command.
|
||||||
|
|||||||
@@ -129,6 +129,12 @@ func TestDomainAdministration(t *testing.T) {
|
|||||||
if err := cli.DeleteDirectoryRecords(targetDomain); err != nil {
|
if err := cli.DeleteDirectoryRecords(targetDomain); err != nil {
|
||||||
t.Errorf("DeleteDirectoryRecords failed: %v", err)
|
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. Состояние домена
|
// 7. Состояние домена
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import (
|
|||||||
// This operation is allowed only when the Directory-based Domains are enabled.
|
// This operation is allowed only when the Directory-based Domains are enabled.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the Domain name to create.
|
// - domain: the Domain name.
|
||||||
// - settings: an optional dictionary specifying the Domain settings.
|
// - settings: an optional dictionary specifying the Domain settings.
|
||||||
//
|
//
|
||||||
// This method executes the CREATEDIRECTORYDOMAIN CLI command.
|
// This method executes the CREATEDIRECTORYDOMAIN CLI command.
|
||||||
@@ -49,7 +49,7 @@ func (cli *Cli) CreateDirectoryDomain(domain string, settings map[string]any) er
|
|||||||
// CreateDomain creates a new secondary Domain.
|
// CreateDomain creates a new secondary Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: the Domain name to create.
|
// - domain: the Domain name.
|
||||||
// - shared: if true, creates a Cluster-wide Domain (Dynamic Cluster only).
|
// - shared: if true, creates a Cluster-wide Domain (Dynamic Cluster only).
|
||||||
// - storage: an optional "storage mount point" directory name (without .mnt suffix).
|
// - storage: an optional "storage mount point" directory name (without .mnt suffix).
|
||||||
// - settings: an optional dictionary specifying the initial Domain settings.
|
// - settings: an optional dictionary specifying the initial Domain settings.
|
||||||
@@ -103,7 +103,7 @@ func (cli *Cli) CreateDomainStorage(storage string, shared bool) error {
|
|||||||
// DeleteDomain removes an existing Domain.
|
// DeleteDomain removes an existing Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// - force: if true, removes the Domain even if it contains accounts or other objects.
|
||||||
//
|
//
|
||||||
// This method executes the DELETEDOMAIN CLI command.
|
// This method executes the DELETEDOMAIN CLI command.
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ func (cli *Cli) GetForwarder(forwarder string) (string, error) {
|
|||||||
// ListForwarders retrieves the list of all Forwarders in the Domain.
|
// ListForwarders retrieves the list of all Forwarders in the Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// This method executes the LISTFORWARDERS CLI command.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ func (cli *Cli) IsGroupExists(group string) (bool, error) {
|
|||||||
// ListGroups retrieves the list of all Groups in the Domain.
|
// ListGroups retrieves the list of all Groups in the Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// This method executes the LISTGROUPS CLI command.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ func (cli *Cli) ListClusterPBXFiles(language string) (map[string]*FileInfo, erro
|
|||||||
// ListDomainPBXFiles lists files in the Domain Real-Time Application Environment.
|
// ListDomainPBXFiles lists files in the Domain Real-Time Application Environment.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// - language: an optional national subset name.
|
||||||
//
|
//
|
||||||
// This method executes the LISTDOMAINPBXFILES CLI command.
|
// This method executes the LISTDOMAINPBXFILES CLI command.
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func (cli *Cli) GetAccountStat(account string, key string) (any, error) {
|
|||||||
// GetDomainStat retrieves statistics data about the specified Domain.
|
// GetDomainStat retrieves statistics data about the specified Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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 the name of the statistical entry to retrieve.
|
||||||
//
|
//
|
||||||
@@ -100,7 +100,7 @@ func (cli *Cli) ResetAccountStat(account string, key string) error {
|
|||||||
// ResetDomainStat resets statistics data about the specified Domain.
|
// ResetDomainStat resets statistics data about the specified Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// 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.
|
// 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 the name of the statistical entry to reset.
|
||||||
// If the key is not specified, all Domain statistical entries are reset.
|
// If the key is not specified, all Domain statistical entries are reset.
|
||||||
|
|||||||
3
tasks.go
3
tasks.go
@@ -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.
|
// ListDomainNamedTasks retrieves the list of all Named Tasks in the Domain.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional Domain name. If the Domain name is not specified,
|
// - domain: an optional Domain name. If empty, applies to the administrator Domain.
|
||||||
// the command applies to the administrator Domain.
|
|
||||||
//
|
//
|
||||||
// This method executes the LISTDOMAINNAMEDTASKS CLI command.
|
// This method executes the LISTDOMAINNAMEDTASKS CLI command.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ func (cli *Cli) FindAccountSession(account, addr, origAddr, protocol, transport,
|
|||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - sessionID: the Session ID.
|
// - 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.
|
// This method executes the GETSESSION CLI command.
|
||||||
//
|
//
|
||||||
@@ -222,7 +222,7 @@ func (cli *Cli) GetSession(sessionID, domain string) (map[string]any, error) {
|
|||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - sessionID: the Session ID.
|
// - 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.
|
// This method executes the KILLSESSION CLI command.
|
||||||
//
|
//
|
||||||
@@ -309,7 +309,7 @@ func (cli *Cli) ListLiteSessions(addr, origAddr string) ([]string, error) {
|
|||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - sessionID: the Session ID.
|
// - 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.
|
||||||
// - file: the name for the File Storage file.
|
// - file: the name for the File Storage file.
|
||||||
// - uploadID: identifies a file in the "uploaded file set".
|
// - uploadID: identifies a file in the "uploaded file set".
|
||||||
// - offset: an optional the file position. Can be a positive number,
|
// - offset: an optional the file position. Can be a positive number,
|
||||||
@@ -351,7 +351,7 @@ func (cli *Cli) StoreSessionFile(sessionID, domain, file, uploadID string, offse
|
|||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - sessionID: the Session ID.
|
// - 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.
|
||||||
// - data: the dictionary that lists new values for the attributes
|
// - data: the dictionary that lists new values for the attributes
|
||||||
// to be updated.
|
// to be updated.
|
||||||
//
|
//
|
||||||
|
|||||||
16
web_skins.go
16
web_skins.go
@@ -42,7 +42,7 @@ func (cli *Cli) CreateClusterSkin(skin string) error {
|
|||||||
// CreateDomainSkin creates a custom Domain Skin.
|
// CreateDomainSkin creates a custom Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - skin: the name of the new Skin. To create the unnamed Domain
|
// - skin: the name of the new Skin. To create the unnamed Domain
|
||||||
// Skin, specify an empty string.
|
// Skin, specify an empty string.
|
||||||
//
|
//
|
||||||
@@ -111,7 +111,7 @@ func (cli *Cli) DeleteClusterSkinFile(skin, file string) error {
|
|||||||
// DeleteDomainSkin deletes a custom Domain Skin.
|
// DeleteDomainSkin deletes a custom Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - skin: the name of the Skin to be deleted. To delete the
|
// - skin: the name of the Skin to be deleted. To delete the
|
||||||
// unnamed Domain Skin, specify an empty string.
|
// unnamed Domain Skin, specify an empty string.
|
||||||
//
|
//
|
||||||
@@ -131,7 +131,7 @@ func (cli *Cli) DeleteDomainSkin(domain, skin string) error {
|
|||||||
// DeleteDomainSkinFile removes a file from a custom Domain Skin.
|
// DeleteDomainSkinFile removes a file from a custom Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - skin: the name of an existing Domain Skin.
|
// - skin: the name of an existing Domain Skin.
|
||||||
// - file: the Skin file name to be deleted.
|
// - file: the Skin file name to be deleted.
|
||||||
//
|
//
|
||||||
@@ -217,7 +217,7 @@ func (cli *Cli) ListClusterSkins() ([]string, error) {
|
|||||||
// ListDomainSkinFiles lists files in a custom Domain Skin.
|
// ListDomainSkinFiles lists files in a custom Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - skin: the name of an existing Domain Skin.
|
// - skin: the name of an existing Domain Skin.
|
||||||
//
|
//
|
||||||
// This method executes the LISTDOMAINSKINFILES CLI command.
|
// This method executes the LISTDOMAINSKINFILES CLI command.
|
||||||
@@ -245,7 +245,7 @@ func (cli *Cli) ListDomainSkinFiles(domain, skin string) (map[string]*FileInfo,
|
|||||||
// ListDomainSkins lists custom Domain Skins.
|
// ListDomainSkins lists custom Domain Skins.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
//
|
//
|
||||||
// This method executes the LISTDOMAINSKINS CLI command.
|
// This method executes the LISTDOMAINSKINS CLI command.
|
||||||
//
|
//
|
||||||
@@ -325,7 +325,7 @@ func (cli *Cli) ReadClusterSkinFile(skin, file string) ([]byte, time.Time, error
|
|||||||
// ReadDomainSkinFile reads a file from a custom Domain Skin.
|
// ReadDomainSkinFile reads a file from a custom Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - skin: the name of an existing Domain Skin.
|
// - skin: the name of an existing Domain Skin.
|
||||||
// - file: the name of an existing file in the Skin.
|
// - file: the name of an existing file in the Skin.
|
||||||
//
|
//
|
||||||
@@ -459,7 +459,7 @@ func (cli *Cli) RenameClusterSkin(oldSkin, newSkin string) error {
|
|||||||
// RenameDomainSkin renames a custom named Domain Skin.
|
// RenameDomainSkin renames a custom named Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - oldSkin: the name of an existing named Skin.
|
// - oldSkin: the name of an existing named Skin.
|
||||||
// - newSkin: the new name for the Skin.
|
// - newSkin: the new name for the Skin.
|
||||||
//
|
//
|
||||||
@@ -518,7 +518,7 @@ func (cli *Cli) StoreClusterSkinFile(skin, file string, data []byte) error {
|
|||||||
// StoreDomainSkinFile stores a file into a custom Domain Skin.
|
// StoreDomainSkinFile stores a file into a custom Domain Skin.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - domain: an optional the Domain name.
|
// - domain: an optional Domain name.
|
||||||
// - skin: the name of an existing Domain Skin.
|
// - skin: the name of an existing Domain Skin.
|
||||||
// - file: the Skin file name.
|
// - file: the Skin file name.
|
||||||
// - data: the file content.
|
// - data: the file content.
|
||||||
|
|||||||
Reference in New Issue
Block a user