{-# 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.ApplicationInsights.Types.RelatedObservations
-- 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.ApplicationInsights.Types.RelatedObservations where

import Amazonka.ApplicationInsights.Types.Observation
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes observations related to the problem.
--
-- /See:/ 'newRelatedObservations' smart constructor.
data RelatedObservations = RelatedObservations'
  { -- | The list of observations related to the problem.
    RelatedObservations -> Maybe [Observation]
observationList :: Prelude.Maybe [Observation]
  }
  deriving (RelatedObservations -> RelatedObservations -> Bool
(RelatedObservations -> RelatedObservations -> Bool)
-> (RelatedObservations -> RelatedObservations -> Bool)
-> Eq RelatedObservations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RelatedObservations -> RelatedObservations -> Bool
$c/= :: RelatedObservations -> RelatedObservations -> Bool
== :: RelatedObservations -> RelatedObservations -> Bool
$c== :: RelatedObservations -> RelatedObservations -> Bool
Prelude.Eq, ReadPrec [RelatedObservations]
ReadPrec RelatedObservations
Int -> ReadS RelatedObservations
ReadS [RelatedObservations]
(Int -> ReadS RelatedObservations)
-> ReadS [RelatedObservations]
-> ReadPrec RelatedObservations
-> ReadPrec [RelatedObservations]
-> Read RelatedObservations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RelatedObservations]
$creadListPrec :: ReadPrec [RelatedObservations]
readPrec :: ReadPrec RelatedObservations
$creadPrec :: ReadPrec RelatedObservations
readList :: ReadS [RelatedObservations]
$creadList :: ReadS [RelatedObservations]
readsPrec :: Int -> ReadS RelatedObservations
$creadsPrec :: Int -> ReadS RelatedObservations
Prelude.Read, Int -> RelatedObservations -> ShowS
[RelatedObservations] -> ShowS
RelatedObservations -> String
(Int -> RelatedObservations -> ShowS)
-> (RelatedObservations -> String)
-> ([RelatedObservations] -> ShowS)
-> Show RelatedObservations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RelatedObservations] -> ShowS
$cshowList :: [RelatedObservations] -> ShowS
show :: RelatedObservations -> String
$cshow :: RelatedObservations -> String
showsPrec :: Int -> RelatedObservations -> ShowS
$cshowsPrec :: Int -> RelatedObservations -> ShowS
Prelude.Show, (forall x. RelatedObservations -> Rep RelatedObservations x)
-> (forall x. Rep RelatedObservations x -> RelatedObservations)
-> Generic RelatedObservations
forall x. Rep RelatedObservations x -> RelatedObservations
forall x. RelatedObservations -> Rep RelatedObservations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RelatedObservations x -> RelatedObservations
$cfrom :: forall x. RelatedObservations -> Rep RelatedObservations x
Prelude.Generic)

-- |
-- Create a value of 'RelatedObservations' 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:
--
-- 'observationList', 'relatedObservations_observationList' - The list of observations related to the problem.
newRelatedObservations ::
  RelatedObservations
newRelatedObservations :: RelatedObservations
newRelatedObservations =
  RelatedObservations' :: Maybe [Observation] -> RelatedObservations
RelatedObservations'
    { $sel:observationList:RelatedObservations' :: Maybe [Observation]
observationList =
        Maybe [Observation]
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of observations related to the problem.
relatedObservations_observationList :: Lens.Lens' RelatedObservations (Prelude.Maybe [Observation])
relatedObservations_observationList :: (Maybe [Observation] -> f (Maybe [Observation]))
-> RelatedObservations -> f RelatedObservations
relatedObservations_observationList = (RelatedObservations -> Maybe [Observation])
-> (RelatedObservations
    -> Maybe [Observation] -> RelatedObservations)
-> Lens
     RelatedObservations
     RelatedObservations
     (Maybe [Observation])
     (Maybe [Observation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RelatedObservations' {Maybe [Observation]
observationList :: Maybe [Observation]
$sel:observationList:RelatedObservations' :: RelatedObservations -> Maybe [Observation]
observationList} -> Maybe [Observation]
observationList) (\s :: RelatedObservations
s@RelatedObservations' {} Maybe [Observation]
a -> RelatedObservations
s {$sel:observationList:RelatedObservations' :: Maybe [Observation]
observationList = Maybe [Observation]
a} :: RelatedObservations) ((Maybe [Observation] -> f (Maybe [Observation]))
 -> RelatedObservations -> f RelatedObservations)
-> ((Maybe [Observation] -> f (Maybe [Observation]))
    -> Maybe [Observation] -> f (Maybe [Observation]))
-> (Maybe [Observation] -> f (Maybe [Observation]))
-> RelatedObservations
-> f RelatedObservations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Observation] [Observation] [Observation] [Observation]
-> Iso
     (Maybe [Observation])
     (Maybe [Observation])
     (Maybe [Observation])
     (Maybe [Observation])
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 [Observation] [Observation] [Observation] [Observation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON RelatedObservations where
  parseJSON :: Value -> Parser RelatedObservations
parseJSON =
    String
-> (Object -> Parser RelatedObservations)
-> Value
-> Parser RelatedObservations
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RelatedObservations"
      ( \Object
x ->
          Maybe [Observation] -> RelatedObservations
RelatedObservations'
            (Maybe [Observation] -> RelatedObservations)
-> Parser (Maybe [Observation]) -> Parser RelatedObservations
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Observation]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ObservationList"
                            Parser (Maybe (Maybe [Observation]))
-> Maybe [Observation] -> Parser (Maybe [Observation])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Observation]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable RelatedObservations

instance Prelude.NFData RelatedObservations