aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
5.99k stars 1.2k forks source link

Check based on Value #2895

Closed AKHIL-882 closed 3 months ago

AKHIL-882 commented 3 months ago

The modified _apply_region function now checks if the $value parameter is set. If it is set, it assigns the value to $args['region']. If $value is not set, it calls the _default_region function to retrieve the default region value and assigns it to $args['region'].

After setting the region value, the function proceeds to check if the value is empty. If it is empty, it invokes the _missing_region function, indicating that the region is missing from the arguments.

Overall, the modified function ensures that the region parameter is either explicitly set or assigned a default value, and it handles the case where the region value is empty by calling a separate function to handle the missing region scenario.

stobrien89 commented 3 months ago

Hi @AKHIL-882,

Thanks for the PR. The ClientResolver.php calls a config key's 'default' method if a value for that key is not provided in the client constructor, meaning currently _default_region is called before _apply_region. _apply_region just ensures the value provided in the client constructor or _default_region isn't empty before applying it to the client's config. Unfortunately we can't accept this change.