{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.CompletedPart
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.S3.Types.CompletedPart where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal

-- | Details of the parts that were uploaded.
--
-- /See:/ 'newCompletedPart' smart constructor.
data CompletedPart = CompletedPart'
  { -- | The base64-encoded, 32-bit CRC32 checksum of the object. This will only
    -- be present if it was uploaded with the object. With multipart uploads,
    -- this may not be a checksum value of the object. For more information
    -- about how checksums are calculated with multipart uploads, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
    -- in the /Amazon S3 User Guide/.
    CompletedPart -> Maybe Text
checksumCRC32 :: Prelude.Maybe Prelude.Text,
    -- | The base64-encoded, 32-bit CRC32C checksum of the object. This will only
    -- be present if it was uploaded with the object. With multipart uploads,
    -- this may not be a checksum value of the object. For more information
    -- about how checksums are calculated with multipart uploads, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
    -- in the /Amazon S3 User Guide/.
    CompletedPart -> Maybe Text
checksumCRC32C :: Prelude.Maybe Prelude.Text,
    -- | The base64-encoded, 160-bit SHA-1 digest of the object. This will only
    -- be present if it was uploaded with the object. With multipart uploads,
    -- this may not be a checksum value of the object. For more information
    -- about how checksums are calculated with multipart uploads, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
    -- in the /Amazon S3 User Guide/.
    CompletedPart -> Maybe Text
checksumSHA1 :: Prelude.Maybe Prelude.Text,
    -- | The base64-encoded, 256-bit SHA-256 digest of the object. This will only
    -- be present if it was uploaded with the object. With multipart uploads,
    -- this may not be a checksum value of the object. For more information
    -- about how checksums are calculated with multipart uploads, see
    -- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
    -- in the /Amazon S3 User Guide/.
    CompletedPart -> Maybe Text
checksumSHA256 :: Prelude.Maybe Prelude.Text,
    -- | Part number that identifies the part. This is a positive integer between
    -- 1 and 10,000.
    CompletedPart -> Int
partNumber :: Prelude.Int,
    -- | Entity tag returned when the part was uploaded.
    CompletedPart -> ETag
eTag :: ETag
  }
  deriving (CompletedPart -> CompletedPart -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompletedPart -> CompletedPart -> Bool
$c/= :: CompletedPart -> CompletedPart -> Bool
== :: CompletedPart -> CompletedPart -> Bool
$c== :: CompletedPart -> CompletedPart -> Bool
Prelude.Eq, ReadPrec [CompletedPart]
ReadPrec CompletedPart
Int -> ReadS CompletedPart
ReadS [CompletedPart]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompletedPart]
$creadListPrec :: ReadPrec [CompletedPart]
readPrec :: ReadPrec CompletedPart
$creadPrec :: ReadPrec CompletedPart
readList :: ReadS [CompletedPart]
$creadList :: ReadS [CompletedPart]
readsPrec :: Int -> ReadS CompletedPart
$creadsPrec :: Int -> ReadS CompletedPart
Prelude.Read, Int -> CompletedPart -> ShowS
[CompletedPart] -> ShowS
CompletedPart -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompletedPart] -> ShowS
$cshowList :: [CompletedPart] -> ShowS
show :: CompletedPart -> String
$cshow :: CompletedPart -> String
showsPrec :: Int -> CompletedPart -> ShowS
$cshowsPrec :: Int -> CompletedPart -> ShowS
Prelude.Show, forall x. Rep CompletedPart x -> CompletedPart
forall x. CompletedPart -> Rep CompletedPart x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompletedPart x -> CompletedPart
$cfrom :: forall x. CompletedPart -> Rep CompletedPart x
Prelude.Generic)

-- |
-- Create a value of 'CompletedPart' 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:
--
-- 'checksumCRC32', 'completedPart_checksumCRC32' - The base64-encoded, 32-bit CRC32 checksum of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
--
-- 'checksumCRC32C', 'completedPart_checksumCRC32C' - The base64-encoded, 32-bit CRC32C checksum of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
--
-- 'checksumSHA1', 'completedPart_checksumSHA1' - The base64-encoded, 160-bit SHA-1 digest of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
--
-- 'checksumSHA256', 'completedPart_checksumSHA256' - The base64-encoded, 256-bit SHA-256 digest of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
--
-- 'partNumber', 'completedPart_partNumber' - Part number that identifies the part. This is a positive integer between
-- 1 and 10,000.
--
-- 'eTag', 'completedPart_eTag' - Entity tag returned when the part was uploaded.
newCompletedPart ::
  -- | 'partNumber'
  Prelude.Int ->
  -- | 'eTag'
  ETag ->
  CompletedPart
newCompletedPart :: Int -> ETag -> CompletedPart
newCompletedPart Int
pPartNumber_ ETag
pETag_ =
  CompletedPart'
    { $sel:checksumCRC32:CompletedPart' :: Maybe Text
checksumCRC32 = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumCRC32C:CompletedPart' :: Maybe Text
checksumCRC32C = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumSHA1:CompletedPart' :: Maybe Text
checksumSHA1 = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumSHA256:CompletedPart' :: Maybe Text
checksumSHA256 = forall a. Maybe a
Prelude.Nothing,
      $sel:partNumber:CompletedPart' :: Int
partNumber = Int
pPartNumber_,
      $sel:eTag:CompletedPart' :: ETag
eTag = ETag
pETag_
    }

-- | The base64-encoded, 32-bit CRC32 checksum of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
completedPart_checksumCRC32 :: Lens.Lens' CompletedPart (Prelude.Maybe Prelude.Text)
completedPart_checksumCRC32 :: Lens' CompletedPart (Maybe Text)
completedPart_checksumCRC32 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {Maybe Text
checksumCRC32 :: Maybe Text
$sel:checksumCRC32:CompletedPart' :: CompletedPart -> Maybe Text
checksumCRC32} -> Maybe Text
checksumCRC32) (\s :: CompletedPart
s@CompletedPart' {} Maybe Text
a -> CompletedPart
s {$sel:checksumCRC32:CompletedPart' :: Maybe Text
checksumCRC32 = Maybe Text
a} :: CompletedPart)

-- | The base64-encoded, 32-bit CRC32C checksum of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
completedPart_checksumCRC32C :: Lens.Lens' CompletedPart (Prelude.Maybe Prelude.Text)
completedPart_checksumCRC32C :: Lens' CompletedPart (Maybe Text)
completedPart_checksumCRC32C = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {Maybe Text
checksumCRC32C :: Maybe Text
$sel:checksumCRC32C:CompletedPart' :: CompletedPart -> Maybe Text
checksumCRC32C} -> Maybe Text
checksumCRC32C) (\s :: CompletedPart
s@CompletedPart' {} Maybe Text
a -> CompletedPart
s {$sel:checksumCRC32C:CompletedPart' :: Maybe Text
checksumCRC32C = Maybe Text
a} :: CompletedPart)

-- | The base64-encoded, 160-bit SHA-1 digest of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
completedPart_checksumSHA1 :: Lens.Lens' CompletedPart (Prelude.Maybe Prelude.Text)
completedPart_checksumSHA1 :: Lens' CompletedPart (Maybe Text)
completedPart_checksumSHA1 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {Maybe Text
checksumSHA1 :: Maybe Text
$sel:checksumSHA1:CompletedPart' :: CompletedPart -> Maybe Text
checksumSHA1} -> Maybe Text
checksumSHA1) (\s :: CompletedPart
s@CompletedPart' {} Maybe Text
a -> CompletedPart
s {$sel:checksumSHA1:CompletedPart' :: Maybe Text
checksumSHA1 = Maybe Text
a} :: CompletedPart)

-- | The base64-encoded, 256-bit SHA-256 digest of the object. This will only
-- be present if it was uploaded with the object. With multipart uploads,
-- this may not be a checksum value of the object. For more information
-- about how checksums are calculated with multipart uploads, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums Checking object integrity>
-- in the /Amazon S3 User Guide/.
completedPart_checksumSHA256 :: Lens.Lens' CompletedPart (Prelude.Maybe Prelude.Text)
completedPart_checksumSHA256 :: Lens' CompletedPart (Maybe Text)
completedPart_checksumSHA256 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {Maybe Text
checksumSHA256 :: Maybe Text
$sel:checksumSHA256:CompletedPart' :: CompletedPart -> Maybe Text
checksumSHA256} -> Maybe Text
checksumSHA256) (\s :: CompletedPart
s@CompletedPart' {} Maybe Text
a -> CompletedPart
s {$sel:checksumSHA256:CompletedPart' :: Maybe Text
checksumSHA256 = Maybe Text
a} :: CompletedPart)

