In the output of gcloud dns managed-zones list
,I want to show the name of dnsName, creationTime, name, networkName, visibility
and the count of recrod-sets
in each hosted-zone
.
I used below command to get two output in two commands
#get hosted-zone and other values
gcloud dns managed-zones list --format='table(dnsName, creationTime:sort=1, name, privateVisibilityConfig.networks.networkUrl.basename(), visibility)'
#get record-sets for a hostedzone
gcloud dns record-sets list --zone=$zoneName |awk 'NR>1{print}'|wc -l
I think I can get this in a shell script by getting a list of hosted zone and then printing two output together.
But is there a better way to do in a single gcloud
command ?
IIRC (!?), you'll need to issue both
gcloud
commands as each provides distinct data.To your point, you should be able to easily combine the combine the commands using a shell script and iterating over each zone from
managed-zones list
, to issuerecord-sets list --zone=${i}
.If you'd like help, please include dummy data from the 2 commands and I'll draft something for you.