pankajastro commented on code in PR #25975:
URL: https://github.com/apache/airflow/pull/25975#discussion_r956230694


##########
airflow/providers/amazon/aws/hooks/redshift_cluster.py:
##########
@@ -153,3 +153,18 @@ def create_cluster_snapshot(
             ManualSnapshotRetentionPeriod=retention_period,
         )
         return response['Snapshot'] if response['Snapshot'] else None
+
+    def get_cluster_snapshot_status(self, snapshot_identifier: str, 
cluster_identifier: str):
+        try:
+            response = self.get_conn().describe_cluster_snapshots(
+                ClusterIdentifier=cluster_identifier,
+                SnapshotIdentifier=snapshot_identifier,
+            )
+            snapshot = response.get("Snapshots")[0]
+            snapshot_status: str = snapshot.get("Status")
+            return snapshot_status
+        except ClientError as exception:
+            if exception.response.get("Error", {}).get("Code", "") == 
"ClusterSnapshotNotFound":
+                return "cluster_snapshot_not_found"

Review Comment:
   I think returning None would be cleaner here but we have a similar method 
`cluster_status` which returns `cluster_not_found`  
https://github.com/apache/airflow/blob/main/airflow/providers/amazon/aws/hooks/redshift_cluster.py#L89
   - Add docstring and now returning 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to