The Python SDK supports list_zones
:
List zones for the project associated with this client.
The equivalent API call is ManagedZones: list
:
Enumerates ManagedZones that have been created but not yet deleted.
If successful, this method returns a response body with the following structure:
{
"kind": "dns#managedZonesListResponse",
"header": {
"operationId": string
},
"managedZones": [
managedZones Resource
],
"nextPageToken": string
}
Regarding managedZones Resource
:
A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.
{
"kind": "dns#managedZone",
"name": string,
"dnsName": string,
"description": string,
"id": unsigned long,
"nameServers": [
string
],
"creationTime": string,
"dnssecConfig": {
"kind": "dns#managedZoneDnsSecConfig",
"state": string,
"defaultKeySpecs": [
{
"kind": "dns#dnsKeySpec",
"keyType": string,
"algorithm": string,
"keyLength": unsigned integer
}
],
"nonExistence": string
},
"nameServerSet": string,
"visibility": string,
"privateVisibilityConfig": {
"kind": "dns#managedZonePrivateVisibilityConfig",
"networks": [
{
"kind": "dns#managedZonePrivateVisibilityConfigNetwork",
"networkUrl": string
}
],
"gkeClusters": [
{
"kind": "dns#managedZonePrivateVisibilityConfigGKECluster",
"gkeClusterName": string
}
]
},
"forwardingConfig": {
"kind": "dns#managedZoneForwardingConfig",
"targetNameServers": [
{
"kind": "dns#managedZoneForwardingConfigNameServerTarget",
"ipv4Address": string,
"forwardingPath": string
}
]
},
"labels": {
(key): string
},
"peeringConfig": {
"kind": "dns#managedZonePeeringConfig",
"targetNetwork": {
"kind": "dns#managedZonePeeringConfigTargetNetwork",
"networkUrl": string,
"deactivateTime": string
}
},
"reverseLookupConfig": {
"kind": "dns#managedZoneReverseLookupConfig"
},
"serviceDirectoryConfig": {
"kind": "dns#managedZoneServiceDirectoryConfig",
"namespace": {
"kind": "dns#managedZoneServiceDirectoryConfigNamespace",
"namespaceUrl": string,
"deletionTime": string
}
},
"cloudLoggingConfig": {
"kind": "dns#managedZoneCloudLoggingConfig",
"enableLogging": boolean
}
}
Therefore it should be possible to retrieve this value and save it as JSON to a file.