domain

package
v0.3.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotifyChannelEmail      = "email"
	NotifyChannelWebhook    = "webhook"
	NotifyChannelDingtalk   = "dingtalk"
	NotifyChannelLark       = "lark"
	NotifyChannelTelegram   = "telegram"
	NotifyChannelServerChan = "serverchan"
	NotifyChannelBark       = "bark"
)
View Source
const (
	WorkflowNodeTypeStart     = "start"
	WorkflowNodeTypeEnd       = "end"
	WorkflowNodeTypeApply     = "apply"
	WorkflowNodeTypeDeploy    = "deploy"
	WorkflowNodeTypeNotify    = "notify"
	WorkflowNodeTypeBranch    = "branch"
	WorkflowNodeTypeCondition = "condition"
)
View Source
const (
	WorkflowTypeAuto   = "auto"
	WorkflowTypeManual = "manual"
)
View Source
const WorkflowOutputCertificate = "certificate"

Variables

View Source
var (
	ErrInvalidParams  = NewXError(400, "invalid params")
	ErrRecordNotFound = NewXError(404, "record not found")
)
View Source
var ValidityDuration = time.Hour * 24 * 10

Functions

func IsRecordNotFound

func IsRecordNotFound(err error) bool

Types

type Access

type Access struct {
	Meta
	Name       string    `json:"name"`
	Config     string    `json:"config"`
	ConfigType string    `json:"configType"`
	Deleted    time.Time `json:"deleted"`
	Usage      string    `json:"usage"`
}

func (*Access) GetString

func (a *Access) GetString(key string) string

兼容一下原 pocketbase 的 record

type AcmeAccount added in v0.2.8

type AcmeAccount struct {
	Id       string
	Ca       string
	Email    string
	Resource *registration.Resource
	Key      string
	Created  time.Time
	Updated  time.Time
}

type AliyunAccess

type AliyunAccess struct {
	AccessKeyId     string `json:"accessKeyId"`
	AccessKeySecret string `json:"accessKeySecret"`
}

type ApplyConfig

type ApplyConfig struct {
	Email              string `json:"email"`
	Access             string `json:"access"`
	KeyAlgorithm       string `json:"keyAlgorithm"`
	Nameservers        string `json:"nameservers"`
	Timeout            int64  `json:"timeout"`
	DisableFollowCNAME bool   `json:"disableFollowCNAME"`
}

type AwsAccess

type AwsAccess struct {
	AccessKeyId     string `json:"accessKeyId"`
	SecretAccessKey string `json:"secretAccessKey"`
	Region          string `json:"region"`
	HostedZoneId    string `json:"hostedZoneId"`
}

type BaiduCloudAccess added in v0.2.14

type BaiduCloudAccess struct {
	AccessKeyId     string `json:"accessKeyId"`
	SecretAccessKey string `json:"secretAccessKey"`
}

type ByteplusAccess added in v0.2.21

type ByteplusAccess struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
}

type Certificate

type Certificate struct {
	Meta
	SAN               string    `json:"san" db:"san"`
	Certificate       string    `json:"certificate" db:"certificate"`
	PrivateKey        string    `json:"privateKey" db:"privateKey"`
	IssuerCertificate string    `json:"issuerCertificate" db:"issuerCertificate"`
	CertUrl           string    `json:"certUrl" db:"certUrl"`
	CertStableUrl     string    `json:"certStableUrl" db:"certStableUrl"`
	Output            string    `json:"output" db:"output"`
	Workflow          string    `json:"workflow" db:"workflow"`
	ExpireAt          time.Time `json:"ExpireAt" db:"expireAt"`
	NodeId            string    `json:"nodeId" db:"nodeId"`
}

type CertificateIssuer

type CertificateIssuer struct {
	Country      string `json:"country"`
	Organization string `json:"organization"`
	CommonName   string `json:"commonName"`
}

type CertificateSubject

type CertificateSubject struct {
	CN string `json:"CN"`
}

type CertificateValidity

type CertificateValidity struct {
	NotBefore string `json:"notBefore"`
	NotAfter  string `json:"notAfter"`
}

type ChannelsConfig

type ChannelsConfig map[string]map[string]any

type CloudflareAccess

type CloudflareAccess struct {
	DnsApiToken string `json:"dnsApiToken"`
}

type DeployConfig

type DeployConfig struct {
	Id     string         `json:"id"`
	Access string         `json:"access"`
	Type   string         `json:"type"`
	Config map[string]any `json:"config"`
}

func (*DeployConfig) GetConfigAsBool added in v0.2.7

