Skip to content

Commit

Permalink
New top-level endpoints package.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Sep 17, 2024
1 parent d27cfcf commit 9dcf735
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions endpoints/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

//go:generate go run ../internal/generate/endpoints/main.go -- https://raw.githubusercontent.com/aws/aws-sdk-go-v2/main/codegen/smithy-aws-go-codegen/src/main/resources/software/amazon/smithy/aws/go/codegen/endpoints.json

package endpoints
6 changes: 0 additions & 6 deletions internal/generate/endpoints/generate.go

This file was deleted.

3 changes: 2 additions & 1 deletion internal/generate/endpoints/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func main() {

td := TemplateData{}
templateFuncMap := template.FuncMap{
"IDToConstant": func(s string) (string, error) {
// KebabToTitle splits a kebab case string and returns a string with each part title cased.
"KebabToTitle": func(s string) (string, error) {
parts := strings.Split(s, "-")
return strings.Join(slices.ApplyToAll(parts, func(s string) string {
return common.FirstUpper(s)
Expand Down
2 changes: 1 addition & 1 deletion internal/generate/endpoints/output.go.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ package endpoints

const (
{{- range .Partitions }}
{{ .ID | IDToConstant}}PartitionID = "{{ .ID }}"
{{ .ID | KebabToTitle}}PartitionID = "{{ .ID }}"
{{- end }}
)

0 comments on commit 9dcf735

Please sign in to comment.