Skip to content

Fetch ClouDNS allowed TTL values from API. #1078#1102

Merged
tlimoncelli merged 2 commits into
DNSControl:masterfrom
riku22:cloudns_ttl_fix
Mar 22, 2021
Merged

Fetch ClouDNS allowed TTL values from API. #1078#1102
tlimoncelli merged 2 commits into
DNSControl:masterfrom
riku22:cloudns_ttl_fix

Conversation

@riku22
Copy link
Copy Markdown
Contributor

@riku22 riku22 commented Mar 22, 2021

Fetch ClouDNS allowed TTL values from API.
Fix the problem of # 1078.

@riku22 riku22 changed the title Fetch ClouDNS allowed TTL values from API Fetch ClouDNS allowed TTL values from API. #1078 Mar 22, 2021
Comment thread providers/cloudns/api.go
return fmt.Errorf("failed fetching available TTL values list from ClouDNS: %s", err)
}

json.Unmarshal(bodyString, &allowedTTLValues)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return err result instead of nil?

Comment thread providers/cloudns/api.go
}

func (c *cloudnsProvider) fetchAvailableTTLValues(domain string) error {
allowedTTLValues = nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is fetchAvailableTTLValues going to make this API call more than once? Would it be sufficient to call it only if needed?

Comment thread providers/cloudns/api.go

type recordResponse map[string]domainRecord

var allowedTTLValues = []uint32{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the API is good. It is better than a constant.
Is the API returning any values that are not on this list? For backwards compatibility it would be good to know.

@riku22
Copy link
Copy Markdown
Contributor Author

riku22 commented Mar 22, 2021

Hello.

  1. The API must be called for each zone.
  2. It's basically a constant value, but it seems that you can add a TTL by contacting support.
    For example, 10 minutes is available for my account.

@tlimoncelli
Copy link
Copy Markdown
Contributor

hello!

"1. The API must be called for each zone."

Interesting! Please add a comment in the code. Other people will find that useful.

@riku22
Copy link
Copy Markdown
Contributor Author

riku22 commented Mar 22, 2021

Added a comment.

@tlimoncelli
Copy link
Copy Markdown
Contributor

Thanks!

@tlimoncelli tlimoncelli merged commit 4eb6fdf into DNSControl:master Mar 22, 2021
@riku22 riku22 deleted the cloudns_ttl_fix branch April 21, 2021 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants