airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] ashb commented on a change in pull request #3823: [AIRFLOW-2985] An operator for S3 object copying/deleting
Date Mon, 03 Sep 2018 13:26:55 GMT
ashb commented on a change in pull request #3823: [AIRFLOW-2985] An operator for S3 object

 File path: airflow/contrib/operators/
 @@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+# 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
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from pprint import pformat
+from airflow.hooks.S3_hook import S3Hook
+from airflow.models import BaseOperator
+from airflow.utils.decorators import apply_defaults
+class S3DeleteObjectsOperator(BaseOperator):
+    """
+    To enable users to delete single object or multiple objects from
+    a bucket using a single HTTP request.
+    Users may specify up to 1000 keys to delete.
+    :param bucket: Name of the bucket in which you are going to delete object(s)
+    :type bucket: str
+    :param keys: The key(s) to delete from S3 bucket.
+        When ``keys`` is a string, it's supposed to be the key name of
+        the single object to delete.
+        When ``keys`` is a list, it's supposed to be the list of the
+        keys to delete.
+    :type keys: str or list
+    :param s3_conn_id: Connection id of the S3 connection to use
+    :type s3_conn_id: str
+    :param verify: Whether or not to verify SSL certificates for S3 connetion.
+        By default SSL certificates are verified.
+        You can provide the following values:
+        - False: do not validate SSL certificates. SSL will still be used,
+                 but SSL certificates will not be
+                 verified.
+        - path/to/cert/bundle.pem: A filename of the CA cert bundle to uses.
+                 You can specify this argument if you want to use a different
+                 CA cert bundle than the one used by botocore.
+    :type verify: bool or str
+    """
+    @apply_defaults
+    def __init__(
+            self,
+            bucket,
+            keys,
+            s3_conn_id='aws_default',
+            verify=None,
+            *args, **kwargs):
+        super(S3DeleteObjectsOperator, self).__init__(*args, **kwargs)
+        self.bucket = bucket
+        if isinstance(keys, list):
+            self.keys = keys
+        else:
+            self.keys = [keys]
 Review comment:
   It might be nice to support the `s3://` style in the single key case?

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message