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

feature: add support for per-service endpoint url configuration #2737

Merged
merged 31 commits into from
Sep 1, 2023

Conversation

stobrien89
Copy link
Member

@stobrien89 stobrien89 commented Jul 25, 2023

Issue #, if available:
#1239

Description of changes:
Adds the ability to configure endpoints on a per-service basis via the environment and ini file. Order of precedence is as follows:

  • endpoint client configuration
  • AWS_ENDPOINT_URL_<SERVICE_IDENTIFIER> env var
  • services endpoint in shared config example:
[default]
region = us-west-2
services = my-services

[services my-services]
s3 =
  endpoint_url = https://s3-endpoint-override.aws
  • AWS_ENDPOINT_URL env var
  • endpoint_url in shared config. example:
[default]
endpoint_url = http://localhost:1234

For backward-compatibility, we will continue to support the endpoint client constructor option, however, endpoint_url will take precedence, if resolved from any one of the above-mentioned options.

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

src/ClientResolver.php Outdated Show resolved Hide resolved
src/AwsClient.php Outdated Show resolved Hide resolved
src/ClientResolver.php Outdated Show resolved Hide resolved
src/Configuration/ConfigurationResolver.php Outdated Show resolved Hide resolved
src/Configuration/ConfigurationResolver.php Show resolved Hide resolved
src/functions.php Outdated Show resolved Hide resolved
src/ClientResolver.php Outdated Show resolved Hide resolved
src/ClientResolver.php Show resolved Hide resolved
src/functions.php Outdated Show resolved Hide resolved
src/Configuration/ConfigurationResolver.php Show resolved Hide resolved
src/functions.php Show resolved Hide resolved
src/ClientResolver.php Outdated Show resolved Hide resolved
src/functions.php Show resolved Hide resolved
src/ClientResolver.php Show resolved Hide resolved
@@ -35,6 +36,7 @@ public static function getArguments()
// (e.g. http://search-blah.{region}.cloudsearch.amazonaws.com)
return explode('.', new Uri($args['endpoint']))[1];
};
unset($args['endpoint']['default']);
Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary? This seems like an endpoint is always required, so it should never go to the default?

Copy link
Member Author

Choose a reason for hiding this comment

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

The client resolver won't handle the 'required' property if there's a default

@stobrien89 stobrien89 merged commit 1cf7f36 into aws:master Sep 1, 2023
15 checks passed
SamRemis pushed a commit to SamRemis/aws-sdk-php that referenced this pull request Nov 28, 2023
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