Skip to content

Commit 502c817

Browse files
skotambkarjasdel
authored andcommitted
aws/endpoints: Expose DNSSuffix for partition (#369)
Ports v1 SDK's ability to expose DNS Suffix for partitions. Fixes #347 .
1 parent 81ab069 commit 502c817

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

CHANGELOG_PENDING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
### SDK Features
22

33
### SDK Enhancements
4+
* `aws/endpoints`: Expose DNSSuffix for partitions ([#368](https://github.com/aws/aws-sdk-go/pull/368))
5+
* 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".
6+
* Fixes [#347](https://github.com/aws/aws-sdk-go/issues/347)
47
* `private/protocol`: Add support for parsing fractional timestamp ([#367](https://github.com/aws/aws-sdk-go-v2/pull/367))
58
* Fixes the SDK's ability to parse fractional unix timestamp values and adds tests.
69
* Fixes [#365](https://github.com/aws/aws-sdk-go-v2/issues/365)

aws/endpoints/endpoints.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ func (ps Partitions) ForPartition(id string) (Partition, bool) {
8282
// A Partition provides the ability to enumerate the partition's regions
8383
// and services.
8484
type Partition struct {
85-
id string
86-
p *partition
85+
id, dnsSuffix string
86+
p *partition
8787
}
8888

89+
// DNSSuffix returns the base domain name of the partition.
90+
func (p Partition) DNSSuffix() string { return p.dnsSuffix }
91+
8992
// ID returns the identifier of the partition.
9093
func (p Partition) ID() string { return p.id }
9194

aws/endpoints/endpoints_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,11 @@ func TestPartitionForRegion(t *testing.T) {
240240
if !ok {
241241
t.Fatalf("expect partition to be found")
242242
}
243+
if e, a := expect.DNSSuffix(), actual.DNSSuffix(); e != a {
244+
t.Errorf("expect %s partition DNSSuffix, got %s", e, a)
245+
}
243246
if e, a := expect.ID(), actual.ID(); e != a {
244-
t.Errorf("expect %s partition, got %s", e, a)
247+
t.Errorf("expect %s partition ID, got %s", e, a)
245248
}
246249
}
247250

aws/endpoints/v3model.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ type partition struct {
5353

5454
func (p partition) Partition() Partition {
5555
return Partition{
56-
id: p.ID,
57-
p: &p,
56+
dnsSuffix: p.DNSSuffix,
57+
id: p.ID,
58+
p: &p,
5859
}
5960
}
6061

0 commit comments

Comments
 (0)