125 lines
5.8 KiB
Go
125 lines
5.8 KiB
Go
package cf
|
|
|
|
type RequestBody struct {
|
|
Comment string `yaml:"comment" json:"comment,omitempty"`
|
|
DomainName string `json:"name" yaml:"name"` // domain name example.com",
|
|
Proxied bool `json:"proxied" yaml:"proxied"` //true,
|
|
Settings Settings `json:"settings,omitempty" yaml:"settings"` //{},
|
|
Tags []string `json:"tags,omitempty" yaml:"tags"` //[],
|
|
TTL int `json:"ttl" yaml:"ttl"` //3600,
|
|
Content string `json:"content" yaml:"content"` //ip to add "198.51.100.4",
|
|
Type string `json:"type" yaml:"type"` //record type "A"
|
|
}
|
|
|
|
type ResponseBody struct {
|
|
Errors []Error `json:"errors"` //"errors": [],
|
|
Messages []string `json:"messages"` //"messages": [],
|
|
Success bool `json:"success"` //"success": true,
|
|
Result []Result `json:"result"` //
|
|
}
|
|
|
|
type Result struct {
|
|
ID string `json:"ID" yaml:"ID"` //"id": "023e105f4ecef8ad9ca31a8372d0c353",
|
|
ZoneID string `json:"zone_id" yaml:"zone_id"`
|
|
ZoneName string `json:"zone_name" yaml:"zone_name"` // the base name for domain.com
|
|
Comment string `json:"comment" yaml:"comment"` // "comment": "Domain verification record",
|
|
Name string `json:"name" yaml:"name"` //domain name or sub domain "name": "test.example.com",
|
|
Proxied bool `json:"proxied" yaml:"proxied"` //"proxied": true,
|
|
Settings Settings `json:"settings" yaml:"settings"` //"settings": {},
|
|
Tags []string `json:"tags" yaml:"tags"` //"tags": [],
|
|
TTL int `json:"ttl" yaml:"ttl"` //"ttl": 3600,
|
|
Content string `json:"content" yaml:"content"` //IP "content": "198.51.100.4",
|
|
Type string `json:"type" yaml:"type"` //"type": "A",
|
|
CommentModifiedOn string `json:"comment_modified_on" yaml:"comment_modified_on"` //"comment_modified_on": "2024-01-01T05:20:00.12345Z",
|
|
CreatedOn string `json:"created_on" yaml:"created_on"` //"created_on": "2014-01-01T05:20:00.12345Z",
|
|
|
|
Meta Meta `json:"meta" yaml:"meta"` //"meta": {},
|
|
ModifiedOn string `json:"modified_on" yaml:"modified_on"` //"modified_on": "2014-01-01T05:20:00.12345Z",
|
|
Proxiable bool `json:"proxiable" yaml:"proxiable"` //"proxiable": true,
|
|
TagsModifiedOn string `json:"tags_modified_on" yaml:"tags_modified_on"` //"tags_modified_on": "2025-01-01T05:20:00.12345Z"
|
|
ResultInfo ResultInfo `json:"result_info" yaml:"result_info"`
|
|
}
|
|
type DetailsResult struct {
|
|
Errors []Error `json:"errors"` //"errors": [],
|
|
Messages []string `json:"messages"` //"messages": [],
|
|
Success bool `json:"success"` //"success": true,
|
|
Result Result `json:"result" yaml:"result"`
|
|
}
|
|
|
|
type Meta struct {
|
|
AutoAdded bool `json:"auto_added" yaml:"auto_added"`
|
|
ManagedByApps bool `json:"managed_by_apps" yaml:"managed_by_apps"`
|
|
ManagedByArgoTunnel bool `json:"managed_by_argo_tunnel" yaml:"managed_by_argo_tunnel"`
|
|
}
|
|
|
|
type ResultInfo struct {
|
|
Page int `json:"page" yaml:"page"`
|
|
PerPage int `json:"per_page" yaml:"per_page"`
|
|
Count int `json:"count" yaml:"count"`
|
|
TotalCount int `json:"total_count" yaml:"total_count"`
|
|
TotalPages int `json:"total_pages" yaml:"total_pages"`
|
|
}
|
|
|
|
// settings response example https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings
|
|
/*
|
|
"messages": [],
|
|
"success": true,
|
|
"result": {
|
|
"zone_defaults": {
|
|
"flatten_all_cnames": false,
|
|
"foundation_dns": false,
|
|
"multi_provider": false,
|
|
"nameservers": {
|
|
"type": "cloudflare.standard"
|
|
},
|
|
"ns_ttl": 86400,
|
|
"secondary_overrides": false,
|
|
"soa": {
|
|
"expire": 604800,
|
|
"min_ttl": 1800,
|
|
"mname": "kristina.ns.cloudflare.com",
|
|
"refresh": 10000,
|
|
"retry": 2400,
|
|
"rname": "admin.example.com",
|
|
"ttl": 3600
|
|
},
|
|
"zone_mode": "dns_only"
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
type Settings struct {
|
|
FlattenAllCNames bool `json:"flatten_all_cnames" yaml:"flatten_all_cnames"` //"flatten_all_cnames": false,
|
|
FoundationDns bool `json:"foundation_dns" yaml:"foundation_dns"` //"foundation_dns": false,
|
|
MultiProvider bool `json:"multi_provider" yaml:"multi_provider"` //"multi_provider": false,
|
|
NSTTL int `json:"ns_ttl" yaml:"ns_ttl"` //"ns_ttl": 86400,
|
|
SecondaryOverrides bool `json:"secondary_overrides" yaml:"secondary_overrides"` //"secondary_overrides": false,
|
|
ZoneMode string `json:"zone_mode" yaml:"zone_mode"` //"zone_mode": "dns_only"
|
|
NameServers NameServers `json:"nameservers" yaml:"nameservers"`
|
|
Soa SOA `json:"soa" yaml:"soa"`
|
|
}
|
|
|
|
type NameServers struct {
|
|
Type string `json:"type" yaml:"tipe"`
|
|
}
|
|
|
|
type SOA struct {
|
|
Expire int `json:"expire" yaml:"expire,flow"` //"expire": 604800,
|
|
MinTTL int `json:"min_ttl" yaml:"min_ttl,flow"` //"min_ttl": 1800,
|
|
MName string `json:"mname" yaml:"mname"` //"mname": "kristina.ns.cloudflare.com",
|
|
Refresh int `json:"refresh" yaml:"refresh"` //"refresh": 10000,
|
|
Retry int `json:"retry" yaml:"retry"` //"retry": 2400,
|
|
RName string `json:"rname" yaml:"rname"` //"rname": "admin.example.com",
|
|
TTL int `json:"ttl" yaml:"ttl"` //"ttl": 3600
|
|
}
|
|
|
|
type Test struct {
|
|
Name string `yaml:"name"`
|
|
Age int `yaml:"age"`
|
|
}
|
|
type Error struct {
|
|
Code int `json:"code" yaml:"code"`
|
|
Message string `json:"message" yaml:"message"`
|
|
}
|