{-# 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-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)
module Amazonka.S3.Types.CopyPartResult where

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

-- | Container for all response elements.
--
-- /See:/ 'newCopyPartResult' smart constructor.
data CopyPartResult = CopyPartResult'
  { -- | Entity tag of the object.
    CopyPartResult -> Maybe ETag
eTag :: Prelude.Maybe ETag,
    -- | Date and time at which the object was uploaded.
    CopyPartResult -> Maybe ISO8601
lastModified :: Prelude.Maybe Core.ISO8601
  }
  deriving (CopyPartResult -> CopyPartResult -> Bool
(CopyPartResult -> CopyPartResult -> Bool)
-> (CopyPartResult -> CopyPartResult -> Bool) -> Eq CopyPartResult
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]
(Int -> ReadS CopyPartResult)
-> ReadS [CopyPartResult]
-> ReadPrec CopyPartResult
-> ReadPrec [CopyPartResult]
-> Read 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
(Int -> CopyPartResult -> ShowS)
-> (CopyPartResult -> String)
-> ([CopyPartResult] -> ShowS)
-> Show CopyPartResult
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. CopyPartResult -> Rep CopyPartResult x)
-> (forall x. Rep CopyPartResult x -> CopyPartResult)
-> Generic CopyPartResult
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:
--
-- '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' :: Maybe ETag -> Maybe ISO8601 -> CopyPartResult
CopyPartResult'
    { $sel:eTag:CopyPartResult' :: Maybe ETag
eTag = Maybe ETag
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:CopyPartResult' :: Maybe ISO8601
lastModified = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing
    }

-- | Entity tag of the object.
copyPartResult_eTag :: Lens.Lens' CopyPartResult (Prelude.Maybe ETag)
copyPartResult_eTag :: (Maybe ETag -> f (Maybe ETag))
-> CopyPartResult -> f CopyPartResult
copyPartResult_eTag = (CopyPartResult -> Maybe ETag)
-> (CopyPartResult -> Maybe ETag -> CopyPartResult)
-> Lens CopyPartResult CopyPartResult (Maybe ETag) (Maybe 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CopyPartResult -> f CopyPartResult
copyPartResult_lastModified = (CopyPartResult -> Maybe ISO8601)
-> (CopyPartResult -> Maybe ISO8601 -> CopyPartResult)
-> Lens
     CopyPartResult CopyPartResult (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyPartResult' {Maybe ISO8601
lastModified :: Maybe ISO8601
$sel:lastModified:CopyPartResult' :: CopyPartResult -> Maybe ISO8601
lastModified} -> Maybe ISO8601
lastModified) (\s :: CopyPartResult
s@CopyPartResult' {} Maybe ISO8601
a -> CopyPartResult
s {$sel:lastModified:CopyPartResult' :: Maybe ISO8601
lastModified = Maybe ISO8601
a} :: CopyPartResult) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> CopyPartResult -> f CopyPartResult)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CopyPartResult
-> f CopyPartResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.Hashable CopyPartResult

instance Prelude.NFData CopyPartResult