{-# 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.CopyPartResult
-- 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.CopyPartResult 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

-- | Container for all response elements.
--
-- /See:/ 'newCopyPartResult' smart constructor.
data CopyPartResult = CopyPartResult'
  { -- | 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/.
    CopyPartResult -> 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/.
    CopyPartResult -> 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/.
    CopyPartResult -> 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/.
    CopyPartResult -> Maybe Text
checksumSHA256 :: Prelude.Maybe Prelude.Text,
    -- | Entity tag of the object.
    CopyPartResult -> Maybe ETag
eTag :: Prelude.Maybe ETag,
    -- | Date and time at which the object was uploaded.
    CopyPartResult -> Maybe RFC822
lastModified :: Prelude.Maybe Data.RFC822
  }
  deriving (CopyPartResult -> CopyPartResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyPartResult -> CopyPartResult -> Bool
$c/= :: CopyPartResult -> CopyPartResult -> Bool
== :: CopyPartResult -> CopyPartResult -> Bool
$c== :: CopyPartResult -> CopyPartResult -> Bool
Prelude.Eq, ReadPrec [CopyPartResult]
ReadPrec CopyPartResult
Int -> ReadS CopyPartResult
ReadS [CopyPartResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyPartResult]
$creadListPrec :: ReadPrec [CopyPartResult]
readPrec :: ReadPrec CopyPartResult
$creadPrec :: ReadPrec CopyPartResult
readList :: ReadS [CopyPartResult]
$creadList :: ReadS [CopyPartResult]
readsPrec :: Int -> ReadS CopyPartResult
$creadsPrec :: Int -> ReadS CopyPartResult
Prelude.Read, Int -> CopyPartResult -> ShowS
[CopyPartResult] -> ShowS
CopyPartResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyPartResult] -> ShowS
$cshowList :: [CopyPartResult] -> ShowS
show :: CopyPartResult -> String
$cshow :: CopyPartResult -> String
showsPrec :: Int -> CopyPartResult -> ShowS
$cshowsPrec :: Int -> CopyPartResult -> ShowS
Prelude.Show, forall x. Rep CopyPartResult x -> CopyPartResult
forall x. CopyPartResult -> Rep CopyPartResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyPartResult x -> CopyPartResult
$cfrom :: forall x. CopyPartResult -> Rep CopyPartResult x
Prelude.Generic)

-- |
-- Create a value of 'CopyPartResult' 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', 'copyPartResult_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', 'copyPartResult_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', 'copyPartResult_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', 'copyPartResult_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/.
--
-- 'eTag', 'copyPartResult_eTag' - Entity tag of the object.
--
-- 'lastModified', 'copyPartResult_lastModified' - Date and time at which the object was uploaded.
newCopyPartResult ::
  CopyPartResult
newCopyPartResult :: CopyPartResult
newCopyPartResult =
  CopyPartResult'
    { $sel:checksumCRC32:CopyPartResult' :: Maybe Text
checksumCRC32 = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumCRC32C:CopyPartResult' :: Maybe Text
checksumCRC32C = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumSHA1:CopyPartResult' :: Maybe Text
checksumSHA1 = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumSHA256:CopyPartResult' :: Maybe Text
checksumSHA256 = forall a. Maybe a
Prelude.Nothing,
      $sel:eTag:CopyPartResult' :: Maybe ETag
eTag = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:CopyPartResult' :: Maybe RFC822
lastModified = forall a. Maybe a
Prelude.Nothing
    }

-- | 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/.
copyPartResult_checksumCRC32 :: Lens.Lens' CopyPartResult (Prelude.Maybe Prelude.Text)
copyPartResult_checksumCRC32 :: Lens' CopyPartResult (Maybe Text)
copyPartResult_checksumCRC32 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe Text
checksumCRC32 :: Maybe Text
$sel:checksumCRC32:CopyPartResult' :: CopyPartResult -> Maybe Text
checksumCRC32} -> Maybe Text
checksumCRC32) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe Text
a -> CopyPartResult
s {$sel:checksumCRC32:CopyPartResult' :: Maybe Text
checksumCRC32 = Maybe Text
a} :: CopyPartResult)

-- | 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/.
copyPartResult_checksumCRC32C :: Lens.Lens' CopyPartResult (Prelude.Maybe Prelude.Text)
copyPartResult_checksumCRC32C :: Lens' CopyPartResult (Maybe Text)
copyPartResult_checksumCRC32C = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe Text
checksumCRC32C :: Maybe Text
$sel:checksumCRC32C:CopyPartResult' :: CopyPartResult -> Maybe Text
checksumCRC32C} -> Maybe Text
checksumCRC32C) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe Text
a -> CopyPartResult
s {$sel:checksumCRC32C:CopyPartResult' :: Maybe Text
checksumCRC32C = Maybe Text
a} :: CopyPartResult)

