- domain(24), product(8), rbm(10), rca(21), rgs(38), ros(19), ssl(5), user(10), workorder(11), public remaining 5 - split nested response structs into reusable named types - rgs reuses rcs request/response types - fix source bugs: malformed paths, resp vs &resp, missing bodies - register all 11 services in sdk.New
73 lines
2.2 KiB
Go
73 lines
2.2 KiB
Go
package domain
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/XingfenD/rainyun_api_go_sdk/apis/common"
|
|
"github.com/XingfenD/rainyun_api_go_sdk/constant"
|
|
)
|
|
|
|
// 添加域名DNS解析
|
|
//
|
|
// id: 域名ID
|
|
func (s *DomainService) AddDomainDNSRecord(id int, req *AddDomainDNSRecordRequest) (*common.BasicOperationResponse, error) {
|
|
path := fmt.Sprintf("/product/domain/%d/dns", id)
|
|
|
|
var resp common.BasicOperationResponse
|
|
err := s.client.Do(constant.HTTPMethod_POST, path, nil, req, &resp)
|
|
|
|
return &resp, err
|
|
}
|
|
|
|
// 修改域名DNS解析
|
|
//
|
|
// req.RecordID 指定要修改的记录
|
|
func (s *DomainService) UpdateDomainDNSRecord(id int, req *AddDomainDNSRecordRequest) (*common.BasicOperationResponse, error) {
|
|
path := fmt.Sprintf("/product/domain/%d/dns", id)
|
|
|
|
var resp common.BasicOperationResponse
|
|
err := s.client.Do(constant.HTTPMethod_PATCH, path, nil, req, &resp)
|
|
|
|
return &resp, err
|
|
}
|
|
|
|
// 删除域名DNS解析
|
|
func (s *DomainService) DeleteDomainDNSRecord(id, recordID int) (*common.BasicOperationResponse, error) {
|
|
path := fmt.Sprintf("/product/domain/%d/dns", id)
|
|
|
|
var resp common.BasicOperationResponse
|
|
err := s.client.Do(constant.HTTPMethod_DELETE, path, nil, DeleteDomainDNSRecordRequest{RecordID: recordID}, &resp)
|
|
|
|
return &resp, err
|
|
}
|
|
|
|
// 添加域名DNSSEC
|
|
func (s *DomainService) AddDomainDNSSEC(id int, req *AddDomainDNSSECRequest) (*common.BasicOperationResponse, error) {
|
|
path := fmt.Sprintf("/product/domain/%d/dnssec", id)
|
|
|
|
var resp common.BasicOperationResponse
|
|
err := s.client.Do(constant.HTTPMethod_POST, path, nil, req, &resp)
|
|
|
|
return &resp, err
|
|
}
|
|
|
|
// 删除域名DNSSEC
|
|
func (s *DomainService) DeleteDomainDNSSEC(id int, req *DeleteDomainDNSSECRequest) (*common.BasicOperationResponse, error) {
|
|
path := fmt.Sprintf("/product/domain/%d/dnssec/delete", id)
|
|
|
|
var resp common.BasicOperationResponse
|
|
err := s.client.Do(constant.HTTPMethod_POST, path, nil, req, &resp)
|
|
|
|
return &resp, err
|
|
}
|
|
|
|
// 同步域名DNSSEC
|
|
func (s *DomainService) SyncDomainDNSSEC(id int) (*common.BasicOperationResponse, error) {
|
|
path := fmt.Sprintf("/product/domain/%d/dnssec/sync", id)
|
|
|
|
var resp common.BasicOperationResponse
|
|
err := s.client.Do(constant.HTTPMethod_POST, path, nil, nil, &resp)
|
|
|
|
return &resp, err
|
|
}
|