Extract runtime clients build logic from EvaluateYamlConfig
The following discussion from !1641 (merged) should be addressed:
-
@tle_gitlab started a discussion: (+1 comment) suggestion (non-blocking): I think
EvaluateYamlConfig
should be a pure data model representing YAML configuration and not responsible for building/resolving runtime clients. One idea to move this to a helper class/method.class ClientResolver: """Utility class for resolving clients based on flow configuration.""" @staticmethod def resolve_for_config(config: "EvaluateYamlConfig") -> CommonClients: """Resolve clients based on the flow configuration requirements. Args: config: The evaluate YAML configuration Returns: CommonClients instance with appropriate clients configured Raises: TypeError: If the flow doesn't implement the required interface """ builder = ClientBuilder() try: # pylint: disable-next=no-member if not config.flow.gitlab_connection_required: env = CommonEnvVariables.model_validate({}) else: env = GitlabEnvVariables.model_validate({}) builder = builder.with_gitlab_rest_client() except AttributeError as ex: raise TypeError("BaseFlowYamlConfig has to be implemented") from ex return builder.build(env)