cpanel

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParkedStatusNotRedirected = "not redirected"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddZoneTextRecordResponse

type AddZoneTextRecordResponse struct {
	cpanelgo.BaseAPI2Response
	Data []struct {
		Result struct {
			Status        int    `json:"status"`
			StatusMessage string `json:"statusmsg"`
		} `json:"result"`
	} `json:"data"`
}

type CpanelApi

type CpanelApi struct {
	cpanelgo.Api
}

func NewJsonApi

func NewJsonApi(hostname, username, password string, insecure bool) (CpanelApi, error)

func NewJsonApiWithClient added in v1.2.0

func NewJsonApiWithClient(hostname, username, password string, insecure bool, cl *http.Client) (CpanelApi, error)

func NewLiveApi

func NewLiveApi(network, address string) (CpanelApi, error)

func (CpanelApi) AddZoneTextRecord

func (c CpanelApi) AddZoneTextRecord(zone, name, txtData, ttl string) error

func (CpanelApi) BrandingInclude

func (c CpanelApi) BrandingInclude(name string) (cpanelgo.BaseAPI1Response, error)

This is fucking undocumented

func (CpanelApi) DeleteCert

func (c CpanelApi) DeleteCert(certId string) (cpanelgo.BaseUAPIResponse, error)

func (CpanelApi) DeleteKey

func (c CpanelApi) DeleteKey(keyId string) (cpanelgo.BaseUAPIResponse, error)

func (CpanelApi) DeleteSSL

func (c CpanelApi) DeleteSSL(domain string) (cpanelgo.BaseUAPIResponse, error)

func (CpanelApi) DomainsData

func (c CpanelApi) DomainsData() (DomainsDataApiResponse, error)

func (CpanelApi) EditZoneTextRecord

func (c CpanelApi) EditZoneTextRecord(line int, zone, txtData, ttl string) error

func (CpanelApi) EnableMailSNI

func (c CpanelApi) EnableMailSNI(domains ...string) (EnableMailSNIAPIResponse, error)

func (CpanelApi) FetchZone

func (c CpanelApi) FetchZone(domain, types string) (FetchZoneApiResponse, error)

func (CpanelApi) FetchZones

func (c CpanelApi) FetchZones() (FetchZonesApiResponse, error)

func (CpanelApi) GenerateSSLKey

func (c CpanelApi) GenerateSSLKey(keySize int, friendlyName string) (GenerateSSLKeyAPIResponse, error)

func (CpanelApi) GetDom

func (c CpanelApi) GetDom(pageTitle string) (GetDomAPIResponse, error)

func (CpanelApi) GetLocaleAttributes

func (c CpanelApi) GetLocaleAttributes() (LocaleAPIResponse_UAPI, error)

func (CpanelApi) GetNVData

func (c CpanelApi) GetNVData(name string) (NVDataGetApiResult, error)

func (CpanelApi) GetQuotaInfo

func (c CpanelApi) GetQuotaInfo() (GetQuotaInfoApiResponse, error)

func (CpanelApi) GetTheme

func (c CpanelApi) GetTheme() (GetThemeAPIResponse, error)

func (CpanelApi) GetUserLocale

func (c CpanelApi) GetUserLocale() (LocaleAPIResponse_API2, error)

func (CpanelApi) HasFeature

func (c CpanelApi) HasFeature(name string) (string, error)

func (CpanelApi) InstallSSLKey

func (c CpanelApi) InstallSSLKey(domain string, cert string, key string, cabundle string) (InstallSSLKeyAPIResponse, error)

func (CpanelApi) InstalledHosts

func (c CpanelApi) InstalledHosts() (InstalledHostsApiResponse, error)

func (CpanelApi) IsMailSNISupported

func (c CpanelApi) IsMailSNISupported() (IsMailSNISupportedAPIResponse, error)

func (CpanelApi) ListParkedDomains

func (c CpanelApi) ListParkedDomains() (ListParkedDomainsApiResponse, error)

func (CpanelApi) ListSSLCerts

func (c CpanelApi) ListSSLCerts() (ListSSLCertsAPIResponse, error)

