mirror of
https://github.com/go-acme/lego.git
synced 2025-03-04 08:08:23 +02:00
Add DNS provider for F5 XC (#2409)
This commit is contained in:
parent
5b06dd7874
commit
4675ef7d9a
54
README.md
54
README.md
@ -110,138 +110,138 @@ Detailed documentation is available [here](https://go-acme.github.io/lego/dns).
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/exoscale/">Exoscale</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/exec/">External program</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/f5xc/">F5 XC</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/freemyip/">freemyip.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gcore/">G-Core</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gcore/">G-Core</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gandi/">Gandi</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gandiv5/">Gandi Live DNS (v5)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/glesys/">Glesys</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/godaddy/">Go Daddy</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/godaddy/">Go Daddy</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/gcloud/">Google Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/googledomains/">Google Domains</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hetzner/">Hetzner</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hostingde/">Hosting.de</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hostingde/">Hosting.de</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hosttech/">Hosttech</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/httpreq/">HTTP request</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/httpnet/">http.net</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/huaweicloud/">Huawei Cloud</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/huaweicloud/">Huawei Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hurricane/">Hurricane Electric DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/hyperone/">HyperOne</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ibmcloud/">IBM Cloud (SoftLayer)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iijdpf/">IIJ DNS Platform Service</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iijdpf/">IIJ DNS Platform Service</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/infoblox/">Infoblox</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/infomaniak/">Infomaniak</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iij/">Internet Initiative Japan</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/internetbs/">Internet.bs</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/internetbs/">Internet.bs</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/inwx/">INWX</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ionos/">Ionos</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ipv64/">IPv64</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iwantmyname/">iwantmyname</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/iwantmyname/">iwantmyname</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/joker/">Joker</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/acme-dns/">Joohoi's ACME-DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/liara/">Liara</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/limacity/">Lima-City</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/limacity/">Lima-City</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/linode/">Linode (v4)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/liquidweb/">Liquid Web</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/loopia/">Loopia</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/luadns/">LuaDNS</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/luadns/">LuaDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mailinabox/">Mail-in-a-Box</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/manageengine/">ManageEngine CloudDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/manual/">Manual</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/metaname/">Metaname</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/metaname/">Metaname</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/metaregistrar/">Metaregistrar</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mijnhost/">mijn.host</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mittwald/">Mittwald</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/myaddr/">myaddr.{tools,dev,io}</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/myaddr/">myaddr.{tools,dev,io}</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mydnsjp/">MyDNS.jp</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/mythicbeasts/">MythicBeasts</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namedotcom/">Name.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namecheap/">Namecheap</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namecheap/">Namecheap</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/namesilo/">Namesilo</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nearlyfreespeech/">NearlyFreeSpeech.NET</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/netcup/">Netcup</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/netlify/">Netlify</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/netlify/">Netlify</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nicmanager/">Nicmanager</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nifcloud/">NIFCloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/njalla/">Njalla</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nodion/">Nodion</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/nodion/">Nodion</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ns1/">NS1</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/otc/">Open Telekom Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/oraclecloud/">Oracle Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ovh/">OVH</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ovh/">OVH</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/plesk/">plesk.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/porkbun/">Porkbun</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/pdns/">PowerDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rackspace/">Rackspace</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rackspace/">Rackspace</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rainyun/">Rain Yun/雨云</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rcodezero/">RcodeZero</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/regru/">reg.ru</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/regfish/">Regfish</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/regfish/">Regfish</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rfc2136/">RFC2136</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/rimuhosting/">RimuHosting</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/sakuracloud/">Sakura Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/scaleway/">Scaleway</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/scaleway/">Scaleway</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selectel/">Selectel</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selectelv2/">Selectel v2</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/selfhostde/">SelfHost.(de|eu)</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/servercow/">Servercow</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/servercow/">Servercow</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/shellrent/">Shellrent</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/simply/">Simply.com</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/sonic/">Sonic</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/spaceship/">Spaceship</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/spaceship/">Spaceship</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/stackpath/">Stackpath</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/technitium/">Technitium</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/tencentcloud/">Tencent Cloud DNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/timewebcloud/">Timeweb Cloud</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/timewebcloud/">Timeweb Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/transip/">TransIP</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/safedns/">UKFast SafeDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/ultradns/">Ultradns</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/variomedia/">Variomedia</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/variomedia/">Variomedia</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vegadns/">VegaDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vercel/">Vercel</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/versio/">Versio.[nl|eu|uk]</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vinyldns/">VinylDNS</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vinyldns/">VinylDNS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vkcloud/">VK Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/volcengine/">Volcano Engine/火山引擎</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vscale/">Vscale</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vultr/">Vultr</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/vultr/">Vultr</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/webnames/">Webnames</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/websupport/">Websupport</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/wedos/">WEDOS</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/westcn/">West.cn/西部数码</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/westcn/">West.cn/西部数码</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandex360/">Yandex 360</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandexcloud/">Yandex Cloud</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/yandex/">Yandex PDD</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zoneee/">Zone.ee</a></td>
|
||||
</tr><tr>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zoneee/">Zone.ee</a></td>
|
||||
<td><a href="https://go-acme.github.io/lego/dns/zonomi/">Zonomi</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr></table>
|
||||
|
||||
<!-- END DNS PROVIDERS LIST -->
|
||||
|
23
cmd/zz_gen_cmd_dnshelp.go
generated
23
cmd/zz_gen_cmd_dnshelp.go
generated
@ -58,6 +58,7 @@ func allDNSCodes() string {
|
||||
"epik",
|
||||
"exec",
|
||||
"exoscale",
|
||||
"f5xc",
|
||||
"freemyip",
|
||||
"gandi",
|
||||
"gandiv5",
|
||||
@ -1148,6 +1149,28 @@ func displayDNSHelp(w io.Writer, name string) error {
|
||||
ew.writeln()
|
||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/exoscale`)
|
||||
|
||||
case "f5xc":
|
||||
// generated from: providers/dns/f5xc/f5xc.toml
|
||||
ew.writeln(`Configuration for F5 XC.`)
|
||||
ew.writeln(`Code: 'f5xc'`)
|
||||
ew.writeln(`Since: 'v4.23.0'`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Credentials:`)
|
||||
ew.writeln(` - "F5XC_API_TOKEN": API token`)
|
||||
ew.writeln(` - "F5XC_GROUP_NAME": Group name`)
|
||||
ew.writeln(` - "F5XC_TENANT_NAME": XC Tenant shortname`)
|
||||
ew.writeln()
|
||||
|
||||
ew.writeln(`Additional Configuration:`)
|
||||
ew.writeln(` - "F5XC_HTTP_TIMEOUT": API request timeout in seconds (Default: 30)`)
|
||||
ew.writeln(` - "F5XC_POLLING_INTERVAL": Time between DNS propagation check in seconds (Default: 2)`)
|
||||
ew.writeln(` - "F5XC_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation in seconds (Default: 60)`)
|
||||
ew.writeln(` - "F5XC_TTL": The TTL of the TXT record used for the DNS challenge in seconds (Default: 120)`)
|
||||
|
||||
ew.writeln()
|
||||
ew.writeln(`More information: https://go-acme.github.io/lego/dns/f5xc`)
|
||||
|
||||
case "freemyip":
|
||||
// generated from: providers/dns/freemyip/freemyip.toml
|
||||
ew.writeln(`Configuration for freemyip.com.`)
|
||||
|
71
docs/content/dns/zz_gen_f5xc.md
generated
Normal file
71
docs/content/dns/zz_gen_f5xc.md
generated
Normal file
@ -0,0 +1,71 @@
|
||||
---
|
||||
title: "F5 XC"
|
||||
date: 2019-03-03T16:39:46+01:00
|
||||
draft: false
|
||||
slug: f5xc
|
||||
dnsprovider:
|
||||
since: "v4.23.0"
|
||||
code: "f5xc"
|
||||
url: "https://www.f5.com/products/distributed-cloud-services"
|
||||
---
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
<!-- providers/dns/f5xc/f5xc.toml -->
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
|
||||
|
||||
Configuration for [F5 XC](https://www.f5.com/products/distributed-cloud-services).
|
||||
|
||||
|
||||
<!--more-->
|
||||
|
||||
- Code: `f5xc`
|
||||
- Since: v4.23.0
|
||||
|
||||
|
||||
Here is an example bash command using the F5 XC provider:
|
||||
|
||||
```bash
|
||||
F5XC_API_TOKEN="xxx" \
|
||||
F5XC_TENANT_NAME="yyy" \
|
||||
F5XC_GROUP_NAME="zzz" \
|
||||
lego --email you@example.com --dns f5xc -d '*.example.com' -d example.com run
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
## Credentials
|
||||
|
||||
| Environment Variable Name | Description |
|
||||
|-----------------------|-------------|
|
||||
| `F5XC_API_TOKEN` | API token |
|
||||
| `F5XC_GROUP_NAME` | Group name |
|
||||
| `F5XC_TENANT_NAME` | XC Tenant shortname |
|
||||
|
||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||
More information [here]({{% ref "dns#configuration-and-credentials" %}}).
|
||||
|
||||
|
||||
## Additional Configuration
|
||||
|
||||
| Environment Variable Name | Description |
|
||||
|--------------------------------|-------------|
|
||||
| `F5XC_HTTP_TIMEOUT` | API request timeout in seconds (Default: 30) |
|
||||
| `F5XC_POLLING_INTERVAL` | Time between DNS propagation check in seconds (Default: 2) |
|
||||
| `F5XC_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation in seconds (Default: 60) |
|
||||
| `F5XC_TTL` | The TTL of the TXT record used for the DNS challenge in seconds (Default: 120) |
|
||||
|
||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||
More information [here]({{% ref "dns#configuration-and-credentials" %}}).
|
||||
|
||||
|
||||
|
||||
|
||||
## More information
|
||||
|
||||
- [API documentation](https://docs.cloud.f5.com/docs-v2/api/dns-zone-rrset)
|
||||
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
||||
<!-- providers/dns/f5xc/f5xc.toml -->
|
||||
<!-- THIS DOCUMENTATION IS AUTO-GENERATED. PLEASE DO NOT EDIT. -->
|
@ -149,7 +149,7 @@ To display the documentation for a specific DNS provider, run:
|
||||
$ lego dnshelp -c code
|
||||
|
||||
Supported DNS providers:
|
||||
acme-dns, alidns, allinkl, arvancloud, auroradns, autodns, azure, azuredns, bindman, bluecat, bookmyname, brandit, bunny, checkdomain, civo, clouddns, cloudflare, cloudns, cloudru, cloudxns, conoha, constellix, corenetworks, cpanel, derak, desec, designate, digitalocean, directadmin, dnshomede, dnsimple, dnsmadeeasy, dnspod, dode, domeneshop, dreamhost, duckdns, dyn, dynu, easydns, edgedns, efficientip, epik, exec, exoscale, freemyip, gandi, gandiv5, gcloud, gcore, glesys, godaddy, googledomains, hetzner, hostingde, hosttech, httpnet, httpreq, huaweicloud, hurricane, hyperone, ibmcloud, iij, iijdpf, infoblox, infomaniak, internetbs, inwx, ionos, ipv64, iwantmyname, joker, liara, lightsail, limacity, linode, liquidweb, loopia, luadns, mailinabox, manageengine, manual, metaname, metaregistrar, mijnhost, mittwald, myaddr, mydnsjp, mythicbeasts, namecheap, namedotcom, namesilo, nearlyfreespeech, netcup, netlify, nicmanager, nifcloud, njalla, nodion, ns1, oraclecloud, otc, ovh, pdns, plesk, porkbun, rackspace, rainyun, rcodezero, regfish, regru, rfc2136, rimuhosting, route53, safedns, sakuracloud, scaleway, selectel, selectelv2, selfhostde, servercow, shellrent, simply, sonic, spaceship, stackpath, technitium, tencentcloud, timewebcloud, transip, ultradns, variomedia, vegadns, vercel, versio, vinyldns, vkcloud, volcengine, vscale, vultr, webnames, websupport, wedos, westcn, yandex, yandex360, yandexcloud, zoneee, zonomi
|
||||
acme-dns, alidns, allinkl, arvancloud, auroradns, autodns, azure, azuredns, bindman, bluecat, bookmyname, brandit, bunny, checkdomain, civo, clouddns, cloudflare, cloudns, cloudru, cloudxns, conoha, constellix, corenetworks, cpanel, derak, desec, designate, digitalocean, directadmin, dnshomede, dnsimple, dnsmadeeasy, dnspod, dode, domeneshop, dreamhost, duckdns, dyn, dynu, easydns, edgedns, efficientip, epik, exec, exoscale, f5xc, freemyip, gandi, gandiv5, gcloud, gcore, glesys, godaddy, googledomains, hetzner, hostingde, hosttech, httpnet, httpreq, huaweicloud, hurricane, hyperone, ibmcloud, iij, iijdpf, infoblox, infomaniak, internetbs, inwx, ionos, ipv64, iwantmyname, joker, liara, lightsail, limacity, linode, liquidweb, loopia, luadns, mailinabox, manageengine, manual, metaname, metaregistrar, mijnhost, mittwald, myaddr, mydnsjp, mythicbeasts, namecheap, namedotcom, namesilo, nearlyfreespeech, netcup, netlify, nicmanager, nifcloud, njalla, nodion, ns1, oraclecloud, otc, ovh, pdns, plesk, porkbun, rackspace, rainyun, rcodezero, regfish, regru, rfc2136, rimuhosting, route53, safedns, sakuracloud, scaleway, selectel, selectelv2, selfhostde, servercow, shellrent, simply, sonic, spaceship, stackpath, technitium, tencentcloud, timewebcloud, transip, ultradns, variomedia, vegadns, vercel, versio, vinyldns, vkcloud, volcengine, vscale, vultr, webnames, websupport, wedos, westcn, yandex, yandex360, yandexcloud, zoneee, zonomi
|
||||
|
||||
More information: https://go-acme.github.io/lego/dns
|
||||
"""
|
||||
|
180
providers/dns/f5xc/f5xc.go
Normal file
180
providers/dns/f5xc/f5xc.go
Normal file
@ -0,0 +1,180 @@
|
||||
// Package f5xc implements a DNS provider for solving the DNS-01 challenge using F5 XC.
|
||||
package f5xc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/challenge/dns01"
|
||||
"github.com/go-acme/lego/v4/platform/config/env"
|
||||
"github.com/go-acme/lego/v4/platform/wait"
|
||||
"github.com/go-acme/lego/v4/providers/dns/f5xc/internal"
|
||||
)
|
||||
|
||||
// Environment variables names.
|
||||
const (
|
||||
envNamespace = "F5XC_"
|
||||
|
||||
EnvToken = envNamespace + "API_TOKEN"
|
||||
EnvTenantName = envNamespace + "TENANT_NAME"
|
||||
EnvGroupName = envNamespace + "GROUP_NAME"
|
||||
|
||||
EnvTTL = envNamespace + "TTL"
|
||||
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
|
||||
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
|
||||
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
|
||||
)
|
||||
|
||||
// Config is used to configure the creation of the DNSProvider.
|
||||
type Config struct {
|
||||
APIToken string
|
||||
TenantName string
|
||||
GroupName string
|
||||
|
||||
PropagationTimeout time.Duration
|
||||
PollingInterval time.Duration
|
||||
TTL int
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewDefaultConfig returns a default configuration for the DNSProvider.
|
||||
func NewDefaultConfig() *Config {
|
||||
return &Config{
|
||||
TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL),
|
||||
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
|
||||
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
|
||||
HTTPClient: &http.Client{
|
||||
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// DNSProvider implements the challenge.Provider interface.
|
||||
type DNSProvider struct {
|
||||
config *Config
|
||||
client *internal.Client
|
||||
}
|
||||
|
||||
// NewDNSProvider returns a DNSProvider instance configured for F5 XC.
|
||||
func NewDNSProvider() (*DNSProvider, error) {
|
||||
values, err := env.Get(EnvToken, EnvTenantName, EnvGroupName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("f5xc: %w", err)
|
||||
}
|
||||
|
||||
config := NewDefaultConfig()
|
||||
config.APIToken = values[EnvToken]
|
||||
config.TenantName = values[EnvTenantName]
|
||||
config.GroupName = values[EnvGroupName]
|
||||
|
||||
return NewDNSProviderConfig(config)
|
||||
}
|
||||
|
||||
// NewDNSProviderConfig return a DNSProvider instance configured for F5 XC.
|
||||
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
|
||||
if config == nil {
|
||||
return nil, errors.New("f5xc: the configuration of the DNS provider is nil")
|
||||
}
|
||||
|
||||
if config.GroupName == "" {
|
||||
return nil, errors.New("f5xc: missing group name")
|
||||
}
|
||||
|
||||
client, err := internal.NewClient(config.APIToken, config.TenantName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("f5xc: %w", err)
|
||||
}
|
||||
|
||||
if config.HTTPClient != nil {
|
||||
client.HTTPClient = config.HTTPClient
|
||||
}
|
||||
|
||||
return &DNSProvider{
|
||||
config: config,
|
||||
client: client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Present creates a TXT record using the specified parameters.
|
||||
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("f5xc: could not find zone for domain %q: %w", domain, err)
|
||||
}
|
||||
|
||||
subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("f5xc: %w", err)
|
||||
}
|
||||
|
||||
existingRRSet, err := d.client.GetRRSet(context.Background(), dns01.UnFqdn(authZone), d.config.GroupName, subDomain, "TXT")
|
||||
if err != nil {
|
||||
return fmt.Errorf("f5xc: get RR Set: %w", err)
|
||||
}
|
||||
|
||||
// New RRSet.
|
||||
if existingRRSet == nil || existingRRSet.RRSet.TXTRecord == nil {
|
||||
rrSet := internal.RRSet{
|
||||
Description: "lego",
|
||||
TTL: d.config.TTL,
|
||||
TXTRecord: &internal.TXTRecord{
|
||||
Name: subDomain,
|
||||
Values: []string{info.Value},
|
||||
},
|
||||
}
|
||||
|
||||
return wait.For("f5xc create", 60*time.Second, 2*time.Second, func() (bool, error) {
|
||||
_, err = d.client.CreateRRSet(context.Background(), dns01.UnFqdn(authZone), d.config.GroupName, rrSet)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("f5xc: create RR set: %w", err)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
})
|
||||
}
|
||||
|
||||
// Update RRSet.
|
||||
existingRRSet.RRSet.TXTRecord.Values = append(existingRRSet.RRSet.TXTRecord.Values, info.Value)
|
||||
|
||||
return wait.For("f5xc replace", 60*time.Second, 2*time.Second, func() (bool, error) {
|
||||
_, err = d.client.ReplaceRRSet(context.Background(), dns01.UnFqdn(authZone), d.config.GroupName, subDomain, "TXT", existingRRSet.RRSet)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("f5xc: replace RR set: %w", err)
|
||||
}
|
||||
|
||||
return true, nil
|
||||
})
|
||||
}
|
||||
|
||||
// CleanUp removes the TXT record matching the specified parameters.
|
||||
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||
info := dns01.GetChallengeInfo(domain, keyAuth)
|
||||
|
||||
authZone, err := dns01.FindZoneByFqdn(info.EffectiveFQDN)
|
||||
if err != nil {
|
||||
return fmt.Errorf("f5xc: could not find zone for domain %q: %w", domain, err)
|
||||
}
|
||||
|
||||
subDomain, err := dns01.ExtractSubDomain(info.EffectiveFQDN, authZone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("f5xc: %w", err)
|
||||
}
|
||||
|
||||
_, err = d.client.DeleteRRSet(context.Background(), dns01.UnFqdn(authZone), d.config.GroupName, subDomain, "TXT")
|
||||
if err != nil {
|
||||
return fmt.Errorf("f5xc: delete RR set: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Timeout returns the timeout and interval to use when checking for DNS propagation.
|
||||
// Adjusting here to cope with spikes in propagation times.
|
||||
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
|
||||
return d.config.PropagationTimeout, d.config.PollingInterval
|
||||
}
|
27
providers/dns/f5xc/f5xc.toml
Normal file
27
providers/dns/f5xc/f5xc.toml
Normal file
@ -0,0 +1,27 @@
|
||||
Name = "F5 XC"
|
||||
Description = ''''''
|
||||
URL = "https://www.f5.com/products/distributed-cloud-services"
|
||||
Code = "f5xc"
|
||||
Since = "v4.23.0"
|
||||
|
||||
Example = '''
|
||||
F5XC_API_TOKEN="xxx" \
|
||||
F5XC_TENANT_NAME="yyy" \
|
||||
F5XC_GROUP_NAME="zzz" \
|
||||
lego --email you@example.com --dns f5xc -d '*.example.com' -d example.com run
|
||||
'''
|
||||
|
||||
[Configuration]
|
||||
[Configuration.Credentials]
|
||||
F5XC_API_TOKEN = "API token"
|
||||
F5XC_TENANT_NAME = "XC Tenant shortname"
|
||||
F5XC_GROUP_NAME = "Group name"
|
||||
[Configuration.Additional]
|
||||
F5XC_POLLING_INTERVAL = "Time between DNS propagation check in seconds (Default: 2)"
|
||||
F5XC_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation in seconds (Default: 60)"
|
||||
F5XC_TTL = "The TTL of the TXT record used for the DNS challenge in seconds (Default: 120)"
|
||||
F5XC_HTTP_TIMEOUT = "API request timeout in seconds (Default: 30)"
|
||||
|
||||
[Links]
|
||||
API = "https://docs.cloud.f5.com/docs-v2/api/dns-zone-rrset"
|
||||
Documentation = "https://my.f5.com/manage/s/article/K000147937"
|
166
providers/dns/f5xc/f5xc_test.go
Normal file
166
providers/dns/f5xc/f5xc_test.go
Normal file
@ -0,0 +1,166 @@
|
||||
package f5xc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-acme/lego/v4/platform/tester"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const envDomain = envNamespace + "DOMAIN"
|
||||
|
||||
var envTest = tester.NewEnvTest(EnvToken, EnvTenantName, EnvGroupName).WithDomain(envDomain)
|
||||
|
||||
func TestNewDNSProvider(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
envVars map[string]string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
envVars: map[string]string{
|
||||
EnvToken: "secret",
|
||||
EnvTenantName: "shortname",
|
||||
EnvGroupName: "group",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "missing API token",
|
||||
envVars: map[string]string{
|
||||
EnvToken: "",
|
||||
EnvTenantName: "shortname",
|
||||
EnvGroupName: "group",
|
||||
},
|
||||
expected: "f5xc: some credentials information are missing: F5XC_API_TOKEN",
|
||||
},
|
||||
{
|
||||
desc: "missing tenant name",
|
||||
envVars: map[string]string{
|
||||
EnvToken: "secret",
|
||||
EnvTenantName: "",
|
||||
EnvGroupName: "group",
|
||||
},
|
||||
expected: "f5xc: some credentials information are missing: F5XC_TENANT_NAME",
|
||||
},
|
||||
{
|
||||
desc: "missing group name",
|
||||
envVars: map[string]string{
|
||||
EnvToken: "secret",
|
||||
EnvTenantName: "shortname",
|
||||
EnvGroupName: "",
|
||||
},
|
||||
expected: "f5xc: some credentials information are missing: F5XC_GROUP_NAME",
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
envVars: map[string]string{},
|
||||
expected: "f5xc: some credentials information are missing: F5XC_API_TOKEN,F5XC_TENANT_NAME,F5XC_GROUP_NAME",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
defer envTest.RestoreEnv()
|
||||
envTest.ClearEnv()
|
||||
|
||||
envTest.Apply(test.envVars)
|
||||
|
||||
p, err := NewDNSProvider()
|
||||
|
||||
if test.expected == "" {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, p)
|
||||
require.NotNil(t, p.config)
|
||||
require.NotNil(t, p.client)
|
||||
} else {
|
||||
require.EqualError(t, err, test.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewDNSProviderConfig(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
apiToken string
|
||||
tenantName string
|
||||
groupName string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
desc: "success",
|
||||
apiToken: "secret",
|
||||
tenantName: "shortname",
|
||||
groupName: "group",
|
||||
},
|
||||
{
|
||||
desc: "missing API token",
|
||||
tenantName: "shortname",
|
||||
groupName: "group",
|
||||
expected: "f5xc: credentials missing",
|
||||
},
|
||||
{
|
||||
desc: "missing tenant name",
|
||||
apiToken: "secret",
|
||||
groupName: "group",
|
||||
expected: "f5xc: missing tenant name",
|
||||
},
|
||||
{
|
||||
desc: "missing group name",
|
||||
apiToken: "secret",
|
||||
tenantName: "shortname",
|
||||
expected: "f5xc: missing group name",
|
||||
},
|
||||
{
|
||||
desc: "missing credentials",
|
||||
expected: "f5xc: missing group name",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
config := NewDefaultConfig()
|
||||
config.APIToken = test.apiToken
|
||||
config.TenantName = test.tenantName
|
||||
config.GroupName = test.groupName
|
||||
|
||||
p, err := NewDNSProviderConfig(config)
|
||||
|
||||
if test.expected == "" {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, p)
|
||||
require.NotNil(t, p.config)
|
||||
require.NotNil(t, p.client)
|
||||
} else {
|
||||
require.EqualError(t, err, test.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLivePresent(t *testing.T) {
|
||||
if !envTest.IsLiveTest() {
|
||||
t.Skip("skipping live test")
|
||||
}
|
||||
|
||||
envTest.RestoreEnv()
|
||||
provider, err := NewDNSProvider()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = provider.Present(envTest.GetDomain(), "", "123d==")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestLiveCleanUp(t *testing.T) {
|
||||
if !envTest.IsLiveTest() {
|
||||
t.Skip("skipping live test")
|
||||
}
|
||||
|
||||
envTest.RestoreEnv()
|
||||
provider, err := NewDNSProvider()
|
||||
require.NoError(t, err)
|
||||
|
||||
err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
|
||||
require.NoError(t, err)
|
||||
}
|
210
providers/dns/f5xc/internal/client.go
Normal file
210
providers/dns/f5xc/internal/client.go
Normal file
@ -0,0 +1,210 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v4/providers/dns/internal/errutils"
|
||||
)
|
||||
|
||||
const defaultHost = "console.ves.volterra.io"
|
||||
|
||||
const authorizationHeader = "Authorization"
|
||||
|
||||
// Client the F5 XC API client.
|
||||
type Client struct {
|
||||
apiToken string
|
||||
|
||||
baseURL *url.URL
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewClient creates a new Client.
|
||||
func NewClient(apiToken string, tenantName string) (*Client, error) {
|
||||
if apiToken == "" {
|
||||
return nil, errors.New("credentials missing")
|
||||
}
|
||||
|
||||
if tenantName == "" {
|
||||
return nil, errors.New("missing tenant name")
|
||||
}
|
||||
|
||||
baseURL, err := url.Parse(fmt.Sprintf("https://%s.%s", tenantName, defaultHost))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parse base URL: %w", err)
|
||||
}
|
||||
|
||||
return &Client{
|
||||
apiToken: apiToken,
|
||||
baseURL: baseURL,
|
||||
HTTPClient: &http.Client{Timeout: 10 * time.Second},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// CreateRRSet creates RRSet.
|
||||
// https://docs.cloud.f5.com/docs-v2/api/dns-zone-rrset#operation/ves.io.schema.dns_zone.rrset.CustomAPI.Create
|
||||
func (c *Client) CreateRRSet(ctx context.Context, dnsZoneName, groupName string, rrSet RRSet) (*APIRRSet, error) {
|
||||
endpoint := c.baseURL.JoinPath("api", "config", "dns", "namespaces", "system", "dns_zones", dnsZoneName, "rrsets", groupName)
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodPost, endpoint, APIRRSet{
|
||||
DNSZoneName: dnsZoneName,
|
||||
GroupName: groupName,
|
||||
RRSet: rrSet,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &APIRRSet{}
|
||||
|
||||
err = c.do(req, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetRRSet gets RRSets.
|
||||
// https://docs.cloud.f5.com/docs-v2/api/dns-zone-rrset#operation/ves.io.schema.dns_zone.rrset.CustomAPI.Get
|
||||
func (c *Client) GetRRSet(ctx context.Context, dnsZoneName, groupName, recordName, recordType string) (*APIRRSet, error) {
|
||||
endpoint := c.baseURL.JoinPath("api", "config", "dns", "namespaces", "system", "dns_zones", dnsZoneName, "rrsets", groupName, recordName, recordType)
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodGet, endpoint, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &APIRRSet{}
|
||||
|
||||
err = c.do(req, result)
|
||||
if err != nil {
|
||||
usce := &APIError{}
|
||||
if errors.As(err, &usce) && usce.StatusCode == http.StatusNotFound {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DeleteRRSet deletes RRSet.
|
||||
// https://docs.cloud.f5.com/docs-v2/api/dns-zone-rrset#operation/ves.io.schema.dns_zone.rrset.CustomAPI.Delete
|
||||
func (c *Client) DeleteRRSet(ctx context.Context, dnsZoneName, groupName, recordName, recordType string) (*APIRRSet, error) {
|
||||
endpoint := c.baseURL.JoinPath("api", "config", "dns", "namespaces", "system", "dns_zones", dnsZoneName, "rrsets", groupName, recordName, recordType)
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodDelete, endpoint, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &APIRRSet{}
|
||||
|
||||
err = c.do(req, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ReplaceRRSet replaces RRSet.
|
||||
// https://docs.cloud.f5.com/docs-v2/api/dns-zone-rrset#operation/ves.io.schema.dns_zone.rrset.CustomAPI.Replace
|
||||
func (c *Client) ReplaceRRSet(ctx context.Context, dnsZoneName, groupName, recordName, recordType string, rrSet RRSet) (*APIRRSet, error) {
|
||||
endpoint := c.baseURL.JoinPath("api", "config", "dns", "namespaces", "system", "dns_zones", dnsZoneName, "rrsets", groupName, recordName, recordType)
|
||||
|
||||
req, err := newJSONRequest(ctx, http.MethodPut, endpoint, APIRRSet{
|
||||
DNSZoneName: dnsZoneName,
|
||||
GroupName: groupName,
|
||||
RRSet: rrSet,
|
||||
Type: recordType,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &APIRRSet{}
|
||||
|
||||
err = c.do(req, result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *Client) do(req *http.Request, result any) error {
|
||||
req.Header.Set(authorizationHeader, "APIToken "+c.apiToken)
|
||||
|
||||
resp, err := c.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
return errutils.NewHTTPDoError(req, err)
|
||||
}
|
||||
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
if resp.StatusCode/100 != 2 {
|
||||
return parseError(req, resp)
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
raw, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return errutils.NewReadResponseError(req, resp.StatusCode, err)
|
||||
}
|
||||
|
||||
err = json.Unmarshal(raw, result)
|
||||
if err != nil {
|
||||
return errutils.NewUnmarshalError(req, resp.StatusCode, raw, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func newJSONRequest(ctx context.Context, method string, endpoint *url.URL, payload any) (*http.Request, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
if payload != nil {
|
||||
err := json.NewEncoder(buf).Encode(payload)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request JSON body: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, method, endpoint.String(), buf)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to create request: %w", err)
|
||||
}
|
||||
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
if payload != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func parseError(req *http.Request, resp *http.Response) error {
|
||||
raw, _ := io.ReadAll(resp.Body)
|
||||
|
||||
apiErr := APIError{StatusCode: resp.StatusCode}
|
||||
err := json.Unmarshal(raw, &apiErr)
|
||||
if err != nil {
|
||||
return errutils.NewUnexpectedStatusCodeError(req, resp.StatusCode, raw)
|
||||
}
|
||||
|
||||
return &apiErr
|
||||
}
|
219
providers/dns/f5xc/internal/client_test.go
Normal file
219
providers/dns/f5xc/internal/client_test.go
Normal file
@ -0,0 +1,219 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func setupTest(t *testing.T, pattern string, status int, filename string) *Client {
|
||||
t.Helper()
|
||||
|
||||
mux := http.NewServeMux()
|
||||
server := httptest.NewServer(mux)
|
||||
t.Cleanup(server.Close)
|
||||
|
||||
mux.HandleFunc(pattern, func(rw http.ResponseWriter, req *http.Request) {
|
||||
if filename == "" {
|
||||
rw.WriteHeader(status)
|
||||
return
|
||||
}
|
||||
|
||||
file, err := os.Open(filepath.Join("fixtures", filename))
|
||||
if err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
defer func() { _ = file.Close() }()
|
||||
|
||||
rw.WriteHeader(status)
|
||||
_, err = io.Copy(rw, file)
|
||||
if err != nil {
|
||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
client, err := NewClient("secret", "shortname")
|
||||
require.NoError(t, err)
|
||||
|
||||
client.HTTPClient = server.Client()
|
||||
client.baseURL, _ = url.Parse(server.URL)
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
func TestClient_Create(t *testing.T) {
|
||||
client := setupTest(t, "POST /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA", http.StatusOK, "create.json")
|
||||
|
||||
rrSet := RRSet{
|
||||
Description: "lego",
|
||||
TTL: 60,
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "wwww",
|
||||
Values: []string{"txt"},
|
||||
},
|
||||
}
|
||||
|
||||
result, err := client.CreateRRSet(context.Background(), "example.com", "groupA", rrSet)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &APIRRSet{
|
||||
DNSZoneName: "string",
|
||||
GroupName: "string",
|
||||
RRSet: RRSet{
|
||||
Description: "string",
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "string",
|
||||
Values: []string{"string"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, result)
|
||||
}
|
||||
|
||||
func TestClient_Create_error(t *testing.T) {
|
||||
client := setupTest(t, "POST /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA", http.StatusBadRequest, "")
|
||||
|
||||
rrSet := RRSet{
|
||||
Description: "lego",
|
||||
TTL: 60,
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "wwww",
|
||||
Values: []string{"txt"},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := client.CreateRRSet(context.Background(), "example.com", "groupA", rrSet)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestClient_Get(t *testing.T) {
|
||||
client := setupTest(t, "GET /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusOK, "get.json")
|
||||
|
||||
result, err := client.GetRRSet(context.Background(), "example.com", "groupA", "www", "TXT")
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &APIRRSet{
|
||||
DNSZoneName: "string",
|
||||
GroupName: "string",
|
||||
Namespace: "string",
|
||||
RecordName: "string",
|
||||
Type: "string",
|
||||
RRSet: RRSet{
|
||||
Description: "string",
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "string",
|
||||
Values: []string{"string"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, result)
|
||||
}
|
||||
|
||||
func TestClient_Get_not_found(t *testing.T) {
|
||||
client := setupTest(t, "GET /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusNotFound, "error_404.json")
|
||||
|
||||
result, err := client.GetRRSet(context.Background(), "example.com", "groupA", "www", "TXT")
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Nil(t, result)
|
||||
}
|
||||
|
||||
func TestClient_Get_error(t *testing.T) {
|
||||
client := setupTest(t, "GET /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusBadRequest, "")
|
||||
|
||||
_, err := client.GetRRSet(context.Background(), "example.com", "groupA", "www", "TXT")
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestClient_Delete(t *testing.T) {
|
||||
client := setupTest(t, "DELETE /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusOK, "get.json")
|
||||
|
||||
result, err := client.DeleteRRSet(context.Background(), "example.com", "groupA", "www", "TXT")
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &APIRRSet{
|
||||
DNSZoneName: "string",
|
||||
GroupName: "string",
|
||||
Namespace: "string",
|
||||
RecordName: "string",
|
||||
Type: "string",
|
||||
RRSet: RRSet{
|
||||
Description: "string",
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "string",
|
||||
Values: []string{"string"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, result)
|
||||
}
|
||||
|
||||
func TestClient_Delete_error(t *testing.T) {
|
||||
client := setupTest(t, "DELETE /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusBadRequest, "")
|
||||
|
||||
_, err := client.DeleteRRSet(context.Background(), "example.com", "groupA", "www", "TXT")
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
func TestClient_Replace(t *testing.T) {
|
||||
client := setupTest(t, "PUT /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusOK, "get.json")
|
||||
|
||||
rrSet := RRSet{
|
||||
Description: "lego",
|
||||
TTL: 60,
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "wwww",
|
||||
Values: []string{"txt"},
|
||||
},
|
||||
}
|
||||
|
||||
result, err := client.ReplaceRRSet(context.Background(), "example.com", "groupA", "www", "TXT", rrSet)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := &APIRRSet{
|
||||
DNSZoneName: "string",
|
||||
GroupName: "string",
|
||||
Namespace: "string",
|
||||
RecordName: "string",
|
||||
Type: "string",
|
||||
RRSet: RRSet{
|
||||
Description: "string",
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "string",
|
||||
Values: []string{"string"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, result)
|
||||
}
|
||||
|
||||
func TestClient_Replace_error(t *testing.T) {
|
||||
client := setupTest(t, "PUT /api/config/dns/namespaces/system/dns_zones/example.com/rrsets/groupA/www/TXT", http.StatusBadRequest, "")
|
||||
|
||||
rrSet := RRSet{
|
||||
Description: "lego",
|
||||
TTL: 60,
|
||||
TXTRecord: &TXTRecord{
|
||||
Name: "wwww",
|
||||
Values: []string{"txt"},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := client.ReplaceRRSet(context.Background(), "example.com", "groupA", "www", "TXT", rrSet)
|
||||
require.Error(t, err)
|
||||
}
|
204
providers/dns/f5xc/internal/fixtures/create.json
Normal file
204
providers/dns/f5xc/internal/fixtures/create.json
Normal file
@ -0,0 +1,204 @@
|
||||
{
|
||||
"dns_zone_name": "string",
|
||||
"group_name": "string",
|
||||
"rrset": {
|
||||
"a_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"aaaa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"afsdb_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"hostname": "string",
|
||||
"subtype": "NONE"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alias_record": {
|
||||
"value": "string"
|
||||
},
|
||||
"caa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": 0,
|
||||
"tag": "string",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "RESERVEDALGORITHM",
|
||||
"cert_key_tag": 0,
|
||||
"cert_type": "INVALIDCERTTYPE",
|
||||
"certificate": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cname_record": {
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
},
|
||||
"description": "string",
|
||||
"ds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"eui48_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstrin"
|
||||
},
|
||||
"eui64_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstringstrin"
|
||||
},
|
||||
"lb_record": {
|
||||
"name": "string",
|
||||
"value": {
|
||||
"name": "string",
|
||||
"namespace": "string",
|
||||
"tenant": "string"
|
||||
}
|
||||
},
|
||||
"loc_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"altitude": 0.1,
|
||||
"horizontal_precision": 0.1,
|
||||
"latitude_degree": 0,
|
||||
"latitude_hemisphere": "N",
|
||||
"latitude_minute": 0,
|
||||
"latitude_second": 0.1,
|
||||
"location_diameter": 0.1,
|
||||
"longitude_degree": 0,
|
||||
"longitude_hemisphere": "E",
|
||||
"longitude_minute": 0,
|
||||
"longitude_second": 0.1,
|
||||
"vertical_precision": 0.1
|
||||
}
|
||||
]
|
||||
},
|
||||
"mx_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"domain": "string",
|
||||
"priority": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"naptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": "string",
|
||||
"order": 0,
|
||||
"preference": 0,
|
||||
"regexp": "string",
|
||||
"replacement": "string",
|
||||
"service": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ns_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"ptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"srv_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"port": 0,
|
||||
"priority": 0,
|
||||
"target": "string",
|
||||
"weight": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"sshfp_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "UNSPECIFIEDALGORITHM",
|
||||
"sha1_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tlsa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"certificate_association_data": "string",
|
||||
"certificate_usage": "CertificateAuthorityConstraint",
|
||||
"matching_type": "NoHash",
|
||||
"selector": "FullCertificate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ttl": 0,
|
||||
"txt_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
207
providers/dns/f5xc/internal/fixtures/delete.json
Normal file
207
providers/dns/f5xc/internal/fixtures/delete.json
Normal file
@ -0,0 +1,207 @@
|
||||
{
|
||||
"dns_zone_name": "string",
|
||||
"group_name": "string",
|
||||
"namespace": "string",
|
||||
"record_name": "string",
|
||||
"rrset": {
|
||||
"a_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"aaaa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"afsdb_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"hostname": "string",
|
||||
"subtype": "NONE"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alias_record": {
|
||||
"value": "string"
|
||||
},
|
||||
"caa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": 0,
|
||||
"tag": "string",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "RESERVEDALGORITHM",
|
||||
"cert_key_tag": 0,
|
||||
"cert_type": "INVALIDCERTTYPE",
|
||||
"certificate": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cname_record": {
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
},
|
||||
"description": "string",
|
||||
"ds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"eui48_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstrin"
|
||||
},
|
||||
"eui64_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstringstrin"
|
||||
},
|
||||
"lb_record": {
|
||||
"name": "string",
|
||||
"value": {
|
||||
"name": "string",
|
||||
"namespace": "string",
|
||||
"tenant": "string"
|
||||
}
|
||||
},
|
||||
"loc_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"altitude": 0.1,
|
||||
"horizontal_precision": 0.1,
|
||||
"latitude_degree": 0,
|
||||
"latitude_hemisphere": "N",
|
||||
"latitude_minute": 0,
|
||||
"latitude_second": 0.1,
|
||||
"location_diameter": 0.1,
|
||||
"longitude_degree": 0,
|
||||
"longitude_hemisphere": "E",
|
||||
"longitude_minute": 0,
|
||||
"longitude_second": 0.1,
|
||||
"vertical_precision": 0.1
|
||||
}
|
||||
]
|
||||
},
|
||||
"mx_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"domain": "string",
|
||||
"priority": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"naptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": "string",
|
||||
"order": 0,
|
||||
"preference": 0,
|
||||
"regexp": "string",
|
||||
"replacement": "string",
|
||||
"service": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ns_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"ptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"srv_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"port": 0,
|
||||
"priority": 0,
|
||||
"target": "string",
|
||||
"weight": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"sshfp_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "UNSPECIFIEDALGORITHM",
|
||||
"sha1_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tlsa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"certificate_association_data": "string",
|
||||
"certificate_usage": "CertificateAuthorityConstraint",
|
||||
"matching_type": "NoHash",
|
||||
"selector": "FullCertificate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ttl": 0,
|
||||
"txt_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "string"
|
||||
}
|
5
providers/dns/f5xc/internal/fixtures/error_404.json
Normal file
5
providers/dns/f5xc/internal/fixtures/error_404.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"code": 5,
|
||||
"details": [],
|
||||
"message": "the requested resource record was not found: (group,name,type) (acme-records,_acme-challenge,TXT)"
|
||||
}
|
5
providers/dns/f5xc/internal/fixtures/error_503.json
Normal file
5
providers/dns/f5xc/internal/fixtures/error_503.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"code": 14,
|
||||
"details": [],
|
||||
"message": "Previous DNS zone change is pending. Try again later"
|
||||
}
|
207
providers/dns/f5xc/internal/fixtures/get.json
Normal file
207
providers/dns/f5xc/internal/fixtures/get.json
Normal file
@ -0,0 +1,207 @@
|
||||
{
|
||||
"dns_zone_name": "string",
|
||||
"group_name": "string",
|
||||
"namespace": "string",
|
||||
"record_name": "string",
|
||||
"rrset": {
|
||||
"a_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"aaaa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"afsdb_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"hostname": "string",
|
||||
"subtype": "NONE"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alias_record": {
|
||||
"value": "string"
|
||||
},
|
||||
"caa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": 0,
|
||||
"tag": "string",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "RESERVEDALGORITHM",
|
||||
"cert_key_tag": 0,
|
||||
"cert_type": "INVALIDCERTTYPE",
|
||||
"certificate": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cname_record": {
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
},
|
||||
"description": "string",
|
||||
"ds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"eui48_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstrin"
|
||||
},
|
||||
"eui64_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstringstrin"
|
||||
},
|
||||
"lb_record": {
|
||||
"name": "string",
|
||||
"value": {
|
||||
"name": "string",
|
||||
"namespace": "string",
|
||||
"tenant": "string"
|
||||
}
|
||||
},
|
||||
"loc_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"altitude": 0.1,
|
||||
"horizontal_precision": 0.1,
|
||||
"latitude_degree": 0,
|
||||
"latitude_hemisphere": "N",
|
||||
"latitude_minute": 0,
|
||||
"latitude_second": 0.1,
|
||||
"location_diameter": 0.1,
|
||||
"longitude_degree": 0,
|
||||
"longitude_hemisphere": "E",
|
||||
"longitude_minute": 0,
|
||||
"longitude_second": 0.1,
|
||||
"vertical_precision": 0.1
|
||||
}
|
||||
]
|
||||
},
|
||||
"mx_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"domain": "string",
|
||||
"priority": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"naptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": "string",
|
||||
"order": 0,
|
||||
"preference": 0,
|
||||
"regexp": "string",
|
||||
"replacement": "string",
|
||||
"service": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ns_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"ptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"srv_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"port": 0,
|
||||
"priority": 0,
|
||||
"target": "string",
|
||||
"weight": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"sshfp_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "UNSPECIFIEDALGORITHM",
|
||||
"sha1_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tlsa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"certificate_association_data": "string",
|
||||
"certificate_usage": "CertificateAuthorityConstraint",
|
||||
"matching_type": "NoHash",
|
||||
"selector": "FullCertificate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ttl": 0,
|
||||
"txt_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "string"
|
||||
}
|
206
providers/dns/f5xc/internal/fixtures/replace.json
Normal file
206
providers/dns/f5xc/internal/fixtures/replace.json
Normal file
@ -0,0 +1,206 @@
|
||||
{
|
||||
"dns_zone_name": "string",
|
||||
"group_name": "string",
|
||||
"record_name": "string",
|
||||
"rrset": {
|
||||
"a_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"aaaa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"afsdb_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"hostname": "string",
|
||||
"subtype": "NONE"
|
||||
}
|
||||
]
|
||||
},
|
||||
"alias_record": {
|
||||
"value": "string"
|
||||
},
|
||||
"caa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": 0,
|
||||
"tag": "string",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "RESERVEDALGORITHM",
|
||||
"cert_key_tag": 0,
|
||||
"cert_type": "INVALIDCERTTYPE",
|
||||
"certificate": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cname_record": {
|
||||
"name": "string",
|
||||
"value": "string"
|
||||
},
|
||||
"description": "string",
|
||||
"ds_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"ds_key_algorithm": "UNSPECIFIED",
|
||||
"key_tag": 0,
|
||||
"sha1_digest": {
|
||||
"digest": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha384_digest": {
|
||||
"digest": "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"eui48_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstrin"
|
||||
},
|
||||
"eui64_record": {
|
||||
"name": "string",
|
||||
"value": "stringstringstringstrin"
|
||||
},
|
||||
"lb_record": {
|
||||
"name": "string",
|
||||
"value": {
|
||||
"name": "string",
|
||||
"namespace": "string",
|
||||
"tenant": "string"
|
||||
}
|
||||
},
|
||||
"loc_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"altitude": 0.1,
|
||||
"horizontal_precision": 0.1,
|
||||
"latitude_degree": 0,
|
||||
"latitude_hemisphere": "N",
|
||||
"latitude_minute": 0,
|
||||
"latitude_second": 0.1,
|
||||
"location_diameter": 0.1,
|
||||
"longitude_degree": 0,
|
||||
"longitude_hemisphere": "E",
|
||||
"longitude_minute": 0,
|
||||
"longitude_second": 0.1,
|
||||
"vertical_precision": 0.1
|
||||
}
|
||||
]
|
||||
},
|
||||
"mx_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"domain": "string",
|
||||
"priority": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"naptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"flags": "string",
|
||||
"order": 0,
|
||||
"preference": 0,
|
||||
"regexp": "string",
|
||||
"replacement": "string",
|
||||
"service": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ns_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"ptr_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"srv_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"port": 0,
|
||||
"priority": 0,
|
||||
"target": "string",
|
||||
"weight": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"sshfp_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"algorithm": "UNSPECIFIEDALGORITHM",
|
||||
"sha1_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstri"
|
||||
},
|
||||
"sha256_fingerprint": {
|
||||
"fingerprint": "stringstringstringstringstringstringstringstringstringstringstri"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tlsa_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
{
|
||||
"certificate_association_data": "string",
|
||||
"certificate_usage": "CertificateAuthorityConstraint",
|
||||
"matching_type": "NoHash",
|
||||
"selector": "FullCertificate"
|
||||
}
|
||||
]
|
||||
},
|
||||
"ttl": 0,
|
||||
"txt_record": {
|
||||
"name": "string",
|
||||
"values": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "string"
|
||||
}
|
48
providers/dns/f5xc/internal/types.go
Normal file
48
providers/dns/f5xc/internal/types.go
Normal file
@ -0,0 +1,48 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type APIError struct {
|
||||
StatusCode int `json:"-"`
|
||||
Code int `json:"code"`
|
||||
Details []string `json:"details"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (a *APIError) Error() string {
|
||||
var details string
|
||||
if len(a.Details) > 0 {
|
||||
details = " " + strings.Join(a.Details, ", ")
|
||||
}
|
||||
|
||||
return fmt.Sprintf("code: %d, message: %s%s", a.Code, a.Message, details)
|
||||
}
|
||||
|
||||
type APIRRSet struct {
|
||||
DNSZoneName string `json:"dns_zone_name,omitempty"`
|
||||
GroupName string `json:"group_name,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
RecordName string `json:"record_name,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
RRSet RRSet `json:"rrset,omitempty"`
|
||||
}
|
||||
|
||||
type RRSetRequest struct {
|
||||
DNSZoneName string `json:"dns_zone_name,omitempty"`
|
||||
GroupName string `json:"group_name,omitempty"`
|
||||
RRSet RRSet `json:"rrset,omitempty"`
|
||||
}
|
||||
|
||||
type RRSet struct {
|
||||
Description string `json:"description,omitempty"`
|
||||
TTL int `json:"ttl,omitempty"`
|
||||
TXTRecord *TXTRecord `json:"txt_record,omitempty"`
|
||||
}
|
||||
|
||||
type TXTRecord struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Values []string `json:"values,omitempty"`
|
||||
}
|
3
providers/dns/zz_gen_dns_providers.go
generated
3
providers/dns/zz_gen_dns_providers.go
generated
@ -52,6 +52,7 @@ import (
|
||||
"github.com/go-acme/lego/v4/providers/dns/epik"
|
||||
"github.com/go-acme/lego/v4/providers/dns/exec"
|
||||
"github.com/go-acme/lego/v4/providers/dns/exoscale"
|
||||
"github.com/go-acme/lego/v4/providers/dns/f5xc"
|
||||
"github.com/go-acme/lego/v4/providers/dns/freemyip"
|
||||
"github.com/go-acme/lego/v4/providers/dns/gandi"
|
||||
"github.com/go-acme/lego/v4/providers/dns/gandiv5"
|
||||
@ -252,6 +253,8 @@ func NewDNSChallengeProviderByName(name string) (challenge.Provider, error) {
|
||||
return exec.NewDNSProvider()
|
||||
case "exoscale":
|
||||
return exoscale.NewDNSProvider()
|
||||
case "f5xc":
|
||||
return f5xc.NewDNSProvider()
|
||||
case "freemyip":
|
||||
return freemyip.NewDNSProvider()
|
||||
case "gandi":
|
||||
|
Loading…
x
Reference in New Issue
Block a user