Skip to content

Commit 071badb

Browse files
committed
Add dns_gcloud_rest for Google Cloud DNS
This script is an alternative to the existing dns_gcloud script but aimed at embeded environments. The existing dns_gcloud script depends on the gcloud CLI, which is over 60 MB on ARM and over 85 MB on x86_64. In many embeded environments, this dependency is too large to install. This new script, dns_gcloud_rest, interfaces with Google Cloud DNS using the REST API. It implements the service account auth flow and requires the user to provision a service account with permission to manage DNS zones. The Google Cloud REST API uses JSON and this script uses regex to extract data from the response bodies. I have done my best to implement robust patterns, but regex is fundamentally not able to parse JSON. The response handling is therefore sensitive to non-semantic details of the response bodies, like newline placement. That said, some responses from GCP are minified and some are pretty; this script handles responses in both formats adequately. This script is ported from a similar script I contributed the the [OpenWRT DDNS scripts][1]. OpenWRT provides tools for JSON parsing and formatting, which makes that version of the script more robust and succinct than this verion. I have tested the script in several environments to ensure portability: - Bash 3.2.57 with macOS coreutils on macOS - Bash 3.2.57 with GNU coreutils on macOS - busybox 1.37.0 on OpenWRT [1]: https://github.com/cbarrick/openwrt_packages/blob/ddns-gcp/net/ddns-scripts/files/usr/lib/ddns/update_gcp_v1.sh
1 parent 5713c1d commit 071badb

1 file changed

Lines changed: 732 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)