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

Add support for configured endpoints. #2328

Merged
merged 26 commits into from
Oct 30, 2023
Merged

Conversation

isaiahvita
Copy link
Contributor

@isaiahvita isaiahvita commented Oct 20, 2023

While SDK consumers can already configure endpoint overrides in code, consumers have expressed the desire for the same configuration options in environment variables and in the aws config file. This PR fulfills this feature.

This PR regenerated code for all services

In order to support this feature, support need to be added for subproperties in the aws config file. It was decided to extend the INI lexer to treat subproperties as literals. Then parse these literals in the config parser.

It was specifically avoided to add this support in the INI parser. This is because the current state of the INI parser:

  • does not follow traditional language parser construction from a CFG (or BNF) into a parse table.
  • LL(1) parser logic from a parse table is obscure and is non-standard
  • all institutional knowledge of this implementation is lost

Feature context: aws/aws-sdk#229
Depends on: aws/smithy-go#463

@isaiahvita isaiahvita requested a review from a team as a code owner October 20, 2023 15:17

// GetServiceBaseEndpoint is used to retrieve a normalized SDK ID for use
// with configured endpoints.
func (c EnvConfig) GetServiceBaseEndpoint(ctx context.Context, sdkID string) (string, bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[nonblocking] In new "resolvers" like this I've just left off the error return if it can't actually return an error.

@@ -482,6 +494,34 @@ func (c EnvConfig) getCustomCABundle(context.Context) (io.Reader, bool, error) {
return bytes.NewReader(b), true, nil
}

// GetIgnoreConfiguredEndpoints is used in knowing when to disable configured
// endpoints feature.
func (c EnvConfig) GetIgnoreConfiguredEndpoints(context.Context) (bool, bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why context.Context? Don't see it used anywhere, it's also not possible for the caller to propagate it with the structure of how these are used (I see you're setting it to context.Background() later on).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see it's part of that static resolver signature. I would just not propagate it further down wherever it's not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, but in this impl in env config and shared config, i dont propagate it down to any further functions. feel free to elaborate if im misunderstanding

config/resolve.go Outdated Show resolved Hide resolved
config/shared_config.go Outdated Show resolved Hide resolved
aws/config.go Show resolved Hide resolved
service/elasticbeanstalk/api_client.go Outdated Show resolved Hide resolved
config/shared_config.go Show resolved Hide resolved
config/shared_config.go Outdated Show resolved Hide resolved
config/env_config.go Show resolved Hide resolved
@lucix-aws lucix-aws linked an issue Oct 20, 2023 that may be closed by this pull request
2 tasks
@isaiahvita isaiahvita force-pushed the endpoint-config branch 3 times, most recently from 4dc8ebb to 76c041d Compare October 24, 2023 19:05
Copy link
Contributor

@lucix-aws lucix-aws left a comment

Choose a reason for hiding this comment

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

We should regenerate everything to see CI pass for every service here but LGTM.

@@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: [1.19, "1.20"]
go-version: ["1.20", "1.21"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we doing this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was before i root caused my issue. and thought this might fix it. but i left it because 1.21 is the latest released version. all tests were passing with it, but i can change it back if you think we should

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah revert this. We technically still need to check 1.19 and I'm going to handle this in a separate PR today anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support endpoint configuration via env and shared config
3 participants