Skip to content

Support regional domain authentication#83

Open
n3ph wants to merge 1 commit intokenzo0107:mainfrom
n3ph:support-regional-resources
Open

Support regional domain authentication#83
n3ph wants to merge 1 commit intokenzo0107:mainfrom
n3ph:support-regional-resources

Conversation

@n3ph
Copy link
Copy Markdown

@n3ph n3ph commented Mar 25, 2026

General

This PR adds support for the region attribute as a preparation for domain authentication in the EU partition.

Unfortunately, the Sendgrid API responses are lacking the region attribute.

@kenzo0107 Let me know, if you see a better option here then to parse on DKIM DNS records.

Additional information

Signed-off-by: Michael Gerlach <michael.gerlach@lanes-planes.com>
@n3ph n3ph changed the title Add support for regional domain authentication Support regional domain authentication Mar 25, 2026
@kenzo0107
Copy link
Copy Markdown
Owner

@n3ph Thank you.

I have a concern about the design of this change.

This repository is an API client library for the SendGrid API, so in principle it should behave according to the API contract defined in the SendGrid documentation.

The current implementation derives Region by parsing the DKIM DNS host name:

r.Region = parseRegion(r.DNS.Dkim1)

However, the SendGrid API response does not include a region attribute, and inferring it from DKIM DNS records introduces behavior that is not part of the API specification. This approach relies on the naming convention of SendGrid DKIM records (e.g. s1, eus1), which is an internal implementation detail and not guaranteed by the public API contract. If that naming scheme changes in the future, the SDK behavior could break.

From a library design perspective, it would be safer for the SDK to remain a thin wrapper around the API and avoid deriving fields that are not present in the API response.

On the other hand, the SendGrid API documentation for domain authentication does define region in the request body:

https://www.twilio.com/docs/sendgrid/api-reference/domain-authentication/authenticate-a-domain

Therefore, I think it makes sense to support region as part of the request struct so that users can explicitly specify it when calling the API. However, I would avoid populating Region in response models by inferring it from DKIM records.

If region handling is required by higher-level tooling (for example Terraform provider logic), it would be more appropriate to derive it in that layer rather than inside the API client library.

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.

Support regional domain authentication

2 participants