func (CpanelApi) ListSSLKeys

func (c CpanelApi) ListSSLKeys() (ListSSLKeysAPIResponse, error)

func (CpanelApi) MailSNIStatus

func (c CpanelApi) MailSNIStatus(domain string) (MailSNIStatusAPIResponse, error)

func (CpanelApi) Mkdir

func (c CpanelApi) Mkdir(name, permissions, path string) (MkdirApiResponse, error)

func (CpanelApi) RebuildMailSNIConfig

func (c CpanelApi) RebuildMailSNIConfig() (RebuildMailSNIConfigAPIResponse, error)

func (CpanelApi) SetNVData

func (c CpanelApi) SetNVData(name string, data interface{}) (NVDataSetApiResult, error)

func (CpanelApi) SetVar

func (c CpanelApi) SetVar(key, value string) (cpanelgo.BaseAPI1Response, error)

func (CpanelApi) SingleDomainData

func (c CpanelApi) SingleDomainData(domain string) (SingleDomainDataApiResponse, error)

func (CpanelApi) UploadFiles

func (c CpanelApi) UploadFiles(name, contents, dir string) error

func (CpanelApi) WebVhostsListDomains

func (c CpanelApi) WebVhostsListDomains() (WebVhostsListDomainsApiResponse, error)

type CpanelApiRequest

type CpanelApiRequest struct {
	Module      string        `json:"module"`
	RequestType string        `json:"reqtype"`
	Function    string        `json:"func"`
	ApiVersion  string        `json:"apiversion"`
	Arguments   cpanelgo.Args `json:"args"`
}

type CpanelSslCertificate

type CpanelSslCertificate struct {
	Domains            []string                       `json:"domains"`
	CommonName         cpanelgo.MaybeCommonNameString `json:"subject.commonName"`
	IsSelfSigned       cpanelgo.MaybeInt64            `json:"is_self_signed"`
	Id                 string                         `json:"id"`
	NotAfter           cpanelgo.MaybeInt64            `json:"not_after"`
	OrgName            string                         `json:"issuer.organizationName"`
	DomainIsConfigured cpanelgo.MaybeInt64            `json:"domain_is_configured"` // Doesn't actually work
}

func (CpanelSslCertificate) Expiry

func (s CpanelSslCertificate) Expiry() time.Time

type DomainsDataApiResponse

type DomainsDataApiResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		MainDomain    DomainsDataDomain   `json:"main_domain"`
		AddonDomains  []DomainsDataDomain `json:"addon_domains"`
		ParkedDomains []string            `json:"parked_domains"`
		Sub_Domains   []json.RawMessage   `json:"sub_domains"`
		Subdomains    []DomainsDataDomain `json:"-"`
	} `json:"data"`
}

func (DomainsDataApiResponse) DataList

func (dd DomainsDataApiResponse) DataList() []DomainsDataDomain

func (DomainsDataApiResponse) DomainList

func (r DomainsDataApiResponse) DomainList() []string

type DomainsDataDomain

type DomainsDataDomain struct {
	Domain       string `json:"domain"`
	Ip           string `json:"ip"`
	DocumentRoot string `json:"documentroot"`
	User         string `json:"user"`
	ServerAlias  string `json:"serveralias"`
	ServerName   string `json:"servername"`
}

type EditZoneTextRecordResponse

type EditZoneTextRecordResponse struct {
	cpanelgo.BaseAPI2Response
	Data []struct {
		Result struct {
			Status        int    `json:"status"`
			StatusMessage string `json:"statusmsg"`
		} `json:"result"`
	} `json:"data"`
}

type EnableMailSNIAPIResponse

type EnableMailSNIAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		UpdatedDomains map[string]int         `json:"updated_domains"`
		FailedDomains  map[string]interface{} `json:"failed_domains"`
	} `json:"data"`
}

type FetchZoneApiResponse

type FetchZoneApiResponse struct {
	cpanelgo.BaseAPI2Response
	Data []struct {
		Records       []ZoneRecord `json:"record"`
		Status        int          `json:"status"`
		StatusMessage string       `json:"statusmsg"`
	} `json:"data"`
}

