directadmin

package module
v0.0.0-...-114aecd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

README

DirectAdmin Go SDK

Interface with a DirectAdmin installation using Go.

This library supports both the legacy/default DirectAdmin API, and their new modern API still in active development.

**Note: This is in an experimental state. While it's being used in production, the library is very likely to change ( especially in-line with DA's own changes). DA features are being added as needed on our end, but PRs are always welcome! **

If you wonder why something has been handled unusually, it's most likely a workaround required by one of DA's many quirks.

Login as Admin / Reseller / User

To open a session as an admin/reseller/user, follow the following code block:

package main

import (
	"time"

	"github.com/levelzerotechnology/directadmin-go"
)

func main() {
	api, err := directadmin.New("https://your.da.address:2222", 5*time.Second)
	if err != nil {
		panic(err)
	}

	userCtx, err := api.LoginAsUser("your_username", "some_password_or_key")
	if err != nil {
		panic(err)
	}

	usage, err := userCtx.GetMyUserUsage()
	if err != nil {
		panic(err)
	}

	userCtx.User.Usage = *usage
}

From here, you can call user functions via userCtx.

For example, if you wanted to print each of your databases to your terminal:

dbs, err := userCtx.GetDatabases()
if err != nil {
    log.Fatalln(err)
}

for _, db := range dbs {
    fmt.Println(db.Name)
}

License

BSD licensed. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	DatabaseFormatGZ  = DatabaseFormat("gz")
	DatabaseFormatSQL = DatabaseFormat("sql")
)
View Source
const (
	AccountRoleAdmin    = "admin"
	AccountRoleReseller = "reseller"
	AccountRoleUser     = "user"
)
View Source
const (
	PHPSelectorExtensionStateBuildIn  = "build-in"
	PHPSelectorExtensionStateDisabled = "disabled"
	PHPSelectorExtensionStateEnabled  = "enabled"
)
View Source
const (
	SoftaculousProtocolHTTP      = "1"
	SoftaculousProtocolHTTPWWW   = "2"
	SoftaculousProtocolHTTPS     = "3"
	SoftaculousProtocolHTTPSWWW  = "4"
	SoftaculousScriptIDWordPress = 26
)
View Source
const Unlimited int = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func New

func New(serverURL string, timeout time.Duration, cacheEnabled bool, debug bool) (*API, error)

func (*API) GetURL

func (a *API) GetURL() string

func (*API) LoginAsAdmin

func (a *API) LoginAsAdmin(username string, passkey string) (*AdminContext, error)

LoginAsAdmin verifies the provided credentials against the DA API, then returns an admin-level context. The passkey can either be the user's password, or a login key.

func (*API) LoginAsReseller

func (a *API) LoginAsReseller(username string, passkey string) (*ResellerContext, error)

LoginAsReseller verifies the provided credentials against the DA API, then returns a reseller-level context. The passkey can either be the user's password, or a login key.

func (*API) LoginAsUser

func (a *API) LoginAsUser(username string, passkey string) (*UserContext, error)

LoginAsUser verifies the provided credentials against the DA API, then returns a user-level context. The passkey can either be the user's password, or a login key.

type Admin

type Admin struct {
	Reseller
}

Admin inherits Reseller which inherits User.

type AdminContext

type AdminContext struct {
	ResellerContext
}

func (*AdminContext) ConvertResellerToUser

func (c *AdminContext) ConvertResellerToUser(username string, reseller string) error

ConvertResellerToUser (admin) converts the given reseller to a user account.

func (*AdminContext) ConvertUserToReseller

func (c *AdminContext) ConvertUserToReseller(username string) error

ConvertUserToReseller (admin) converts the given user account to a reseller account.

func (*AdminContext) CreateResellerPackage

func (c *AdminContext) CreateResellerPackage(pack ResellerPackage) error

CreateResellerPackage (admin) creates the provided package.

func (*AdminContext) DeleteResellerPackages

func (c *AdminContext) DeleteResellerPackages(packs ...string) error

DeleteResellerPackages (admin) deletes all the specified packs for the session user.

func (*AdminContext) DisableRedis

func (c *AdminContext) DisableRedis() error

DisableRedis (admin) disables Redis for the server.

func (*AdminContext) EnableRedis

func (c *AdminContext) EnableRedis() error

EnableRedis (admin) enables Redis for the server.

func (*AdminContext) GetAllUsers

func (c *AdminContext) GetAllUsers() ([]string, error)

GetAllUsers (admin) returns an array of all users.

func (*AdminContext) GetLicense

func (c *AdminContext) GetLicense() (*License, error)

func (*AdminContext) GetLoginHistory

func (c *AdminContext) GetLoginHistory() ([]*LoginHistory, error)

func (*AdminContext) GetRedisStatus

func (c *AdminContext) GetRedisStatus() (bool, string, error)

GetRedisStatus (admin) returns whether Redis is enabled and it's version.

func (*AdminContext) GetResellerPackage

func (c *AdminContext) GetResellerPackage(packageName string) (ResellerPackage, error)

GetResellerPackage (admin) returns the single specified package.

func (*AdminContext) GetResellerPackages

func (c *AdminContext) GetResellerPackages() ([]ResellerPackage, error)

GetResellerPackages (admin) returns all packages belonging to the session user.

func (*AdminContext) GetResellers

func (c *AdminContext) GetResellers() ([]string, error)

GetResellers (admin) returns an array of all resellers.

func (*AdminContext) LoginAsMyReseller

func (c *AdminContext) LoginAsMyReseller(username string) (*ResellerContext, error)

LoginAsMyReseller logs the current admin into the given reseller's account.

func (*AdminContext) MoveUserToReseller

func (c *AdminContext) MoveUserToReseller(username string, reseller string) error

MoveUserToReseller (admin) moves the given user to the given reseller.

func (*AdminContext) RenameResellerPackage

func (c *AdminContext) RenameResellerPackage(oldPackName string, newPackName string) error

RenameResellerPackage (admin) renames the provided package.

func (*AdminContext) RestartDirectAdmin

func (c *AdminContext) RestartDirectAdmin() error

RestartDirectAdmin (admin) restarts the DirectAdmin process on the server.

func (*AdminContext) UpdateDirectAdmin

func (c *AdminContext) UpdateDirectAdmin() error

UpdateDirectAdmin (admin) initiates a DirectAdmin update on the server.

func (*AdminContext) UpdateHostname

func (c *AdminContext) UpdateHostname(hostname string) error

UpdateHostname (admin) updates the server's hostname.

func (*AdminContext) UpdateResellerPackage

func (c *AdminContext) UpdateResellerPackage(pack ResellerPackage) error

UpdateResellerPackage (admin) accepts a Package object and updates the version on DA with it.

type BasicSysInfo

type BasicSysInfo struct {
	AllowPasswordReset bool      `json:"allowPasswordReset"`
	Hostname           string    `json:"hostname"`
	Languages          []string  `json:"languages"`
	LicenseError       string    `json:"licenseError"`
	LicenseTrial       bool      `json:"licenseTrial"`
	LicenseValid       bool      `json:"licenseValid"`
	OtpTrustDays       int       `json:"otpTrustDays"`
	Time               time.Time `json:"time"`
}

type DNSRecord

