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

Expose Endpoints Partition DNSSuffix #2710

Closed
bflad opened this issue Jul 23, 2019 · 3 comments · Fixed by #2711 or #2725
Closed

Expose Endpoints Partition DNSSuffix #2710

bflad opened this issue Jul 23, 2019 · 3 comments · Fixed by #2711 or #2725
Labels
feature-request A feature should be added or improved.

Comments

@bflad
Copy link
Contributor

bflad commented Jul 23, 2019

Feature description

There does not appear to be an easy method to extract the existing endpoints.Partition DNSSuffix field for the default partitions:

DNSSuffix: "amazonaws.com",

DNSSuffix: "amazonaws.com.cn",

DNSSuffix: "amazonaws.com",

This information is helpful in building AWS partition agnostic IAM policy documents (https://docs.amazonaws.cn/en_us/aws/latest/userguide/iam.html) and constructing hostnames not available in the default endpoints information such as S3 website endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region).

Describe alternatives you've considered

Hardcoding the DNS suffix after performing a regional lookup against AWS China:

if partition, ok := endpoints.PartitionForRegion(endpoints.DefaultPartitions(), region); ok && partition.ID() == endpoints.AwsCnPartitionID {
	return fmt.Sprintf("s3-website.%s.amazonaws.com.cn", region)
}
return fmt.Sprintf("s3-website.%s.amazonaws.com", region)

Additional context

@bflad
Copy link
Contributor Author

bflad commented Jul 23, 2019

Potential implementation submitted: #2711

@jasdel
Copy link
Contributor

jasdel commented Aug 2, 2019

Thanks for creating this feature request @bflad. The DNS suffix is an internal detail of the endpoint resolver's metadata, and we've tried to only expose that data as needed. With that said, in this context, I think it makes sense for DNS suffix to be exposed.

We'll review the PR and get back to you with feedback.

jasdel pushed a commit that referenced this issue Aug 2, 2019
Exposes the underlying partition metadata's DNSSuffix value via the `DNSSuffix` method on the endpoint's `Partition` type. This allows access to the partition's DNS suffix, e.g. "amazon.com".

Fix #2710
@jasdel
Copy link
Contributor

jasdel commented Aug 2, 2019

The change looks good, thanks for taking the time to create the PR. It is merged in and will be included in the SDK's next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants