{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.S3.UploadPart
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Uploads a part in a multipart upload.
--
-- In this operation, you provide part data in your request. However, you
-- have an option to specify your existing Amazon S3 object as a data
-- source for the part you are uploading. To upload a part from an existing
-- object, you use the
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html UploadPartCopy>
-- operation.
--
-- You must initiate a multipart upload (see
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html CreateMultipartUpload>)
-- before you can upload any part. In response to your initiate request,
-- Amazon S3 returns an upload ID, a unique identifier, that you must
-- include in your upload part request.
--
-- Part numbers can be any number from 1 to 10,000, inclusive. A part
-- number uniquely identifies a part and also defines its position within
-- the object being created. If you upload a new part using the same part
-- number that was used with a previous part, the previously uploaded part
-- is overwritten. Each part must be at least 5 MB in size, except the last
-- part. There is no size limit on the last part of your multipart upload.
--
-- To ensure that data is not corrupted when traversing the network,
-- specify the @Content-MD5@ header in the upload part request. Amazon S3
-- checks the part data against the provided MD5 value. If they do not
-- match, Amazon S3 returns an error.
--
-- If the upload request is signed with Signature Version 4, then Amazon
-- Web Services S3 uses the @x-amz-content-sha256@ header as a checksum
-- instead of @Content-MD5@. For more information see
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-auth-using-authorization-header.html Authenticating Requests: Using the Authorization Header (Amazon Web Services Signature Version 4)>.
--
-- __Note:__ After you initiate multipart upload and upload one or more
-- parts, you must either complete or abort multipart upload in order to
-- stop getting charged for storage of the uploaded parts. Only after you
-- either complete or abort multipart upload, Amazon S3 frees up the parts
-- storage and stops charging you for the parts storage.
--
-- For more information on multipart uploads, go to
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html Multipart Upload Overview>
-- in the /Amazon S3 User Guide/ .
--
-- For information on the permissions required to use the multipart upload
-- API, go to
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html Multipart Upload and Permissions>
-- in the /Amazon S3 User Guide/.
--
-- You can optionally request server-side encryption where Amazon S3
-- encrypts your data as it writes it to disks in its data centers and
-- decrypts it for you when you access it. You have the option of providing
-- your own encryption key, or you can use the Amazon Web Services managed
-- encryption keys. If you choose to provide your own encryption key, the
-- request headers you provide in the request must match the headers you
-- used in the request to initiate the upload by using
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html CreateMultipartUpload>.
-- For more information, go to
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html Using Server-Side Encryption>
-- in the /Amazon S3 User Guide/.
--
-- Server-side encryption is supported by the S3 Multipart Upload actions.
-- Unless you are using a customer-provided encryption key, you don\'t need
-- to specify the encryption parameters in each UploadPart request.
-- Instead, you only need to specify the server-side encryption parameters
-- in the initial Initiate Multipart request. For more information, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html CreateMultipartUpload>.
--
-- If you requested server-side encryption using a customer-provided
-- encryption key in your initiate multipart upload request, you must
-- provide identical encryption information in each part upload using the
-- following headers.
--
-- -   x-amz-server-side-encryption-customer-algorithm
--
-- -   x-amz-server-side-encryption-customer-key
--
-- -   x-amz-server-side-encryption-customer-key-MD5
--
-- __Special Errors__
--
-- -   -   /Code: NoSuchUpload/
--
--     -   /Cause: The specified multipart upload does not exist. The
--         upload ID might be invalid, or the multipart upload might have
--         been aborted or completed./
--
--     -   /HTTP Status Code: 404 Not Found/
--
--     -   /SOAP Fault Code Prefix: Client/
--
-- __Related Resources__
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html CreateMultipartUpload>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html CompleteMultipartUpload>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html AbortMultipartUpload>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html ListParts>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html ListMultipartUploads>
module Amazonka.S3.UploadPart
  ( -- * Creating a Request
    UploadPart (..),
    newUploadPart,

    -- * Request Lenses
    uploadPart_contentLength,
    uploadPart_sSECustomerAlgorithm,
    uploadPart_sSECustomerKey,
    uploadPart_requestPayer,
    uploadPart_sSECustomerKeyMD5,
    uploadPart_contentMD5,
    uploadPart_expectedBucketOwner,
    uploadPart_bucket,
    uploadPart_key,
    uploadPart_partNumber,
    uploadPart_uploadId,
    uploadPart_body,

    -- * Destructuring the Response
    UploadPartResponse (..),
    newUploadPartResponse,

    -- * Response Lenses
    uploadPartResponse_requestCharged,
    uploadPartResponse_eTag,
    uploadPartResponse_sSECustomerAlgorithm,
    uploadPartResponse_bucketKeyEnabled,
    uploadPartResponse_sSECustomerKeyMD5,
    uploadPartResponse_sSEKMSKeyId,
    uploadPartResponse_serverSideEncryption,
    uploadPartResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types

-- | /See:/ 'newUploadPart' smart constructor.
data UploadPart = UploadPart'
  { -- | Size of the body in bytes. This parameter is useful when the size of the
    -- body cannot be determined automatically.
    UploadPart -> Maybe Integer
contentLength :: Prelude.Maybe Prelude.Integer,
    -- | Specifies the algorithm to use to when encrypting the object (for
    -- example, AES256).
    UploadPart -> Maybe Text
sSECustomerAlgorithm :: Prelude.Maybe Prelude.Text,
    -- | Specifies the customer-provided encryption key for Amazon S3 to use in
    -- encrypting data. This value is used to store the object and then it is
    -- discarded; Amazon S3 does not store the encryption key. The key must be
    -- appropriate for use with the algorithm specified in the
    -- @x-amz-server-side-encryption-customer-algorithm header@. This must be
    -- the same encryption key specified in the initiate multipart upload
    -- request.
    UploadPart -> Maybe (Sensitive Text)
sSECustomerKey :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    UploadPart -> Maybe RequestPayer
requestPayer :: Prelude.Maybe RequestPayer,
    -- | Specifies the 128-bit MD5 digest of the encryption key according to RFC
    -- 1321. Amazon S3 uses this header for a message integrity check to ensure
    -- that the encryption key was transmitted without error.
    UploadPart -> Maybe Text
sSECustomerKeyMD5 :: Prelude.Maybe Prelude.Text,
    -- | The base64-encoded 128-bit MD5 digest of the part data. This parameter
    -- is auto-populated when using the command from the CLI. This parameter is
    -- required if object lock parameters are specified.
    UploadPart -> Maybe Text
contentMD5 :: Prelude.Maybe Prelude.Text,
    -- | The account ID of the expected bucket owner. If the bucket is owned by a
    -- different account, the request will fail with an HTTP
    -- @403 (Access Denied)@ error.
    UploadPart -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The 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
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html 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 using 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
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using S3 on Outposts>
    -- in the /Amazon S3 User Guide/.
    UploadPart -> BucketName
bucket :: BucketName,
    -- | Object key for which the multipart upload was initiated.
    UploadPart -> ObjectKey
key :: ObjectKey,
    -- | Part number of part being uploaded. This is a positive integer between 1
    -- and 10,000.
    UploadPart -> Int
partNumber :: Prelude.Int,
    -- | Upload ID identifying the multipart upload whose part is being uploaded.
    UploadPart -> Text
uploadId :: Prelude.Text,
    -- | Object data.
    UploadPart -> RequestBody
body :: Core.RequestBody
  }
  deriving (Int -> UploadPart -> ShowS
[UploadPart] -> ShowS
UploadPart -> String
(Int -> UploadPart -> ShowS)
-> (UploadPart -> String)
-> ([UploadPart] -> ShowS)
-> Show UploadPart
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadPart] -> ShowS
$cshowList :: [UploadPart] -> ShowS
show :: UploadPart -> String
$cshow :: UploadPart -> String
showsPrec :: Int -> UploadPart -> ShowS
$cshowsPrec :: Int -> UploadPart -> ShowS
Prelude.Show, (forall x. UploadPart -> Rep UploadPart x)
-> (forall x. Rep UploadPart x -> UploadPart) -> Generic UploadPart
forall x. Rep UploadPart x -> UploadPart
forall x. UploadPart -> Rep UploadPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadPart x -> UploadPart
$cfrom :: forall x. UploadPart -> Rep UploadPart x
Prelude.Generic)

-- |
-- Create a value of 'UploadPart' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'contentLength', 'uploadPart_contentLength' - Size of the body in bytes. This parameter is useful when the size of the
-- body cannot be determined automatically.
--
-- 'sSECustomerAlgorithm', 'uploadPart_sSECustomerAlgorithm' - Specifies the algorithm to use to when encrypting the object (for
-- example, AES256).
--
-- 'sSECustomerKey', 'uploadPart_sSECustomerKey' - Specifies the customer-provided encryption key for Amazon S3 to use in
-- encrypting data. This value is used to store the object and then it is
-- discarded; Amazon S3 does not store the encryption key. The key must be
-- appropriate for use with the algorithm specified in the
-- @x-amz-server-side-encryption-customer-algorithm header@. This must be
-- the same encryption key specified in the initiate multipart upload
-- request.
--
-- 'requestPayer', 'uploadPart_requestPayer' - Undocumented member.
--
-- 'sSECustomerKeyMD5', 'uploadPart_sSECustomerKeyMD5' - Specifies the 128-bit MD5 digest of the encryption key according to RFC
-- 1321. Amazon S3 uses this header for a message integrity check to ensure
-- that the encryption key was transmitted without error.
--
-- 'contentMD5', 'uploadPart_contentMD5' - The base64-encoded 128-bit MD5 digest of the part data. This parameter
-- is auto-populated when using the command from the CLI. This parameter is
-- required if object lock parameters are specified.
--
-- 'expectedBucketOwner', 'uploadPart_expectedBucketOwner' - The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
--
-- 'bucket', 'uploadPart_bucket' - The 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html 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 using 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using S3 on Outposts>
-- in the /Amazon S3 User Guide/.
--
-- 'key', 'uploadPart_key' - Object key for which the multipart upload was initiated.
--
-- 'partNumber', 'uploadPart_partNumber' - Part number of part being uploaded. This is a positive integer between 1
-- and 10,000.
--
-- 'uploadId', 'uploadPart_uploadId' - Upload ID identifying the multipart upload whose part is being uploaded.
--
-- 'body', 'uploadPart_body' - Object data.
newUploadPart ::
  -- | 'bucket'
  BucketName ->
  -- | 'key'
  ObjectKey ->
  -- | 'partNumber'
  Prelude.Int ->
  -- | 'uploadId'
  Prelude.Text ->
  -- | 'body'
  Core.RequestBody ->
  UploadPart
newUploadPart :: BucketName -> ObjectKey -> Int -> Text -> RequestBody -> UploadPart
newUploadPart
  BucketName
pBucket_
  ObjectKey
pKey_
  Int
pPartNumber_
  Text
pUploadId_
  RequestBody
pBody_ =
    UploadPart' :: Maybe Integer
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe RequestPayer
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> BucketName
-> ObjectKey
-> Int
-> Text
-> RequestBody
-> UploadPart
UploadPart'
      { $sel:contentLength:UploadPart' :: Maybe Integer
contentLength = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
        $sel:sSECustomerAlgorithm:UploadPart' :: Maybe Text
sSECustomerAlgorithm = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:sSECustomerKey:UploadPart' :: Maybe (Sensitive Text)
sSECustomerKey = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:requestPayer:UploadPart' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
forall a. Maybe a
Prelude.Nothing,
        $sel:sSECustomerKeyMD5:UploadPart' :: Maybe Text
sSECustomerKeyMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:contentMD5:UploadPart' :: Maybe Text
contentMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:expectedBucketOwner:UploadPart' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:bucket:UploadPart' :: BucketName
bucket = BucketName
pBucket_,
        $sel:key:UploadPart' :: ObjectKey
key = ObjectKey
pKey_,
        $sel:partNumber:UploadPart' :: Int
partNumber = Int
pPartNumber_,
        $sel:uploadId:UploadPart' :: Text
uploadId = Text
pUploadId_,
        $sel:body:UploadPart' :: RequestBody
body = RequestBody
pBody_
      }

-- | Size of the body in bytes. This parameter is useful when the size of the
-- body cannot be determined automatically.
uploadPart_contentLength :: Lens.Lens' UploadPart (Prelude.Maybe Prelude.Integer)
uploadPart_contentLength :: (Maybe Integer -> f (Maybe Integer)) -> UploadPart -> f UploadPart
uploadPart_contentLength = (UploadPart -> Maybe Integer)
-> (UploadPart -> Maybe Integer -> UploadPart)
-> Lens UploadPart UploadPart (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe Integer
contentLength :: Maybe Integer
$sel:contentLength:UploadPart' :: UploadPart -> Maybe Integer
contentLength} -> Maybe Integer
contentLength) (\s :: UploadPart
s@UploadPart' {} Maybe Integer
a -> UploadPart
s {$sel:contentLength:UploadPart' :: Maybe Integer
contentLength = Maybe Integer
a} :: UploadPart)

-- | Specifies the algorithm to use to when encrypting the object (for
-- example, AES256).
uploadPart_sSECustomerAlgorithm :: Lens.Lens' UploadPart (Prelude.Maybe Prelude.Text)
uploadPart_sSECustomerAlgorithm :: (Maybe Text -> f (Maybe Text)) -> UploadPart -> f UploadPart
uploadPart_sSECustomerAlgorithm = (UploadPart -> Maybe Text)
-> (UploadPart -> Maybe Text -> UploadPart)
-> Lens UploadPart UploadPart (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe Text
sSECustomerAlgorithm :: Maybe Text
$sel:sSECustomerAlgorithm:UploadPart' :: UploadPart -> Maybe Text
sSECustomerAlgorithm} -> Maybe Text
sSECustomerAlgorithm) (\s :: UploadPart
s@UploadPart' {} Maybe Text
a -> UploadPart
s {$sel:sSECustomerAlgorithm:UploadPart' :: Maybe Text
sSECustomerAlgorithm = Maybe Text
a} :: UploadPart)

-- | Specifies the customer-provided encryption key for Amazon S3 to use in
-- encrypting data. This value is used to store the object and then it is
-- discarded; Amazon S3 does not store the encryption key. The key must be
-- appropriate for use with the algorithm specified in the
-- @x-amz-server-side-encryption-customer-algorithm header@. This must be
-- the same encryption key specified in the initiate multipart upload
-- request.
uploadPart_sSECustomerKey :: Lens.Lens' UploadPart (Prelude.Maybe Prelude.Text)
uploadPart_sSECustomerKey :: (Maybe Text -> f (Maybe Text)) -> UploadPart -> f UploadPart
uploadPart_sSECustomerKey = (UploadPart -> Maybe (Sensitive Text))
-> (UploadPart -> Maybe (Sensitive Text) -> UploadPart)
-> Lens
     UploadPart
     UploadPart
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe (Sensitive Text)
sSECustomerKey :: Maybe (Sensitive Text)
$sel:sSECustomerKey:UploadPart' :: UploadPart -> Maybe (Sensitive Text)
sSECustomerKey} -> Maybe (Sensitive Text)
sSECustomerKey) (\s :: UploadPart
s@UploadPart' {} Maybe (Sensitive Text)
a -> UploadPart
s {$sel:sSECustomerKey:UploadPart' :: Maybe (Sensitive Text)
sSECustomerKey = Maybe (Sensitive Text)
a} :: UploadPart) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UploadPart -> f UploadPart)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UploadPart
-> f UploadPart
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Undocumented member.
uploadPart_requestPayer :: Lens.Lens' UploadPart (Prelude.Maybe RequestPayer)
uploadPart_requestPayer :: (Maybe RequestPayer -> f (Maybe RequestPayer))
-> UploadPart -> f UploadPart
uploadPart_requestPayer = (UploadPart -> Maybe RequestPayer)
-> (UploadPart -> Maybe RequestPayer -> UploadPart)
-> Lens
     UploadPart UploadPart (Maybe RequestPayer) (Maybe RequestPayer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe RequestPayer
requestPayer :: Maybe RequestPayer
$sel:requestPayer:UploadPart' :: UploadPart -> Maybe RequestPayer
requestPayer} -> Maybe RequestPayer
requestPayer) (\s :: UploadPart
s@UploadPart' {} Maybe RequestPayer
a -> UploadPart
s {$sel:requestPayer:UploadPart' :: Maybe RequestPayer
requestPayer = Maybe RequestPayer
a} :: UploadPart)

-- | Specifies the 128-bit MD5 digest of the encryption key according to RFC
-- 1321. Amazon S3 uses this header for a message integrity check to ensure
-- that the encryption key was transmitted without error.
uploadPart_sSECustomerKeyMD5 :: Lens.Lens' UploadPart (Prelude.Maybe Prelude.Text)
uploadPart_sSECustomerKeyMD5 :: (Maybe Text -> f (Maybe Text)) -> UploadPart -> f UploadPart
uploadPart_sSECustomerKeyMD5 = (UploadPart -> Maybe Text)
-> (UploadPart -> Maybe Text -> UploadPart)
-> Lens UploadPart UploadPart (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe Text
sSECustomerKeyMD5 :: Maybe Text
$sel:sSECustomerKeyMD5:UploadPart' :: UploadPart -> Maybe Text
sSECustomerKeyMD5} -> Maybe Text
sSECustomerKeyMD5) (\s :: UploadPart
s@UploadPart' {} Maybe Text
a -> UploadPart
s {$sel:sSECustomerKeyMD5:UploadPart' :: Maybe Text
sSECustomerKeyMD5 = Maybe Text
a} :: UploadPart)

-- | The base64-encoded 128-bit MD5 digest of the part data. This parameter
-- is auto-populated when using the command from the CLI. This parameter is
-- required if object lock parameters are specified.
uploadPart_contentMD5 :: Lens.Lens' UploadPart (Prelude.Maybe Prelude.Text)
uploadPart_contentMD5 :: (Maybe Text -> f (Maybe Text)) -> UploadPart -> f UploadPart
uploadPart_contentMD5 = (UploadPart -> Maybe Text)
-> (UploadPart -> Maybe Text -> UploadPart)
-> Lens UploadPart UploadPart (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe Text
contentMD5 :: Maybe Text
$sel:contentMD5:UploadPart' :: UploadPart -> Maybe Text
contentMD5} -> Maybe Text
contentMD5) (\s :: UploadPart
s@UploadPart' {} Maybe Text
a -> UploadPart
s {$sel:contentMD5:UploadPart' :: Maybe Text
contentMD5 = Maybe Text
a} :: UploadPart)

-- | The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
uploadPart_expectedBucketOwner :: Lens.Lens' UploadPart (Prelude.Maybe Prelude.Text)
uploadPart_expectedBucketOwner :: (Maybe Text -> f (Maybe Text)) -> UploadPart -> f UploadPart
uploadPart_expectedBucketOwner = (UploadPart -> Maybe Text)
-> (UploadPart -> Maybe Text -> UploadPart)
-> Lens UploadPart UploadPart (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:UploadPart' :: UploadPart -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: UploadPart
s@UploadPart' {} Maybe Text
a -> UploadPart
s {$sel:expectedBucketOwner:UploadPart' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: UploadPart)

-- | The 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html 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 using 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
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html Using S3 on Outposts>
-- in the /Amazon S3 User Guide/.
uploadPart_bucket :: Lens.Lens' UploadPart BucketName
uploadPart_bucket :: (BucketName -> f BucketName) -> UploadPart -> f UploadPart
uploadPart_bucket = (UploadPart -> BucketName)
-> (UploadPart -> BucketName -> UploadPart)
-> Lens UploadPart UploadPart BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {BucketName
bucket :: BucketName
$sel:bucket:UploadPart' :: UploadPart -> BucketName
bucket} -> BucketName
bucket) (\s :: UploadPart
s@UploadPart' {} BucketName
a -> UploadPart
s {$sel:bucket:UploadPart' :: BucketName
bucket = BucketName
a} :: UploadPart)

-- | Object key for which the multipart upload was initiated.
uploadPart_key :: Lens.Lens' UploadPart ObjectKey
uploadPart_key :: (ObjectKey -> f ObjectKey) -> UploadPart -> f UploadPart
uploadPart_key = (UploadPart -> ObjectKey)
-> (UploadPart -> ObjectKey -> UploadPart)
-> Lens UploadPart UploadPart ObjectKey ObjectKey
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {ObjectKey
key :: ObjectKey
$sel:key:UploadPart' :: UploadPart -> ObjectKey
key} -> ObjectKey
key) (\s :: UploadPart
s@UploadPart' {} ObjectKey
a -> UploadPart
s {$sel:key:UploadPart' :: ObjectKey
key = ObjectKey
a} :: UploadPart)

-- | Part number of part being uploaded. This is a positive integer between 1
-- and 10,000.
uploadPart_partNumber :: Lens.Lens' UploadPart Prelude.Int
uploadPart_partNumber :: (Int -> f Int) -> UploadPart -> f UploadPart
uploadPart_partNumber = (UploadPart -> Int)
-> (UploadPart -> Int -> UploadPart)
-> Lens UploadPart UploadPart Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Int
partNumber :: Int
$sel:partNumber:UploadPart' :: UploadPart -> Int
partNumber} -> Int
partNumber) (\s :: UploadPart
s@UploadPart' {} Int
a -> UploadPart
s {$sel:partNumber:UploadPart' :: Int
partNumber = Int
a} :: UploadPart)

-- | Upload ID identifying the multipart upload whose part is being uploaded.
uploadPart_uploadId :: Lens.Lens' UploadPart Prelude.Text
uploadPart_uploadId :: (Text -> f Text) -> UploadPart -> f UploadPart
uploadPart_uploadId = (UploadPart -> Text)
-> (UploadPart -> Text -> UploadPart)
-> Lens UploadPart UploadPart Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {Text
uploadId :: Text
$sel:uploadId:UploadPart' :: UploadPart -> Text
uploadId} -> Text
uploadId) (\s :: UploadPart
s@UploadPart' {} Text
a -> UploadPart
s {$sel:uploadId:UploadPart' :: Text
uploadId = Text
a} :: UploadPart)

-- | Object data.
uploadPart_body :: Lens.Lens' UploadPart Core.RequestBody
uploadPart_body :: (RequestBody -> f RequestBody) -> UploadPart -> f UploadPart
uploadPart_body = (UploadPart -> RequestBody)
-> (UploadPart -> RequestBody -> UploadPart)
-> Lens UploadPart UploadPart RequestBody RequestBody
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPart' {RequestBody
body :: RequestBody
$sel:body:UploadPart' :: UploadPart -> RequestBody
body} -> RequestBody
body) (\s :: UploadPart
s@UploadPart' {} RequestBody
a -> UploadPart
s {$sel:body:UploadPart' :: RequestBody
body = RequestBody
a} :: UploadPart)

instance Core.AWSRequest UploadPart where
  type AWSResponse UploadPart = UploadPartResponse
  request :: UploadPart -> Request UploadPart
request =
    Request UploadPart -> Request UploadPart
forall a. Request a -> Request a
Request.s3vhost
      (Request UploadPart -> Request UploadPart)
-> (UploadPart -> Request UploadPart)
-> UploadPart
-> Request UploadPart
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> UploadPart -> Request UploadPart
forall a. (ToRequest a, ToBody a) => Service -> a -> Request a
Request.putBody Service
defaultService
  response :: Logger
-> Service
-> Proxy UploadPart
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UploadPart)))
response =
    (Int
 -> ResponseHeaders -> () -> Either String (AWSResponse UploadPart))
-> Logger
-> Service
-> Proxy UploadPart
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UploadPart)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Maybe RequestCharged
-> Maybe ETag
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe ServerSideEncryption
-> Int
-> UploadPartResponse
UploadPartResponse'
            (Maybe RequestCharged
 -> Maybe ETag
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe ServerSideEncryption
 -> Int
 -> UploadPartResponse)
-> Either String (Maybe RequestCharged)
-> Either
     String
     (Maybe ETag
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe ServerSideEncryption
      -> Int
      -> UploadPartResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (ResponseHeaders
h ResponseHeaders
-> HeaderName -> Either String (Maybe RequestCharged)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-request-charged")
            Either
  String
  (Maybe ETag
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe ServerSideEncryption
   -> Int
   -> UploadPartResponse)
-> Either String (Maybe ETag)
-> Either
     String
     (Maybe Text
      -> Maybe Bool
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe ServerSideEncryption
      -> Int
      -> UploadPartResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders -> HeaderName -> Either String (Maybe ETag)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"ETag")
            Either
  String
  (Maybe Text
   -> Maybe Bool
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe ServerSideEncryption
   -> Int
   -> UploadPartResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe ServerSideEncryption
      -> Int
      -> UploadPartResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( ResponseHeaders
h
                            ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-server-side-encryption-customer-algorithm"
                        )
            Either
  String
  (Maybe Bool
   -> Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe ServerSideEncryption
   -> Int
   -> UploadPartResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe ServerSideEncryption
      -> Int
      -> UploadPartResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( ResponseHeaders
h
                            ResponseHeaders -> HeaderName -> Either String (Maybe Bool)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-server-side-encryption-bucket-key-enabled"
                        )
            Either
  String
  (Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe ServerSideEncryption
   -> Int
   -> UploadPartResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (Sensitive Text)
      -> Maybe ServerSideEncryption -> Int -> UploadPartResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( ResponseHeaders
h
                            ResponseHeaders -> HeaderName -> Either String (Maybe Text)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-server-side-encryption-customer-key-MD5"
                        )
            Either
  String
  (Maybe (Sensitive Text)
   -> Maybe ServerSideEncryption -> Int -> UploadPartResponse)
-> Either String (Maybe (Sensitive Text))
-> Either
     String (Maybe ServerSideEncryption -> Int -> UploadPartResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( ResponseHeaders
h
                            ResponseHeaders
-> HeaderName -> Either String (Maybe (Sensitive Text))
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-server-side-encryption-aws-kms-key-id"
                        )
            Either
  String (Maybe ServerSideEncryption -> Int -> UploadPartResponse)
-> Either String (Maybe ServerSideEncryption)
-> Either String (Int -> UploadPartResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h ResponseHeaders
-> HeaderName -> Either String (Maybe ServerSideEncryption)
forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Core..#? HeaderName
"x-amz-server-side-encryption")
            Either String (Int -> UploadPartResponse)
-> Either String Int -> Either String UploadPartResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Core.ToBody UploadPart where
  toBody :: UploadPart -> RequestBody
toBody UploadPart' {Int
Maybe Integer
Maybe Text
Maybe (Sensitive Text)
Maybe RequestPayer
Text
RequestBody
ObjectKey
BucketName
body :: RequestBody
uploadId :: Text
partNumber :: Int
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
sSECustomerKeyMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
sSECustomerKey :: Maybe (Sensitive Text)
sSECustomerAlgorithm :: Maybe Text
contentLength :: Maybe Integer
$sel:body:UploadPart' :: UploadPart -> RequestBody
$sel:uploadId:UploadPart' :: UploadPart -> Text
$sel:partNumber:UploadPart' :: UploadPart -> Int
$sel:key:UploadPart' :: UploadPart -> ObjectKey
$sel:bucket:UploadPart' :: UploadPart -> BucketName
$sel:expectedBucketOwner:UploadPart' :: UploadPart -> Maybe Text
$sel:contentMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:sSECustomerKeyMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:requestPayer:UploadPart' :: UploadPart -> Maybe RequestPayer
$sel:sSECustomerKey:UploadPart' :: UploadPart -> Maybe (Sensitive Text)
$sel:sSECustomerAlgorithm:UploadPart' :: UploadPart -> Maybe Text
$sel:contentLength:UploadPart' :: UploadPart -> Maybe Integer
..} = RequestBody -> RequestBody
forall a. ToBody a => a -> RequestBody
Core.toBody RequestBody
body

instance Core.ToHeaders UploadPart where
  toHeaders :: UploadPart -> ResponseHeaders
toHeaders UploadPart' {Int
Maybe Integer
Maybe Text
Maybe (Sensitive Text)
Maybe RequestPayer
Text
RequestBody
ObjectKey
BucketName
body :: RequestBody
uploadId :: Text
partNumber :: Int
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
sSECustomerKeyMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
sSECustomerKey :: Maybe (Sensitive Text)
sSECustomerAlgorithm :: Maybe Text
contentLength :: Maybe Integer
$sel:body:UploadPart' :: UploadPart -> RequestBody
$sel:uploadId:UploadPart' :: UploadPart -> Text
$sel:partNumber:UploadPart' :: UploadPart -> Int
$sel:key:UploadPart' :: UploadPart -> ObjectKey
$sel:bucket:UploadPart' :: UploadPart -> BucketName
$sel:expectedBucketOwner:UploadPart' :: UploadPart -> Maybe Text
$sel:contentMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:sSECustomerKeyMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:requestPayer:UploadPart' :: UploadPart -> Maybe RequestPayer
$sel:sSECustomerKey:UploadPart' :: UploadPart -> Maybe (Sensitive Text)
$sel:sSECustomerAlgorithm:UploadPart' :: UploadPart -> Maybe Text
$sel:contentLength:UploadPart' :: UploadPart -> Maybe Integer
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Content-Length" HeaderName -> Maybe Integer -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Integer
contentLength,
        HeaderName
"x-amz-server-side-encryption-customer-algorithm"
          HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
sSECustomerAlgorithm,
        HeaderName
"x-amz-server-side-encryption-customer-key"
          HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
sSECustomerKey,
        HeaderName
"x-amz-request-payer" HeaderName -> Maybe RequestPayer -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe RequestPayer
requestPayer,
        HeaderName
"x-amz-server-side-encryption-customer-key-MD5"
          HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
sSECustomerKeyMD5,
        HeaderName
"Content-MD5" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
contentMD5,
        HeaderName
"x-amz-expected-bucket-owner"
          HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
      ]

instance Core.ToPath UploadPart where
  toPath :: UploadPart -> ByteString
toPath UploadPart' {Int
Maybe Integer
Maybe Text
Maybe (Sensitive Text)
Maybe RequestPayer
Text
RequestBody
ObjectKey
BucketName
body :: RequestBody
uploadId :: Text
partNumber :: Int
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
sSECustomerKeyMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
sSECustomerKey :: Maybe (Sensitive Text)
sSECustomerAlgorithm :: Maybe Text
contentLength :: Maybe Integer
$sel:body:UploadPart' :: UploadPart -> RequestBody
$sel:uploadId:UploadPart' :: UploadPart -> Text
$sel:partNumber:UploadPart' :: UploadPart -> Int
$sel:key:UploadPart' :: UploadPart -> ObjectKey
$sel:bucket:UploadPart' :: UploadPart -> BucketName
$sel:expectedBucketOwner:UploadPart' :: UploadPart -> Maybe Text
$sel:contentMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:sSECustomerKeyMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:requestPayer:UploadPart' :: UploadPart -> Maybe RequestPayer
$sel:sSECustomerKey:UploadPart' :: UploadPart -> Maybe (Sensitive Text)
$sel:sSECustomerAlgorithm:UploadPart' :: UploadPart -> Maybe Text
$sel:contentLength:UploadPart' :: UploadPart -> Maybe Integer
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket, ByteString
"/", ObjectKey -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ObjectKey
key]

instance Core.ToQuery UploadPart where
  toQuery :: UploadPart -> QueryString
toQuery UploadPart' {Int
Maybe Integer
Maybe Text
Maybe (Sensitive Text)
Maybe RequestPayer
Text
RequestBody
ObjectKey
BucketName
body :: RequestBody
uploadId :: Text
partNumber :: Int
key :: ObjectKey
bucket :: BucketName
expectedBucketOwner :: Maybe Text
contentMD5 :: Maybe Text
sSECustomerKeyMD5 :: Maybe Text
requestPayer :: Maybe RequestPayer
sSECustomerKey :: Maybe (Sensitive Text)
sSECustomerAlgorithm :: Maybe Text
contentLength :: Maybe Integer
$sel:body:UploadPart' :: UploadPart -> RequestBody
$sel:uploadId:UploadPart' :: UploadPart -> Text
$sel:partNumber:UploadPart' :: UploadPart -> Int
$sel:key:UploadPart' :: UploadPart -> ObjectKey
$sel:bucket:UploadPart' :: UploadPart -> BucketName
$sel:expectedBucketOwner:UploadPart' :: UploadPart -> Maybe Text
$sel:contentMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:sSECustomerKeyMD5:UploadPart' :: UploadPart -> Maybe Text
$sel:requestPayer:UploadPart' :: UploadPart -> Maybe RequestPayer
$sel:sSECustomerKey:UploadPart' :: UploadPart -> Maybe (Sensitive Text)
$sel:sSECustomerAlgorithm:UploadPart' :: UploadPart -> Maybe Text
$sel:contentLength:UploadPart' :: UploadPart -> Maybe Integer
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"partNumber" ByteString -> Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Int
partNumber,
        ByteString
"uploadId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
uploadId
      ]

-- | /See:/ 'newUploadPartResponse' smart constructor.
data UploadPartResponse = UploadPartResponse'
  { UploadPartResponse -> Maybe RequestCharged
requestCharged :: Prelude.Maybe RequestCharged,
    -- | Entity tag for the uploaded object.
    UploadPartResponse -> Maybe ETag
eTag :: Prelude.Maybe ETag,
    -- | If server-side encryption with a customer-provided encryption key was
    -- requested, the response will include this header confirming the
    -- encryption algorithm used.
    UploadPartResponse -> Maybe Text
sSECustomerAlgorithm :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the multipart upload uses an S3 Bucket Key for
    -- server-side encryption with Amazon Web Services KMS (SSE-KMS).
    UploadPartResponse -> Maybe Bool
bucketKeyEnabled :: Prelude.Maybe Prelude.Bool,
    -- | If server-side encryption with a customer-provided encryption key was
    -- requested, the response will include this header to provide round-trip
    -- message integrity verification of the customer-provided encryption key.
    UploadPartResponse -> Maybe Text
sSECustomerKeyMD5 :: Prelude.Maybe Prelude.Text,
    -- | If present, specifies the ID of the Amazon Web Services Key Management
    -- Service (Amazon Web Services KMS) symmetric customer managed key was
    -- used for the object.
    UploadPartResponse -> Maybe (Sensitive Text)
sSEKMSKeyId :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The server-side encryption algorithm used when storing this object in
    -- Amazon S3 (for example, AES256, aws:kms).
    UploadPartResponse -> Maybe ServerSideEncryption
serverSideEncryption :: Prelude.Maybe ServerSideEncryption,
    -- | The response's http status code.
    UploadPartResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UploadPartResponse -> UploadPartResponse -> Bool
(UploadPartResponse -> UploadPartResponse -> Bool)
-> (UploadPartResponse -> UploadPartResponse -> Bool)
-> Eq UploadPartResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploadPartResponse -> UploadPartResponse -> Bool
$c/= :: UploadPartResponse -> UploadPartResponse -> Bool
== :: UploadPartResponse -> UploadPartResponse -> Bool
$c== :: UploadPartResponse -> UploadPartResponse -> Bool
Prelude.Eq, Int -> UploadPartResponse -> ShowS
[UploadPartResponse] -> ShowS
UploadPartResponse -> String
(Int -> UploadPartResponse -> ShowS)
-> (UploadPartResponse -> String)
-> ([UploadPartResponse] -> ShowS)
-> Show UploadPartResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploadPartResponse] -> ShowS
$cshowList :: [UploadPartResponse] -> ShowS
show :: UploadPartResponse -> String
$cshow :: UploadPartResponse -> String
showsPrec :: Int -> UploadPartResponse -> ShowS
$cshowsPrec :: Int -> UploadPartResponse -> ShowS
Prelude.Show, (forall x. UploadPartResponse -> Rep UploadPartResponse x)
-> (forall x. Rep UploadPartResponse x -> UploadPartResponse)
-> Generic UploadPartResponse
forall x. Rep UploadPartResponse x -> UploadPartResponse
forall x. UploadPartResponse -> Rep UploadPartResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploadPartResponse x -> UploadPartResponse
$cfrom :: forall x. UploadPartResponse -> Rep UploadPartResponse x
Prelude.Generic)

-- |
-- Create a value of 'UploadPartResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'requestCharged', 'uploadPartResponse_requestCharged' - Undocumented member.
--
-- 'eTag', 'uploadPartResponse_eTag' - Entity tag for the uploaded object.
--
-- 'sSECustomerAlgorithm', 'uploadPartResponse_sSECustomerAlgorithm' - If server-side encryption with a customer-provided encryption key was
-- requested, the response will include this header confirming the
-- encryption algorithm used.
--
-- 'bucketKeyEnabled', 'uploadPartResponse_bucketKeyEnabled' - Indicates whether the multipart upload uses an S3 Bucket Key for
-- server-side encryption with Amazon Web Services KMS (SSE-KMS).
--
-- 'sSECustomerKeyMD5', 'uploadPartResponse_sSECustomerKeyMD5' - If server-side encryption with a customer-provided encryption key was
-- requested, the response will include this header to provide round-trip
-- message integrity verification of the customer-provided encryption key.
--
-- 'sSEKMSKeyId', 'uploadPartResponse_sSEKMSKeyId' - If present, specifies the ID of the Amazon Web Services Key Management
-- Service (Amazon Web Services KMS) symmetric customer managed key was
-- used for the object.
--
-- 'serverSideEncryption', 'uploadPartResponse_serverSideEncryption' - The server-side encryption algorithm used when storing this object in
-- Amazon S3 (for example, AES256, aws:kms).
--
-- 'httpStatus', 'uploadPartResponse_httpStatus' - The response's http status code.
newUploadPartResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UploadPartResponse
newUploadPartResponse :: Int -> UploadPartResponse
newUploadPartResponse Int
pHttpStatus_ =
  UploadPartResponse' :: Maybe RequestCharged
-> Maybe ETag
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe ServerSideEncryption
-> Int
-> UploadPartResponse
UploadPartResponse'
    { $sel:requestCharged:UploadPartResponse' :: Maybe RequestCharged
requestCharged =
        Maybe RequestCharged
forall a. Maybe a
Prelude.Nothing,
      $sel:eTag:UploadPartResponse' :: Maybe ETag
eTag = Maybe ETag
forall a. Maybe a
Prelude.Nothing,
      $sel:sSECustomerAlgorithm:UploadPartResponse' :: Maybe Text
sSECustomerAlgorithm = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucketKeyEnabled:UploadPartResponse' :: Maybe Bool
bucketKeyEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:sSECustomerKeyMD5:UploadPartResponse' :: Maybe Text
sSECustomerKeyMD5 = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sSEKMSKeyId:UploadPartResponse' :: Maybe (Sensitive Text)
sSEKMSKeyId = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:serverSideEncryption:UploadPartResponse' :: Maybe ServerSideEncryption
serverSideEncryption = Maybe ServerSideEncryption
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UploadPartResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
uploadPartResponse_requestCharged :: Lens.Lens' UploadPartResponse (Prelude.Maybe RequestCharged)
uploadPartResponse_requestCharged :: (Maybe RequestCharged -> f (Maybe RequestCharged))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_requestCharged = (UploadPartResponse -> Maybe RequestCharged)
-> (UploadPartResponse
    -> Maybe RequestCharged -> UploadPartResponse)
-> Lens
     UploadPartResponse
     UploadPartResponse
     (Maybe RequestCharged)
     (Maybe RequestCharged)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe RequestCharged
requestCharged :: Maybe RequestCharged
$sel:requestCharged:UploadPartResponse' :: UploadPartResponse -> Maybe RequestCharged
requestCharged} -> Maybe RequestCharged
requestCharged) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe RequestCharged
a -> UploadPartResponse
s {$sel:requestCharged:UploadPartResponse' :: Maybe RequestCharged
requestCharged = Maybe RequestCharged
a} :: UploadPartResponse)

