Skip to content

Commit

Permalink
endpoints: Generate IDs and lookup table.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Sep 17, 2024
1 parent 9dcf735 commit e0af509
Show file tree
Hide file tree
Showing 8 changed files with 422 additions and 17 deletions.
8 changes: 8 additions & 0 deletions endpoints/endpoints.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package endpoints

const (
AwsGlobalRegionID = "aws-global" // AWS Standard global region.
)
301 changes: 293 additions & 8 deletions endpoints/endpoints_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions endpoints/partition.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package endpoints

import (
"regexp"
)

type Partition struct {
id string
name string
dnsSuffix string
regionRegex *regexp.Regexp
}

func (p *Partition) ID() string {
return p.id
}

func (p *Partition) Name() string {
return p.name
}

func (p *Partition) DNSSuffix() string {
return p.dnsSuffix
}

func (p *Partition) RegionRegex() *regexp.Regexp {
return p.regionRegex
}
22 changes: 22 additions & 0 deletions endpoints/region.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package endpoints

type Region struct {
id string
description string
partitionID string
}

func (r *Region) ID() string {
return r.id
}

func (r *Region) Description() string {
return r.description
}

func (r *Region) PartitionID() string {
return r.partitionID
}
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.22
toolchain go1.22.7

require (
github.com/YakDriver/regexache v0.24.0
github.com/aws/aws-sdk-go-v2 v1.30.5
github.com/aws/aws-sdk-go-v2/config v1.27.33
github.com/aws/aws-sdk-go-v2/credentials v1.17.32
Expand Down Expand Up @@ -48,7 +49,7 @@ require (
github.com/fatih/color v1.17.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
Expand Down
Loading

0 comments on commit e0af509

Please sign in to comment.