michalslowikowski00 commented on a change in pull request #10947:
URL: https://github.com/apache/airflow/pull/10947#discussion_r495789790



##########
File path: airflow/providers/amazon/aws/hooks/glacier.py
##########
@@ -0,0 +1,92 @@
+#
+# 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 typing import Any, Dict
+
+from botocore.exceptions import ClientError
+
+from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
+
+
+class GlacierHook(AwsBaseHook):
+    """
+    Hook for connection with Amazon Glacier
+    """
+
+    def __init__(self, *, aws_conn_id: str = "aws_default", **kwargs) -> None:
+        super().__init__(client_type="glacier", **kwargs)
+        self.aws_conn_id = aws_conn_id
+
+    def retrieve_inventory(self, vault_name: str) -> Dict[str, Any]:
+        """
+        Initiate an Amazon Glacier inventory-retrieval job
+
+        :param vault_name: the Glacier vault on which job is executed
+        :type vault_name: str
+        """
+        job_parms = {'Type': 'inventory-retrieval'}
+        self.log.info("Retrieving inventory for vault: %s", vault_name)
+        try:
+            response = self.get_conn().initiate_job(vaultName=vault_name, 
jobParameters=job_parms)
+        except ClientError as e:
+            self.log.exception(e)
+            raise
+
+        if response is not None:
+            self.log.info("Initiated inventory-retrieval job for: %s", 
vault_name)
+            self.log.info("Retrieval Job ID: %s", response["jobId"])
+        return response

Review comment:
       TBH, I don't know. I can't find information if response can be None. 
   Going deeper into this method `initiate_job()` I see that the response can 
be `UnexpectedHTTPResponseError`, but there is always response different than 
None.




----------------------------------------------------------------
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]


Reply via email to