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

bugfix: presigned configured urls #2878

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

stobrien89
Copy link
Member

Description of changes:
Fixes issue with configured endpoint urls when used during presigning.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -564,7 +564,11 @@ private function setClientBuiltIns($args)
$config = $this->getConfig();
$service = $args['service'];

$builtIns['SDK::Endpoint'] = isset($args['endpoint']) ? $args['endpoint'] : null;
$builtIns['SDK::Endpoint'] = isset($args['endpoint'])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think readability can be improved here by using if statements instead. For example:

$builtIns['SDK::Endpoint'] = null;
if (isset($args['endpoint'])) {
    $builtIns['SDK::Endpoint'] = $args['endpoint'];
} else if(isset($config['configured_endpoint_url'])) {
    $builtIns['SDK::Endpoint'] = $this->getEndpoint();
}

Or if our docs build process would permit us:

$builtIns['SDK::Endpoint'] = args['endpoint'] ?? $config['configured_endpoint_url'] ?? null;

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why should we not consider the endpoint resolved by the ClientResolver utility instead?

For example, the client resolver will ignore resolving an endpoint if it was already provided in the arguments, otherwise it will resolve the endpoint with the default implementation there.
So then the resolved config should contains the endpoint we need:

$this->endpoint = new Uri($config['endpoint']);

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're unable to do that for historical reasons. The legacy endpoint provider will add an endpoint to the args returned from the clientResolver if that value is not already set, meaning the value is always set and we need a way to determine whether or not a customer has resolved an endpoint from their environment.

Copy link
Member Author

@stobrien89 stobrien89 Feb 12, 2024

Choose a reason for hiding this comment

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

Re: the readability, happy to change that to an if/else.

@stobrien89 stobrien89 closed this Feb 12, 2024
@stobrien89 stobrien89 reopened this Feb 12, 2024
@stobrien89 stobrien89 merged commit d82b17b into aws:master Feb 12, 2024
35 checks passed
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