40 lines
934 B
Go
40 lines
934 B
Go
package alidns
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ssdomei232/goodBaby/internal/meta"
|
|
)
|
|
|
|
// 阿里云删除记录规则验证器
|
|
type AliDNSDeleteRecordRuleValidator struct{}
|
|
|
|
func (v *AliDNSDeleteRecordRuleValidator) GetType() string {
|
|
return RuleTypeDeleteRecord
|
|
}
|
|
|
|
func (v *AliDNSDeleteRecordRuleValidator) Validate(configJSON string) error {
|
|
config, err := ParseDeleteRecordConfig(configJSON)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if config.RecordID == "" {
|
|
return fmt.Errorf("阿里云删除记录规则配置中 record_id 不能为空")
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (v *AliDNSDeleteRecordRuleValidator) Meta() meta.RuleMeta {
|
|
return meta.RuleMeta{
|
|
Type: RuleTypeDeleteRecord,
|
|
Label: "删除阿里云DNS解析记录",
|
|
Description: "触发时删除阿里云DNS解析记录",
|
|
AccountType: AccountType,
|
|
Fields: []meta.Field{
|
|
{Key: "record_id", Label: "记录ID", Type: meta.FieldString, Required: true},
|
|
},
|
|
}
|
|
}
|