Skip to content

Commit

Permalink
aws/endpoints: Expose DNSSuffix for partition (#369)
Browse files Browse the repository at this point in the history
Ports v1 SDK's ability to expose DNS Suffix for partitions.

Fixes #347 .
  • Loading branch information
skotambkar authored and jasdel committed Aug 30, 2019
1 parent 81ab069 commit 502c817
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
### SDK Features

### SDK Enhancements
* `aws/endpoints`: Expose DNSSuffix for partitions ([#368](https://github.com/aws/aws-sdk-go/pull/368))
* 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".
* Fixes [#347](https://github.com/aws/aws-sdk-go/issues/347)
* `private/protocol`: Add support for parsing fractional timestamp ([#367](https://github.com/aws/aws-sdk-go-v2/pull/367))
* Fixes the SDK's ability to parse fractional unix timestamp values and adds tests.
* Fixes [#365](https://github.com/aws/aws-sdk-go-v2/issues/365)
Expand Down
7 changes: 5 additions & 2 deletions aws/endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ func (ps Partitions) ForPartition(id string) (Partition, bool) {
// A Partition provides the ability to enumerate the partition's regions
// and services.
type Partition struct {
id string
p *partition
id, dnsSuffix string
p *partition
}

// DNSSuffix returns the base domain name of the partition.
func (p Partition) DNSSuffix() string { return p.dnsSuffix }

// ID returns the identifier of the partition.
func (p Partition) ID() string { return p.id }

Expand Down
5 changes: 4 additions & 1 deletion aws/endpoints/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,11 @@ func TestPartitionForRegion(t *testing.T) {
if !ok {
t.Fatalf("expect partition to be found")
}
if e, a := expect.DNSSuffix(), actual.DNSSuffix(); e != a {
t.Errorf("expect %s partition DNSSuffix, got %s", e, a)
}
if e, a := expect.ID(), actual.ID(); e != a {
t.Errorf("expect %s partition, got %s", e, a)
t.Errorf("expect %s partition ID, got %s", e, a)
}
}

Expand Down
5 changes: 3 additions & 2 deletions aws/endpoints/v3model.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ type partition struct {

func (p partition) Partition() Partition {
return Partition{
id: p.ID,
p: &p,
dnsSuffix: p.DNSSuffix,
id: p.ID,
p: &p,
}
}

Expand Down

0 comments on commit 502c817

Please sign in to comment.