result

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package result implements structures representing the result of API method responses.

Index

Constants

View Source
const (
	Basic = TypeRecords(1) // type of "A, MX, TXT" records.
	NS    = TypeRecords(2) // type of NS-records.
	CNAME = TypeRecords(3) // type of CNAME-records.
)
View Source
const Unlimited = 2147483647

Unlimited is the value of the limiting fields in UserInfo, which indicates the absence of limits.

Variables

View Source
var ErrNotFoundField = errors.New("field for get data result not found") // "field for get data result not found"
View Source
var ErrUnknownValueForFileType = errors.New("unknown value fot type FileType") // "unknown value fot type FileType"

Functions

This section is empty.

Types

type BasicRecords

type BasicRecords struct {
	DNSRecords
	A    []record.ARecord    `json:"A,omitempty"`    // A records.
	AAAA []record.AAAARecord `json:"AAAA,omitempty"` // AAAA records.
	CAA  []record.CAARecord  `json:"CAA,omitempty"`  // CAA records.
	Mx   []record.MXRecord   `json:"MX,omitempty"`   // MX records.
	Txt  []record.TXTRecord  `json:"TXT,omitempty"`  // TXT records.
	Srv  []record.SRVRecord  `json:"SRV,omitempty"`  // SRV records.
}

BasicRecords is a representation of the "A, MX, TXT" records information in the getData response.

type BoolResult

type BoolResult bool

BoolResult is the type of result of a request to the Beget.API, when returning only the bool result

type CNAMERecords

type CNAMERecords struct {
	DNSRecords
	CNames []record.CNAMERecord `json:"CNAME,omitempty"` // CNAME records.
}

CNAMERecords is a representation of the CNAME records information in the getData response.

type DNSRecords

type DNSRecords struct {
	DNS   []record.DNSRecord   `json:"DNS"`              // DNS records.
	DNSIP []record.DNSIPRecord `json:"DNS_IP,omitempty"` // DNS_IP records.
}

DNSRecords is a representation of the DNS records information in the getData response.

type DatabaseName added in v0.1.1

type DatabaseName string

DatabaseName represents the name of databases for Beget Responses.

type FileBackup added in v0.1.1

type FileBackup struct {
	BackupID ID             `json:"backup_id"`
	Date     time.BegetTime `json:"date"`
}

FileBackup is an entry in the list of file backups.

type FileBackupList added in v0.1.1

type FileBackupList []FileBackup

FileBackupList is the result of a successful call to the getFileBackupList method.

type FileList added in v0.1.1

type FileList []FileRecord

FileList is the result of a successful call to the getFileList method.

type FileRecord added in v0.1.1

type FileRecord struct {
	Name         string         `json:"name"`
	IsDirectory  FileType       `json:"is_dir"`
	CreationTime time.BegetTime `json:"mtime"`
	Size         uint64         `json:"size"`
}

FileRecord is an entry in the list of files in a directory.

type FileType added in v0.1.1

type FileType bool

FileType represents the type of file on the ftp server. Means true if it is a directory, otherwise it is a file.

func (*FileType) UnmarshalJSON added in v0.1.1

func (ft *FileType) UnmarshalJSON(data []byte) error

UnmarshalJSON specifies the unmarshalling of FileType from a JSON string. FileType is true if the Json string contains "true" or "1". FileType is false if the Json string contains "false", "null", "1" or the string is empty.

type GetData

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

GetData is the result of a successful call to the getData method.

func (*GetData) BasicRecords

func (gdr *GetData) BasicRecords() *BasicRecords

BasicRecords returns "A, MX, TXT" records if they are provided in the response. Otherwise, it returns nil

func (*GetData) CNAMERecords

func (gdr *GetData) CNAMERecords() *CNAMERecords

CNAMERecords returns CNAME records if they are provided in the response. Otherwise, it returns nil

func (*GetData) Fqdn

func (gdr *GetData) Fqdn() string

Fqdn returns the domain name passed in the request to getData method.

func (*GetData) IsBegetDNS

func (gdr *GetData) IsBegetDNS() bool

IsBegetDNS reports whether the domain is located on the Beget DNS servers.

func (*GetData) IsSubdomain

func (gdr *GetData) IsSubdomain() bool

IsSubdomain reports whether the domain is subdomain.

func (*GetData) IsUnderControl

func (gdr *GetData) IsUnderControl() bool

IsUnderControl reports whether Beget service the domain.

func (*GetData) NSRecords

func (gdr *GetData) NSRecords() *NSRecords

NSRecords returns NS records if they are provided in the response. Otherwise, it returns nil

func (*GetData) TypeRecords

func (gdr *GetData) TypeRecords() TypeRecords

TypeRecords returns type of DNS-records for the domain.

func (*GetData) UnmarshalJSON

func (gdr *GetData) UnmarshalJSON(data []byte) error

UnmarshalJSON is functions for encoding/json to unmarshal getData response from json format.

type ID added in v0.1.1

type ID uint64

ID is a type of the unique identifier for Beget Responses.

type Log added in v0.1.1

type Log []LogRecord

Log is the result of a successful call to the getLog method.

type LogRecord added in v0.1.1

