(
self, py_operation_name, operation_name, service_model
)
| 428 | return mapping |
| 429 | |
| 430 | def _create_api_method( |
| 431 | self, py_operation_name, operation_name, service_model |
| 432 | ): |
| 433 | def _api_call(self, *args, **kwargs): |
| 434 | # We're accepting *args so that we can give a more helpful |
| 435 | # error message than TypeError: _api_call takes exactly |
| 436 | # 1 argument. |
| 437 | if args: |
| 438 | raise TypeError( |
| 439 | f"{py_operation_name}() only accepts keyword arguments." |
| 440 | ) |
| 441 | # The "self" in this scope is referring to the BaseClient. |
| 442 | return self._make_api_call(operation_name, kwargs) |
| 443 | |
| 444 | _api_call.__name__ = str(py_operation_name) |
| 445 | |
| 446 | # Add the docstring to the client method |
| 447 | operation_model = service_model.operation_model(operation_name) |
| 448 | docstring = ClientMethodDocstring( |
| 449 | operation_model=operation_model, |
| 450 | method_name=operation_name, |
| 451 | event_emitter=self._event_emitter, |
| 452 | method_description=operation_model.documentation, |
| 453 | example_prefix=f'response = client.{py_operation_name}', |
| 454 | include_signature=False, |
| 455 | ) |
| 456 | _api_call.__doc__ = docstring |
| 457 | return _api_call |
| 458 | |
| 459 | def _evaluate_client_specific_token(self, signing_name): |
| 460 | # Resolves an auth_token for the given signing_name. |
no test coverage detected