-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for endpoint discovery (#1707)
* Configuration class * ConfigurationProvider first pass * ClientResolver configuration * Configuration tweaks * Add endpoint discovery moved to AwsClient * Add EndpointList * Initial EndpointDiscovery middleware * Middleware ideal path * EndpointDiscoveryMiddleware invoke additions * Add configuration logic to middleware * Add discovery api fail case * EndpointList modifications * Handle InvalidEndpointException workflow * EndpointDiscoveryMiddlewareTest setup * Change config env variable to match established standard * Added toArray to configuration * Add ConfigurationProviderTest * Add ConfigurationTest * Tweak original endpoint used in middleware * Removed extraneous variable * Add discovery middleware test basic request cases * Add tests for discovery request construction * Add cache test * Add cache limit test * Add EndpointListTest * Add getEndpoint and test * Use getEndpoint where relevant * Fix undeclared variable issue in middleware * Remove correct endpoint for InvalidEndpointException * Add basic tests for InvalidEndpointException * Editing pass for constructor change, minor issues * Add Describe failure tests, flesh out invalid endpoint exception tests * Add additional tests and support * Add test for faulty endpoint discovery model * Tweak EndpointListTest for more explicit active to expired transition * Add tests to cover edge case exceptions * Discovery middleware editing pass * Additional test coverage for ConfigurationProviderTest * Another editing pass * Move discovery exception handling outside of main invoke * Minor tweaks * Modify EndpointList getExpired to private method * Remove dev ed_override client arg * Unit test tweaks * Add support for alternate environment variable * Separate out a handler for invalid endpoint exception in the discovery middleware * Tweaks to middleware and configuration provider * Tweak to middleware * Add changelog * State preservation tweaks for config provider test * Add client documentation * Code style pass * Formatting tweak
- Loading branch information
1 parent
2c1800a
commit 37ccee8
Showing
13 changed files
with
2,656 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"type": "feature", | ||
"category": "EndpointDiscovery", | ||
"description": "This feature adds SDK support for discovering the correct endpoint for a customer by making requests against a service-provided API, for operations specified by the service." | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
namespace Aws\EndpointDiscovery; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
private $cacheLimit; | ||
private $enabled; | ||
|
||
public function __construct($enabled, $cacheLimit = 1000) | ||
{ | ||
$this->cacheLimit = filter_var($cacheLimit, FILTER_VALIDATE_INT); | ||
if ($this->cacheLimit == false || $this->cacheLimit < 1) { | ||
throw new \InvalidArgumentException( | ||
"'cache_limit' value must be a positive integer." | ||
); | ||
} | ||
|
||
// Unparsable $enabled flag errs on the side of disabling endpoint discovery | ||
$this->enabled = filter_var($enabled, FILTER_VALIDATE_BOOLEAN); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function isEnabled() | ||
{ | ||
return $this->enabled; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getCacheLimit() | ||
{ | ||
return $this->cacheLimit; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function toArray() | ||
{ | ||
return [ | ||
'enabled' => $this->isEnabled(), | ||
'cache_limit' => $this->getCacheLimit() | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
namespace Aws\EndpointDiscovery; | ||
|
||
/** | ||
* Provides access to endpoint discovery configuration options: | ||
* 'enabled', 'cache_limit' | ||
*/ | ||
interface ConfigurationInterface | ||
{ | ||
/** | ||
* Checks whether or not endpoint discovery is enabled. | ||
* | ||
* @return bool | ||
*/ | ||
public function isEnabled(); | ||
|
||
/** | ||
* Returns the cache limit, if available. | ||
* | ||
* @return string|null | ||
*/ | ||
public function getCacheLimit(); | ||
|
||
/** | ||
* Returns the configuration as an associative array | ||
* | ||
* @return array | ||
*/ | ||
public function toArray(); | ||
} |
Oops, something went wrong.