amoghrajesh commented on code in PR #58621:
URL: https://github.com/apache/airflow/pull/58621#discussion_r2559924762
##########
airflow-core/src/airflow/secrets/base_secrets.py:
##########
@@ -16,37 +16,16 @@
# under the License.
from __future__ import annotations
-from abc import ABC
from typing import TYPE_CHECKING
+from airflow._shared.secrets_backend.base import BaseSecretsBackend as
BaseSecretsBackendFromShared
+
if TYPE_CHECKING:
from airflow.models.connection import Connection
-class BaseSecretsBackend(ABC):
- """Abstract base class to retrieve Connection object given a conn_id or
Variable given a key."""
-
- @staticmethod
- def build_path(path_prefix: str, secret_id: str, sep: str = "/") -> str:
- """
- Given conn_id, build path for Secrets Backend.
-
- :param path_prefix: Prefix of the path to get secret
- :param secret_id: Secret id
- :param sep: separator used to concatenate connections_prefix and
conn_id. Default: "/"
- """
- return f"{path_prefix}{sep}{secret_id}"
-
- def get_conn_value(self, conn_id: str) -> str | None:
- """
- Retrieve from Secrets Backend a string value representing the
Connection object.
-
- If the client your secrets backend uses already returns a python dict,
you should override
- ``get_connection`` instead.
-
- :param conn_id: connection id
- """
- raise NotImplementedError
+class BaseSecretsBackend(BaseSecretsBackendFromShared):
Review Comment:
The secrets backend for airflow core: env backend, metastore backend, and
localfilesystem backend can continue extending this class.
##########
shared/secrets_backend/src/airflow_shared/secrets_backend/base.py:
##########
@@ -0,0 +1,68 @@
+# 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 abc import ABC
+
+
+class BaseSecretsBackend(ABC):
Review Comment:
Over time, I would like to see providers etc write their custom backends
with this class as base
--
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]