{-# 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.CloudFront.Types.InvalidationSummary
-- 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.CloudFront.Types.InvalidationSummary where

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

-- | A summary of an invalidation request.
--
-- /See:/ 'newInvalidationSummary' smart constructor.
data InvalidationSummary = InvalidationSummary'
  { -- | The unique ID for an invalidation request.
    InvalidationSummary -> Text
id :: Prelude.Text,
    -- | The time that an invalidation request was created.
    InvalidationSummary -> ISO8601
createTime :: Core.ISO8601,
    -- | The status of an invalidation request.
    InvalidationSummary -> Text
status :: Prelude.Text
  }
  deriving (InvalidationSummary -> InvalidationSummary -> Bool
(InvalidationSummary -> InvalidationSummary -> Bool)
-> (InvalidationSummary -> InvalidationSummary -> Bool)
-> Eq InvalidationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvalidationSummary -> InvalidationSummary -> Bool
$c/= :: InvalidationSummary -> InvalidationSummary -> Bool
== :: InvalidationSummary -> InvalidationSummary -> Bool
$c== :: InvalidationSummary -> InvalidationSummary -> Bool
Prelude.Eq, ReadPrec [InvalidationSummary]
ReadPrec InvalidationSummary
Int -> ReadS InvalidationSummary
ReadS [InvalidationSummary]
(Int -> ReadS InvalidationSummary)
-> ReadS [InvalidationSummary]
-> ReadPrec InvalidationSummary
-> ReadPrec [InvalidationSummary]
-> Read InvalidationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InvalidationSummary]
$creadListPrec :: ReadPrec [InvalidationSummary]
readPrec :: ReadPrec InvalidationSummary
$creadPrec :: ReadPrec InvalidationSummary
readList :: ReadS [InvalidationSummary]
$creadList :: ReadS [InvalidationSummary]
readsPrec :: Int -> ReadS InvalidationSummary
$creadsPrec :: Int -> ReadS InvalidationSummary
Prelude.Read, Int -> InvalidationSummary -> ShowS
[InvalidationSummary] -> ShowS
InvalidationSummary -> String
(Int -> InvalidationSummary -> ShowS)
-> (InvalidationSummary -> String)
-> ([InvalidationSummary] -> ShowS)
-> Show InvalidationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvalidationSummary] -> ShowS
$cshowList :: [InvalidationSummary] -> ShowS
show :: InvalidationSummary -> String
$cshow :: InvalidationSummary -> String
showsPrec :: Int -> InvalidationSummary -> ShowS
$cshowsPrec :: Int -> InvalidationSummary -> ShowS
Prelude.Show, (forall x. InvalidationSummary -> Rep InvalidationSummary x)
-> (forall x. Rep InvalidationSummary x -> InvalidationSummary)
-> Generic InvalidationSummary
forall x. Rep InvalidationSummary x -> InvalidationSummary
forall x. InvalidationSummary -> Rep InvalidationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InvalidationSummary x -> InvalidationSummary
$cfrom :: forall x. InvalidationSummary -> Rep InvalidationSummary x
Prelude.Generic)

-- |
-- Create a value of 'InvalidationSummary' 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:
--
-- 'id', 'invalidationSummary_id' - The unique ID for an invalidation request.
--
-- 'createTime', 'invalidationSummary_createTime' - The time that an invalidation request was created.
--
-- 'status', 'invalidationSummary_status' - The status of an invalidation request.
newInvalidationSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'createTime'
  Prelude.UTCTime ->
  -- | 'status'
  Prelude.Text ->
  InvalidationSummary
newInvalidationSummary :: Text -> UTCTime -> Text -> InvalidationSummary
newInvalidationSummary Text
pId_ UTCTime
pCreateTime_ Text
pStatus_ =
  InvalidationSummary' :: Text -> ISO8601 -> Text -> InvalidationSummary
InvalidationSummary'
    { $sel:id:InvalidationSummary' :: Text
id = Text
pId_,
      $sel:createTime:InvalidationSummary' :: ISO8601
createTime = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateTime_,
      $sel:status:InvalidationSummary' :: Text
status = Text
pStatus_
    }

-- | The unique ID for an invalidation request.
invalidationSummary_id :: Lens.Lens' InvalidationSummary Prelude.Text
invalidationSummary_id :: (Text -> f Text) -> InvalidationSummary -> f InvalidationSummary
invalidationSummary_id = (InvalidationSummary -> Text)
-> (InvalidationSummary -> Text -> InvalidationSummary)
-> Lens InvalidationSummary InvalidationSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvalidationSummary' {Text
id :: Text
$sel:id:InvalidationSummary' :: InvalidationSummary -> Text
id} -> Text
id) (\s :: InvalidationSummary
s@InvalidationSummary' {} Text
a -> InvalidationSummary
s {$sel:id:InvalidationSummary' :: Text
id = Text
a} :: InvalidationSummary)

-- | The time that an invalidation request was created.
invalidationSummary_createTime :: Lens.Lens' InvalidationSummary Prelude.UTCTime
invalidationSummary_createTime :: (UTCTime -> f UTCTime)
-> InvalidationSummary -> f InvalidationSummary
invalidationSummary_createTime = (InvalidationSummary -> ISO8601)
-> (InvalidationSummary -> ISO8601 -> InvalidationSummary)
-> Lens InvalidationSummary InvalidationSummary ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvalidationSummary' {ISO8601
createTime :: ISO8601
$sel:createTime:InvalidationSummary' :: InvalidationSummary -> ISO8601
createTime} -> ISO8601
createTime) (\s :: InvalidationSummary
s@InvalidationSummary' {} ISO8601
a -> InvalidationSummary
s {$sel:createTime:InvalidationSummary' :: ISO8601
createTime = ISO8601
a} :: InvalidationSummary) ((ISO8601 -> f ISO8601)
 -> InvalidationSummary -> f InvalidationSummary)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> InvalidationSummary
-> f InvalidationSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The status of an invalidation request.
invalidationSummary_status :: Lens.Lens' InvalidationSummary Prelude.Text
invalidationSummary_status :: (Text -> f Text) -> InvalidationSummary -> f InvalidationSummary
invalidationSummary_status = (InvalidationSummary -> Text)
-> (InvalidationSummary -> Text -> InvalidationSummary)
-> Lens InvalidationSummary InvalidationSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvalidationSummary' {Text
status :: Text
$sel:status:InvalidationSummary' :: InvalidationSummary -> Text
status} -> Text
status) (\s :: InvalidationSummary
s@InvalidationSummary' {} Text
a -> InvalidationSummary
s {$sel:status:InvalidationSummary' :: Text
status = Text
a} :: InvalidationSummary)

instance Core.FromXML InvalidationSummary where
  parseXML :: [Node] -> Either String InvalidationSummary
parseXML [Node]
x =
    Text -> ISO8601 -> Text -> InvalidationSummary
InvalidationSummary'
      (Text -> ISO8601 -> Text -> InvalidationSummary)
-> Either String Text
-> Either String (ISO8601 -> Text -> InvalidationSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
      Either String (ISO8601 -> Text -> InvalidationSummary)
-> Either String ISO8601
-> Either String (Text -> InvalidationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CreateTime")
      Either String (Text -> InvalidationSummary)
-> Either String Text -> Either String InvalidationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Status")

instance Prelude.Hashable InvalidationSummary

instance Prelude.NFData InvalidationSummary