-- | Entity tag for the uploaded object.
uploadPartResponse_eTag :: Lens.Lens' UploadPartResponse (Prelude.Maybe ETag)
uploadPartResponse_eTag :: (Maybe ETag -> f (Maybe ETag))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_eTag = (UploadPartResponse -> Maybe ETag)
-> (UploadPartResponse -> Maybe ETag -> UploadPartResponse)
-> Lens
     UploadPartResponse UploadPartResponse (Maybe ETag) (Maybe ETag)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe ETag
eTag :: Maybe ETag
$sel:eTag:UploadPartResponse' :: UploadPartResponse -> Maybe ETag
eTag} -> Maybe ETag
eTag) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe ETag
a -> UploadPartResponse
s {$sel:eTag:UploadPartResponse' :: Maybe ETag
eTag = Maybe ETag
a} :: UploadPartResponse)

-- | If server-side encryption with a customer-provided encryption key was
-- requested, the response will include this header confirming the
-- encryption algorithm used.
uploadPartResponse_sSECustomerAlgorithm :: Lens.Lens' UploadPartResponse (Prelude.Maybe Prelude.Text)
uploadPartResponse_sSECustomerAlgorithm :: (Maybe Text -> f (Maybe Text))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_sSECustomerAlgorithm = (UploadPartResponse -> Maybe Text)
-> (UploadPartResponse -> Maybe Text -> UploadPartResponse)
-> Lens
     UploadPartResponse UploadPartResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe Text
