{-# 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.ProfilingStatus
-- 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.ProfilingStatus where

import Amazonka.CodeGuruProfiler.Types.AggregatedProfileTime
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Profiling status includes information about the last time a profile
-- agent pinged back, the last time a profile was received, and the
-- aggregation period and start time for the most recent aggregated
-- profile.
--
-- /See:/ 'newProfilingStatus' smart constructor.
data ProfilingStatus = ProfilingStatus'
  { -- | The date and time when the profiling agent most recently pinged back.
    -- Specify 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.
    ProfilingStatus -> Maybe POSIX
latestAgentOrchestratedAt :: Prelude.Maybe Core.POSIX,
    -- | The date and time when the most recent profile was received. Specify
    -- 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.
    ProfilingStatus -> Maybe POSIX
latestAgentProfileReportedAt :: Prelude.Maybe Core.POSIX,
    -- | An
    -- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html AggregatedProfileTime>
    -- object that contains the aggregation period and start time for an
    -- aggregated profile.
    ProfilingStatus -> Maybe AggregatedProfileTime
latestAggregatedProfile :: Prelude.Maybe AggregatedProfileTime
  }
  deriving (ProfilingStatus -> ProfilingStatus -> Bool
(ProfilingStatus -> ProfilingStatus -> Bool)
-> (ProfilingStatus -> ProfilingStatus -> Bool)
-> Eq ProfilingStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProfilingStatus -> ProfilingStatus -> Bool
$c/= :: ProfilingStatus -> ProfilingStatus -> Bool
== :: ProfilingStatus -> ProfilingStatus -> Bool
$c== :: ProfilingStatus -> ProfilingStatus -> Bool
Prelude.Eq, ReadPrec [ProfilingStatus]
ReadPrec ProfilingStatus
Int -> ReadS ProfilingStatus
ReadS [ProfilingStatus]
(Int -> ReadS ProfilingStatus)
-> ReadS [ProfilingStatus]
-> ReadPrec ProfilingStatus
-> ReadPrec [ProfilingStatus]
-> Read ProfilingStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProfilingStatus]
$creadListPrec :: ReadPrec [ProfilingStatus]
readPrec :: ReadPrec ProfilingStatus
$creadPrec :: ReadPrec ProfilingStatus
readList :: ReadS [ProfilingStatus]
$creadList :: ReadS [ProfilingStatus]
readsPrec :: Int -> ReadS ProfilingStatus
$creadsPrec :: Int -> ReadS ProfilingStatus
Prelude.Read, Int -> ProfilingStatus -> ShowS
[ProfilingStatus] -> ShowS
ProfilingStatus -> String
(Int -> ProfilingStatus -> ShowS)
-> (ProfilingStatus -> String)
-> ([ProfilingStatus] -> ShowS)
-> Show ProfilingStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProfilingStatus] -> ShowS
$cshowList :: [ProfilingStatus] -> ShowS
show :: ProfilingStatus -> String
$cshow :: ProfilingStatus -> String
showsPrec :: Int -> ProfilingStatus -> ShowS
$cshowsPrec :: Int -> ProfilingStatus -> ShowS
Prelude.Show, (forall x. ProfilingStatus -> Rep ProfilingStatus x)
-> (forall x. Rep ProfilingStatus x -> ProfilingStatus)
-> Generic ProfilingStatus
forall x. Rep ProfilingStatus x -> ProfilingStatus
forall x. ProfilingStatus -> Rep ProfilingStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProfilingStatus x -> ProfilingStatus
$cfrom :: forall x. ProfilingStatus -> Rep ProfilingStatus x
Prelude.Generic)

-- |
-- Create a value of 'ProfilingStatus' 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:
--
-- 'latestAgentOrchestratedAt', 'profilingStatus_latestAgentOrchestratedAt' - The date and time when the profiling agent most recently pinged back.
-- Specify 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.
--
-- 'latestAgentProfileReportedAt', 'profilingStatus_latestAgentProfileReportedAt' - The date and time when the most recent profile was received. Specify
-- 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.
--
-- 'latestAggregatedProfile', 'profilingStatus_latestAggregatedProfile' - An
-- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html AggregatedProfileTime>
-- object that contains the aggregation period and start time for an
-- aggregated profile.
newProfilingStatus ::
  ProfilingStatus
newProfilingStatus :: ProfilingStatus
newProfilingStatus =
  ProfilingStatus' :: Maybe POSIX
