Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes codegen for multiple account ids #4608

Merged
merged 1 commit into from Nov 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions private/model/api/endpoint_arn.go
Expand Up @@ -76,11 +76,15 @@ const accountIDWithARNShapeTmplDef = `
{{ range $_, $name := $.MemberNames -}}
{{ $elem := index $.MemberRefs $name -}}
{{ if $elem.AccountIDMemberWithARN -}}
// updateAccountID returns a pointer to a modified copy of input,
{{ $FunctionName := $name }}
{{ if eq $name "AccountId" }}
{{ $FunctionName = "AccountID" }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to change AccountId to AccountID to support backwards compatibility. if we wanted to drop it, we could removed this if statement.

{{ end }}
// update{{ $FunctionName }} returns a pointer to a modified copy of input,
// if account id is not provided, we update the account id in modified input
// if account id is provided, but doesn't match with the one in ARN, we throw an error
// if account id is not updated, we return nil. Note that original input is not modified.
func (s {{ $.ShapeName }}) updateAccountID(accountId string) (interface{}, error) {
func (s {{ $.ShapeName }}) update{{ $FunctionName }}(accountId string) (interface{}, error) {
if s.{{ $name }} == nil {
s.{{ $name }} = aws.String(accountId)
return &s, nil
Expand Down