-- | Part number that identifies the part. This is a positive integer between
-- 1 and 10,000.
completedPart_partNumber :: Lens.Lens' CompletedPart Prelude.Int
completedPart_partNumber :: Lens' CompletedPart Int
completedPart_partNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {Int
partNumber :: Int
$sel:partNumber:CompletedPart' :: CompletedPart -> Int
partNumber} -> Int
partNumber) (\s :: CompletedPart
s@CompletedPart' {} Int
a -> CompletedPart
s {$sel:partNumber:CompletedPart' :: Int
partNumber = Int
a} :: CompletedPart)

-- | Entity tag returned when the part was uploaded.
completedPart_eTag :: Lens.Lens' CompletedPart ETag
completedPart_eTag :: Lens' CompletedPart ETag
completedPart_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompletedPart' {ETag
eTag :: ETag
$sel:eTag:CompletedPart' :: CompletedPart -> ETag
eTag} -> ETag
eTag) (\s :: CompletedPart
s@CompletedPart' {} ETag
a -> CompletedPart
s {$sel:eTag:CompletedPart' :: ETag
eTag = ETag
a} :: CompletedPart)

instance Prelude.Hashable CompletedPart where
  hashWithSalt :: Int -> CompletedPart -> Int
hashWithSalt Int
_salt CompletedPart' {Int
Maybe Text
ETag
eTag :: ETag
partNumber :: Int
checksumSHA256 :: Maybe Text
checksumSHA1 :: Maybe Text
checksumCRC32C :: Maybe Text
checksumCRC32 :: Maybe Text
$sel:eTag:CompletedPart' :: CompletedPart -> ETag
$sel:partNumber:CompletedPart' :: CompletedPart -> Int
$sel:checksumSHA256:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumSHA1:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumCRC32C:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumCRC32:CompletedPart' :: CompletedPart -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
checksumCRC32
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
checksumCRC32C
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
checksumSHA1
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
checksumSHA256
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
partNumber
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ETag
eTag

instance Prelude.NFData CompletedPart where
  rnf :: CompletedPart -> ()
rnf CompletedPart' {Int
Maybe Text
ETag
eTag :: ETag
partNumber :: Int
checksumSHA256 :: Maybe Text
checksumSHA1 :: Maybe Text
checksumCRC32C :: Maybe Text
checksumCRC32 :: Maybe Text
$sel:eTag:CompletedPart' :: CompletedPart -> ETag
$sel:partNumber:CompletedPart' :: CompletedPart -> Int
$sel:checksumSHA256:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumSHA1:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumCRC32C:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumCRC32:CompletedPart' :: CompletedPart -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
checksumCRC32
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
checksumCRC32C
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
checksumSHA1
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
checksumSHA256
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
partNumber
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ETag
eTag

instance Data.ToXML CompletedPart where
  toXML :: CompletedPart -> XML
toXML CompletedPart' {Int
Maybe Text
ETag
eTag :: ETag
partNumber :: Int
checksumSHA256 :: Maybe Text
checksumSHA1 :: Maybe Text
checksumCRC32C :: Maybe Text
checksumCRC32 :: Maybe Text
$sel:eTag:CompletedPart' :: CompletedPart -> ETag
$sel:partNumber:CompletedPart' :: CompletedPart -> Int
$sel:checksumSHA256:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumSHA1:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumCRC32C:CompletedPart' :: CompletedPart -> Maybe Text
$sel:checksumCRC32:CompletedPart' :: CompletedPart -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"ChecksumCRC32" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
checksumCRC32,
        Name
"ChecksumCRC32C" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
checksumCRC32C,
        Name
"ChecksumSHA1" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
checksumSHA1,
        Name
"ChecksumSHA256" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
checksumSHA256,
        Name
"PartNumber" forall a. ToXML a => Name -> a -> XML
Data.@= Int
partNumber,
        Name
"ETag" forall a. ToXML a => Name -> a -> XML
Data.@= ETag
eTag
      ]