-- | 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/.
copyPartResult_checksumSHA1 :: Lens.Lens' CopyPartResult (Prelude.Maybe Prelude.Text)
copyPartResult_checksumSHA1 :: Lens' CopyPartResult (Maybe Text)
copyPartResult_checksumSHA1 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe Text
checksumSHA1 :: Maybe Text
$sel:checksumSHA1:CopyPartResult' :: CopyPartResult -> Maybe Text
checksumSHA1} -> Maybe Text
checksumSHA1) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe Text
a -> CopyPartResult
s {$sel:checksumSHA1:CopyPartResult' :: Maybe Text
checksumSHA1 = Maybe Text
a} :: CopyPartResult)

-- | 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/.
copyPartResult_checksumSHA256 :: Lens.Lens' CopyPartResult (Prelude.Maybe Prelude.Text)
copyPartResult_checksumSHA256 :: Lens' CopyPartResult (Maybe Text)
copyPartResult_checksumSHA256 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe Text
checksumSHA256 :: Maybe Text
$sel:checksumSHA256:CopyPartResult' :: CopyPartResult -> Maybe Text
checksumSHA256} -> Maybe Text
checksumSHA256) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe Text
a -> CopyPartResult
s {$sel:checksumSHA256:CopyPartResult' :: Maybe Text
checksumSHA256 = Maybe Text
a} :: CopyPartResult)

-- | Entity tag of the object.
copyPartResult_eTag :: Lens.Lens' CopyPartResult (Prelude.Maybe ETag)
copyPartResult_eTag :: Lens' CopyPartResult (Maybe ETag)
copyPartResult_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe ETag
eTag :: Maybe ETag
$sel:eTag:CopyPartResult' :: CopyPartResult -> Maybe ETag
eTag} -> Maybe ETag
eTag) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe ETag
a -> CopyPartResult
s {$sel:eTag:CopyPartResult' :: Maybe ETag
eTag = Maybe ETag
a} :: CopyPartResult)

-- | Date and time at which the object was uploaded.
copyPartResult_lastModified :: Lens.Lens' CopyPartResult (Prelude.Maybe Prelude.UTCTime)
copyPartResult_lastModified :: Lens' CopyPartResult (Maybe UTCTime)
copyPartResult_lastModified = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe RFC822
lastModified :: Maybe RFC822
$sel:lastModified:CopyPartResult' :: CopyPartResult -> Maybe RFC822
lastModified} -> Maybe RFC822
lastModified) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe RFC822
a -> CopyPartResult
s {$sel:lastModified:CopyPartResult' :: Maybe RFC822
lastModified = Maybe RFC822
a} :: CopyPartResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromXML CopyPartResult where
  parseXML :: [Node] -> Either String CopyPartResult
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ETag
-> Maybe RFC822
-> CopyPartResult
CopyPartResult'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ChecksumCRC32")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ChecksumCRC32C")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ChecksumSHA1")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ChecksumSHA256")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ETag")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"LastModified")

instance Prelude.Hashable CopyPartResult where
  hashWithSalt :: Int -> CopyPartResult -> Int
hashWithSalt Int
_salt CopyPartResult' {Maybe Text
Maybe RFC822
Maybe ETag
lastModified :: Maybe RFC822
eTag :: Maybe ETag
checksumSHA256 :: Maybe Text
checksumSHA1 :: Maybe Text
checksumCRC32C :: Maybe Text
checksumCRC32 :: Maybe Text
$sel:lastModified:CopyPartResult' :: CopyPartResult -> Maybe RFC822
$sel:eTag:CopyPartResult' :: CopyPartResult -> Maybe ETag
$sel:checksumSHA256:CopyPartResult' :: CopyPartResult -> Maybe Text
$sel:checksumSHA1:CopyPartResult' :: CopyPartResult -> Maybe Text
$sel:checksumCRC32C:CopyPartResult' :: CopyPartResult -> Maybe Text
$sel:checksumCRC32:CopyPartResult' :: CopyPartResult -> 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` Maybe ETag
eTag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RFC822
lastModified

instance Prelude.NFData CopyPartResult where
  rnf :: CopyPartResult -> ()
rnf CopyPartResult' {Maybe Text
Maybe RFC822
Maybe ETag
lastModified :: Maybe RFC822
eTag :: Maybe ETag
checksumSHA256 :: Maybe Text
checksumSHA1 :: Maybe Text
checksumCRC32C :: Maybe Text
checksumCRC32 :: Maybe Text
$sel:lastModified:CopyPartResult' :: CopyPartResult -> Maybe RFC822
$sel:eTag:CopyPartResult' :: CopyPartResult -> Maybe ETag
$sel:checksumSHA256:CopyPartResult' :: CopyPartResult -> Maybe Text
$sel:checksumSHA1:CopyPartResult' :: CopyPartResult -> Maybe Text
$sel:checksumCRC32C:CopyPartResult' :: CopyPartResult -> Maybe Text
$sel:checksumCRC32:CopyPartResult' :: CopyPartResult -> 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 Maybe ETag
eTag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RFC822
lastModified