|
8 | 8 | use AsyncAws\Core\Credentials\ChainProvider;
|
9 | 9 | use AsyncAws\Core\Credentials\CredentialProvider;
|
10 | 10 | use AsyncAws\Core\Credentials\SymfonyCacheProvider;
|
11 |
| -use AsyncAws\Core\HttpClient\AwsRetryStrategy; |
12 | 11 | use AsyncAws\Symfony\Bundle\Secrets\CachedEnvVarLoader;
|
13 | 12 | use AsyncAws\Symfony\Bundle\Secrets\SsmVault;
|
14 | 13 | use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
15 |
| -use Symfony\Component\DependencyInjection\ChildDefinition; |
16 | 14 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
17 | 15 | use Symfony\Component\DependencyInjection\ContainerInterface;
|
18 | 16 | use Symfony\Component\DependencyInjection\Definition;
|
19 | 17 | use Symfony\Component\DependencyInjection\Reference;
|
20 |
| -use Symfony\Component\HttpClient\Retry\RetryStrategyInterface; |
21 |
| -use Symfony\Component\HttpClient\RetryableHttpClient; |
22 | 18 | use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
23 | 19 | use Symfony\Contracts\Cache\CacheInterface;
|
24 | 20 |
|
@@ -98,17 +94,7 @@ private function addServiceDefinition(ContainerBuilder $container, string $name,
|
98 | 94 | $httpClient = $config['http_client'] ? new Reference($config['http_client']) : null;
|
99 | 95 | } else {
|
100 | 96 | // Use default Symfony http_client unless explicitly set to null.
|
101 |
| - if (class_exists(RetryableHttpClient::class)) { |
102 |
| - $httpClient = new Definition(RetryableHttpClient::class); |
103 |
| - $httpClient->setArguments([ |
104 |
| - new Reference('async_aws.http_client'), |
105 |
| - new Definition(AwsRetryStrategy::class), |
106 |
| - 3, |
107 |
| - $logger, |
108 |
| - ]); |
109 |
| - } else { |
110 |
| - $httpClient = new Reference('async_aws.http_client'); |
111 |
| - } |
| 97 | + $httpClient = new Reference('http_client', ContainerInterface::NULL_ON_INVALID_REFERENCE); |
112 | 98 | }
|
113 | 99 |
|
114 | 100 | // If no credential provider is specified, lets configured a credentials provider with cache.
|
@@ -140,12 +126,10 @@ private function addServiceDefinition(ContainerBuilder $container, string $name,
|
140 | 126 | }
|
141 | 127 |
|
142 | 128 | $definition = new Definition($clientClass);
|
143 |
| - $definition->setArguments([ |
144 |
| - $config['config'], |
145 |
| - $credentialServiceId ? new Reference($credentialServiceId) : null, |
146 |
| - $httpClient, |
147 |
| - $logger, |
148 |
| - ]); |
| 129 | + $definition->addArgument($config['config']); |
| 130 | + $definition->addArgument($credentialServiceId ? new Reference($credentialServiceId) : null); |
| 131 | + $definition->addArgument($httpClient); |
| 132 | + $definition->addArgument($logger); |
149 | 133 | $definition->addTag('monolog.logger', ['channel' => 'async_aws']);
|
150 | 134 | $container->setDefinition(sprintf('async_aws.client.%s', $name), $definition);
|
151 | 135 | }
|
|
0 commit comments