These functions are then executed when sign(), open() or request() are called, providing the credentials to the signing function. This way, ServiceEndpoint instances can refresh expiring credentials easily:
// Always use the given credentials
new ServiceEndpoint('lambda', new Credentials(/* ... */));
// Use the default credential provider
new ServiceEndpoint('lambda', CredentialProvider::default());
// Use a custom function
new ServiceEndpoint('lambda', fn() => new Credentials(/* ... */));
These functions are then executed when
sign()
,open()
orrequest()
are called, providing the credentials to the signing function. This way, ServiceEndpoint instances can refresh expiring credentials easily: