nuclearpinguin commented on a change in pull request #7307: [AIRFLOW-6676] 
added GCSDeleteBucketOperator
URL: https://github.com/apache/airflow/pull/7307#discussion_r373679320
 
 

 ##########
 File path: airflow/providers/google/cloud/operators/gcs.py
 ##########
 @@ -625,3 +625,32 @@ def execute(self, context: Dict):
                 object_name=self.destination_object,
                 filename=destination_file.name
             )
+
+
+class GCSDeleteBucketOperator(BaseOperator):
+    """
+    Deletes bucket from a Google Cloud Storage.
+
+    .. seealso::
+        For more information on how to use this operator, take a look at the 
guide:
+        :ref:`howto/operator:GCSDeleteBucketOperator`
+
+    :param bucket_name: name of the bucket which will be deleted
+    :type bucket_name: str
+    """
+
+    template_fields = ('bucket_name', "gcp_conn_id")
+
+    @apply_defaults
+    def __init__(self,
+                 bucket_name: str,
+                 gcp_conn_id: str = 'google_cloud_default',
+                 *args, **kwargs) -> None:
+        super().__init__(*args, **kwargs)
+
+        self.bucket_name = bucket_name
+        self.gcp_conn_id = gcp_conn_id
+
+    def execute(self, context):
+        hook = GCSHook(gcp_conn_id=self.gcp_conn_id, )
+        hook.delete_bucket(self.bucket_name)
 
 Review comment:
   ```suggestion
           hook.delete_bucket(bucket_name=self.bucket_name, force=self.force)
   ```

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


With regards,
Apache Git Services

Reply via email to