Skip to content

Commit

Permalink
aws/endpoints: Expose DNSSuffix for partitions
Browse files Browse the repository at this point in the history
Reference: aws#2710
  • Loading branch information
bflad committed Jul 23, 2019
1 parent f0c3a48 commit 25893ba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions aws/endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ func PartitionForRegion(ps []Partition, regionID 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 @@ -330,8 +330,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 @@ -54,8 +54,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 25893ba

Please sign in to comment.