{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 ISO8601
latestAgentOrchestratedAt :: Prelude.Maybe Data.ISO8601,
    -- | 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 ISO8601
latestAgentProfileReportedAt :: Prelude.Maybe Data.ISO8601,
    -- | 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
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]
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
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. 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'
    { $sel:latestAgentOrchestratedAt:ProfilingStatus' :: Maybe ISO8601
latestAgentOrchestratedAt =
        forall a. Maybe a
Prelude.Nothing,
      $sel:latestAgentProfileReportedAt:ProfilingStatus' :: Maybe ISO8601
latestAgentProfileReportedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:latestAggregatedProfile:ProfilingStatus' :: Maybe AggregatedProfileTime
latestAggregatedProfile = 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 :: Lens' ProfilingStatus (Maybe UTCTime)
profilingStatus_latestAgentOrchestratedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilingStatus' {Maybe ISO8601
latestAgentOrchestratedAt :: Maybe ISO8601
$sel:latestAgentOrchestratedAt:ProfilingStatus' :: ProfilingStatus -> Maybe ISO8601
latestAgentOrchestratedAt} -> Maybe ISO8601
latestAgentOrchestratedAt) (\s :: ProfilingStatus
s@ProfilingStatus' {} Maybe ISO8601
a -> ProfilingStatus
s {$sel:latestAgentOrchestratedAt:ProfilingStatus' :: Maybe ISO8601
latestAgentOrchestratedAt = Maybe ISO8601
a} :: ProfilingStatus) 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

-- | 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 :: Lens' ProfilingStatus (Maybe UTCTime)
profilingStatus_latestAgentProfileReportedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProfilingStatus' {Maybe ISO8601
latestAgentProfileReportedAt :: Maybe ISO8601
$sel:latestAgentProfileReportedAt:ProfilingStatus' :: ProfilingStatus -> Maybe ISO8601
latestAgentProfileReportedAt} -> Maybe ISO8601
latestAgentProfileReportedAt) (\s :: ProfilingStatus
s@ProfilingStatus' {} Maybe ISO8601
a -> ProfilingStatus
s {$sel:latestAgentProfileReportedAt:ProfilingStatus' :: Maybe ISO8601
latestAgentProfileReportedAt = Maybe ISO8601
a} :: ProfilingStatus) 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

-- | 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 :: Lens' ProfilingStatus (Maybe AggregatedProfileTime)
profilingStatus_latestAggregatedProfile = 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 Data.FromJSON ProfilingStatus where
  parseJSON :: Value -> Parser ProfilingStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProfilingStatus"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe ISO8601 -> Maybe AggregatedProfileTime -> ProfilingStatus
ProfilingStatus'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"latestAgentOrchestratedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"latestAgentProfileReportedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"latestAggregatedProfile")
      )

instance Prelude.Hashable ProfilingStatus where
  hashWithSalt :: Int -> ProfilingStatus -> Int
hashWithSalt Int
_salt ProfilingStatus' {Maybe ISO8601
Maybe AggregatedProfileTime
latestAggregatedProfile :: Maybe AggregatedProfileTime
latestAgentProfileReportedAt :: Maybe ISO8601
latestAgentOrchestratedAt :: Maybe ISO8601
$sel:latestAggregatedProfile:ProfilingStatus' :: ProfilingStatus -> Maybe AggregatedProfileTime
$sel:latestAgentProfileReportedAt:ProfilingStatus' :: ProfilingStatus -> Maybe ISO8601
$sel:latestAgentOrchestratedAt:ProfilingStatus' :: ProfilingStatus -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
latestAgentOrchestratedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
latestAgentProfileReportedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AggregatedProfileTime
latestAggregatedProfile

instance Prelude.NFData ProfilingStatus where
  rnf :: ProfilingStatus -> ()
rnf ProfilingStatus' {Maybe ISO8601
Maybe AggregatedProfileTime
latestAggregatedProfile :: Maybe AggregatedProfileTime
latestAgentProfileReportedAt :: Maybe ISO8601
latestAgentOrchestratedAt :: Maybe ISO8601
$sel:latestAggregatedProfile:ProfilingStatus' :: ProfilingStatus -> Maybe AggregatedProfileTime
$sel:latestAgentProfileReportedAt:ProfilingStatus' :: ProfilingStatus -> Maybe ISO8601
$sel:latestAgentOrchestratedAt:ProfilingStatus' :: ProfilingStatus -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
latestAgentOrchestratedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
latestAgentProfileReportedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AggregatedProfileTime
latestAggregatedProfile