cloudns

package module
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

README

cloudns api

Documentation

Index

Constants

View Source
const (
	// APIVersion is the currently supported API version
	APIVersion string = apiVersion

	// APIURL is the URL of the API service backend.
	APIURL string = "https://api.cloudns.net"
)

Variables

View Source
var (
	// AuthId Api user ID
	AuthId *string = nil

	// SubAuthId Api sub user ID
	SubAuthId *int = nil

	// SubAuthUser Api sub user name
	SubAuthUser *string = nil

	// AuthPassword is the password for API user ID or for API sub user ID
	AuthPassword *string = nil

	// DefaultMaxNetworkRetries is the default maximum number of retries made
	// by a Cloudns client.
	DefaultMaxNetworkRetries int64 = 2
)

Functions

func Int

func Int(v int) *int

func Int64

func Int64(v int64) *int64

func MasterIpType

func MasterIpType(fl validator.FieldLevel) bool

func OrderBy

func OrderBy(fl validator.FieldLevel) bool

func Port

func Port(fl validator.FieldLevel) bool

func Priority

func Priority(fl validator.FieldLevel) bool

func RecordTypes

func RecordTypes(fl validator.FieldLevel) bool

func RegisterValidationErrors

func RegisterValidationErrors(trans ut.Translator)

func RowsPerPage

func RowsPerPage(fl validator.FieldLevel) bool

func SetAppInfo

func SetAppInfo(info *AppInfo)

func SetBackend

func SetBackend(b Backend)

func String

func String(v string) *string

func Ttl

func Ttl(fl validator.FieldLevel) bool

func ValidateParams

func ValidateParams[T any](value T) []string

func ValidatorInit

func ValidatorInit()

func Weight

func Weight(fl validator.FieldLevel) bool

func ZoneStatus

func ZoneStatus(fl validator.FieldLevel) bool

func ZoneType

func ZoneType(fl validator.FieldLevel) bool

Types

type AccountBalanceResponse

type AccountBalanceResponse struct {
	Funds string `json:"funds"`
}

type AccountIpResponse

type AccountIpResponse struct {
	Ip string `json:"ip"`
}

type AccountLoginResponse

type AccountLoginResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type AddRecordParams

type AddRecordParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
	RecordType *string `json:"record-type" validate:"required,record_types"`
	Host       *string `json:"host" validate:"required"`
	Record     *string `json:"record" validate:"required"`
	TTL        *string `json:"ttl,omitempty" validate:"required,ttl"`
	Priority   *string `json:"priority,omitempty" validate:"omitempty,priority"`
	Weight     *string `json:"weight,omitempty" validate:"omitempty,weight"`
	Port       *string `json:"port,omitempty" validate:"omitempty,port"`
}

type AddRecordResponse

type AddRecordResponse struct {
	Status            string                `json:"status"`
	StatusDescription string                `json:"statusDescription"`
	Data              AddRecordResponseData `json:"data"`
}

type AddRecordResponseData

type AddRecordResponseData struct {
	Id *int `json:"id"`
}

type AppInfo

type AppInfo struct {
	Name      string `json:"name"`
	PartnerID string `json:"partner_id"`
	URL       string `json:"url"`
	Version   string `json:"version"`
}

type AvailableNameServers

type AvailableNameServers struct {
	Id            *string `json:"id"`
	Type          *string `json:"type"`
	Name          *string `json:"name"`
	Ip4           *string `json:"ip4"`
	Ip6           *string `json:"ip6"`
	Location      *string `json:"location"`
	LocationCc    *string `json:"location_cc"`
	DdosProtected *int    `json:"ddos_protected"`
}

type AvailableNameServersListParams

type AvailableNameServersListParams struct {
	auth.Auth    `json:",inline"`
	DetailedInfo *int `json:"detailed-info,omitempty"`
}

type Backend

type Backend interface {
	Call(method, path string, params interface{}, v interface{}, isPlain bool) error
}

func GetBackend

func GetBackend() Backend

func GetBackendWithConfig

func GetBackendWithConfig(config *BackendConfig) Backend

type BackendConfig

type BackendConfig struct {
	HTTPClient *http.Client

	MaxNetworkRetries *int64

	URL *string
}

type BackendImplementation

type BackendImplementation struct {
	URL               string
	HTTPClient        *http.Client
	MaxNetworkRetries int64
	// contains filtered or unexported fields
}

func (*BackendImplementation) Call

func (s *BackendImplementation) Call(method, path string, params interface{}, v interface{}, isPlain bool) error

func (*BackendImplementation) CallRaw

func (s *BackendImplementation) CallRaw(method, path string, params []byte, v interface{}, isPlain bool) error

func (*BackendImplementation) Do

func (s *BackendImplementation) Do(req *http.Request, body *bytes.Buffer, v interface{}, isPlain bool) error

func (*BackendImplementation) NewRequest

func (s *BackendImplementation) NewRequest(method, path, contentType string, params *bytes.Buffer) (*http.Request, error)

func (*BackendImplementation) ReadPlainResponse

func (s *BackendImplementation) ReadPlainResponse(resBody []byte, v interface{}) error

func (*BackendImplementation) UnmarshalJSONVerbose

func (s *BackendImplementation) UnmarshalJSONVerbose(statusCode int, body []byte, v interface{}) error

type Backends

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

type ChangeZoneStatusParams

type ChangeZoneStatusParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
	Status     *int    `json:"status" validate:"omitempty,zone_status"`
}

type ChangeZoneStatusResponse

type ChangeZoneStatusResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type DeleteDomainZoneParams

type DeleteDomainZoneParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
}

type DeleteDomainZoneResponse

type DeleteDomainZoneResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type DeleteRecordParams

type DeleteRecordParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
	RecordId   *string `json:"record-id" validate:"required"`
}

type DeleteRecordResponse

type DeleteRecordResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type DomainZones

type DomainZones struct {
	Name      *string `json:"name,omitempty"`
	Type      *string `json:"type,omitempty"`
	Group     *string `json:"group,omitempty"`
	HasBulk   *bool   `json:"hasBulk,omitempty"`
	Zone      *string `json:"zone,omitempty"`
	Status    *string `json:"status,omitempty"`
	Serial    *string `json:"serial,omitempty"`
	IsUpdated *int    `json:"isUpdated,omitempty"`
}

type DomainZonesPagesCountParams

type DomainZonesPagesCountParams struct {
	auth.Auth   `json:",inline"`
	RowsPerPage *int `json:"rows-per-page" validate:"required,rows_per_page"`
}

type GetZoneInformationParams

type GetZoneInformationParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
}

type IsUpdatedZoneParams

type IsUpdatedZoneParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
}

type ListDomainZonesParams

type ListDomainZonesParams struct {
	auth.Auth   `json:",inline"`
	Page        *int    `json:"page" validate:"required"`
	RowsPerPage *int    `json:"rows-per-page" validate:"required,rows_per_page"`
	Search      *string `json:"search,omitempty"`
	GroupId     *int    `json:"group-id,omitempty"`
}

type ListDomainZonesResponse

type ListDomainZonesResponse struct {
	Page        *int           `json:"page"`
	RowsPerPage *int           `json:"rows-per-page"`
	PageCount   *int           `json:"page-count"`
	DomainZones []*DomainZones `json:"domain-zones"`
}

type ModifyRecordParams

type ModifyRecordParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
	RecordId   *string `json:"record-id" validate:"required"`
	Host       *string `json:"host" validate:"required"`
	Record     *string `json:"record" validate:"required"`
	TTL        *string `json:"ttl,omitempty" validate:"required,ttl"`
	Priority   *string `json:"priority,omitempty" validate:"omitempty,priority"`
	Weight     *string `json:"weight,omitempty" validate:"omitempty,weight"`
	Port       *string `json:"port,omitempty" validate:"omitempty,port"`
}

type ModifyRecordResponse

type ModifyRecordResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type Record

