{-# 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.CodeGuruProfiler.Types.TimestampStructure
-- 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.CodeGuruProfiler.Types.TimestampStructure where

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

-- | A data type that contains a @Timestamp@ object. This is specified using
-- the ISO 8601 format. For example, 2020-06-01T13:15:02.001Z represents 1
-- millisecond past June 1, 2020 1:15:02 PM UTC.
--
-- /See:/ 'newTimestampStructure' smart constructor.
data TimestampStructure = TimestampStructure'
  { -- | A @Timestamp@. This is specified using the ISO 8601 format. For example,
    -- 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020
    -- 1:15:02 PM UTC.
    TimestampStructure -> POSIX
value :: Core.POSIX
  }
  deriving (TimestampStructure -> TimestampStructure -> Bool
(TimestampStructure -> TimestampStructure -> Bool)
-> (TimestampStructure -> TimestampStructure -> Bool)
-> Eq TimestampStructure
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestampStructure -> TimestampStructure -> Bool
$c/= :: TimestampStructure -> TimestampStructure -> Bool
== :: TimestampStructure -> TimestampStructure -> Bool
$c== :: TimestampStructure -> TimestampStructure -> Bool
Prelude.Eq, ReadPrec [TimestampStructure]
ReadPrec TimestampStructure
Int -> ReadS TimestampStructure
ReadS [TimestampStructure]
(Int -> ReadS TimestampStructure)
-> ReadS [TimestampStructure]
-> ReadPrec TimestampStructure
-> ReadPrec [TimestampStructure]
-> Read TimestampStructure
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestampStructure]
$creadListPrec :: ReadPrec [TimestampStructure]
readPrec :: ReadPrec TimestampStructure
$creadPrec :: ReadPrec TimestampStructure
readList :: ReadS [TimestampStructure]
$creadList :: ReadS [TimestampStructure]
readsPrec :: Int -> ReadS TimestampStructure
$creadsPrec :: Int -> ReadS TimestampStructure
Prelude.Read, Int -> TimestampStructure -> ShowS
[TimestampStructure] -> ShowS
TimestampStructure -> String
(Int -> TimestampStructure -> ShowS)
-> (TimestampStructure -> String)
-> ([TimestampStructure] -> ShowS)
-> Show TimestampStructure
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestampStructure] -> ShowS
$cshowList :: [TimestampStructure] -> ShowS
show :: TimestampStructure -> String
$cshow :: TimestampStructure -> String
showsPrec :: Int -> TimestampStructure -> ShowS
$cshowsPrec :: Int -> TimestampStructure -> ShowS
Prelude.Show, (forall x. TimestampStructure -> Rep TimestampStructure x)
-> (forall x. Rep TimestampStructure x -> TimestampStructure)
-> Generic TimestampStructure
forall x. Rep TimestampStructure x -> TimestampStructure
forall x. TimestampStructure -> Rep TimestampStructure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestampStructure x -> TimestampStructure
$cfrom :: forall x. TimestampStructure -> Rep TimestampStructure x
Prelude.Generic)

-- |
-- Create a value of 'TimestampStructure' 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:
--
-- 'value', 'timestampStructure_value' - A @Timestamp@. This is specified using the ISO 8601 format. For example,
-- 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020
-- 1:15:02 PM UTC.
newTimestampStructure ::
  -- | 'value'
  Prelude.UTCTime ->
  TimestampStructure
newTimestampStructure :: UTCTime -> TimestampStructure
newTimestampStructure UTCTime
pValue_ =
  TimestampStructure' :: POSIX -> TimestampStructure
TimestampStructure'
    { $sel:value:TimestampStructure' :: POSIX
value =
        Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pValue_
    }

-- | A @Timestamp@. This is specified using the ISO 8601 format. For example,
-- 2020-06-01T13:15:02.001Z represents 1 millisecond past June 1, 2020
-- 1:15:02 PM UTC.
timestampStructure_value :: Lens.Lens' TimestampStructure Prelude.UTCTime
timestampStructure_value :: (UTCTime -> f UTCTime)
-> TimestampStructure -> f TimestampStructure
timestampStructure_value = (TimestampStructure -> POSIX)
-> (TimestampStructure -> POSIX -> TimestampStructure)
-> Lens TimestampStructure TimestampStructure POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestampStructure' {POSIX
value :: POSIX
$sel:value:TimestampStructure' :: TimestampStructure -> POSIX
value} -> POSIX
value) (\s :: TimestampStructure
s@TimestampStructure' {} POSIX
a -> TimestampStructure
s {$sel:value:TimestampStructure' :: POSIX
value = POSIX
a} :: TimestampStructure) ((POSIX -> f POSIX) -> TimestampStructure -> f TimestampStructure)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> TimestampStructure
-> f TimestampStructure
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON TimestampStructure where
  parseJSON :: Value -> Parser TimestampStructure
parseJSON =
    String
-> (Object -> Parser TimestampStructure)
-> Value
-> Parser TimestampStructure
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TimestampStructure"
      ( \Object
x ->
          POSIX -> TimestampStructure
TimestampStructure' (POSIX -> TimestampStructure)
-> Parser POSIX -> Parser TimestampStructure
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"value")
      )

instance Prelude.Hashable TimestampStructure

instance Prelude.NFData TimestampStructure