ferruzzi commented on code in PR #31134:
URL: https://github.com/apache/airflow/pull/31134#discussion_r1237439014


##########
airflow/providers/microsoft/azure/operators/functions.py:
##########
@@ -0,0 +1,81 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from functools import cached_property
+from typing import TYPE_CHECKING, Any, Sequence
+
+from airflow.models import BaseOperator
+from airflow.providers.microsoft.azure.hooks.functions import 
AzureFunctionsHook
+
+if TYPE_CHECKING:
+    from airflow.utils.context import Context
+
+
+class AzureFunctionsInvokeOperator(BaseOperator):
+    """
+    Invokes an Azure function. You can invoke a function in azure by making 
http request.

Review Comment:
   ```suggestion
       Invokes an Azure function by making an http request.
   ```



##########
airflow/providers/microsoft/azure/hooks/functions.py:
##########
@@ -0,0 +1,112 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from typing import Any
+
+import requests
+from azure.identity import ClientSecretCredential
+
+from airflow.providers.http.hooks.http import HttpHook
+from airflow.providers.microsoft.azure.utils import get_field
+
+
+class AzureFunctionsHook(HttpHook):
+    """
+    Invokes an Azure functions. You can invoke a function in azure by making 
http request.

Review Comment:
   ```suggestion
       Invokes an Azure function by making an http request.
   ```



##########
docs/apache-airflow-providers-microsoft-azure/operators/functions.rst:
##########
@@ -0,0 +1,47 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+Azure Functions Operators
+=========================
+Azure Functions is a serverless solution that allows you to write less code, 
maintain less infrastructure,
+and save on costs. Instead of worrying about deploying and maintaining 
servers, the cloud infrastructure provides
+all the up-to-date resources needed to keep your applications running. Azure 
Functions allows you to implement your
+system's logic into readily available blocks of code. These code blocks are 
called "functions".
+
+Operators
+---------
+
+.. _howto/operator:AzureFunctionsInvokeOperator:
+
+Invoke an Azure functions

Review Comment:
   If "Azure Functions" is a service name:
   
   ```suggestion
   Invoke an Azure Function
   ```



##########
docs/apache-airflow-providers-microsoft-azure/operators/functions.rst:
##########
@@ -0,0 +1,47 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+Azure Functions Operators
+=========================
+Azure Functions is a serverless solution that allows you to write less code, 
maintain less infrastructure,
+and save on costs. Instead of worrying about deploying and maintaining 
servers, the cloud infrastructure provides
+all the up-to-date resources needed to keep your applications running. Azure 
Functions allows you to implement your
+system's logic into readily available blocks of code. These code blocks are 
called "functions".
+
+Operators
+---------
+
+.. _howto/operator:AzureFunctionsInvokeOperator:
+
+Invoke an Azure functions
+-------------------------
+Use the 
:class:`~airflow.providers.microsoft.azure.operators.azure_functions.AzureFunctionsInvokeOperator`
 to invoke the
+functions in azure. Below is an example of using this operator.

Review Comment:
   ```suggestion
   function in Azure. Below is an example of using this operator.
   ```



##########
airflow/providers/microsoft/azure/operators/functions.py:
##########
@@ -0,0 +1,81 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+from functools import cached_property
+from typing import TYPE_CHECKING, Any, Sequence
+
+from airflow.models import BaseOperator
+from airflow.providers.microsoft.azure.hooks.functions import 
AzureFunctionsHook
+
+if TYPE_CHECKING:
+    from airflow.utils.context import Context
+
+
+class AzureFunctionsInvokeOperator(BaseOperator):

Review Comment:
   Should this be Functions (plural) or Function (single) ?



##########
docs/apache-airflow-providers-microsoft-azure/connections/azure_functions.rst:
##########
@@ -0,0 +1,60 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+
+.. _howto/connection:azure_functions:
+
+Microsoft Azure Functions
+=========================
+
+The Azure Functions connection type enables the Azure Functions Integrations 
from Airflow.

Review Comment:
   This is awkward phrasing, but I don't know what the solution is, maybe:  
   ```suggestion
   The Azure Functions connection type enables integrating with Azure Functions 
from Airflow.
   ```



##########
tests/providers/microsoft/azure/operators/test_functions.py:
##########
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from __future__ import annotations
+
+import json
+from unittest import mock
+
+from airflow.providers.microsoft.azure.operators.functions import 
AzureFunctionsInvokeOperator
+
+

Review Comment:
   I won't block for this, but I'd like to see some more cases tested here.   
Are there any cases where the HTTP response might have an error that should be 
tested and verified, for example?



-- 
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