vincbeck commented on code in PR #26652:
URL: https://github.com/apache/airflow/pull/26652#discussion_r981343017
##########
airflow/providers/amazon/aws/operators/glacier.py:
##########
@@ -54,3 +54,55 @@ def __init__(
def execute(self, context: Context):
hook = GlacierHook(aws_conn_id=self.aws_conn_id)
return hook.retrieve_inventory(vault_name=self.vault_name)
+
+
+class GlacierUploadArchiveOperator(BaseOperator):
+ """
+ This operation adds an archive to a vault
+
+ .. seealso::
+ For more information on how to use this operator, take a look at the
guide:
+ :ref:`howto/operator:GlacierUploadArchiveOperator`
+
+ :param account_id: The AWS account ID of the account that owns the vault.
+ You can either specify an AWS account ID or optionally a single `- `
(hyphen),
+ in which case Amazon S3 Glacier uses the AWS account ID associated with
+ the credentials used to sign the request
+ :param vault_name: The name of the vault
+ :param archive: A bytes or seekable file-like object. The data to upload.
+ :param description: The description of the archive you are uploading
+ :param checksum: The SHA256 tree hash of the data being uploaded.
+ This parameter is automatically populated if it is not provided
+ :param aws_conn_id: The reference to the AWS connection details
+ """
+
+ template_fields: Sequence[str] = ("vault_name",)
+
+ def __init__(
+ self,
+ *,
+ vault_name: str,
+ archive: object,
+ checksum: str | None = None,
+ description: str | None = None,
+ account_id: str = "_",
+ aws_conn_id="aws_default",
+ **kwargs,
+ ):
+ super().__init__(**kwargs)
+ self.aws_conn_id = aws_conn_id
+ self.account_id = account_id
+ self.vault_name = vault_name
+ self.archive = archive
+ self.checksum = checksum
+ self.description = description
+
+ def execute(self, context: Context):
+ hook = GlacierHook(aws_conn_id=self.aws_conn_id)
+ hook.get_conn().upload_archive(
Review Comment:
In case you want to use the response from boto3
```suggestion
return hook.get_conn().upload_archive(
```
##########
airflow/providers/amazon/aws/example_dags/example_glacier_to_gcs.py:
##########
@@ -46,6 +49,12 @@
)
# [END howto_sensor_glacier_job_operation]
+ # [START howto_operator_glacier_upload_data]
Review Comment:
This one would make more sense?
```suggestion
# [START howto_operator_glacier_upload_archive]
```
--
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]