|
| 1 | +/** |
| 2 | + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * SPDX-License-Identifier: Apache-2.0. |
| 4 | + */ |
| 5 | +#pragma once |
| 6 | +#include <aws/s3-transfer/S3Transfer_EXPORTS.h> |
| 7 | +#include <aws/s3-transfer/DownloadProgressListener.h> |
| 8 | +#include <aws/core/utils/memory/stl/AWSString.h> |
| 9 | +#include <aws/core/utils/memory/stl/AWSVector.h> |
| 10 | +#include <aws/core/utils/stream/ResponseStream.h> |
| 11 | +#include <aws/s3/model/GetObjectRequest.h> |
| 12 | +#include <memory> |
| 13 | +#include <utility> |
| 14 | + |
| 15 | +namespace Aws { |
| 16 | +namespace S3 { |
| 17 | +namespace Transfer { |
| 18 | + |
| 19 | +/** |
| 20 | + * Request type for S3TransferManager::Download. Carries the inner S3 GetObjectRequest along |
| 21 | + * with the local destination (file path or stream factory) and any request-level progress |
| 22 | + * listeners. The transfer manager parallelizes large objects via ranged GETs internally. |
| 23 | + */ |
| 24 | +class AWS_S3_TRANSFER_API DownloadRequest final { |
| 25 | + public: |
| 26 | + explicit DownloadRequest( |
| 27 | + Aws::S3::Model::GetObjectRequest s3Request, |
| 28 | + Aws::String destinationFilePath, |
| 29 | + Aws::IOStreamFactory responseStreamFactory, |
| 30 | + Aws::Vector<std::shared_ptr<DownloadProgressListener>> transferListeners = {}) |
| 31 | + : m_s3Request(std::move(s3Request)), |
| 32 | + m_destinationFilePath(std::move(destinationFilePath)), |
| 33 | + m_responseStreamFactory(std::move(responseStreamFactory)), |
| 34 | + m_transferListeners(std::move(transferListeners)) {} |
| 35 | + |
| 36 | + inline const Aws::S3::Model::GetObjectRequest& GetS3Request() const { return m_s3Request; } |
| 37 | + inline const Aws::String& GetDestinationFilePath() const { return m_destinationFilePath; } |
| 38 | + inline const Aws::IOStreamFactory& GetResponseStreamFactory() const { return m_responseStreamFactory; } |
| 39 | + inline const Aws::Vector<std::shared_ptr<DownloadProgressListener>>& GetTransferListeners() const { |
| 40 | + return m_transferListeners; |
| 41 | + } |
| 42 | + |
| 43 | + |
| 44 | + private: |
| 45 | + Aws::S3::Model::GetObjectRequest m_s3Request; |
| 46 | + Aws::String m_destinationFilePath; |
| 47 | + Aws::IOStreamFactory m_responseStreamFactory; |
| 48 | + Aws::Vector<std::shared_ptr<DownloadProgressListener>> m_transferListeners; |
| 49 | +}; |
| 50 | + |
| 51 | +} |
| 52 | +} |
| 53 | +} |
0 commit comments