Code Monkey home page Code Monkey logo

Comments (8)

mwarkentin avatar mwarkentin commented on May 11, 2024

I was able to update the record when hitting the API directly:

$ curl -X PUT "https://api.cloudflare.com/client/v4/zones/5058354498babe04ef58c4168949b099/dns_records/2dc525087c2ff8b02289eef8a0ec1d68" \
>      -H "X-Auth-Email: ***" \
>      -H "X-Auth-Key: ***" \
>      -H "Content-Type: application/json" \
>      --data '{"type":"A","name":"CFAPI-modified","content":"192.168.10.10","ttl":120,"proxied":false}'
{"result":{"id":"2dc525087c2ff8b02289eef8a0ec1d68","type":"A","name":"cfapi-modified.wave-juno.com","content":"192.168.10.10","proxiable":false,"proxied":false,"ttl":120,"locked":false,"zone_id":"5058354498babe04ef58c4168949b099","zone_name":"wave-juno.com","modified_on":"2016-12-20T20:45:04.595545Z","created_on":"2016-12-20T20:45:04.595545Z","meta":{"auto_added":false}},"success":true,"errors":[],"messages":[]}

from cloudflare-go.

jamesog avatar jamesog commented on May 11, 2024

Ah, there is indeed a very stupid bug here. I think when it was originally written an assumption was made that anything but the label name would be changed, so UpdateDNSRecord is actually fetching the existing record (based on the recordID) and overwriting the name :-(

I'm not sure why the TTL isn't being updated, though. Maybe an artefact of the entire record not being updated?

from cloudflare-go.

jamesog avatar jamesog commented on May 11, 2024

Hopefully the PR fixes this for you. Are you able to test it before merging?

from cloudflare-go.

mwarkentin avatar mwarkentin commented on May 11, 2024

@jamesog I'd be happy to test, but not sure how.. I tried checking out origin/jamesog/97-updatednsrecord in $GOPATH/src/github/cloudflare/cloudflare-go and then re-ran my script, however I'm seeing the same result (just a record named cfapi).

Not sure if this is an issue with how I did things or if there's still an issue with the library. Maybe you could add some debug output so I'm sure that I'm actually running your code? 😄

Output

2016/12/20 17:04:26 [DEBUG] CloudFlare Record create configuration: cloudflare.DNSRecord{ID:"", Type:"A", Name:"CFAPI", Content:"127.0.0.1", Proxiable:false, Proxied:false, TTL:3600, Locked:false, ZoneID:"5058354498babe04ef58c4168949b099", ZoneName:"wave-juno.com", CreatedOn:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}, ModifiedOn:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}, Data:interface {}(nil), Meta:interface {}(nil), Priority:0}
2016/12/20 17:04:27 [INFO] CloudFlare Record ID: be0df701e59406ea97c8dc818813b8b5
2016/12/20 17:04:27 [DEBUG] CloudFlare Record update configuration: cloudflare.DNSRecord{ID:"be0df701e59406ea97c8dc818813b8b5", Type:"A", Name:"CFAPI-modified", Content:"192.168.10.10", Proxiable:false, Proxied:true, TTL:120, Locked:false, ZoneID:"5058354498babe04ef58c4168949b099", ZoneName:"wave-juno.com", CreatedOn:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}, ModifiedOn:time.Time{sec:0, nsec:0, loc:(*time.Location)(nil)}, Data:interface {}(nil), Meta:interface {}(nil), Priority:0}

Web Console

from cloudflare-go.

mwarkentin avatar mwarkentin commented on May 11, 2024

@jamesog I added some extra debugging logs, and noticed I was trying to update the record to proxied = true which wasn't valid and causing the update to fail. After I resolved this, I was able to successfully update the name:

from cloudflare-go.

jamesog avatar jamesog commented on May 11, 2024

Cool, thanks!

from cloudflare-go.

mwarkentin avatar mwarkentin commented on May 11, 2024

@jamesog Awesome, thanks for the quick response on this! 👍

from cloudflare-go.

jamesog avatar jamesog commented on May 11, 2024

Welcome :-)

from cloudflare-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.