sSECustomerAlgorithm :: Maybe Text
$sel:sSECustomerAlgorithm:UploadPartResponse' :: UploadPartResponse -> Maybe Text
sSECustomerAlgorithm} -> Maybe Text
sSECustomerAlgorithm) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe Text
a -> UploadPartResponse
s {$sel:sSECustomerAlgorithm:UploadPartResponse' :: Maybe Text
sSECustomerAlgorithm = Maybe Text
a} :: UploadPartResponse)

-- | Indicates whether the multipart upload uses an S3 Bucket Key for
-- server-side encryption with Amazon Web Services KMS (SSE-KMS).
uploadPartResponse_bucketKeyEnabled :: Lens.Lens' UploadPartResponse (Prelude.Maybe Prelude.Bool)
uploadPartResponse_bucketKeyEnabled :: (Maybe Bool -> f (Maybe Bool))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_bucketKeyEnabled = (UploadPartResponse -> Maybe Bool)
-> (UploadPartResponse -> Maybe Bool -> UploadPartResponse)
-> Lens
     UploadPartResponse UploadPartResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe Bool
bucketKeyEnabled :: Maybe Bool
$sel:bucketKeyEnabled:UploadPartResponse' :: UploadPartResponse -> Maybe Bool
bucketKeyEnabled} -> Maybe Bool
bucketKeyEnabled) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe Bool
a -> UploadPartResponse
s {$sel:bucketKeyEnabled:UploadPartResponse' :: Maybe Bool
bucketKeyEnabled = Maybe Bool
a} :: UploadPartResponse)

