whm

package
v0.0.0-...-ba27fde Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWhmImpersonationApi

func NewWhmImpersonationApi(hostname, username, accessHash, userToImpersonate string, insecure bool) cpanel.CpanelApi

func NewWhmImpersonationApiTotp

func NewWhmImpersonationApiTotp(hostname, username, accessHash, userToImpersonate, secret string, insecure bool) cpanel.CpanelApi

Types

type AccountSummaryApiResponse

type AccountSummaryApiResponse struct {
	BaseWhmApiResponse
	Data struct {
		Account []struct {
			Email     string `json:"email"`
			Suspended int    `json:"suspended"`
		} `json:"acct"`
	} `json:"data"`
}

func (AccountSummaryApiResponse) Email

func (AccountSummaryApiResponse) HasEmail

func (r AccountSummaryApiResponse) HasEmail() bool

func (AccountSummaryApiResponse) Suspended

func (r AccountSummaryApiResponse) Suspended() bool

type BaseWhmApiResponse

type BaseWhmApiResponse struct {
	Metadata struct {
		Reason    string      `json:"reason"`
		ResultRaw interface{} `json:"result"`
	} `json:"metadata"`
}

func (BaseWhmApiResponse) Error

func (r BaseWhmApiResponse) Error() error

func (BaseWhmApiResponse) Result

func (r BaseWhmApiResponse) Result() int

WHM randomly returns this as a string, gg

type CreateUserSessionApiResponse

type CreateUserSessionApiResponse struct {
	BaseWhmApiResponse
	Data struct {
		SecurityToken string              `json:"cp_security_token"`
		Expires       cpanelgo.MaybeInt64 `json:"expires"`
		Session       string              `json:"session"`
		Url           string              `json:"url"`
	} `json:"data"`
}

type FetchServiceSslComponentsAPIResponse

type FetchServiceSslComponentsAPIResponse struct {
	BaseWhmApiResponse
	Data struct {
		Services []struct {
			Service         string `json:"service"`
			Certificate     string `json:"certificate"`
			CABundle        string `json:"cabundle"`
			CertificateInfo struct {
				IsSelfSigned int                 `json:"is_self_signed"`
				NotAfter     cpanelgo.MaybeInt64 `json:"not_after"`
				Domains      []string            `json:"domains"`
			} `json:"certificate_info"`
		} `json:"services"`
	} `json:"data"`
}

func (FetchServiceSslComponentsAPIResponse) Services

type FetchSslVhostsApiResponse

type FetchSslVhostsApiResponse struct {
	BaseWhmApiResponse
	Data struct {
		Vhosts []VhostEntry `json:"vhosts"`
	} `json:"data"`
}

type GetTweakSettingApiResponse

type GetTweakSettingApiResponse struct {
	BaseWhmApiResponse
	Data struct {
		TweakSetting struct {
			Key   string `json:"key"`
			Value string `json:"value"`
		} `json:"tweaksetting"`
	} `json:"data"`
}

type ListAccountsApiResponse

type ListAccountsApiResponse struct {
	BaseWhmApiResponse
	Data struct {
		Accounts []struct {
			User  string `json:"user"`
			Theme string `json:"theme"`
		} `json:"acct"`
	} `json:"data"`
}

type VhostEntry

type VhostEntry struct {
	User        string                      `json:"user"`
	Docroot     string                      `json:"docroot"`
	Certificate cpanel.CpanelSslCertificate `json:"crt"`
}

type WhmApi

type WhmApi struct {
	Hostname   string
	Username   string
	AccessHash string
	Password   string
	Insecure   bool
	TotpSecret string
}

This implements a standalone WHM client, not for the cPanel API

func NewWhmApiAccessHash

func NewWhmApiAccessHash(hostname, username, accessHash string, insecure bool) WhmApi

func NewWhmApiAccessHashTotp

func NewWhmApiAccessHashTotp(hostname, username, accessHash string, insecure bool, secret string) WhmApi

func NewWhmApiPassword

func NewWhmApiPassword(hostname, username, password string, insecure bool) WhmApi

func (WhmApi) AccountSummary

func (a WhmApi) AccountSummary(username string) (AccountSummaryApiResponse, error)

func (WhmApi) CreateUserSession

func (a WhmApi) CreateUserSession(username, service string) (CreateUserSessionApiResponse, error)

func (WhmApi) FetchServiceSslComponents

func (a WhmApi) FetchServiceSslComponents() (FetchServiceSslComponentsAPIResponse, error)

func (WhmApi) FetchSslVhosts

func (a WhmApi) FetchSslVhosts() (FetchSslVhostsApiResponse, error)

func (WhmApi) GetTweakSetting

func (a WhmApi) GetTweakSetting(key, module string) (GetTweakSettingApiResponse, error)

func (WhmApi) InstallServiceSslCertificate

func (a WhmApi) InstallServiceSslCertificate(service, crt, key, cabundle string) (BaseWhmApiResponse, error)

func (WhmApi) ListAccounts

func (a WhmApi) ListAccounts() (ListAccountsApiResponse, error)

func (WhmApi) RestartService

func (a WhmApi) RestartService(name string) (BaseWhmApiResponse, error)

func (WhmApi) SetTweakSetting

func (a WhmApi) SetTweakSetting(key, module, value string) (BaseWhmApiResponse, error)

func (*WhmApi) WHMAPI1

func (c *WhmApi) WHMAPI1(function string, arguments cpanelgo.Args, out interface{}) error

type WhmImpersonationApi

type WhmImpersonationApi struct {
	Impersonate string // who we are impersonating
	WhmApi
}

func (*WhmImpersonationApi) API1

func (c *WhmImpersonationApi) API1(module, function string, arguments []string, out interface{}) error

func (*WhmImpersonationApi) API2

func (c *WhmImpersonationApi) API2(module, function string, arguments cpanelgo.Args, out interface{}) error

func (*WhmImpersonationApi) Close

func (c *WhmImpersonationApi) Close() error

func (*WhmImpersonationApi) UAPI

func (c *WhmImpersonationApi) UAPI(module, function string, arguments cpanelgo.Args, out interface{}) error

Jump to

Keyboard shortcuts

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