potiuk commented on a change in pull request #8974: URL: https://github.com/apache/airflow/pull/8974#discussion_r440543398
########## File path: airflow/providers/hashicorp/hooks/vault.py ########## @@ -0,0 +1,328 @@ +# 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. + +"""Hook for HashiCorp Vault""" +import json +from typing import Optional, Tuple + +import hvac +from hvac.exceptions import VaultError +from requests import Response + +from airflow.hooks.base_hook import BaseHook +from airflow.providers.hashicorp.common.vault_client import VaultClient Review comment: For now. I moved the client to be class within the hook (so no more common package) but I still think having those two (Hooks and Client) separated adds a lot of value. Hook deals only with the connection (which neither client nor Secret backend needs) and client provide an interface that can be used by both secret and hook. I think it does the job nicely and cleanly. For me it adds value as it provides a clean interface that abstracts away from either Hook-specific code or Backend specific code. Both use different mechanisms to retrieve connection parameters and it only seems appropriate to have common interface that has clean interface that does not have either Hook's or Backend-specific way of retrieving connection parameters. I really think the level of abstraction versus duplication here is right. I'd love to hear other's opinion on that if you still disagree . ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