-- | If server-side encryption with a customer-provided encryption key was
-- requested, the response will include this header to provide round-trip
-- message integrity verification of the customer-provided encryption key.
uploadPartResponse_sSECustomerKeyMD5 :: Lens.Lens' UploadPartResponse (Prelude.Maybe Prelude.Text)
uploadPartResponse_sSECustomerKeyMD5 :: (Maybe Text -> f (Maybe Text))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_sSECustomerKeyMD5 = (UploadPartResponse -> Maybe Text)
-> (UploadPartResponse -> Maybe Text -> UploadPartResponse)
-> Lens
     UploadPartResponse UploadPartResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe Text
sSECustomerKeyMD5 :: Maybe Text
$sel:sSECustomerKeyMD5:UploadPartResponse' :: UploadPartResponse -> Maybe Text
sSECustomerKeyMD5} -> Maybe Text
sSECustomerKeyMD5) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe Text
a -> UploadPartResponse
s {$sel:sSECustomerKeyMD5:UploadPartResponse' :: Maybe Text
sSECustomerKeyMD5 = Maybe Text
a} :: UploadPartResponse)

-- | If present, specifies the ID of the Amazon Web Services Key Management
-- Service (Amazon Web Services KMS) symmetric customer managed key was
-- used for the object.
uploadPartResponse_sSEKMSKeyId :: Lens.Lens' UploadPartResponse (Prelude.Maybe Prelude.Text)
uploadPartResponse_sSEKMSKeyId :: (Maybe Text -> f (Maybe Text))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_sSEKMSKeyId = (UploadPartResponse -> Maybe (Sensitive Text))
-> (UploadPartResponse
    -> Maybe (Sensitive Text) -> UploadPartResponse)
-> Lens
     UploadPartResponse
     UploadPartResponse
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe (Sensitive Text)
sSEKMSKeyId :: Maybe (Sensitive Text)
$sel:sSEKMSKeyId:UploadPartResponse' :: UploadPartResponse -> Maybe (Sensitive Text)
sSEKMSKeyId} -> Maybe (Sensitive Text)
sSEKMSKeyId) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe (Sensitive Text)
a -> UploadPartResponse
s {$sel:sSEKMSKeyId:UploadPartResponse' :: Maybe (Sensitive Text)
sSEKMSKeyId = Maybe (Sensitive Text)
a} :: UploadPartResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UploadPartResponse -> f UploadPartResponse)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UploadPartResponse
-> f UploadPartResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The server-side encryption algorithm used when storing this object in
-- Amazon S3 (for example, AES256, aws:kms).
uploadPartResponse_serverSideEncryption :: Lens.Lens' UploadPartResponse (Prelude.Maybe ServerSideEncryption)
uploadPartResponse_serverSideEncryption :: (Maybe ServerSideEncryption -> f (Maybe ServerSideEncryption))
-> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_serverSideEncryption = (UploadPartResponse -> Maybe ServerSideEncryption)
-> (UploadPartResponse
    -> Maybe ServerSideEncryption -> UploadPartResponse)
-> Lens
     UploadPartResponse
     UploadPartResponse
     (Maybe ServerSideEncryption)
     (Maybe ServerSideEncryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Maybe ServerSideEncryption
serverSideEncryption :: Maybe ServerSideEncryption
$sel:serverSideEncryption:UploadPartResponse' :: UploadPartResponse -> Maybe ServerSideEncryption
serverSideEncryption} -> Maybe ServerSideEncryption
serverSideEncryption) (\s :: UploadPartResponse
s@UploadPartResponse' {} Maybe ServerSideEncryption
a -> UploadPartResponse
s {$sel:serverSideEncryption:UploadPartResponse' :: Maybe ServerSideEncryption
serverSideEncryption = Maybe ServerSideEncryption
a} :: UploadPartResponse)

-- | The response's http status code.
uploadPartResponse_httpStatus :: Lens.Lens' UploadPartResponse Prelude.Int
uploadPartResponse_httpStatus :: (Int -> f Int) -> UploadPartResponse -> f UploadPartResponse
uploadPartResponse_httpStatus = (UploadPartResponse -> Int)
-> (UploadPartResponse -> Int -> UploadPartResponse)
-> Lens UploadPartResponse UploadPartResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploadPartResponse' {Int
httpStatus :: Int
$sel:httpStatus:UploadPartResponse' :: UploadPartResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UploadPartResponse
s@UploadPartResponse' {} Int
a -> UploadPartResponse
s {$sel:httpStatus:UploadPartResponse' :: Int
httpStatus = Int
a} :: UploadPartResponse)

instance Prelude.NFData UploadPartResponse