Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- streamUpload :: forall m. (MonadUnliftIO m, MonadResource m) => Env -> Maybe ChunkSize -> CreateMultipartUpload -> ConduitT ByteString Void m (Either (AbortMultipartUploadResponse, SomeException) CompleteMultipartUploadResponse)
- type ChunkSize = Int
- minimumChunkSize :: ChunkSize
- type NumThreads = Int
- concurrentUpload :: forall m. (MonadResource m, MonadCatch m) => Env -> Maybe ChunkSize -> Maybe NumThreads -> UploadLocation -> CreateMultipartUpload -> m CompleteMultipartUploadResponse
- data UploadLocation
- = FP FilePath
- | BS ByteString
- abortAllUploads :: MonadResource m => Env -> BucketName -> m ()
- data CreateMultipartUploadResponse = CreateMultipartUploadResponse' {
- abortDate :: Maybe RFC822
- abortRuleId :: Maybe Text
- bucket :: Maybe BucketName
- bucketKeyEnabled :: Maybe Bool
- checksumAlgorithm :: Maybe ChecksumAlgorithm
- key :: Maybe ObjectKey
- requestCharged :: Maybe RequestCharged
- sSECustomerAlgorithm :: Maybe Text
- sSECustomerKeyMD5 :: Maybe Text
- sSEKMSEncryptionContext :: Maybe (Sensitive Text)
- sSEKMSKeyId :: Maybe (Sensitive Text)
- serverSideEncryption :: Maybe ServerSideEncryption
- httpStatus :: Int
- uploadId :: Text
- data CreateMultipartUpload = CreateMultipartUpload' {
- acl :: Maybe ObjectCannedACL
- bucketKeyEnabled :: Maybe Bool
- cacheControl :: Maybe Text
- checksumAlgorithm :: Maybe ChecksumAlgorithm
- contentDisposition :: Maybe Text
- contentEncoding :: Maybe Text
- contentLanguage :: Maybe Text
- contentType :: Maybe Text
- expectedBucketOwner :: Maybe Text
- expires :: Maybe RFC822
- grantFullControl :: Maybe Text
- grantRead :: Maybe Text
- grantReadACP :: Maybe Text
- grantWriteACP :: Maybe Text
- metadata :: HashMap Text Text
- objectLockLegalHoldStatus :: Maybe ObjectLockLegalHoldStatus
- objectLockMode :: Maybe ObjectLockMode
- objectLockRetainUntilDate :: Maybe ISO8601
- requestPayer :: Maybe RequestPayer
- sSECustomerAlgorithm :: Maybe Text
- sSECustomerKey :: Maybe (Sensitive Text)
- sSECustomerKeyMD5 :: Maybe Text
- sSEKMSEncryptionContext :: Maybe (Sensitive Text)
- sSEKMSKeyId :: Maybe (Sensitive Text)
- serverSideEncryption :: Maybe ServerSideEncryption
- storageClass :: Maybe StorageClass
- tagging :: Maybe Text
- websiteRedirectLocation :: Maybe Text
- bucket :: BucketName
- key :: ObjectKey
- data CompleteMultipartUploadResponse
- data CompleteMultipartUpload = CompleteMultipartUpload' {
- checksumCRC32 :: Maybe Text
- checksumCRC32C :: Maybe Text
- checksumSHA1 :: Maybe Text
- checksumSHA256 :: Maybe Text
- expectedBucketOwner :: Maybe Text
- multipartUpload :: Maybe CompletedMultipartUpload
- requestPayer :: Maybe RequestPayer
- sSECustomerAlgorithm :: Maybe Text
- sSECustomerKey :: Maybe (Sensitive Text)
- sSECustomerKeyMD5 :: Maybe Text
- bucket :: BucketName
- key :: ObjectKey
- uploadId :: Text
- newCompleteMultipartUpload :: BucketName -> ObjectKey -> Text -> CompleteMultipartUpload
Documentation
:: forall m. (MonadUnliftIO m, MonadResource m) | |
=> Env | |
-> Maybe ChunkSize | Optional chunk size |
-> CreateMultipartUpload | Upload location |
-> ConduitT ByteString Void m (Either (AbortMultipartUploadResponse, SomeException) CompleteMultipartUploadResponse) |
Given a CreateMultipartUpload
, creates a Sink
which will sequentially
upload the data streamed in in chunks of at least minimumChunkSize
and return either
the CompleteMultipartUploadResponse
, or if an exception is thrown,
AbortMultipartUploadResponse
and the exception as SomeException
. If aborting
the upload also fails then the exception caused by the call to abort will be thrown.
ListMultipartUploads
can be used to list any pending
uploads - it is important to abort multipart uploads because you will
be charged for storage of the parts until it is completed or aborted.
See the AWS documentation for more details.
Internally, a single chunkSize
d buffer will be allocated and reused between
requests to avoid holding onto incoming ByteString
s.
May throw Error
minimumChunkSize :: ChunkSize Source #
Minimum size of data which will be sent in a single part, currently 6MB
type NumThreads = Int Source #
:: forall m. (MonadResource m, MonadCatch m) | |
=> Env | |
-> Maybe ChunkSize | Optional chunk size |
-> Maybe NumThreads | Optional number of threads to upload with |
-> UploadLocation | Whether to upload a file on disk or a |
-> CreateMultipartUpload | Description of where to upload. |
-> m CompleteMultipartUploadResponse |
Allows a file or ByteString
to be uploaded concurrently, using the
async library. The chunk size may optionally be specified, but will be at least
minimumChunkSize
, and may be made larger than if the ByteString
or file
is larger enough to cause more than 10,000 chunks.
Files are mmapped into chunkSize
chunks and each chunk is uploaded in parallel.
This considerably reduces the memory necessary compared to reading the contents
into memory as a strict ByteString
. The usual caveats about mmaped files apply:
if the file is modified during this operation, the data may become corrupt.
May throw Error
, or IOError
; an attempt is made to cancel the
multipart upload on any error, but this may also fail if, for example, the network
connection has been broken. See abortAllUploads
for a crude cleanup method.
data UploadLocation Source #
Specifies whether to upload a file or ByteString
.
FP FilePath | A file to be uploaded |
BS ByteString | A strict |
abortAllUploads :: MonadResource m => Env -> BucketName -> m () Source #
Aborts all uploads in a given bucket - useful for cleaning up.
data CreateMultipartUploadResponse #
See: newCreateMultipartUploadResponse
smart constructor.
CreateMultipartUploadResponse' | |
|
Instances
data CreateMultipartUpload #
See: newCreateMultipartUpload
smart constructor.
CreateMultipartUpload' | |
|
Instances
data CompleteMultipartUploadResponse #
See: newCompleteMultipartUploadResponse
smart constructor.
Instances
data CompleteMultipartUpload #
See: newCompleteMultipartUpload
smart constructor.
CompleteMultipartUpload' | |
|
Instances
:: BucketName | |
-> ObjectKey | |
-> Text | |
-> CompleteMultipartUpload |
Create a value of CompleteMultipartUpload
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
CompleteMultipartUpload
, completeMultipartUpload_checksumCRC32
- This header can be used as a data integrity check to verify that the
data received is the same data that was originally sent. This header
specifies the base64-encoded, 32-bit CRC32 checksum of the object. For
more information, see
Checking object integrity
in the Amazon S3 User Guide.
CompleteMultipartUpload
, completeMultipartUpload_checksumCRC32C
- This header can be used as a data integrity check to verify that the
data received is the same data that was originally sent. This header
specifies the base64-encoded, 32-bit CRC32C checksum of the object. For
more information, see
Checking object integrity
in the Amazon S3 User Guide.
CompleteMultipartUpload
, completeMultipartUpload_checksumSHA1
- This header can be used as a data integrity check to verify that the
data received is the same data that was originally sent. This header
specifies the base64-encoded, 160-bit SHA-1 digest of the object. For
more information, see
Checking object integrity
in the Amazon S3 User Guide.
CompleteMultipartUpload
, completeMultipartUpload_checksumSHA256
- This header can be used as a data integrity check to verify that the
data received is the same data that was originally sent. This header
specifies the base64-encoded, 256-bit SHA-256 digest of the object. For
more information, see
Checking object integrity
in the Amazon S3 User Guide.
$sel:expectedBucketOwner:CompleteMultipartUpload'
, completeMultipartUpload_expectedBucketOwner
- The account ID of the expected bucket owner. If the bucket is owned by a
different account, the request fails with the HTTP status code
403 Forbidden
(access denied).
$sel:multipartUpload:CompleteMultipartUpload'
, completeMultipartUpload_multipartUpload
- The container for the multipart upload request information.
$sel:requestPayer:CompleteMultipartUpload'
, completeMultipartUpload_requestPayer
- Undocumented member.
$sel:sSECustomerAlgorithm:CompleteMultipartUpload'
, completeMultipartUpload_sSECustomerAlgorithm
- The server-side encryption (SSE) algorithm used to encrypt the object.
This parameter is needed only when the object was created using a
checksum algorithm. For more information, see
Protecting data using SSE-C keys
in the Amazon S3 User Guide.
$sel:sSECustomerKey:CompleteMultipartUpload'
, completeMultipartUpload_sSECustomerKey
- The server-side encryption (SSE) customer managed key. This parameter is
needed only when the object was created using a checksum algorithm. For
more information, see
Protecting data using SSE-C keys
in the Amazon S3 User Guide.
$sel:sSECustomerKeyMD5:CompleteMultipartUpload'
, completeMultipartUpload_sSECustomerKeyMD5
- The MD5 server-side encryption (SSE) customer managed key. This
parameter is needed only when the object was created using a checksum
algorithm. For more information, see
Protecting data using SSE-C keys
in the Amazon S3 User Guide.
CompleteMultipartUpload
, completeMultipartUpload_bucket
- Name of the bucket to which the multipart upload was initiated.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct
requests to the S3 on Outposts hostname. The S3 on Outposts hostname
takes the form
AccessPointName
-
AccountId
.
outpostID
.s3-outposts.
Region
.amazonaws.com
.
When using this action with S3 on Outposts through the Amazon Web
Services SDKs, you provide the Outposts bucket ARN in place of the
bucket name. For more information about S3 on Outposts ARNs, see
Using Amazon S3 on Outposts
in the Amazon S3 User Guide.
CompleteMultipartUpload
, completeMultipartUpload_key
- Object key for which the multipart upload was initiated.
CompleteMultipartUpload
, completeMultipartUpload_uploadId
- ID for the initiated multipart upload.