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

refactor/regen for upstream endpoint middleware/binding changes #2293

Merged
merged 3 commits into from
Sep 29, 2023

Conversation

lucix-aws
Copy link
Contributor

@lucix-aws lucix-aws commented Sep 28, 2023

Track changes in aws/smithy-go#455 and regenerate s3, s3control, and eventbridge services.

The behavior to disable modeled AccountId prefix for v2 endpoint resolution in s3control was ported to a standalone middleware, this was previously a per-op "post-resolution" hook in codegen, which doesn't exist anymore.

@lucix-aws lucix-aws requested a review from a team as a code owner September 28, 2023 00:18
return params
}

func (in *ActivateEventSourceInput) bindEndpointParams(p *EndpointParameters) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that I see all of these empty bindings I'm thinking we probably want to just not generate in that case. The outer bind call could then delegate accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did the above after discussing offline.

@lucix-aws lucix-aws force-pushed the feat-sraauth-endpointbindings branch from 512ddf0 to 2c3ae91 Compare September 28, 2023 00:41
}

type resolveEndpointV2Middleware struct {
options Options
Copy link
Contributor

Choose a reason for hiding this comment

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

is this the client Options in api_client.go?
reason why im asking is because it seems that there was a previous effort to not pass the client Options around directly in middleware, but rather to create intermediary objects and only copy out what you need from the client Options
https://github.com/aws/aws-sdk-go-v2/blob/main/service/s3/api_client.go#L468
https://github.com/aws/aws-sdk-go-v2/blob/main/service/s3/api_op_GetObject.go#L517

would you be able to comment on whether you think that previous pattern should or should not be followed?

also, why give resolver its own field if it already exists in the same options field

func addResolveEndpointV2Middleware(stack *middleware.Stack, options Options) error {
	return stack.Serialize.Insert(&resolveEndpointV2Middleware{
		options:  options,
		resolver: options.EndpointResolverV2,
	}, "ResolveEndpoint", middleware.After)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline - this is more important for exported middlewares or situations where code can't take a dependency on Options directly. For codegenned middleware internal to services, passing options at large is generally fine.

return params
}

func (in *AbortMultipartUploadInput) bindEndpointParams(p *EndpointParameters) {
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, was there a strong reason to put all the operation input receivers for bindEndpointParams here rather than in the operation specfic files where the operation input struct is defined? or was it more of a toss up between "it being endpoints related functionality" and "it being an operation method"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved after discussing offline.

bindEndpointParams(*EndpointParameters)
}

func bindEndpointParams(input endpointParamsBinder, options Options) *EndpointParameters {
Copy link
Contributor

Choose a reason for hiding this comment

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

this does look much simpler. i think when i first implemented it i was trying to follow a pattern common in this SDK of only copying out of Options what you need (see my other comment). but seeing how much simpler this is makes me seem to prefer this more.

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.

2 participants