Initial commit (code only without large binaries)
This commit is contained in:
22
EdgeAPI/internal/dnsclients/cloudflare/response_base.go
Normal file
22
EdgeAPI/internal/dnsclients/cloudflare/response_base.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type BaseResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Errors []struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
} `json:"errors"`
|
||||
}
|
||||
|
||||
func (this *BaseResponse) IsOk() bool {
|
||||
return this.Success
|
||||
}
|
||||
|
||||
func (this *BaseResponse) LastError() (code int, message string) {
|
||||
if len(this.Errors) == 0 {
|
||||
return 0, ""
|
||||
}
|
||||
return this.Errors[0].Code, this.Errors[0].Message
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type CreateDNSRecordResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type DeleteDNSRecordResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type GetDNSRecordsResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Result []struct {
|
||||
Id string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Content string `json:"content"`
|
||||
Ttl int `json:"ttl"`
|
||||
ZoneId string `json:"zoneId"`
|
||||
ZoneName string `json:"zoneName"`
|
||||
} `json:"result"`
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type ResponseInterface interface {
|
||||
IsOk() bool
|
||||
LastError() (code int, message string)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type UpdateDNSRecordResponse struct {
|
||||
BaseResponse
|
||||
}
|
||||
12
EdgeAPI/internal/dnsclients/cloudflare/response_zones.go
Normal file
12
EdgeAPI/internal/dnsclients/cloudflare/response_zones.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package cloudflare
|
||||
|
||||
type ZonesResponse struct {
|
||||
BaseResponse
|
||||
|
||||
Result []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"result"`
|
||||
}
|
||||
Reference in New Issue
Block a user