type LogRecord struct {
	ID         ID             `json:"id"`
	Operation  Operation      `json:"operation"`
	Type       OperationType  `json:"type"`
	DateCreate time.BegetTime `json:"date_create"`
	TargetList []string       `json:"target_list"`
	Status     Status         `json:"status"`
}

LogRecord is a record in the operation log in the Beget.

type MYSQLBackup added in v0.1.1

type MYSQLBackup FileBackup

MYSQLBackup is an entry in the list of MYSQL backups.

type MYSQLBackupList added in v0.1.1

type MYSQLBackupList []MYSQLBackup

MYSQLBackupList is the result of a successful call to the getMysqlBackupList method.

type MYSQLList added in v0.1.1

type MYSQLList []DatabaseName

MYSQLList is the result of a successful call to the getMysqlList method.

type NSRecords

type NSRecords struct {
	DNSRecords
	NSs []record.NSRecord `json:"NS,omitempty"` // NS records.
}

NSRecords is a representation of the NS records information in the getData response.

type Operation added in v0.1.1

type Operation string

Operation represents the operation performed on the database or files in the Beget.

const (
	Restore  Operation = "restore"  // files or databases war restored.
	Download Operation = "download" // files or databases war downloaded.
)

type OperationType added in v0.1.1

type OperationType string

OperationType represents a specific operation performed in the Beget.

const (
	RestoreFile   OperationType = "restore_file"   // files war restored.
	DownloadFile  OperationType = "download_file"  // files war downloaded.
	RestoreMYSQL  OperationType = "restore_mysql"  // databases war restored.
	DownloadMYSQL OperationType = "download_mysql" // databases war downloaded.
)

type SSHToggle added in v0.1.1

type SSHToggle []any

SSHToggle is the result of a successful call to the toggleSsh method. At the moment, in any case, the result will be an empty array.

type Status added in v0.1.1

type Status string

Status represents the status of the operation performed in the Beget.

const (
	SUCCESS Status = "success" // the operation was completed successfully.
	ERROR   Status = "error"   // the operation failed with an error.
)

type TypeRecords

type TypeRecords int64

TypeRecords is a type, that specifies the type of the records in the getData response.

type UserInfo added in v0.1.1

type UserInfo struct {
	PlanName            string  `json:"plan_name"`                    // name of the rate
	UserSites           uint64  `json:"user_sites"`                   // the actual number of user sites
	PlanSite            uint64  `json:"plan_site"`                    // maximum number of sites
	UserDomains         uint64  `json:"user_domains"`                 // the actual number of user domains
	PlanDomain          uint64  `json:"plan_domain"`                  // maximum number of domains
	UserMysqlSize       uint64  `json:"user_mysqlsize"`               // the actual volume of the MySQL user database
	PlanMysql           uint64  `json:"plan_mysql"`                   // maximum volume of the MySQL database
	UserQuota           uint64  `json:"user_quota"`                   // the size of the disk quota used by the user
	PlanQuota           uint64  `json:"plan_quota"`                   // maximum disk quota size
	UserFtp             uint64  `json:"user_ftp"`                     // the actual number of user FTP accounts
	PlanFtp             uint64  `json:"plan_ftp"`                     // maximum number of FTP accounts
	UserMail            uint64  `json:"user_mail"`                    // the actual number of user mailboxes
	PlanMail            uint64  `json:"plan_mail"`                    // maximum number of mailboxes
	UserBash            string  `json:"user_bash"`                    // the command shell used
	PlanCp              int64   `json:"plan_cp,omitempty"`            // not documented by Beget API
	UserRateCurrent     float64 `json:"user_rate_current"`            // the current cost of the rate plan per day
	UserIsYearPlan      string  `json:"user_is_year_plan"`            // reports whether the annual discount is used
	UserRateYear        int64   `json:"user_rate_year"`               // the current cost of the rate plan per year
	UserRateMonth       int64   `json:"user_rate_month"`              // the current cost of the rate plan per month
	UserBalance         float64 `json:"user_balance"`                 // User's current balance
	UserDaysToBlock     uint64  `json:"user_days_to_block,omitempty"` // not documented by Beget API
	ServerApacheVersion string  `json:"server_apache_version"`        // apache version on the user's server
	ServerMysqlVersion  string  `json:"server_mysql_version"`         // mysql version on the user's server
	ServerNginxVersion  string  `json:"server_nginx_version"`         // nginx version on the user's server
	ServerPerlVersion   string  `json:"server_perl_version"`          // perl version on the user's server
	ServerPhpVersion    string  `json:"server_php_version"`           // php version on the user's server
	ServerPythonVersion string  `json:"server_python_version"`        // python version on the user's server
	ServerName          string  `json:"server_name"`                  // user's server name
	ServerCPUName       string  `json:"server_cpu_name"`              // user's server cpu name
	ServerMemory        uint64  `json:"server_memory"`                // user's server RAM count
	ServerMemoryCurrent uint64  `json:"server_memorycurrent"`         // the amount of RAM used by the user's server
	ServerLoadAverage   float64 `json:"server_loadaverage"`           // load Average of user's server
	ServerUptime        uint64  `json:"server_uptime"`                // uptime of user's server
}

UserInfo is the result of a successful call to the getAccountInfo method.

Jump to

Keyboard shortcuts

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