-> Maybe POSIX -> Maybe AggregatedProfileTime -> ProfilingStatus
ProfilingStatus'
    { $sel:latestAgentOrchestratedAt:ProfilingStatus' :: Maybe POSIX
latestAgentOrchestratedAt =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:latestAgentProfileReportedAt:ProfilingStatus' :: Maybe POSIX
latestAgentProfileReportedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:latestAggregatedProfile:ProfilingStatus' :: Maybe AggregatedProfileTime
latestAggregatedProfile = Maybe AggregatedProfileTime
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time when the profiling agent most recently pinged back.
-- Specify 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.
profilingStatus_latestAgentOrchestratedAt :: Lens.Lens' ProfilingStatus (Prelude.Maybe Prelude.UTCTime)
profilingStatus_latestAgentOrchestratedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProfilingStatus -> f ProfilingStatus
profilingStatus_latestAgentOrchestratedAt = (ProfilingStatus -> Maybe POSIX)
-> (ProfilingStatus -> Maybe POSIX -> ProfilingStatus)
-> Lens ProfilingStatus ProfilingStatus (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilingStatus' {Maybe POSIX
latestAgentOrchestratedAt :: Maybe POSIX
$sel:latestAgentOrchestratedAt:ProfilingStatus' :: ProfilingStatus -> Maybe POSIX
latestAgentOrchestratedAt} -> Maybe POSIX
latestAgentOrchestratedAt) (\s :: ProfilingStatus
s@ProfilingStatus' {} Maybe POSIX
a -> ProfilingStatus
s {$sel:latestAgentOrchestratedAt:ProfilingStatus' :: Maybe POSIX
latestAgentOrchestratedAt = Maybe POSIX
a} :: ProfilingStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProfilingStatus -> f ProfilingStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProfilingStatus
-> f ProfilingStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The date and time when the most recent profile was received. Specify
-- 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.
profilingStatus_latestAgentProfileReportedAt :: Lens.Lens' ProfilingStatus (Prelude.Maybe Prelude.UTCTime)
profilingStatus_latestAgentProfileReportedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ProfilingStatus -> f ProfilingStatus
profilingStatus_latestAgentProfileReportedAt = (ProfilingStatus -> Maybe POSIX)
-> (ProfilingStatus -> Maybe POSIX -> ProfilingStatus)
-> Lens ProfilingStatus ProfilingStatus (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilingStatus' {Maybe POSIX
latestAgentProfileReportedAt :: Maybe POSIX
$sel:latestAgentProfileReportedAt:ProfilingStatus' :: ProfilingStatus -> Maybe POSIX
latestAgentProfileReportedAt} -> Maybe POSIX
latestAgentProfileReportedAt) (\s :: ProfilingStatus
s@ProfilingStatus' {} Maybe POSIX
a -> ProfilingStatus
s {$sel:latestAgentProfileReportedAt:ProfilingStatus' :: Maybe POSIX
latestAgentProfileReportedAt = Maybe POSIX
a} :: ProfilingStatus) ((Maybe POSIX -> f (Maybe POSIX))
 -> ProfilingStatus -> f ProfilingStatus)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ProfilingStatus
-> f ProfilingStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | An
-- <https://docs.aws.amazon.com/codeguru/latest/profiler-api/API_AggregatedProfileTime.html AggregatedProfileTime>
-- object that contains the aggregation period and start time for an
-- aggregated profile.
profilingStatus_latestAggregatedProfile :: Lens.Lens' ProfilingStatus (Prelude.Maybe AggregatedProfileTime)
profilingStatus_latestAggregatedProfile :: (Maybe AggregatedProfileTime -> f (Maybe AggregatedProfileTime))
-> ProfilingStatus -> f ProfilingStatus
profilingStatus_latestAggregatedProfile = (ProfilingStatus -> Maybe AggregatedProfileTime)
-> (ProfilingStatus
    -> Maybe AggregatedProfileTime -> ProfilingStatus)
-> Lens
     ProfilingStatus
     ProfilingStatus
     (Maybe AggregatedProfileTime)
     (Maybe AggregatedProfileTime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilingStatus' {Maybe AggregatedProfileTime
latestAggregatedProfile :: Maybe AggregatedProfileTime
$sel:latestAggregatedProfile:ProfilingStatus' :: ProfilingStatus -> Maybe AggregatedProfileTime
latestAggregatedProfile} -> Maybe AggregatedProfileTime
latestAggregatedProfile) (\s :: ProfilingStatus
s@ProfilingStatus' {} Maybe AggregatedProfileTime
a -> ProfilingStatus
s {$sel:latestAggregatedProfile:ProfilingStatus' :: Maybe AggregatedProfileTime
latestAggregatedProfile = Maybe AggregatedProfileTime
a} :: ProfilingStatus)

instance Core.FromJSON ProfilingStatus where
  parseJSON :: Value -> Parser ProfilingStatus
parseJSON =
    String
-> (Object -> Parser ProfilingStatus)
-> Value
-> Parser ProfilingStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProfilingStatus"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX -> Maybe AggregatedProfileTime -> ProfilingStatus
ProfilingStatus'
            (Maybe POSIX
 -> Maybe POSIX -> Maybe AggregatedProfileTime -> ProfilingStatus)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX -> Maybe AggregatedProfileTime -> ProfilingStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"latestAgentOrchestratedAt")
            Parser
  (Maybe POSIX -> Maybe AggregatedProfileTime -> ProfilingStatus)
-> Parser (Maybe POSIX)
-> Parser (Maybe AggregatedProfileTime -> ProfilingStatus)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"latestAgentProfileReportedAt")
            Parser (Maybe AggregatedProfileTime -> ProfilingStatus)
-> Parser (Maybe AggregatedProfileTime) -> Parser ProfilingStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AggregatedProfileTime)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"latestAggregatedProfile")
      )

instance Prelude.Hashable ProfilingStatus

instance Prelude.NFData ProfilingStatus