func (dc *DeployConfig) GetConfigAsBool(key string) bool

以布尔形式获取配置项。

入参:

  • key: 配置项的键。

出参:

  • 配置项的值。如果配置项不存在或者类型不是布尔,则返回 false。

func (*DeployConfig) GetConfigAsInt32 added in v0.2.9

func (dc *DeployConfig) GetConfigAsInt32(key string) int32

以 32 位整数形式获取配置项。

入参:

  • key: 配置项的键。

出参:

  • 配置项的值。如果配置项不存在或者类型不是 32 位整数,则返回 0。

func (*DeployConfig) GetConfigAsString added in v0.2.7

func (dc *DeployConfig) GetConfigAsString(key string) string

以字符串形式获取配置项。

入参:

  • key: 配置项的键。

出参:

  • 配置项的值。如果配置项不存在或者类型不是字符串,则返回空字符串。

func (*DeployConfig) GetConfigAsVariables added in v0.2.13

func (dc *DeployConfig) GetConfigAsVariables() map[string]string

以变量字典形式获取配置项。

出参:

  • 变量字典。

func (*DeployConfig) GetConfigOrDefaultAsBool added in v0.2.7

func (dc *DeployConfig) GetConfigOrDefaultAsBool(key string, defaultValue bool) bool

以布尔形式获取配置项。

入参:

  • key: 配置项的键。
  • defaultValue: 默认值。

出参:

  • 配置项的值。如果配置项不存在或者类型不是布尔,则返回默认值。

func (*DeployConfig) GetConfigOrDefaultAsInt32 added in v0.2.9

func (dc *DeployConfig) GetConfigOrDefaultAsInt32(key string, defaultValue int32) int32

以 32 位整数形式获取配置项。

入参:

  • key: 配置项的键。
  • defaultValue: 默认值。

出参:

  • 配置项的值。如果配置项不存在、类型不是 32 位整数或者值为零值,则返回默认值。

func (*DeployConfig) GetConfigOrDefaultAsString added in v0.2.7

func (dc *DeployConfig) GetConfigOrDefaultAsString(key string, defaultValue string) string

以字符串形式获取配置项。

入参:

  • key: 配置项的键。
  • defaultValue: 默认值。

出参:

  • 配置项的值。如果配置项不存在、类型不是字符串或者值为零值,则返回默认值。

func (*DeployConfig) GetDomain added in v0.2.7

func (dc *DeployConfig) GetDomain(wildcard ...bool) string

GetDomain returns the domain from the deploy config if the domain is a wildcard domain, and wildcard is true, return the wildcard domain

type DogeCloudAccess added in v0.2.14

type DogeCloudAccess struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
}

type GodaddyAccess

type GodaddyAccess struct {
	ApiKey    string `json:"apiKey"`
	ApiSecret string `json:"apiSecret"`
}

type HttpreqAccess

type HttpreqAccess struct {
	Endpoint string `json:"endpoint"`
	Mode     string `json:"mode"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type HuaweiCloudAccess

type HuaweiCloudAccess struct {
	AccessKeyId     string `json:"accessKeyId"`
	SecretAccessKey string `json:"secretAccessKey"`
	Region          string `json:"region"`
}

type KV

type KV struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type KubernetesAccess

type KubernetesAccess struct {
	KubeConfig string `json:"kubeConfig"`
}

type LocalAccess

type LocalAccess struct{}

type Meta

type Meta struct {
	Id      string    `json:"id" db:"id"`
	Created time.Time `json:"created" db:"created"`
	Updated time.Time `json:"updated" db:"updated"`
}

type MetaData

type MetaData struct {
	Version            string              `json:"version"`
	SerialNumber       string              `json:"serialNumber"`
	Validity           CertificateValidity `json:"validity"`
	SignatureAlgorithm string              `json:"signatureAlgorithm"`
	Issuer             CertificateIssuer   `json:"issuer"`
	Subject            CertificateSubject  `json:"subject"`
}

type NameSiloAccess

type NameSiloAccess struct {
	ApiKey string `json:"apiKey"`
}

type NotifyMessage

type NotifyMessage struct {
	Subject string
	Message string
}

type NotifyTemplate

type NotifyTemplate struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

type NotifyTemplates

type NotifyTemplates struct {
	NotifyTemplates []NotifyTemplate `json:"notifyTemplates"`
}

type NotifyTestPushReq

type NotifyTestPushReq struct {
	Channel string `json:"channel"`
}

type PdnsAccess

type PdnsAccess struct {
	ApiUrl string `json:"apiUrl"`
	ApiKey string `json:"apiKey"`
}

type QiniuAccess

type QiniuAccess struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
}

type RunLog

type RunLog struct {
	NodeName string         `json:"nodeName"`
	Error    string         `json:"error"`
	Outputs  []RunLogOutput `json:"outputs"`
}

type RunLogOutput

type RunLogOutput struct {
	Time    string `json:"time"`
	Title   string `json:"title"`
	Content string `json:"content"`
	Error   string `json:"error"`
}

type RunLogs

type RunLogs []RunLog

func (RunLogs) Error

func (r RunLogs) Error() string

type SSHAccess

type SSHAccess struct {
	Host          string `json:"host"`
	Port          string `json:"port"`
	Username      string `json:"username"`
	Password      string `json:"password"`
	Key           string `json:"key"`
	KeyPassphrase string `json:"keyPassphrase"`
}

type Setting

type Setting struct {
	ID      string    `json:"id"`
	Name    string    `json:"name"`
	Content string    `json:"content"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
}