func (FetchZoneApiResponse) Find

func (r FetchZoneApiResponse) Find(name, rrType string) (bool, []int)

Returns line number

type FetchZonesApiResponse

type FetchZonesApiResponse struct {
	cpanelgo.BaseAPI2Response
	Data []struct {
		Status        int                 `json:"status"`
		StatusMessage string              `json:"statusmsg"`
		Zones         map[string][]string `json:"zones"`
	} `json:"data"`
}

func (FetchZonesApiResponse) FindRootForName

func (r FetchZonesApiResponse) FindRootForName(name string) string

type GenerateSSLKeyAPIResponse

type GenerateSSLKeyAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Created       cpanelgo.MaybeInt64 `json:"created"`
		Modulus       string              `json:"modulus"`
		Text          string              `json:"text"`
		Id            string              `json:"id"`
		FriendlyName  string              `json:"friendly_name"`
		ModulusLength int                 `json:"modulus_length"`
	} `json:"data"`
}

type GetDomAPIResponse

type GetDomAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Header string `json:"header"`
		Footer string `json:"footer"`
	} `json:"data"`
}

type GetQuotaInfoApiResponse

type GetQuotaInfoApiResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		UnderQuotaOverall *json.RawMessage `json:"under_quota_overall"`
	} `json:"data"`
}

func (GetQuotaInfoApiResponse) IsUnderQuota

func (q GetQuotaInfoApiResponse) IsUnderQuota() bool

type GetThemeAPIResponse

type GetThemeAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Theme string `json:"data"`
}

type InstallSSLKeyAPIResponse

type InstallSSLKeyAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Action                  string   `json:"action"`
		CertId                  string   `json:"cert_id"`
		Domain                  string   `json:"domain"`
		Html                    string   `json:"html"`
		Ip                      string   `json:"ip"`
		KeyId                   string   `json:"key_id"`
		Message                 string   `json:"message"`
		StatusMsg               string   `json:"statusmsg"`
		User                    string   `json:"user"`
		WarningDomains          []string `json:"warning_domains"`
		WorkingDomains          []string `json:"working_domains"`
		ExtraCertificateDomains []string `json:"extra_certificate_domains"`
	} `json:"data"`
}

type InstalledCertificate

type InstalledCertificate struct {
	Certificate     CpanelSslCertificate `json:"certificate"`
	CertificateText string               `json:"certificate_text"`
	FQDNs           []string             `json:"fqdns"`
}

type InstalledHostsApiResponse

type InstalledHostsApiResponse struct {
	cpanelgo.BaseUAPIResponse
	Data []InstalledCertificate `json:"data"`
}

func (InstalledHostsApiResponse) DoesAnyValidCertificateOverlapVhostsWith

func (r InstalledHostsApiResponse) DoesAnyValidCertificateOverlapVhostsWith(domain string, expiryCutoff time.Time) bool

In AutoSSL we want to avoid issuing certificates into virtual hosts that already have a valid certificate installed, whether or not that certificate actually covers `domain`

func (InstalledHostsApiResponse) GetCertificateForDomain added in v1.2.0

func (r InstalledHostsApiResponse) GetCertificateForDomain(d string) (CpanelSslCertificate, bool)

func (InstalledHostsApiResponse) HasDomain

func (r InstalledHostsApiResponse) HasDomain(d string) bool

func (InstalledHostsApiResponse) HasValidDomain

func (r InstalledHostsApiResponse) HasValidDomain(wanted string, expiryCutoff time.Time) bool

type IsMailSNISupportedAPIResponse

type IsMailSNISupportedAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data int `json:"data"`
}

type JsonApiGateway

type JsonApiGateway struct {
	Hostname string
	Username string
	Password string
	Insecure bool
	// contains filtered or unexported fields
}

func (*JsonApiGateway) API1

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

func (*JsonApiGateway) API2

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

func (*JsonApiGateway) Close

func (c *JsonApiGateway) Close() error

func (*JsonApiGateway) UAPI

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

type ListParkedDomainsApiResponse

type ListParkedDomainsApiResponse struct {
	cpanelgo.BaseAPI2Response
	Data []ParkedDomain `json:"data"`
}

