{-# 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.CopyObjectResult
-- 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.CopyObjectResult 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:/ 'newCopyObjectResult' smart constructor.
data CopyObjectResult = CopyObjectResult'
  { -- | 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/.
    CopyObjectResult -> 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/.
    CopyObjectResult -> 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/.
    CopyObjectResult -> 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/.
    CopyObjectResult -> Maybe Text
checksumSHA256 :: Prelude.Maybe Prelude.Text,
    -- | Returns the ETag of the new object. The ETag reflects only changes to
    -- the contents of an object, not its metadata.
    CopyObjectResult -> Maybe ETag
eTag :: Prelude.Maybe ETag,
    -- | Creation date of the object.
    CopyObjectResult -> Maybe RFC822
lastModified :: Prelude.Maybe Data.RFC822
  }
  deriving (CopyObjectResult -> CopyObjectResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyObjectResult -> CopyObjectResult -> Bool
$c/= :: CopyObjectResult -> CopyObjectResult -> Bool
== :: CopyObjectResult -> CopyObjectResult -> Bool
$c== :: CopyObjectResult -> CopyObjectResult -> Bool
Prelude.Eq, ReadPrec [CopyObjectResult]
ReadPrec CopyObjectResult
Int -> ReadS CopyObjectResult
ReadS [CopyObjectResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyObjectResult]
$creadListPrec :: ReadPrec [CopyObjectResult]
readPrec :: ReadPrec CopyObjectResult
$creadPrec :: ReadPrec CopyObjectResult
readList :: ReadS [CopyObjectResult]
$creadList :: ReadS [CopyObjectResult]
readsPrec :: Int -> ReadS CopyObjectResult
$creadsPrec :: Int -> ReadS CopyObjectResult
Prelude.Read, Int -> CopyObjectResult -> ShowS
[CopyObjectResult] -> ShowS
CopyObjectResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyObjectResult] -> ShowS
$cshowList :: [CopyObjectResult] -> ShowS
show :: CopyObjectResult -> String
$cshow :: CopyObjectResult -> String
showsPrec :: Int -> CopyObjectResult -> ShowS
$cshowsPrec :: Int -> CopyObjectResult -> ShowS
Prelude.Show, forall x. Rep CopyObjectResult x -> CopyObjectResult
forall x. CopyObjectResult -> Rep CopyObjectResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyObjectResult x -> CopyObjectResult
$cfrom :: forall x. CopyObjectResult -> Rep CopyObjectResult x
Prelude.Generic)

-- |
-- Create a value of 'CopyObjectResult' 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', 'copyObjectResult_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', 'copyObjectResult_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', 'copyObjectResult_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', 'copyObjectResult_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', 'copyObjectResult_eTag' - Returns the ETag of the new object. The ETag reflects only changes to
-- the contents of an object, not its metadata.
--
-- 'lastModified', 'copyObjectResult_lastModified' - Creation date of the object.
newCopyObjectResult ::
  CopyObjectResult
newCopyObjectResult :: CopyObjectResult
newCopyObjectResult =
  CopyObjectResult'
    { $sel:checksumCRC32:CopyObjectResult' :: Maybe Text
checksumCRC32 = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumCRC32C:CopyObjectResult' :: Maybe Text
checksumCRC32C = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumSHA1:CopyObjectResult' :: Maybe Text
checksumSHA1 = forall a. Maybe a
Prelude.Nothing,
      $sel:checksumSHA256:CopyObjectResult' :: Maybe Text
checksumSHA256 = forall a. Maybe a
Prelude.Nothing,
      $sel:eTag:CopyObjectResult' :: Maybe ETag
eTag = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:CopyObjectResult' :: 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/.
copyObjectResult_checksumCRC32 :: Lens.Lens' CopyObjectResult (Prelude.Maybe Prelude.Text)
copyObjectResult_checksumCRC32 :: Lens' CopyObjectResult (Maybe Text)
copyObjectResult_checksumCRC32 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyObjectResult' {Maybe Text
checksumCRC32 :: Maybe Text
$sel:checksumCRC32:CopyObjectResult' :: CopyObjectResult -> Maybe Text
checksumCRC32} -> Maybe Text
checksumCRC32) (\s :: CopyObjectResult
s@CopyObjectResult' {} Maybe Text
a -> CopyObjectResult
s {$sel:checksumCRC32:CopyObjectResult' :: Maybe Text
checksumCRC32 = Maybe Text
a} :: CopyObjectResult)

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

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

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

-- | Returns the ETag of the new object. The ETag reflects only changes to
-- the contents of an object, not its metadata.
copyObjectResult_eTag :: Lens.Lens' CopyObjectResult (Prelude.Maybe ETag)
copyObjectResult_eTag :: Lens' CopyObjectResult (Maybe ETag)
copyObjectResult_eTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyObjectResult' {Maybe ETag
eTag :: Maybe ETag
$sel:eTag:CopyObjectResult' :: CopyObjectResult -> Maybe ETag
eTag} -> Maybe ETag
eTag) (\s :: CopyObjectResult
s@CopyObjectResult' {} Maybe ETag
a -> CopyObjectResult
s {$sel:eTag:CopyObjectResult' :: Maybe ETag
eTag = Maybe ETag
a} :: CopyObjectResult)

-- | Creation date of the object.
copyObjectResult_lastModified :: Lens.Lens' CopyObjectResult (Prelude.Maybe Prelude.UTCTime)
copyObjectResult_lastModified :: Lens' CopyObjectResult (Maybe UTCTime)
copyObjectResult_lastModified = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyObjectResult' {Maybe RFC822
lastModified :: Maybe RFC822
$sel:lastModified:CopyObjectResult' :: CopyObjectResult -> Maybe RFC822
lastModified} -> Maybe RFC822
lastModified) (\s :: CopyObjectResult
s@CopyObjectResult' {} Maybe RFC822
a -> CopyObjectResult
s {$sel:lastModified:CopyObjectResult' :: Maybe RFC822
lastModified = Maybe RFC822
a} :: CopyObjectResult) 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 CopyObjectResult where
  parseXML :: [Node] -> Either String CopyObjectResult
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ETag
-> Maybe RFC822
-> CopyObjectResult
CopyObjectResult'
      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 CopyObjectResult where
  hashWithSalt :: Int -> CopyObjectResult -> Int
hashWithSalt Int
_salt CopyObjectResult' {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:CopyObjectResult' :: CopyObjectResult -> Maybe RFC822
$sel:eTag:CopyObjectResult' :: CopyObjectResult -> Maybe ETag
$sel:checksumSHA256:CopyObjectResult' :: CopyObjectResult -> Maybe Text
$sel:checksumSHA1:CopyObjectResult' :: CopyObjectResult -> Maybe Text
$sel:checksumCRC32C:CopyObjectResult' :: CopyObjectResult -> Maybe Text
$sel:checksumCRC32:CopyObjectResult' :: CopyObjectResult -> 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 CopyObjectResult where
  rnf :: CopyObjectResult -> ()
rnf CopyObjectResult' {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:CopyObjectResult' :: CopyObjectResult -> Maybe RFC822
$sel:eTag:CopyObjectResult' :: CopyObjectResult -> Maybe ETag
$sel:checksumSHA256:CopyObjectResult' :: CopyObjectResult -> Maybe Text
$sel:checksumSHA1:CopyObjectResult' :: CopyObjectResult -> Maybe Text
$sel:checksumCRC32C:CopyObjectResult' :: CopyObjectResult -> Maybe Text
$sel:checksumCRC32:CopyObjectResult' :: CopyObjectResult -> 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