Using the api examples listed:
from gloud import dns
client = dns.Client.from_service_account_json('/etc/opt/hider/dnste-testtestxx.json','dnste-1337')
zone = client.zone('base-test')
record_set = zone.resource_record_set("willows.test.com", "A", 3600, "11.11.11.11")
changes = zone.changes()
changes.add_record_set(record_set)
changes.create()
Getting:
BadRequest: 400 Invalid value for 'entity.change.additions[0].name': 'willows.test.com' (POST https://www.googleapis.com....
Tried CNAME, A, still no luck.
Looking at the source, the first input in the record_set is the name.
Seems to be nothing available as to what or why I'm getting this error.
Thanks, Joe
record_set = zone.resource_record_set("willows.test.com", "A", 3600, "11.11.11.11")
BadRequest: 400 Invalid value for 'entity.change.additions[0].name': 'willows.test.com' (POST https://www.googleapis.com....
Tried CNAME, A, still no luck.
Looking at the source, the first input in the record_set is the name.Seems to be nothing available as to what or why I'm getting this error.
>>> import time
>>> from gcloud import dns
>>> client = dns.Client(project='PROJECT_ID')
>>> zone = client.zone('acme-co', 'example.com')
>>> TWO_HOURS = 2 * 60 * 60 # seconds
>>> record_set = zone.resource_record_set(
... 'www.example.com', 'CNAME', TWO_HOURS, 'www1.example.com')
>>> changes = zone.changes()
>>> changes.add_record_set(record_set)
>>> changes.create() # API request
>>> while changes.status != 'done':
... print('Waiting for changes to complete')
... time.sleep(60) # or whatever interval is appropriate
... changes.reload() # API request
record_set = zone.resource_record_set('www.example.com', 'CNAME', 3600, 'www1.example.com')
Needs to be in this form:
CNAME:
record_set = zone.resource_record_set('www.example.com.', 'CNAME', 3600, ['www1.example.com.',])
Or for A records:
record_set = zone.resource_record_set('www.example.com.', 'A', 3600, ['11.111.11.111',])
Resource records need to be in a List form, DNS records seem to need the trailing dot.. can someone chime in on this? Is that correct form?
It's the only way I seem to be able to get records into the zone files.
Thanks, Joe