type Record struct {
	Id               *string `json:"id"`
	Type             *string `json:"type"`
	Host             *string `json:"host"`
	Record           *string `json:"record"`
	DynamicUrlStatus *int    `json:"dynamicurl_status"`
	Priority         *string `json:"priority"`
	Weight           *string `json:"weight"`
	Port             *string `json:"port"`
	Failover         *string `json:"failover"`
	TTL              *string `json:"ttl"`
	Status           *int    `json:"status"`
}

type RecordListParams added in v0.0.20

type RecordListParams struct {
	auth.Auth   `json:",inline"`
	DomainName  *string `json:"domain-name" validate:"required"`
	Host        *string `json:"host,omitempty"`
	HostLike    *string `json:"host-like,omitempty"`
	Type        *string `json:"type,omitempty" validate:"omitempty,record_types"`
	RowsPerPage *int    `json:"rows-per-page,omitempty" validate:"omitempty,rows_per_page"`
	Page        *int    `json:"page,omitempty"`
	OrderBy     *string `json:"order-by,omitempty" validate:"omitempty,order_by"`
}

type RecordListResponse added in v0.0.20

type RecordListResponse struct {
	Page        *int               `json:"page"`
	RowsPerPage *int               `json:"rows-per-page"`
	PageCount   *int               `json:"page-count"`
	Records     map[string]*Record `json:"records"`
}

type RecordParams

type RecordParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
	RecordId   *int    `json:"record-id" validate:"required"`
}

type RecordResponse

type RecordResponse struct {
	Id               *string `json:"id"`
	Type             *string `json:"type"`
	Host             *string `json:"host"`
	Record           *string `json:"record"`
	TTL              *string `json:"ttl"`
	Priority         *string `json:"priority"`
	Weight           *string `json:"weight,omitempty"`
	Port             *string `json:"port,omitempty"`
	DynamicUrlStatus *int    `json:"dynamicurl_status"`
	Failover         *string `json:"failover"`
	Status           *int    `json:"status"`
}

type RecordsPagesCountParams

type RecordsPagesCountParams struct {
	auth.Auth   `json:",inline"`
	DomainName  *string `json:"domain-name" validate:"required"`
	Host        *string `json:"host,omitempty"`
	Type        *string `json:"type,omitempty" validate:"omitempty,record_types"`
	RowsPerPage *int    `json:"rows-per-page" validate:"required,rows_per_page"`
}

type RecordsStatisticsResponse

type RecordsStatisticsResponse struct {
	Count *int    `json:"count"`
	Limit *string `json:"limit"`
}

type RegisterDomainZoneParams

type RegisterDomainZoneParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string  `json:"domain-name" validate:"required"`
	ZoneType   *string  `json:"zone-type" validate:"zonetype"`
	NS         []string `json:"ns"`
	MasterIP   *string  `json:"master-ip,omitempty" validate:"omitempty,master_ip"`
}

type RegisterDomainZoneResponse

type RegisterDomainZoneResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type UpdateZoneParams

type UpdateZoneParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
}

type UpdateZoneResponse

type UpdateZoneResponse struct {
	Status            string `json:"status"`
	StatusDescription string `json:"statusDescription"`
}

type UpdateZoneStatusParams

type UpdateZoneStatusParams struct {
	auth.Auth  `json:",inline"`
	DomainName *string `json:"domain-name" validate:"required"`
}

type UpdateZoneStatusResponse

type UpdateZoneStatusResponse struct {
	Server  *string `json:"server"`
	Ip4     *string `json:"ip4"`
	Ip6     *string `json:"ip6"`
	Updated *bool   `json:"updated"`
}

type ZoneInformationResponse

type ZoneInformationResponse struct {
	Name   *string `json:"name"`
	Type   *string `json:"type"`
	Zone   *string `json:"zone"`
	Status *string `json:"status"`
}

type ZoneStatisticsResponse

type ZoneStatisticsResponse struct {
	Count *string `json:"count"`
	Limit *string `json:"limit"`
}

Directories

Path Synopsis
Package accounts provides the /accounts APIs
Package accounts provides the /accounts APIs
Package customer provides the dns zones APIs
Package customer provides the dns zones APIs
Package customer provides the records APIs
Package customer provides the records APIs

Jump to

Keyboard shortcuts

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