type ListSSLCertsAPIResponse

type ListSSLCertsAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data []CpanelSslCertificate `json:"data"`
}

type ListSSLKeysAPIResponse

type ListSSLKeysAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Created       cpanelgo.MaybeInt64 `json:"created"`
		Modulus       string              `json:"modulus"`
		Id            string              `json:"id"`
		FriendlyName  string              `json:"friendly_name"`
		ModulusLength int                 `json:"modulus_length"`
	} `json:"data"`
}

type LiveApiGateway

type LiveApiGateway struct {
	net.Conn
}

func (*LiveApiGateway) API1

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

func (*LiveApiGateway) API2

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

func (*LiveApiGateway) Close

func (c *LiveApiGateway) Close() error

func (*LiveApiGateway) UAPI

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

type LocaleAPIResponse_API2

type LocaleAPIResponse_API2 struct {
	cpanelgo.BaseAPI2Response
	Data []struct {
		Locale string `json:"locale"`
	} `json:"data"`
}

type LocaleAPIResponse_UAPI

type LocaleAPIResponse_UAPI struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Direction string `json:"direction"`
		Name      string `json:"name"`
		Locale    string `json:"locale"`
		Encoding  string `json:"encoding"`
	} `json:"data"`
}

type MailSNIStatusAPIResponse

type MailSNIStatusAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Enabled int `json:"enabled"`
	} `json:"data"`
}

type MkdirApiResponse

type MkdirApiResponse struct {
	cpanelgo.BaseAPI2Response
	Data []struct {
		Permissions string `json:"permissions"`
		Name        string `json:"name"`
		Path        string `json:"path"`
	} `json:"data"`
}

type NVDataGetApiResult

type NVDataGetApiResult struct {
	cpanelgo.BaseUAPIResponse
	Data []struct {
		FileName     string `json:"name"`
		FileContents string `json:"value"`
	} `json:"data"`
}

type NVDataSetApiResult

type NVDataSetApiResult struct {
	cpanelgo.BaseUAPIResponse
	Data []struct {
		Set string `json:"set"`
	} `json:"data"`
}

type ParkedDomain

type ParkedDomain struct {
	Domain string `json:"domain"`
	Status string `json:"status"`
	Dir    string `json:"dir"`
}

type RebuildMailSNIConfigAPIResponse

type RebuildMailSNIConfigAPIResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Success int `json:"success"`
	}
}

type SingleDomainDataApiResponse

type SingleDomainDataApiResponse struct {
	Status int `json:"status"`
	Data   struct {
		Domain       string `json:"domain"`
		DocumentRoot string `json:"documentroot"`
	} `json:"data"`
}

type UploadFilesApiResponse

type UploadFilesApiResponse struct {
	cpanelgo.BaseUAPIResponse
	Data struct {
		Uploads   []string `json:"uploads"`
		Succeeded int      `json:"succeeded"`
		Warned    int      `json:"warned"`
		Failed    int      `json:"failed"`
	} `json:"data"`
}

type VhostEntry

type VhostEntry struct {
	Domain          string   `json:"domain"`
	VhostName       string   `json:"vhost_name"`
	VhostIsSsl      int      `json:"vhost_is_ssl"`
	ProxySubdomains []string `json:"proxy_subdomains"`
}

type WebVhostsListDomainsApiResponse

type WebVhostsListDomainsApiResponse struct {
	cpanelgo.BaseUAPIResponse
	Data []VhostEntry `json:"data"`
}

func (WebVhostsListDomainsApiResponse) GetAllProxySubdomains

func (r WebVhostsListDomainsApiResponse) GetAllProxySubdomains() []string

func (WebVhostsListDomainsApiResponse) GetProxySubdomainsMap

func (vhapi WebVhostsListDomainsApiResponse) GetProxySubdomainsMap() map[string][]string

put them into map for easy access

type ZoneRecord

type ZoneRecord struct {
	Name   string `json:"name"`
	Record string `json:"record"`
	Type   string `json:"type"`
	Line   int    `json:"line"`
}

Jump to

Keyboard shortcuts

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