jason810496 commented on code in PR #58759: URL: https://github.com/apache/airflow/pull/58759#discussion_r2567451162
########## providers/openfaas/docs/connections/openfaas.rst: ########## @@ -0,0 +1,39 @@ + .. 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:openfaas: + +OpenFaaS Connection +=================== +The OpenFaaS connection type provides connection to an OpenFaaS gateway. Review Comment: ```suggestion =================== The OpenFaaS connection type provides connection to an OpenFaaS gateway. ``` ########## providers/openfaas/docs/connections/openfaas.rst: ########## @@ -0,0 +1,39 @@ + .. 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:openfaas: + +OpenFaaS Connection +=================== +The OpenFaaS connection type provides connection to an OpenFaaS gateway. + +Configuring the Connection +-------------------------- +Host (required) Review Comment: ```suggestion -------------------------- Host (required) ``` ########## providers/openfaas/src/airflow/providers/openfaas/hooks/openfaas.py: ########## @@ -32,16 +32,29 @@ class OpenFaasHook(BaseHook): Interact with OpenFaaS to query, deploy, invoke and update function. :param function_name: Name of the function, Defaults to None - :param conn_id: openfaas connection to use, Defaults to open_faas_default - for example host : http://openfaas.faas.com, Connection Type : Http + :param conn_id: OpenFaaS connection to use, defaults to ``open_faas_default`` + for example host : http://openfaas.faas.com """ + conn_name_attr = "conn_id" + default_conn_name = "open_faas_default" + conn_type = "openfaas" + hook_name = "OpenFaaS" + GET_FUNCTION = "/system/function/" INVOKE_ASYNC_FUNCTION = "/async-function/" INVOKE_FUNCTION = "/function/" DEPLOY_FUNCTION = "/system/functions" UPDATE_FUNCTION = "/system/functions" + @classmethod + def get_ui_field_behaviour(cls) -> dict[str, Any]: + """Return custom field behaviour.""" + return { + "hidden_fields": ["schema", "port", "login", "password", "extra"], + "relabeling": {}, + } Review Comment: It would be nice to add unit test in `providers/openfaas/tests/unit/openfaas/hooks/test_openfaas.py` to test the expected result of `get_ui_field_behaviour` even it quite trivial, thanks! -- 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]
