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

Support alternate domains when passed a prefix ending with "." #19

Merged
merged 2 commits into from
Aug 17, 2024

Conversation

thekid
Copy link
Member

@thekid thekid commented Aug 17, 2024

Typically, the pattern for AWS service's endpoints is {service}.amazonaws.com (or {service}.{region}.amazonaws.com). In some cases like with Bedrock, there are two separate endpoint: bedrock for management, and bedrock-runtime for accessing the AI models. However, the credentials need to always scoped to the service, for which the using() method was established.

This PR adds a shorthand for having to repeat the region and top-level domain in this case by passing the prefix ending with a ".":

use com\amazon\aws\{ServiceEndpoint, CredentialProvider};

// Before
$runtime= (new ServiceEndpoint('bedrock', CredentialProvider::default()))
  ->using('bedrock-runtime.eu-central-1.amazonaws.com')
  ->in('eu-central-1')
;

// After
$runtime= (new ServiceEndpoint('bedrock', CredentialProvider::default()))
  ->using('bedrock-runtime.')
  ->in('eu-central-1')
;

@thekid thekid added the enhancement New feature or request label Aug 17, 2024
@thekid thekid merged commit db425aa into main Aug 17, 2024
20 checks passed
@thekid thekid deleted the feature/alternate-domain branch August 17, 2024 15:34
@thekid
Copy link
Member Author

thekid commented Aug 18, 2024

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

Successfully merging this pull request may close these issues.

1 participant