diff --git a/airflow/providers/opsgenie/hooks/opsgenie.py b/airflow/providers/opsgenie/hooks/opsgenie.py index 239f67a7e2120..8dab4e12e58a1 100644 --- a/airflow/providers/opsgenie/hooks/opsgenie.py +++ b/airflow/providers/opsgenie/hooks/opsgenie.py @@ -17,6 +17,8 @@ # under the License. from __future__ import annotations +from typing import Any + from opsgenie_sdk import ( AlertApi, ApiClient, @@ -156,3 +158,11 @@ def delete_alert( except OpenApiException as e: self.log.exception("Exception when calling AlertApi->delete_alert: %s\n", e) raise e + + @classmethod + def get_ui_field_behaviour(cls) -> dict[str, Any]: + """Returns custom field behaviour.""" + return { + "hidden_fields": ["port", "schema", "login", "extra"], + "relabeling": {"password": "Opsgenie API Key"}, + } diff --git a/docs/apache-airflow-providers-opsgenie/connections.rst b/docs/apache-airflow-providers-opsgenie/connections.rst new file mode 100644 index 0000000000000..c021eafcd7525 --- /dev/null +++ b/docs/apache-airflow-providers-opsgenie/connections.rst @@ -0,0 +1,35 @@ + .. 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. + +Opsgenie Connection +=================== + +The Opsgenie connection type enables connection to Opsgenie. + +Default Connection IDs +---------------------- + +OpsgenieAlert Hook uses parameter ``opsgenie_conn_id`` for Connection IDs and the value of the +parameter as ``opsgenie_default`` by default. + +Configuring the Connection +-------------------------- +Host + The host of the Opsgenie (should be with scheme). + +Opsgenie API Key + The API key of the user that will be used for authentication against the Opsgenie API. diff --git a/docs/apache-airflow-providers-opsgenie/index.rst b/docs/apache-airflow-providers-opsgenie/index.rst index d2e10c2612629..2440fd689948d 100644 --- a/docs/apache-airflow-providers-opsgenie/index.rst +++ b/docs/apache-airflow-providers-opsgenie/index.rst @@ -34,6 +34,7 @@ :maxdepth: 1 :caption: Guides + Connection types Operators Notifications