@@ -83,6 +83,8 @@ private void generateService(PythonWriter writer) {
8383 }
8484 }
8585
86+ writer .addDependency (SmithyPythonDependency .SMITHY_CORE );
87+ writer .addImport ("smithy_core.retries" , "RetryStrategyResolver" );
8688 writer .write ("""
8789 def __init__(self, config: $1T | None = None, plugins: list[$2T] | None = None):
8890 self._config = config or $1T()
@@ -95,6 +97,8 @@ def __init__(self, config: $1T | None = None, plugins: list[$2T] | None = None):
9597
9698 for plugin in client_plugins:
9799 plugin(self._config)
100+
101+ self._retry_strategy_resolver = RetryStrategyResolver()
98102 """ , configSymbol , pluginSymbol , writer .consumer (w -> writeDefaultPlugins (w , defaultPlugins )));
99103
100104 var topDownIndex = TopDownIndex .of (model );
@@ -168,8 +172,7 @@ private void writeSharedOperationInit(PythonWriter writer, OperationShape operat
168172 writer .write ("""
169173 :param plugins: A list of callables that modify the configuration dynamically.
170174 Changes made by these plugins only apply for the duration of the operation
171- execution and will not affect any other operation invocations.
172- """ );
175+ execution and will not affect any other operation invocations.""" );
173176
174177 });
175178
@@ -188,6 +191,8 @@ private void writeSharedOperationInit(PythonWriter writer, OperationShape operat
188191 writer .addImport ("smithy_core.types" , "TypedProperties" );
189192 writer .addImport ("smithy_core.aio.client" , "RequestPipeline" );
190193 writer .addImport ("smithy_core.exceptions" , "ExpectationNotMetError" );
194+ writer .addImport ("smithy_core.retries" , "RetryStrategyOptions" );
195+ writer .addImport ("smithy_core.interfaces.retries" , "RetryStrategy" );
191196 writer .addStdlibImport ("copy" , "deepcopy" );
192197
193198 writer .write ("""
@@ -201,6 +206,24 @@ private void writeSharedOperationInit(PythonWriter writer, OperationShape operat
201206 plugin(config)
202207 if config.protocol is None or config.transport is None:
203208 raise ExpectationNotMetError("protocol and transport MUST be set on the config to make calls.")
209+
210+ # Resolve retry strategy from config
211+ if isinstance(config.retry_strategy, RetryStrategy):
212+ retry_strategy = config.retry_strategy
213+ elif isinstance(config.retry_strategy, RetryStrategyOptions):
214+ retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy(
215+ options=config.retry_strategy
216+ )
217+ elif config.retry_strategy is None:
218+ retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy(
219+ options=RetryStrategyOptions()
220+ )
221+ else:
222+ raise TypeError(
223+ f"retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, "
224+ f"got {type(config.retry_strategy).__name__}"
225+ )
226+
204227 pipeline = RequestPipeline(
205228 protocol=config.protocol,
206229 transport=config.transport
@@ -213,7 +236,7 @@ raise ExpectationNotMetError("protocol and transport MUST be set on the config t
213236 auth_scheme_resolver=config.auth_scheme_resolver,
214237 supported_auth_schemes=config.auth_schemes,
215238 endpoint_resolver=config.endpoint_resolver,
216- retry_strategy=config. retry_strategy,
239+ retry_strategy=retry_strategy,
217240 )
218241 """ , writer .consumer (w -> writeDefaultPlugins (w , defaultPlugins )));
219242
0 commit comments