func (*Setting) GetChannelContent

func (s *Setting) GetChannelContent(channel string) (map[string]any, error)

type Statistics

type Statistics struct {
	CertificateTotal      int `json:"certificateTotal"`
	CertificateExpireSoon int `json:"certificateExpireSoon"`
	CertificateExpired    int `json:"certificateExpired"`

	WorkflowTotal    int `json:"workflowTotal"`
	WorkflowEnabled  int `json:"workflowEnabled"`
	WorkflowDisabled int `json:"workflowDisabled"`
}

type TencentAccess

type TencentAccess struct {
	SecretId  string `json:"secretId"`
	SecretKey string `json:"secretKey"`
}

type VolcEngineAccess

type VolcEngineAccess struct {
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`

	// Deprecated: Use [AccessKey] and [SecretKey] instead in the future
	AccessKeyId string `json:"accessKeyId"`
	// Deprecated: Use [AccessKey] and [SecretKey] instead in the future
	SecretAccessKey string `json:"secretAccessKey"`
}

type WebhookAccess

type WebhookAccess struct {
	Url string `json:"url"`
}

type Workflow

type Workflow struct {
	Meta
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Type        string        `json:"type"`
	Crontab     string        `json:"crontab"`
	Content     *WorkflowNode `json:"content"`
	Draft       *WorkflowNode `json:"draft"`
	Enabled     bool          `json:"enabled"`
	HasDraft    bool          `json:"hasDraft"`
}

type WorkflowNode

type WorkflowNode struct {
	Id     string           `json:"id"`
	Name   string           `json:"name"`
	Next   *WorkflowNode    `json:"next"`
	Config map[string]any   `json:"config"`
	Input  []WorkflowNodeIo `json:"input"`
	Output []WorkflowNodeIo `json:"output"`

	Validated bool   `json:"validated"`
	Type      string `json:"type"`

	Branches []WorkflowNode `json:"branches"`
}

func (*WorkflowNode) GetConfigBool

func (n *WorkflowNode) GetConfigBool(key string) bool

func (*WorkflowNode) GetConfigInt64

func (n *WorkflowNode) GetConfigInt64(key string) int64

func (*WorkflowNode) GetConfigString

func (n *WorkflowNode) GetConfigString(key string) string

type WorkflowNodeIo

type WorkflowNodeIo struct {
	Label         string                      `json:"label"`
	Name          string                      `json:"name"`
	Type          string                      `json:"type"`
	Required      bool                        `json:"required"`
	Value         any                         `json:"value"`
	ValueSelector WorkflowNodeIoValueSelector `json:"valueSelector"`
}

type WorkflowNodeIoValueSelector

type WorkflowNodeIoValueSelector struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type WorkflowOutput

type WorkflowOutput struct {
	Meta
	Workflow string           `json:"workflow"`
	NodeId   string           `json:"nodeId"`
	Node     *WorkflowNode    `json:"node"`
	Output   []WorkflowNodeIo `json:"output"`
	Succeed  bool             `json:"succeed"`
}

type WorkflowRunLog

type WorkflowRunLog struct {
	Meta
	Workflow string   `json:"workflow"`
	Log      []RunLog `json:"log"`
	Succeed  bool     `json:"succeed"`
	Error    string   `json:"error"`
}

type WorkflowRunReq

type WorkflowRunReq struct {
	Id string `json:"id"`
}

type XError

type XError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func NewXError

func NewXError(code int, msg string) *XError

func (*XError) Error

func (e *XError) Error() string

func (*XError) GetCode

func (e *XError) GetCode() int

Jump to

Keyboard shortcuts

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