type DNSRecord struct {
	Name  string `json:"name"`
	TTL   int    `json:"ttl"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

type Database

type Database struct {
	Name             string `json:"database"`
	DefaultCharset   string `json:"defaultCharset"`
	DefaultCollation string `json:"defaultCollation"`
	DefinerIssues    int    `json:"definerIssues"`
	EventCount       int    `json:"eventCount"`
	RoutineCount     int    `json:"routineCount"`
	SizeBytes        int    `json:"sizeBytes"`
	TableCount       int    `json:"tableCount"`
	TriggerCount     int    `json:"triggerCount"`
	UserCount        int    `json:"userCount"`
	ViewCount        int    `json:"viewCount"`
}

type DatabaseFormat

type DatabaseFormat string

type DatabaseProcess

type DatabaseProcess struct {
	Command  string `json:"command"`
	Database string `json:"database"`
	Host     string `json:"host"`
	ID       int    `json:"id"`
	Info     string `json:"info"`
	State    string `json:"state"`
	Time     int    `json:"time"`
	User     string `json:"user"`
}

type DatabaseUser

type DatabaseUser struct {
	HostPatterns []string `json:"hostPatterns"`
	Password     string   `json:"password"`
	User         string   `json:"dbuser"`
}

type DatabaseWithUser

type DatabaseWithUser struct {
	Database
	Password string `json:"password"`
	User     string `json:"dbuser"`
}

type Domain

type Domain struct {
	Active             bool     `json:"active" yaml:"active"`
	BandwidthQuota     int      `json:"bandwidthQuota" yaml:"bandwidthQuota"`
	BandwidthUsage     int      `json:"bandwidthUsage" yaml:"bandwidthUsage"`
	CGIEnabled         bool     `json:"cgiEnabled" yaml:"cgiEnabled"`
	DefaultDomain      bool     `json:"defaultDomain" yaml:"defaultDomain"`
	DiskQuota          int      `json:"diskQuota" yaml:"diskQuota"`
	DiskUsage          int      `json:"diskUsage" yaml:"diskUsage"`
	Domain             string   `json:"domain" yaml:"domain"`
	IPAddresses        []string `json:"ipAddresses" yaml:"ipAddresses"`
	ModSecurityEnabled bool     `json:"modSecurityEnabled" yaml:"modSecurityEnabled"`
	OpenBaseDirEnabled bool     `json:"openBaseDirEnabled" yaml:"openBaseDirEnabled"`
	PHPEnabled         bool     `json:"phpEnabled" yaml:"phpEnabled"`
	PHPSelectorEnabled bool     `json:"phpSelectorEnabled" yaml:"phpSelectorEnabled"`
	PHPVersion         string   `json:"phpVersion" yaml:"phpVersion"`
	SafeMode           bool     `json:"safeMode" yaml:"safeMode"`
	SSLEnabled         bool     `json:"sslEnabled" yaml:"sslEnabled"`
	Subdomains         []string `json:"subdomains" yaml:"subdomains"`
	SubdomainUsage     int      `json:"subdomainUsage" yaml:"subdomainUsage"`
	Suspended          bool     `json:"suspended" yaml:"suspended"`
	Username           string   `json:"username" yaml:"username"`
}

type EmailAccount

type EmailAccount struct {
	DiskQuota int    `json:"diskQuota" yaml:"diskQuota"`
	DiskUsage int    `json:"diskUsage" yaml:"diskUsage"`
	Domain    string `json:"domain" yaml:"domain"`
	Password  string `json:"password" yaml:"password"`
	SendQuota int    `json:"sendQuota" yaml:"sendQuota"`
	SendUsage int    `json:"sendUsage" yaml:"sendUsage"`
	Suspended bool   `json:"suspended" yaml:"suspended"`
	Username  string `json:"username" yaml:"username"`
}

type FileMetadata

type FileMetadata struct {
	AccessTime time.Time `json:"accessTime"`
	BirthTime  time.Time `json:"birthTime"`
	ChangeTime time.Time `json:"changeTime"`
	GID        int       `json:"gid"`
	Group      string    `json:"group"`
	Mode       string    `json:"mode"`
	ModifyTime time.Time `json:"modifyTime"`
	Name       string    `json:"name"`
	SizeBytes  int       `json:"sizeBytes"`
	Symlink    struct {
		Resolved string `json:"resolved"`
		Target   string `json:"target"`
	} `json:"symlink"`
	Type     string `json:"type"`
	UID      int    `json:"uid"`
	UnixMode int    `json:"unixMode"`
	User     string `json:"user"`
}

type License

type License struct {
	Expires time.Time `json:"expires"`
	LID     int       `json:"lid"`
	Limits  struct {
		Legacy               bool `json:"legacy"`
		MaxAdminsOrResellers int  `json:"maxAdminsOrResellers"`
		MaxDomains           int  `json:"maxDomains"`
		MaxUsers             int  `json:"maxUsers"`
		OnlyVPS              bool `json:"onlyVPS"`
		ProPack              bool `json:"proPack"`
		Trial                bool `json:"trial"`
	} `json:"limits"`
	Name  string `json:"name"`
	PID   int    `json:"pid"`
	Type  string `json:"type"`
	UID   int    `json:"uid"`
	Usage struct {
		AdminsOrResellers int `json:"adminsOrResellers"`
		Domains           int `json:"domains"`
		Users             int `json:"users"`
	} `json:"usage"`
}

type LoginHistory

type LoginHistory struct {
	Attempts  int       `json:"attempts"`
	Host      string    `json:"host"`
	Timestamp time.Time `json:"timestamp"`
}

type LoginKeyURL

type LoginKeyURL struct {
	AllowNetworks []string  `json:"allowNetworks"`
	Created       time.Time `json:"created"`
	CreatedBy     string    `json:"createdBy"`
	Expires       time.Time `json:"expires"`
	ID            string    `json:"id"`
	RedirectURL   string    `json:"redirectURL"`
	URL           string    `json:"url"`
}

type Message

type Message struct {
	From      string    `json:"from"`
	FromName  string    `json:"fromName"`
	ID        int       `json:"id"`
	LegacyID  string    `json:"legacyID"`
	Message   string    `json:"message"`
	Subject   string    `json:"subject"`
	Timestamp time.Time `json:"timestamp"`
	Unread    bool      `json:"unread"`
}

type PHPSelectorExtension

type PHPSelectorExtension struct {
	Description string `json:"description"`
	Name        string `json:"name"`
	State       string `json:"state"`
}

PHPSelectorExtension represents a PHP extension configuration.

type PHPSelectorList

type PHPSelectorList struct {
	AvailableVersions  []*PHPSelectorVersion `json:"available_versions"`
	DefaultVersion     string                `json:"default_version"`
	DomainsTabIsHidden bool                  `json:"domains_tab_is_hidden"`
	ExtensionsIsHidden bool                  `json:"extensions_is_hidden"`
	Result             string                `json:"result"`
	SelectedVersion    string                `json:"selected_version"`
	SelectorEnabled    bool                  `json:"selector_enabled"`
	Timestamp          float64               `json:"timestamp"`
}

func (*PHPSelectorList) GetVersion

func (l *PHPSelectorList) GetVersion(version string) (*PHPSelectorVersion, error)

GetVersion retrieves the given PHP version with its extensions.

type PHPSelectorOption

type PHPSelectorOption struct {
	Comment string `json:"comment"`
	Default string `json:"default"`
	Range   string `json:"range,omitempty"`
	Type    string `json:"type"`
}

PHPSelectorOption represents a PHP configuration option.

type PHPSelectorVersion

type PHPSelectorVersion struct {
	Extensions   []*PHPSelectorExtension       `json:"extensions"`
	NameModifier string                        `json:"name_modifier"`
	Options      map[string]*PHPSelectorOption `json:"options"`
	Status       string                        `json:"status"`
	Version      string                        `json:"version"`
}

PHPSelectorVersion represents a single PHP version configuration.

func (*PHPSelectorVersion) GetEnabledExtensions

func (v *PHPSelectorVersion) GetEnabledExtensions() []string

GetEnabledExtensions returns a slice of enabled and built-in extensions for the given PHP version.

type PHPVersion

type PHPVersion struct {
	ID       string `json:"value"`
	Selected bool   `json:"selected"`
	Text     string `json:"text"`
	Version  string `json:"version"`
}

type Package

type Package struct {
	AnonymousFTPEnabled     bool   `json:"anonymousFTPEnabled" yaml:"anonymousFTPEnabled"`
	BandwidthQuota          int    `json:"bandwidthQuota" yaml:"bandwidthQuota"`
	CPUQuota                int    `json:"cpuQuota" yaml:"cpuQuota"`
	CatchallEnabled         bool   `json:"catchallEnabled" yaml:"catchallEnabled"`
	CGIEnabled              bool   `json:"cgiEnabled" yaml:"cgiEnabled"`
	CronEnabled             bool   `json:"cronEnabled" yaml:"cronEnabled"`
	DNSControlEnabled       bool   `json:"dnsControlEnabled" yaml:"dnsControlEnabled"`
	DomainPointerQuota      int    `json:"domainPointerQuota" yaml:"domainPointerQuota"`
	DomainQuota             int    `json:"domainQuota" yaml:"domainQuota"`
	EmailAutoresponderQuota int    `json:"emailAutoresponderQuota" yaml:"emailAutoresponderQuota"`
	EmailForwarderQuota     int    `json:"emailForwarderQuota" yaml:"emailForwarderQuota"`
	EmailMailingListQuota   int    `json:"emailMailingListQuota" yaml:"emailMailingListQuota"`
	EmailQuota              int    `json:"emailQuota" yaml:"emailQuota"`
	FTPQuota                int    `json:"ftp" yaml:"ftpQuota"`
	GitEnabled              bool   `json:"gitEnabled" yaml:"gitEnabled"`
	IOReadBandwidthMax      int    `json:"ioReadBandwidthMax" yaml:"ioReadBandwidthMax"`
	IOReadIopsMax           int    `json:"ioReadIopsMax" yaml:"ioReadIopsMax"`
	IOWriteBandwidthMax     int    `json:"ioWriteBandwidthMax" yaml:"ioWriteBandwidthMax"`
	IOWriteIopsMax          int    `json:"ioWriteIopsMax" yaml:"ioWriteIopsMax"`
	InodeQuota              int    `json:"inodeQuota" yaml:"inodeQuota"`
	JailEnabled             bool   `json:"jailEnabled" yaml:"jailEnabled"`
	Language                string `json:"language" yaml:"language"`
	LoginKeysEnabled        bool   `json:"loginKeysEnabled" yaml:"loginKeysEnabled"`
	MemoryHigh              int    `json:"memoryHigh" yaml:"memoryHigh"`
	MemoryMax               int    `json:"memoryMax" yaml:"memoryMax"`
	MySQLQuota              int    `json:"mySQLQuota" yaml:"mySQLQuota"`
	Name                    string `json:"name" yaml:"name"`
	NginxEnabled            bool   `json:"nginxEnabled" yaml:"nginxEnabled"`
	PHPEnabled              bool   `json:"phpEnabled" yaml:"phpEnabled"`
	Quota                   int    `json:"quota" yaml:"quota"`
	RedisEnabled            bool   `json:"redisEnabled" yaml:"redisEnabled"`
	SSHEnabled              bool   `json:"sshEnabled" yaml:"sshEnabled"`
	Skin                    string `json:"skin" yaml:"skin"`
	SpamAssassinEnabled     bool   `json:"spamAssassinEnabled" yaml:"spamAssassinEnabled"`
	SSLEnabled              bool   `json:"sslEnabled" yaml:"sslEnabled"`
	SubdomainQuota          int    `json:"subdomainQuota" yaml:"subdomainQuota"`
	SuspendAtLimitEnabled   bool   `json:"suspendAtLimitEnabled" yaml:"suspendAtLimitEnabled"`
	SysInfoEnabled          bool   `json:"sysInfoEnabled" yaml:"sysInfoEnabled"`
	TasksMax                int    `json:"tasksMax" yaml:"tasksMax"`
	WordPressEnabled        bool   `json:"wordpressEnabled" yaml:"wordpressEnabled"`
}

type Plugin

type Plugin struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	MenuEntry struct {
		Title string `json:"title"`
		URL   string `json:"url"`
		Icon  string `json:"icon"`
	} `json:"menuEntry"`
}

type Reseller

type Reseller struct {
	User
}

Reseller inherits User.

type ResellerContext

type ResellerContext struct {
	UserContext
}

func (*ResellerContext) AddUserIP

func (c *ResellerContext) AddUserIP(username string, ip string) error

AddUserIP (reseller) adds an additional IP to a user's account.

func (*ResellerContext) CheckUserExists

func (c *ResellerContext) CheckUserExists(username string) error

CheckUserExists (reseller) checks if the given user exists.

func (*ResellerContext) CreatePackage

func (c *ResellerContext) CreatePackage(pack Package) error

CreatePackage (reseller) creates the provided package.

func (*ResellerContext) CreateUser

func (c *ResellerContext) CreateUser(user UserConfig, password string, emailUser bool) error

CreateUser (reseller) create a user.

The following fields must be populated: Domain, Email, IPAddresses, Package, Username.

func (*ResellerContext) DeletePackages

func (c *ResellerContext) DeletePackages(packs ...string) error

DeletePackages (reseller) deletes all the specified packs for the session user.

func (*ResellerContext) DeleteUsers

func (c *ResellerContext) DeleteUsers(usernames ...string) error

DeleteUsers (reseller) deletes all the users associated with the given usernames.

func (*ResellerContext) GetMyUsers

func (c *ResellerContext) GetMyUsers() ([]string, error)

GetMyUsers (reseller) returns all users belonging to the session user.

func (*ResellerContext) GetMyUsersWithData

func (c *ResellerContext) GetMyUsersWithData(retrieveConfig bool, retrieveUsage bool) ([]User, error)

GetMyUsersWithData (reseller) returns all users belonging to the session user, along with the toggled data (config and/or usage).

func (*ResellerContext) GetPackage

func (c *ResellerContext) GetPackage(packageName string) (Package, error)

GetPackage (reseller) returns the single specified package.

func (*ResellerContext) GetPackages

func (c *ResellerContext) GetPackages() ([]Package, error)

GetPackages (reseller) returns all packages belonging to the session user.

func (*ResellerContext) GetUserConfig

func (c *ResellerContext) GetUserConfig(username string) (*UserConfig, error)

GetUserConfig (reseller) returns the given user's config.

func (*ResellerContext) GetUserUsage

func (c *ResellerContext) GetUserUsage(username string) (*UserUsage, error)

GetUserUsage (reseller) returns the given user's usage.

func (*ResellerContext) LoginAsMyUser

func (c *ResellerContext) LoginAsMyUser(username string) (*UserContext, error)

LoginAsMyUser logs the current reseller into the given user's account.

func (*ResellerContext) RenamePackage

func (c *ResellerContext) RenamePackage(oldPackName string, newPackName string) error

RenamePackage (reseller) renames the provided package.

func (*ResellerContext) SuspendUser

func (c *ResellerContext) SuspendUser(username string) error

func (*ResellerContext) SuspendUsers

func (c *ResellerContext) SuspendUsers(usernames ...string) error

func (*ResellerContext) UnsuspendUser

func (c *ResellerContext) UnsuspendUser(username string) error

func (*ResellerContext) UnsuspendUsers

func (c *ResellerContext) UnsuspendUsers(usernames ...string) error

func (*ResellerContext) UpdatePackage

func (c *ResellerContext) UpdatePackage(pack Package) error

UpdatePackage (reseller) accepts a Package object and updates the version on DA with it.

type ResellerPackage

type ResellerPackage struct {
	Package
	OversellEnabled bool `json:"oversellEnabled" url:"oversellEnabled"`
	UserQuota       int  `json:"userQuota" url:"userQuota"`
}

type Session

type Session struct {
	AllowedCommands []string `json:"allowedCommands"`
	ConfigFeatures  struct {
		Auth2FA                         bool `json:"auth2FA"`
		BruteforceLogScanner            bool `json:"bruteforceLogScanner"`
		CGroup                          bool `json:"cgroup"`
		ClamAV                          bool `json:"clamav"`
		Composer                        bool `json:"composer"`
		DNSSEC                          int  `json:"dnssec"`
		Git                             bool `json:"git"`
		IMAPSync                        bool `json:"imapsync"`
		Inode                           bool `json:"inode"`
		IPv6                            bool `json:"IPv6"`
		Jail                            int  `json:"jail"`
		MXWithoutDNSControl             bool `json:"mxWithoutDNSControl"`
		NetdataSock                     bool `json:"netdataSock"`
		Nginx                           bool `json:"nginx"`
		NginxProxy                      bool `json:"nginxProxy"`
		NginxTemplates                  bool `json:"nginxTemplates"`
		OneClickPMALogin                bool `json:"oneClickPMALogin"`
		PHPMyAdmin                      bool `json:"phpmyadmin"`
		Redis                           bool `json:"redis"`
		ResellerCustomizeSkinConfigJSON bool `json:"resellerCustomizeSkinConfigJSON"`
		Roundcube                       bool `json:"roundcube"`
		RspamdSock                      bool `json:"rspamdSock"`
		SecurityQuestions               bool `json:"securityQuestions"`
		SquirrelMail                    bool `json:"squirrelMail"`
		Unit                            bool `json:"unit"`
		Webmail                         bool `json:"webmail"`
		WordPress                       bool `json:"wordpress"`
	} `json:"configFeatures"`
	CustomDomainItems []struct {
		Checked     bool   `json:"checked"`
		Default     string `json:"default"`
		Description string `json:"description"`
		Hidden      bool   `json:"hidden"`
		Label       string `json:"label"`
		Name        string `json:"name"`
		Options     []struct {
			Text  string `json:"text"`
			Value string `json:"value"`
		} `json:"options"`
		ReadOnly bool   `json:"readOnly"`
		Type     string `json:"type"`
	} `json:"customDomainItems"`
	CustombuildOptions struct {
		ModSecurity bool `json:"modSecurity"`
	} `json:"custombuildOptions"`
	Demo              bool `json:"demo"`
	DirectadminConfig struct {
		AllowForwarderPipe                 bool     `json:"allowForwarderPipe"`
		FTPSeparator                       string   `json:"ftpSeparator"`
		HomeOverrides                      []string `json:"homeOverrides"`
		LoginKeys                          bool     `json:"loginKeys"`
		MaxFilesizeBytes                   int      `json:"maxFilesizeBytes"`
		ResellerWarningBandwidthPercentage int      `json:"resellerWarningBandwidthPercentage"`
		ShowPointersInList                 int      `json:"showPointersInList"`
		TableDefaultIPP                    int      `json:"tableDefaultIPP"`
		UserWarningBandwidthPercentage     int      `json:"userWarningBandwidthPercentage"`
		UserWarningInodePercentage         int      `json:"userWarningInodePercentage"`
		UserWarningQuotaPercentage         int      `json:"userWarningQuotaPercentage"`
		WebappsSSL                         bool     `json:"webappsSSL"`
		WebmailHideLinks                   bool     `json:"webmailHideLinks"`
		WebmailLink                        string   `json:"webmailLink"`
	} `json:"directadminConfig"`
	EffectiveRole           string `json:"effectiveRole"`
	EffectiveUsername       string `json:"effectiveUsername"`
	HavePluginHooksAdmin    bool   `json:"havePluginHooksAdmin"`
	HavePluginHooksReseller bool   `json:"havePluginHooksReseller"`
	HavePluginHooksUser     bool   `json:"havePluginHooksUser"`
	HomeDir                 string `json:"homeDir"`
	LoginAsDNSControl       bool   `json:"loginAsDNSControl"`
	PHPMyAdminPublic        bool   `json:"phpmyadminPublic"`
	RealUsername            string `json:"realUsername"`
	SelectedDomain          string `json:"selectedDomain"`
	SessionID               string `json:"sessionID"`
	TicketsEnabled          bool   `json:"ticketsEnabled"`
}

type SoftaculousInstallation

type SoftaculousInstallation struct {
	ID                string `json:"insid"`
	ScriptID          int    `json:"sid"`
	Ver               string `json:"ver"`
	ITime             int    `json:"itime"`
	Path              string `json:"softpath"`
	URL               string `json:"softurl"`
	Domain            string `json:"softdomain"`
	FileIndex         any    `json:"fileindex"` // Sometimes a string slice, other times a map.
	SiteName          string `json:"site_name"`
	SoftDB            string `json:"softdb"`
	SoftDBuser        string `json:"softdbuser"`
	SoftDBhost        string `json:"softdbhost"`
	SoftDBpass        string `json:"softdbpass"`
	DBCreated         bool   `json:"dbcreated"`
	DBPrefix          string `json:"dbprefix"`
	ImportSrc         string `json:"import_src"`
	DisplaySoftDBPass string `json:"display_softdbpass"`
	ScriptName        string `json:"script_name"`
}

type SoftaculousScript

type SoftaculousScript struct {
	AdminEmail         string `url:"admin_email"`
	AdminPassword      string `url:"admin_pass"`
	AdminUsername      string `url:"admin_username"`
	AutoUpgrade        bool   `url:"en_auto_upgrade"`
	AutoUpgradePlugins bool   `url:"auto_upgrade_plugins"`
	AutoUpgradeThemes  bool   `url:"auto_upgrade_plugins"`
	DatabaseName       string `url:"softdb"`
	DatabasePrefix     string `url:"dbprefix"` // Optional.
	Directory          string `url:"softdirectory"`
	Domain             string `url:"softdomain"`
	Language           string `url:"language"`
	NotifyOnInstall    bool   `url:"noemail"`
	NotifyOnUpdate     bool   `url:"disable_notify_update"`
	OverwriteExisting  bool   `url:"overwrite_existing"`
	Protocol           string `url:"softproto"`
	SiteDescription    string `url:"site_desc"`
	SiteName           string `json:"site_name"`
}

func SoftaculousScriptWithDefaults

func SoftaculousScriptWithDefaults() *SoftaculousScript

func (*SoftaculousScript) Parse

func (s *SoftaculousScript) Parse() (url.Values, error)

func (*SoftaculousScript) Validate

func (s *SoftaculousScript) Validate() error

type Subdomain

type Subdomain struct {
	Domain     string `json:"domain" yaml:"domain"`
	PHPVersion string `json:"phpVersion" yaml:"phpVersion"`
	PublicHTML string `json:"publicHTML" yaml:"publicHTML"`
	Subdomain  string `json:"subdomain" yaml:"subdomain"`
}

type SysInfo

type SysInfo struct {
	CPUCount int `json:"cpuCount" yaml:"cpuCount"`
	CPUs     map[string]struct {
		MHz    float64 `json:"mhz"`
		Model  string  `json:"model"`
		Vendor string  `json:"vendor"`
	}
	SystemLoad struct {
		Last1Minute   string `json:"last1Minute"`
		Last5Minutes  string `json:"last5Minutes"`
		Last15Minutes string `json:"last15Minutes"`
	} `json:"systemLoad"`
	MemInfo struct {
		Active            int `json:"active"`
		ActiveAnon        int `json:"activeAnon"`
		ActiveFile        int `json:"activeFile"`
		AnonHugePages     int `json:"anonHugePages"`
		AnonPages         int `json:"anonPages"`
		Bounce            int `json:"bounce"`
		Buffers           int `json:"buffers"`
		Cached            int `json:"cached"`
		CommitLimit       int `json:"commitLimit"`
		CommittedAS       int `json:"committedAs"`
		DirectMap1G       int `json:"directMap1G"`
		DirectMap2M       int `json:"directMap2M"`
		DirectMap4K       int `json:"directMap4K"`
		Dirty             int `json:"Dirty"`
		FileHugePages     int `json:"fileHugePages"`
		FilePmdMapped     int `json:"filePmdMapped"`
		HardwareCorrupted int `json:"hardwareCorrupted"`
		HugePagesFree     int `json:"hugePagesFree"`
		HugePagesRsvd     int `json:"hugePagesRsvd"`
		HugePagesSurp     int `json:"hugePagesSurp"`
		HugePagesTotal    int `json:"hugePagesTotal"`
		HugePageSize      int `json:"hugePageSize"`
		HugeTlb           int `json:"hugeTlb"`
		Inactive          int `json:"inactive"`
		InactiveAnon      int `json:"inactiveAnon"`
		InactiveFile      int `json:"inactiveFile"`
		KReclaimable      int `json:"kReclaimable"`
		KernelStack       int `json:"kernelStack"`
		Mapped            int `json:"mapped"`
		MemAvailable      int `json:"memAvailable"`
		MemFree           int `json:"memFree"`
		MemTotal          int `json:"memTotal"`
		MLocked           int `json:"mLocked"`
		NfsUnstable       int `json:"nfsUnstable"`
		PageTables        int `json:"pageTables"`
		PerCPU            int `json:"perCpu"`
		SReclaimable      int `json:"sReclaimable"`
		SUnreclaim        int `json:"sUnreclaim"`
		Shmem             int `json:"shmem"`
		ShmemHugePages    int `json:"shmemHugePages"`
		ShmemPmdMapped    int `json:"shmemPmdMapped"`
		Slab              int `json:"slab"`
		SwapCached        int `json:"swapCached"`
		SwapFree          int `json:"swapFree"`
		SwapTotal         int `json:"swapTotal"`
		Unevictable       int `json:"snevictable"`
		VMAllocChunk      int `json:"vmallocChunk"`
		VMAllocTotal      int `json:"vmallocTotal"`
		VMAllocUsed       int `json:"vmallocUsed"`
		Writeback         int `json:"writeback"`
		WritebackTMP      int `json:"writebackTmp"`
	} `json:"memory"`
	Services map[string]struct {
		Name    string `json:"name"`
		Status  string `json:"status"`
		Version string `json:"version"`
	} `json:"services"`
	Uptime struct {
		Days         string `json:"days"`
		Hours        string `json:"hours"`
		Minutes      string `json:"minutes"`
		TotalSeconds string `json:"totalSeconds"`
		Uptime       string `json:"uptime"`
	} `json:"uptime"`
}

type User

type User struct {
	Config UserConfig `json:"config"`
	Usage  UserUsage  `json:"usage"`
}

type UserConfig

type UserConfig struct {
	AccountEnabled           bool     `json:"account"`
	AFTPEnabled              bool     `json:"aftp"`
	APIAllowPassword         bool     `json:"apiAllowPassword"`
	AutorespondersLimit      int      `json:"autorespondersLim"`
	BandwidthLimit           int      `json:"bandwidthLim"`
	CatchAllEnabled          bool     `json:"catchAll"`
	CGIEnabled               bool     `json:"cgi"`
	ClamAVEnabled            bool     `json:"clamav"`
	CPUQuota                 string   `json:"cpuQuota"`
	Creator                  string   `json:"creator"`
	CronEnabled              bool     `json:"cron"`
	DateCreated              string   `json:"dateCreated"`
	DNSControlEnabled        bool     `json:"dnsControl"`
	DocsRoot                 string   `json:"docsRoot"`
	Domain                   string   `json:"domain"`
	DomainPointersLimit      int      `json:"domainPointersLim"`
	Domains                  []string `json:"domains"`
	DomainsLimit             int      `json:"domainsLim"`
	Email                    string   `json:"email"`
	EmailAccountsLimit       int      `json:"emailAccountsLim"`
	EmailForwardersLimit     int      `json:"emailForwardersLim"`
	FeatureSets              []string `json:"featureSets"`
	FTPAccountsLimit         int      `json:"ftpAccountsLim"`
	GitEnabled               bool     `json:"git"`
	InodeLimit               int      `json:"inodeLim"`
	IOReadBandwidthMax       string   `json:"ioReadBandwidthMax"`
	IOReadIOPSMax            string   `json:"ioReadIOPSMax"`
	IOWriteBandwidthMax      string   `json:"ioWriteBandwidthMax"`
	IOWriteIOPSMax           string   `json:"ioWriteIOPSMax"`
	IP                       string   `json:"ip"`
	JailEnabled              bool     `json:"jail"`
	Language                 string   `json:"language"`
	LetsEncrypt              int      `json:"letsEncrypt"`
	LoginKeysEnabled         bool     `json:"loginKeys"`
	MailPartition            string   `json:"mailPartition"`
	MailingListsLimit        int      `json:"mailingListsLim"`
	MemoryHigh               string   `json:"memoryHigh"`
	MemoryMax                string   `json:"memoryMax"`
	MySQLConf                string   `json:"mySqlConf"`
	MySQLDatabasesLimit      int      `json:"mySqlDatabasesLim"`
	Name                     string   `json:"name"`
	NginxEnabled             bool     `json:"nginxUnit"`
	NS1                      string   `json:"ns1"`
	NS2                      string   `json:"ns2"`
	Package                  string   `json:"package"`
	PHPEnabled               bool     `json:"php"`
	PluginsBlacklist         []string `json:"pluginsBlacklist"`
	PluginsWhitelist         []string `json:"pluginsWhitelist"`
	QuotaLimit               int      `json:"quotaLim"`
	RedisEnabled             bool     `json:"redis"`
	SecurityQuestionsEnabled bool     `json:"securityQuestions"`
	Skin                     string   `json:"skin"`
	SpamEnabled              bool     `json:"spam"`
	SSHEnabled               bool     `json:"ssh"`
	SSLEnabled               bool     `json:"ssl"`
	SubdomainsLimit          int      `json:"subdomainsLim"`
	Suspended                bool     `json:"suspended"`
	SysInfoEnabled           bool     `json:"sysInfo"`
	TasksMax                 string   `json:"tasksMax"`
	TwoStepAuthEnabled       bool     `json:"twoStepAuth"`
	TwoStepAuthDescription   string   `json:"twoStepAuthDesc"`
	UserType                 string   `json:"userType"`
	Username                 string   `json:"username"`
	Users                    []string `json:"users"`
	UsersLimit               int      `json:"usersLim"`
	UsersManageDomains       int      `json:"usersManageDomains"`
	WordPressEnabled         bool     `json:"wordpress"`
	Zoom                     int      `json:"zoom"`
}

type UserContext

type UserContext struct {
	User User
	// contains filtered or unexported fields
}

func (*UserContext) AddDomainIP

func (c *UserContext) AddDomainIP(domain string, ip string, createDNSRecords bool) error

AddDomainIP (user) adds an additional IP to a domain.

func (*UserContext) ChangeWordPressUserPassword

func (c *UserContext) ChangeWordPressUserPassword(locationID string, userID int, password string) error

ChangeWordPressUserPassword (user) changes the password of the given WordPress user.

func (*UserContext) CheckDNSRecordExists

func (c *UserContext) CheckDNSRecordExists(checkField string, domain string, dnsRecord DNSRecord) error

CheckDNSRecordExists (user) checks if the given dns record exists on the server.

checkField can be either "name" or "value".

func (*UserContext) CheckDomainExists

func (c *UserContext) CheckDomainExists(domain string) error

CheckDomainExists (user) checks if the given domain exists on the server.

func (*UserContext) CreateArchive

func (c *UserContext) CreateArchive(destinationPath string, sources ...string) error

CreateArchive (user) creates a zip of the given files on the server.

The destination path is relative by default.

func (*UserContext) CreateBackup

func (c *UserContext) CreateBackup(domain string, backupItems ...string) error

CreateBackup (user) creates an account backup for the given domain, and the given items.

func (*UserContext) CreateBackupAllItems

func (c *UserContext) CreateBackupAllItems(domain string) error

CreateBackupAllItems (user) wraps around CreateBackup and provides all available backup items.

func (*UserContext) CreateDNSRecord

func (c *UserContext) CreateDNSRecord(domain string, dnsRecord DNSRecord) error

CreateDNSRecord (user) creates the provided DNS record for the given domain.

func (*UserContext) CreateDatabase

func (c *UserContext) CreateDatabase(database *Database) error

CreateDatabase (user) creates a new database.

func (*UserContext) CreateDatabaseUser

func (c *UserContext) CreateDatabaseUser(databaseUser *DatabaseUser) error

CreateDatabaseUser (user) creates a new database user with the specified username, password, and host patterns. It prepends the username prefix if the caller didn't do it.

func (*UserContext) CreateDatabaseWithUser

func (c *UserContext) CreateDatabaseWithUser(database *DatabaseWithUser) error

CreateDatabaseWithUser (user) creates a new database and database user.

func (*UserContext) CreateDirectory

func (c *UserContext) CreateDirectory(path string) error

CreateDirectory (user) creates the given path, including any missing parent directories.

func (*UserContext) CreateDomain

func (c *UserContext) CreateDomain(domain Domain) error

CreateDomain (user) creates the provided domain for the session user.

func (*UserContext) CreateEmailAccount

func (c *UserContext) CreateEmailAccount(emailAccount EmailAccount) error

CreateEmailAccount (user) creates the given email account.

func (*UserContext) CreateEmailForwarder

func (c *UserContext) CreateEmailForwarder(domain string, user string, emails ...string) error

CreateEmailForwarder (user) creates the specified email forwarder.

func (*UserContext) CreateLoginURL

func (c *UserContext) CreateLoginURL(loginKeyURL *LoginKeyURL) error

func (*UserContext) CreateSession

func (c *UserContext) CreateSession() error

CreateSession (user) creates a session for the provided credentials if one does not already exist.

func (*UserContext) CreateSubdomain

func (c *UserContext) CreateSubdomain(subdomain Subdomain) error

CreateSubdomain (user) creates the provided subdomain for the session user. This automatically gets called if subdomains are included in the CreateDomain call. You cannot specify a custom directory here.

func (*UserContext) CreateWordPressInstall

func (c *UserContext) CreateWordPressInstall(install WordPressInstall, createDatabase bool) error

func (*UserContext) CreateWordPressInstallQuick

func (c *UserContext) CreateWordPressInstallQuick(install WordPressInstallQuick) error

CreateWordPressInstallQuick (user) creates a new wordpress install and automatically creates a database.

func (*UserContext) DeleteDNSRecords

func (c *UserContext) DeleteDNSRecords(dnsRecords ...DNSRecord) error

DeleteDNSRecords (user) deletes all the specified DNS records for the session user.

func (*UserContext) DeleteDatabase

func (c *UserContext) DeleteDatabase(databaseName string) error

DeleteDatabase (user) removes a database identified by databaseName after applying the username prefix.

func (*UserContext) DeleteDomains

func (c *UserContext) DeleteDomains(deleteData bool, domains ...string) error

DeleteDomains (user) deletes all the specified domains for the session user.

func (*UserContext) DeleteEmailAccount

func (c *UserContext) DeleteEmailAccount(domain string, name string) error

func (*UserContext) DeleteEmailForwarders

func (c *UserContext) DeleteEmailForwarders(domain string, names ...string) error

DeleteEmailForwarder deletes the specified email forwarder.

func (*UserContext) DeleteFiles

func (c *UserContext) DeleteFiles(skipTrash bool, files ...string) error

DeleteFiles (user) deletes all the specified files for the session user.

func (*UserContext) DeleteSubdomains

func (c *UserContext) DeleteSubdomains(deleteData bool, domain string, subdomains ...string) error

DeleteSubdomains (user) deletes all the specified subdomain for the session user.

func (*UserContext) DeleteWordPressInstall

func (c *UserContext) DeleteWordPressInstall(id string) error

func (*UserContext) DownloadDatabase

func (c *UserContext) DownloadDatabase(name string, format DatabaseFormat) ([]byte, error)

DownloadDatabase (user) retrieves a database by name and format from the server and returns its data as a byte slice. The method appends the username and ensures the file uses a valid DatabaseFormat (gz or sql). Returns an error if the format is invalid or the download request fails.

func (*UserContext) DownloadDatabaseToDisk

func (c *UserContext) DownloadDatabaseToDisk(name string, format DatabaseFormat, outputPath string) error

func (*UserContext) DownloadFile

func (c *UserContext) DownloadFile(filePath string) ([]byte, error)

DownloadFile (user) downloads the given file path from the server.

func (*UserContext) DownloadFileToDisk

func (c *UserContext) DownloadFileToDisk(filePath string, outputPath string) error

DownloadFileToDisk (user) wraps DownloadFile and writes the output to the given path.

func (*UserContext) ExportDatabase

func (c *UserContext) ExportDatabase(databaseName string, gzip bool) ([]byte, error)

ExportDatabase (user) returns an export of the given database.

func (*UserContext) ExtractArchive

func (c *UserContext) ExtractArchive(destinationDir string, source string, mergeAndOverwrite bool) error

ExtractArchive (user) unzips the given file path on the server.

func (*UserContext) GetBackups

func (c *UserContext) GetBackups(domain string) ([]string, error)

GetBackups (user) returns an array of the session user's backups for the given domain.

func (*UserContext) GetBasicSysInfo

func (c *UserContext) GetBasicSysInfo() (*BasicSysInfo, error)

func (*UserContext) GetDNSRecords

func (c *UserContext) GetDNSRecords(domain string) ([]DNSRecord, error)

GetDNSRecords (user) returns the given domain's DNS records.

func (*UserContext) GetDatabase

func (c *UserContext) GetDatabase(databaseName string) (*Database, error)

GetDatabase (user) returns the given database.

func (*UserContext) GetDatabaseProcesses

func (c *UserContext) GetDatabaseProcesses() ([]*DatabaseProcess, error)

GetDatabaseProcesses (admin) returns an array of current database processes.

func (*UserContext) GetDatabases

func (c *UserContext) GetDatabases() ([]*Database, error)

GetDatabases (user) returns an array of the session user's databases.

func (*UserContext) GetDomain

func (c *UserContext) GetDomain(domainName string) (Domain, error)

GetDomain (user) returns the single specified domain.

func (*UserContext) GetDomains

func (c *UserContext) GetDomains() ([]Domain, error)

GetDomains (user) returns the session user's domains.

func (*UserContext) GetEmailAccounts

func (c *UserContext) GetEmailAccounts(domain string) ([]EmailAccount, error)

GetEmailAccounts (user) returns an array of email accounts belonging to the provided domain.

func (*UserContext) GetEmailForwarders

func (c *UserContext) GetEmailForwarders(domain string) (map[string][]string, error)

GetEmailForwarders (user) returns an array of email forwarders belonging to the provided domain.

func (*UserContext) GetFileMetadata

func (c *UserContext) GetFileMetadata(filePath string) (*FileMetadata, error)

GetFileMetadata (user) retrieves file metadata for the given path.

func (*UserContext) GetLoginURLs

func (c *UserContext) GetLoginURLs() ([]*LoginKeyURL, error)

func (*UserContext) GetMessages

func (c *UserContext) GetMessages() ([]*Message, error)

GetMessages (user) returns an array of the session user's backups.

func (*UserContext) GetMyUserConfig

func (c *UserContext) GetMyUserConfig() (*UserConfig, error)

GetMyUserConfig (user) returns the session user's config.

func (*UserContext) GetMyUserUsage

func (c *UserContext) GetMyUserUsage() (*UserUsage, error)

GetMyUserUsage (user) returns the session user's usage.

func (*UserContext) GetMyUsername

func (c *UserContext) GetMyUsername() string

GetMyUsername returns the current user's username. This is particularly useful when logging in as another user, as it trims the admin/reseller username automatically.

func (*UserContext) GetPHPVersions

func (c *UserContext) GetPHPVersions(domainName string) ([]*PHPVersion, error)

GetPHPVersions (user) returns an array of the available PHP versions.

func (*UserContext) GetPlugins

func (c *UserContext) GetPlugins() ([]*Plugin, error)

GetPlugins (user) returns the list of plugins in-use.

func (*UserContext) GetSessionInfo

func (c *UserContext) GetSessionInfo() (*Session, error)

func (*UserContext) GetSysInfo

func (c *UserContext) GetSysInfo() (*SysInfo, error)

func (*UserContext) GetWordPressInstalls

func (c *UserContext) GetWordPressInstalls() ([]*WordPressLocation, error)
func (c *UserContext) GetWordPressSSOLink(locationID string, userID int) (string, error)

func (*UserContext) GetWordPressUsers

func (c *UserContext) GetWordPressUsers(locationID string) ([]*WordPressUser, error)

func (*UserContext) ImportDatabase

func (c *UserContext) ImportDatabase(databaseName string, emptyExistingDatabase bool, sql []byte) error

ImportDatabase (user) imports the given database export into the given database.

func (*UserContext) IssueSSL

func (c *UserContext) IssueSSL(domain string, hostnamesToCertify ...string) error

IssueSSL (user) requests a lets encrypt certificate for the given hostnames.

func (*UserContext) ListDomains

func (c *UserContext) ListDomains() (domainList []string, err error)

ListDomains (user) returns an array of all domains for the session user.

func (*UserContext) ListSubdomains

func (c *UserContext) ListSubdomains(domain string) (subdomainList []string, err error)

ListSubdomains (user) returns an array of all subdomains for the given domain.

func (*UserContext) Login

func (c *UserContext) Login() error

Login checks whether the configured credentials work against the configured API.

func (*UserContext) MovePath

func (c *UserContext) MovePath(source string, destination string, overwrite bool) error

MovePath (user) moves the given file or directory to the new destination.

func (*UserContext) PHPSelectorDisableExtension

func (c *UserContext) PHPSelectorDisableExtension(version string, extension string) error

PHPSelectorDisableExtension disables the given extension for the given PHP version if it is not already disabled.

func (*UserContext) PHPSelectorEnableExtension

func (c *UserContext) PHPSelectorEnableExtension(version string, extension string) error

PHPSelectorEnableExtension enables the given extension for the given PHP version if it is not already enabled.

func (*UserContext) PHPSelectorGetDefaultVersion

func (c *UserContext) PHPSelectorGetDefaultVersion() (*PHPSelectorVersion, error)

PHPSelectorGetDefaultVersion retrieves the server's default PHP version with its extensions.

func (*UserContext) PHPSelectorGetSelectedVersion

func (c *UserContext) PHPSelectorGetSelectedVersion() (*PHPSelectorVersion, error)

PHPSelectorGetSelectedVersion retrieves the selected PHP version with its extensions.

func (*UserContext) PHPSelectorGetVersion

func (c *UserContext) PHPSelectorGetVersion(version string) (*PHPSelectorVersion, error)

PHPSelectorGetVersion retrieves the given PHP version with its extensions.

func (*UserContext) PHPSelectorListVersions

func (c *UserContext) PHPSelectorListVersions() (*PHPSelectorList, error)

PHPSelectorListVersions lists all PHP versions accessible to the authenticated user.

func (*UserContext) PHPSelectorSetExtensions

func (c *UserContext) PHPSelectorSetExtensions(version string, extensions ...string) error

PHPSelectorSetExtensions sets the given extensions for the given PHP version.

func (*UserContext) PHPSelectorSetOptions

func (c *UserContext) PHPSelectorSetOptions(version string, options map[string]string) error

PHPSelectorSetOptions sets the given options for the given PHP version.

func (*UserContext) PHPSelectorSetVersion

func (c *UserContext) PHPSelectorSetVersion(version string) error

PHPSelectorSetVersion sets PHP to the given version.

func (*UserContext) RestoreBackup

func (c *UserContext) RestoreBackup(domain string, backupFilename string, backupItems ...string) error

RestoreBackup (user) restores an account backup for the given domain, and the given items.

func (*UserContext) RestoreBackupAllItems

func (c *UserContext) RestoreBackupAllItems(domain string, backupFilename string) error

RestoreBackupAllItems (user) wraps around RestoreBackup and provides all available backup items.

func (*UserContext) SetDefaultDomain

func (c *UserContext) SetDefaultDomain(domain string) error

SetDefaultDomain (user) sets the default domain for the session user.

func (*UserContext) SetPHPVersion

func (c *UserContext) SetPHPVersion(domain string, versionID string) error

SetPHPVersion (user) sets the PHP version for the given domain to the given version ID.

func (*UserContext) SoftaculousInstallScript

func (c *UserContext) SoftaculousInstallScript(script *SoftaculousScript, scriptID int) error

SoftaculousInstallScript calls Softaculous's install script API endpoint.

Docs: https://www.softaculous.com/docs/api/remote-api/#install-a-script

func (*UserContext) SoftaculousListInstallations

func (c *UserContext) SoftaculousListInstallations() ([]*SoftaculousInstallation, error)

SoftaculousListInstallations lists all installations accessible to the authenticated user.

func (*UserContext) SoftaculousUninstallScript

func (c *UserContext) SoftaculousUninstallScript(installID string, deleteFiles bool, deleteDB bool) error

SoftaculousUninstallScript calls Softaculous's install script API endpoint.

Docs: https://www.softaculous.com/docs/api/remote-api/#remove-an-installed-script

func (*UserContext) ToggleDKIM

func (c *UserContext) ToggleDKIM(domain string, status bool) error

ToggleDKIM (user) sets DKIM for the given domain.

func (*UserContext) UpdateDNSRecord

func (c *UserContext) UpdateDNSRecord(domain string, originalDNSRecord DNSRecord, updatedDNSRecord DNSRecord) error

UpdateDNSRecord (user) updates the given DNS record for the given domain.

func (*UserContext) UpdateDatabaseUserHosts

func (c *UserContext) UpdateDatabaseUserHosts(username string, hosts []string) error

UpdateDatabaseUserHosts (user) updates the given database user's hosts.

func (*UserContext) UpdateDatabaseUserPassword

func (c *UserContext) UpdateDatabaseUserPassword(username string, password string) error

UpdateDatabaseUserPassword (user) updates the given database user's password.

func (*UserContext) UpdateDomain

func (c *UserContext) UpdateDomain(domain Domain) error

UpdateDomain (user) accepts a Domain object and updates the version on DA with it.

func (*UserContext) UpdateEmailAccount

func (c *UserContext) UpdateEmailAccount(emailAccount EmailAccount) error

UpdateEmailAccount (user) updates/overwrites the given email account.

func (*UserContext) UpdateEmailForwarder

func (c *UserContext) UpdateEmailForwarder(domain string, user string, emails ...string) error

UpdateEmailForwarder (user) updates the specified email forwarder.

func (*UserContext) UpdateSubdomainRoot

func (c *UserContext) UpdateSubdomainRoot(subdomain Subdomain) error

func (*UserContext) UploadFile

func (c *UserContext) UploadFile(uploadToPath string, fileData []byte, overwrite bool) error

UploadFile uploads the provided byte data as a file for the session user.

func (*UserContext) UploadFileFromDisk

func (c *UserContext) UploadFileFromDisk(uploadToPath string, localFilePath string, overwrite bool) error

UploadFileFromDisk (user) uploads the provided file for the session user.

Example: UploadFileFromDisk("/domains/domain.tld/public_html/file.zip", "file.zip").

func (*UserContext) UseInternalMailHandler

func (c *UserContext) UseInternalMailHandler(domain string, enable bool) error

UseInternalMailHandler tells the server to use the local mail handler for the given domain. If this is enabled, other domains on the server that email this domain will use the server's local mail handler to deliver the email, rather than looking up the domain's MX records. This is fine if your email is being hosted on the same server, but not otherwise.

func (*UserContext) VerifyEmailAccount

func (c *UserContext) VerifyEmailAccount(address string, password string) error

VerifyEmailAccount (user) accepts the full email address as well as the password for the account. If the credentials aren't correct, an error will be returned.

type UserUsage

type UserUsage struct {
	AutoResponders struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"autoresponders"`
	BandwidthBytes struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"bandwidthBytes"`
	DBQuotaBytes   int `json:"dbQuotaBytes"`
	DomainPointers struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"domainPointers"`
	Domains struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"domains"`
	EmailAccounts struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"emailAccounts"`
	EmailDeliveries         int `json:"emailDeliveries"`
	EmailDeliveriesIncoming int `json:"emailDeliveriesIncoming"`
	EmailDeliveriesOutgoing int `json:"emailDeliveriesOutgoing"`
	EmailForwarders         struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"emailForwarders"`
	EmailQuotaBytes int `json:"emailQuotaBytes"`
	FTPAccounts     struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"ftpAccounts"`
	Inode struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"inode"`
	MailingLists struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"mailingLists"`
	MySQLDatabases struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"mySqlDatabases"`
	OtherQuotaBytes int `json:"otherQuotaBytes"`
	QuotaBytes      struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"quotaBytes"`
	QuotaWithoutSystemBytes int `json:"quotaWithoutSystemBytes"`
	Subdomains              struct {
		Limit     int  `json:"limit"`
		Unlimited bool `json:"unlimited"`
		Usage     int  `json:"usage"`
	} `json:"subdomains"`
}

