Documentation
¶
Overview ¶
Package westcn implements a DNS record management client compatible with the libdns interfaces for west.cn.
Index ¶
- type APIResponse
- type Client
- type Provider
- func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- func (p *Provider) GetRecords(ctx context.Context, zone string) ([]libdns.Record, error)
- func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
- type Record
- type RecordID
- type RecordIDResponse
- type Records
- type RecordsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct {
Result int `json:"result,omitempty"`
ClientID string `json:"clientid,omitempty"`
Msg string `json:"msg,omitempty"`
ErrorCode int `json:"errcode,omitempty"`
}
APIResponse API响应结构体 Result: 200为成功,其他均为失败 Msg: 错误或提示信息 https://www.west.cn/CustomerCenter/doc/apiv2.html#12u3001u8eabu4efdu9a8cu8bc10a3ca20id3d12u3001u8eabu4efdu9a8cu8bc13e203ca3e56
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client West.cn API 客户端
func (*Client) AppendRecord ¶ added in v1.0.0
AppendRecord 添加一条记录 https://www.west.cn/CustomerCenter/doc/domain_v2.html#37u3001u6dfbu52a0u57dfu540du89e3u67900a3ca20id3d37u3001u6dfbu52a0u57dfu540du89e3u67903e203ca3e
func (*Client) DeleteRecord ¶
DeleteRecord 删除一条记录 https://www.west.cn/CustomerCenter/doc/domain_v2.html#39u3001u5220u9664u57dfu540du89e3u67900a3ca20id3d39u3001u5220u9664u57dfu540du89e3u67903e203ca3e
func (*Client) GetRecords ¶
type Provider ¶
type Provider struct {
// Username is your username for west.cn, see https://www.west.cn/CustomerCenter/doc/apiv2.html#12u3001u8eabu4efdu9a8cu8bc10a3ca20id3d12u3001u8eabu4efdu9a8cu8bc13e203ca3e
Username string `json:"username,omitempty"`
// APIPassword is your API password for west.cn, see https://www.west.cn/CustomerCenter/doc/apiv2.html#12u3001u8eabu4efdu9a8cu8bc10a3ca20id3d12u3001u8eabu4efdu9a8cu8bc13e203ca3e
APIPassword string `json:"api_password,omitempty"`
// contains filtered or unexported fields
}
Provider facilitates DNS record manipulation with west.cn.
func (*Provider) AppendRecords ¶
func (p *Provider) AppendRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
AppendRecords adds records to the zone. It returns the records that were added. NOTE: This implementation is NOT atomic.
func (*Provider) DeleteRecords ¶
func (p *Provider) DeleteRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
DeleteRecords deletes the records from the zone. It returns the records that were deleted. NOTE: This implementation is NOT atomic.
func (*Provider) GetRecords ¶
GetRecords lists all the records in the zone.
func (*Provider) SetRecords ¶
func (p *Provider) SetRecords(ctx context.Context, zone string, records []libdns.Record) ([]libdns.Record, error)
SetRecords sets the records in the zone, either by updating existing records or creating new ones. It returns the updated records. NOTE: This implementation is NOT atomic.
type Record ¶
type Record struct {
ID int `json:"id,omitempty"`
Item string `json:"item,omitempty"` // 主机名称,获取记录时返回
Host string `json:"host,omitempty"` // 主机名称,添加记录时需要
Type string `json:"type,omitempty"`
Value string `json:"value,omitempty"`
TTL int `json:"ttl,omitempty"` // 60~86400 seconds
Level int `json:"level,omitempty"`
}
type RecordIDResponse ¶ added in v1.0.0
type RecordIDResponse struct {
APIResponse
Data RecordID `json:"data,omitempty"`
}
type RecordsResponse ¶ added in v1.0.0
type RecordsResponse struct {
APIResponse
Data Records `json:"data,omitempty"`
}