Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns: UpdateDNSRecord: clean up params and drop record lookup #1170

Merged
merged 5 commits into from
Jan 10, 2023

Conversation

favonia
Copy link
Contributor

@favonia favonia commented Jan 8, 2023

Description

This PR avoids the extra DNS record lookup for name and type; these two fields are not needed for the PATCH method and thus the lookup is useless. It also removes many parameters that are probably read-only.

PS: This PR does not imply the data field should be there---I did not touch it because I do not understand it. Also, I assume meta is read-only, which could be wrong. @jacobbednarz Should data be there? How about meta?

Has your change been tested?

Yes. I can confirm the real Cloudflare API does not need name or type to update a DNS record.

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Even though it changes UpdateDNSRecordParams, any existing application which puts non-zero values in those deleted fields should have failed to update the DNS record.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented (api.cloudflare.com or developers.cloudflare.com) and stable APIs.

@favonia favonia changed the title fix(dns): clean up UpdateDNSRecordParams fix(dns): clean up UpdateDNSRecordParams and remove useless record lookup Jan 8, 2023
@favonia favonia changed the title fix(dns): clean up UpdateDNSRecordParams and remove useless record lookup fix(dns): UpdateDNSRecord: clean up params and drop record lookup Jan 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2023

changelog detected ✅

@codecov-commenter
Copy link

codecov-commenter commented Jan 8, 2023

Codecov Report

Merging #1170 (c58af05) into master (6153c1e) will decrease coverage by 0.09%.
The diff coverage is 45.32%.

@@            Coverage Diff             @@
##           master    #1170      +/-   ##
==========================================
- Coverage   49.40%   49.31%   -0.10%     
==========================================
  Files         127      128       +1     
  Lines       12290    12409     +119     
==========================================
+ Hits         6072     6119      +47     
- Misses       4840     4886      +46     
- Partials     1378     1404      +26     
Impacted Files Coverage Δ
access_organization.go 64.70% <ø> (ø)
cloudflare_experimental.go 0.00% <0.00%> (ø)
utils.go 72.72% <ø> (ø)
cloudflare.go 68.37% <14.28%> (-0.34%) ⬇️
mtls_certificates.go 26.59% <26.59%> (ø)
dns.go 66.66% <84.90%> (+2.94%) ⬆️
origin_ca.go 57.26% <90.90%> (-2.09%) ⬇️
devices_managed_networks.go 41.55% <100.00%> (+9.09%) ⬆️
email_routing_destination.go 66.66% <100.00%> (+0.41%) ⬆️
email_routing_rules.go 65.64% <100.00%> (+0.26%) ⬆️
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@favonia
Copy link
Contributor Author

favonia commented Jan 8, 2023

@jacobbednarz the coverage comparison unfortunately is not very helpful because the data for the master branch have not been consistently uploaded to Codecov.

@favonia favonia changed the title fix(dns): UpdateDNSRecord: clean up params and drop record lookup dns: UpdateDNSRecord: clean up params and drop record lookup Jan 8, 2023
.changelog/1170.txt Outdated Show resolved Hide resolved
.changelog/1170.txt Outdated Show resolved Hide resolved
dns.go Show resolved Hide resolved
dns.go Show resolved Hide resolved
@jacobbednarz
Copy link
Member

This PR does not imply the data field should be there---I did not touch it because I do not understand it. Also, I assume meta is read-only, which could be wrong. @jacobbednarz Should data be there?

data is what is used for complex record types (CAA, SRV, etc) instead of content.

How about meta?

meta is read only. largely to inform if the record is managed by an internal service instead of customers.

favonia and others added 4 commits January 9, 2023 22:09
This commit does not mean all the remaining fields should be there;
I did not touch the ones I do not understand.
@jacobbednarz jacobbednarz merged commit a37d5c1 into cloudflare:master Jan 10, 2023
@jacobbednarz
Copy link
Member

thanks as always, @favonia

@github-actions github-actions bot added this to the v0.59.0 milestone Jan 10, 2023
github-actions bot pushed a commit that referenced this pull request Jan 10, 2023
@favonia favonia deleted the remove-extra-dns-lookup branch January 10, 2023 08:20
ivan-section-io pushed a commit to section/cloudflare-go that referenced this pull request Jan 12, 2023
@github-actions
Copy link
Contributor

This functionality has been released in v0.59.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants