uranusjr commented on a change in pull request #21686:
URL: https://github.com/apache/airflow/pull/21686#discussion_r810687095



##########
File path: airflow/providers/amazon/aws/hooks/lambda_function.py
##########
@@ -40,30 +41,84 @@ class LambdaHook(AwsBaseHook):
 
     def __init__(
         self,
-        function_name: str,
-        log_type: str = 'None',
-        qualifier: str = '$LATEST',
-        invocation_type: str = 'RequestResponse',
         *args,
         **kwargs,
     ) -> None:
-        self.function_name = function_name
-        self.log_type = log_type
-        self.invocation_type = invocation_type
-        self.qualifier = qualifier
         kwargs["client_type"] = "lambda"
         super().__init__(*args, **kwargs)
 
-    def invoke_lambda(self, payload: str) -> str:
-        """Invoke Lambda Function"""
-        response = self.conn.invoke(
-            FunctionName=self.function_name,
-            InvocationType=self.invocation_type,
-            LogType=self.log_type,
-            Payload=payload,
-            Qualifier=self.qualifier,
-        )
+    def invoke_lambda(
+        self,
+        function_name: str,
+        invocation_type: Optional[str] = None,
+        log_type: Optional[str] = None,
+        client_context: Optional[str] = None,
+        payload: Optional[str] = None,
+        qualifier: Optional[str] = None,
+    ):

Review comment:
       ```suggestion
       def invoke_lambda(
           self,
           *,
           function_name: str,
           invocation_type: Optional[str] = None,
           log_type: Optional[str] = None,
           client_context: Optional[str] = None,
           payload: Optional[str] = None,
           qualifier: Optional[str] = None,
       ):
   ```
   
   How about make these all keyword-only arguments? This is probably how a user 
is supposed to use them anyway (the invocation line would not be readable 
otherwise), so let’s enforce them.
   
   Same for other functions on the hook.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to