From 4fd97dd91523e1a186f680b9724a95505d4dbbe6 Mon Sep 17 00:00:00 2001
From: Elad Kalif <45845474+eladkal@users.noreply.github.com>
Date: Tue, 25 Oct 2022 11:23:03 +0300
Subject: [PATCH 1/2] Remove deprecated code from Opsgenie provider

---
 airflow/providers/opsgenie/CHANGELOG.rst      |  9 ++++
 .../opsgenie/hooks/opsgenie_alert.py          | 29 ------------
 .../opsgenie/operators/opsgenie_alert.py      | 45 -------------------
 scripts/in_container/verify_providers.py      |  2 -
 4 files changed, 9 insertions(+), 76 deletions(-)
 delete mode 100644 airflow/providers/opsgenie/hooks/opsgenie_alert.py
 delete mode 100644 airflow/providers/opsgenie/operators/opsgenie_alert.py

diff --git a/airflow/providers/opsgenie/CHANGELOG.rst b/airflow/providers/opsgenie/CHANGELOG.rst
index 501f1c22c0804..2a31b1eed065e 100644
--- a/airflow/providers/opsgenie/CHANGELOG.rst
+++ b/airflow/providers/opsgenie/CHANGELOG.rst
@@ -24,6 +24,15 @@
 Changelog
 ---------
 
+5.0.0
+.....
+
+Breaking changes
+~~~~~~~~~~~~~~~~
+
+* Remove 'OpsgenieAlertOperator' also removed hooks.opsgenie_alert path
+
+
 4.0.0
 .....
 
diff --git a/airflow/providers/opsgenie/hooks/opsgenie_alert.py b/airflow/providers/opsgenie/hooks/opsgenie_alert.py
deleted file mode 100644
index 5c92b6fe2aeab..0000000000000
--- a/airflow/providers/opsgenie/hooks/opsgenie_alert.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-"""This module is deprecated. Please use :mod:`airflow.providers.opsgenie.hooks.opsgenie`."""
-from __future__ import annotations
-
-import warnings
-
-from airflow.providers.opsgenie.hooks.opsgenie import OpsgenieAlertHook  # noqa
-
-warnings.warn(
-    "This module is deprecated. Please use `airflow.providers.opsgenie.hooks.opsgenie`.",
-    DeprecationWarning,
-    stacklevel=2,
-)
diff --git a/airflow/providers/opsgenie/operators/opsgenie_alert.py b/airflow/providers/opsgenie/operators/opsgenie_alert.py
deleted file mode 100644
index 8807433f1c363..0000000000000
--- a/airflow/providers/opsgenie/operators/opsgenie_alert.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# 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.
-"""This module is deprecated. Please use :mod:`airflow.providers.opsgenie.operators.opsgenie`."""
-from __future__ import annotations
-
-import warnings
-
-from airflow.providers.opsgenie.operators.opsgenie import OpsgenieCreateAlertOperator
-
-warnings.warn(
-    "This module is deprecated. Please use `airflow.providers.opsgenie.operators.opsgenie`.",
-    DeprecationWarning,
-    stacklevel=2,
-)
-
-
-class OpsgenieAlertOperator(OpsgenieCreateAlertOperator):
-    """
-    This operator is deprecated.
-    Please use :class:`airflow.providers.opsgenie.operators.opsgenie.OpsgenieCreateAlertOperator`.
-    """
-
-    def __init__(self, *args, **kwargs):
-        warnings.warn(
-            "This operator is deprecated. "
-            "Please use :class:`airflow.providers.opsgenie.operators.opsgenie.OpsgenieCreateAlertOperator`.",
-            DeprecationWarning,
-            stacklevel=2,
-        )
-        super().__init__(*args, **kwargs)
diff --git a/scripts/in_container/verify_providers.py b/scripts/in_container/verify_providers.py
index ad5a6b0f735d5..76a89494c3d52 100755
--- a/scripts/in_container/verify_providers.py
+++ b/scripts/in_container/verify_providers.py
@@ -250,8 +250,6 @@ class ProviderPackageDetails(NamedTuple):
     "This module is deprecated. Please use `kubernetes.client.models.V1EnvVar`.",
     "numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header,"
     " got 216 from PyObject",
-    "This module is deprecated. Please use `airflow.providers.opsgenie.hooks.opsgenie`.",
-    "This module is deprecated. Please use `airflow.providers.opsgenie.operators.opsgenie`.",
     "This module is deprecated. Please use `airflow.providers.tableau.sensors.tableau`.",
     "This module is deprecated. Please use `airflow.providers.amazon.aws.operators.lambda_function`.",
     (

From 63ea009c60ee8e4f3e17968a25e85da1a8f9a2ab Mon Sep 17 00:00:00 2001
From: Elad Kalif <45845474+eladkal@users.noreply.github.com>
Date: Tue, 25 Oct 2022 12:12:23 +0300
Subject: [PATCH 2/2] fix static checks

---
 airflow/providers/opsgenie/provider.yaml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/airflow/providers/opsgenie/provider.yaml b/airflow/providers/opsgenie/provider.yaml
index 06e6f354f166a..8d77943e63bb0 100644
--- a/airflow/providers/opsgenie/provider.yaml
+++ b/airflow/providers/opsgenie/provider.yaml
@@ -49,13 +49,11 @@ integrations:
 operators:
   - integration-name: Opsgenie
     python-modules:
-      - airflow.providers.opsgenie.operators.opsgenie_alert
       - airflow.providers.opsgenie.operators.opsgenie
 
 hooks:
   - integration-name: Opsgenie
     python-modules:
-      - airflow.providers.opsgenie.hooks.opsgenie_alert
       - airflow.providers.opsgenie.hooks.opsgenie
 
 connection-types:
