0

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 ?

Wojtek_B
  • 4,245
  • 1
  • 7
  • 21
Learner
  • 1,544
  • 8
  • 29
  • 55

1 Answers1

1

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 issue record-sets list --zone=${i}.

If you'd like help, please include dummy data from the 2 commands and I'll draft something for you.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88
  • Thansk @dazWilkin, I'll do thatI I was just looking if someone has done in a single command using some hack. – Learner Apr 23 '21 at 00:41