type WordPressInstall

type WordPressInstall struct {
	AdminEmail string `json:"adminEmail" yaml:"adminEmail"`
	AdminName  string `json:"adminName" yaml:"adminName"`
	AdminPass  string `json:"adminPass" yaml:"adminPass"`
	DBName     string `json:"dbName" yaml:"dbName"`
	DBPass     string `json:"dbPass" yaml:"dbPass"`
	DBPrefix   string `json:"dbPrefix" yaml:"dbPrefix"`
	DBUser     string `json:"dbUser" yaml:"dbUser"`
	FilePath   string `json:"filePath" yaml:"filePath"`
	Title      string `json:"title" yaml:"title"`
}

type WordPressInstallQuick

type WordPressInstallQuick struct {
	AdminEmail string `json:"adminEmail" yaml:"adminEmail"`
	AdminName  string `json:"adminName" yaml:"adminName"`
	AdminPass  string `json:"adminPass" yaml:"adminPass"`
	FilePath   string `json:"filePath" yaml:"filePath"`
	Title      string `json:"title" yaml:"title"`
}

type WordPressLocation

type WordPressLocation struct {
	FilePath  string `json:"filePath"`
	Host      string `json:"host"`
	ID        string `json:"id"`
	WebPath   string `json:"webPath"`
	WordPress struct {
		AutoUpdateMajor bool   `json:"autoUpdateMajor"`
		AutoUpdateMinor bool   `json:"autoUpdateMinor"`
		Error           string `json:"error"`
		SiteURL         string `json:"siteURL"`
		Template        string `json:"template"`
		Title           string `json:"title"`
		Version         string `json:"version"`
	} `json:"wordpress"`
}

type WordPressUser

type WordPressUser struct {
	ID          int       `json:"id"`
	DisplayName string    `json:"displayName"`
	Email       string    `json:"email"`
	Login       string    `json:"login"`
	Registered  time.Time `json:"registered"`
	Roles       []string  `json:"roles"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL