{-# 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.FIS.Types.ExperimentSummary
-- 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.FIS.Types.ExperimentSummary where

import qualified Amazonka.Core as Core
import Amazonka.FIS.Types.ExperimentState
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides a summary of an experiment.
--
-- /See:/ 'newExperimentSummary' smart constructor.
data ExperimentSummary = ExperimentSummary'
  { -- | The time that the experiment was created.
    ExperimentSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The ID of the experiment template.
    ExperimentSummary -> Maybe Text
experimentTemplateId :: Prelude.Maybe Prelude.Text,
    -- | The state of the experiment.
    ExperimentSummary -> Maybe ExperimentState
state :: Prelude.Maybe ExperimentState,
    -- | The ID of the experiment.
    ExperimentSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The tags for the experiment.
    ExperimentSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (ExperimentSummary -> ExperimentSummary -> Bool
(ExperimentSummary -> ExperimentSummary -> Bool)
-> (ExperimentSummary -> ExperimentSummary -> Bool)
-> Eq ExperimentSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExperimentSummary -> ExperimentSummary -> Bool
$c/= :: ExperimentSummary -> ExperimentSummary -> Bool
== :: ExperimentSummary -> ExperimentSummary -> Bool
$c== :: ExperimentSummary -> ExperimentSummary -> Bool
Prelude.Eq, ReadPrec [ExperimentSummary]
ReadPrec ExperimentSummary
Int -> ReadS ExperimentSummary
ReadS [ExperimentSummary]
(Int -> ReadS ExperimentSummary)
-> ReadS [ExperimentSummary]
-> ReadPrec ExperimentSummary
-> ReadPrec [ExperimentSummary]
-> Read ExperimentSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExperimentSummary]
$creadListPrec :: ReadPrec [ExperimentSummary]
readPrec :: ReadPrec ExperimentSummary
$creadPrec :: ReadPrec ExperimentSummary
readList :: ReadS [ExperimentSummary]
$creadList :: ReadS [ExperimentSummary]
readsPrec :: Int -> ReadS ExperimentSummary
$creadsPrec :: Int -> ReadS ExperimentSummary
Prelude.Read, Int -> ExperimentSummary -> ShowS
[ExperimentSummary] -> ShowS
ExperimentSummary -> String
(Int -> ExperimentSummary -> ShowS)
-> (ExperimentSummary -> String)
-> ([ExperimentSummary] -> ShowS)
-> Show ExperimentSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExperimentSummary] -> ShowS
$cshowList :: [ExperimentSummary] -> ShowS
show :: ExperimentSummary -> String
$cshow :: ExperimentSummary -> String
showsPrec :: Int -> ExperimentSummary -> ShowS
$cshowsPrec :: Int -> ExperimentSummary -> ShowS
Prelude.Show, (forall x. ExperimentSummary -> Rep ExperimentSummary x)
-> (forall x. Rep ExperimentSummary x -> ExperimentSummary)
-> Generic ExperimentSummary
forall x. Rep ExperimentSummary x -> ExperimentSummary
forall x. ExperimentSummary -> Rep ExperimentSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExperimentSummary x -> ExperimentSummary
$cfrom :: forall x. ExperimentSummary -> Rep ExperimentSummary x
Prelude.Generic)

-- |
-- Create a value of 'ExperimentSummary' 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:
--
-- 'creationTime', 'experimentSummary_creationTime' - The time that the experiment was created.
--
-- 'experimentTemplateId', 'experimentSummary_experimentTemplateId' - The ID of the experiment template.
--
-- 'state', 'experimentSummary_state' - The state of the experiment.
--
-- 'id', 'experimentSummary_id' - The ID of the experiment.
--
-- 'tags', 'experimentSummary_tags' - The tags for the experiment.
newExperimentSummary ::
  ExperimentSummary
newExperimentSummary :: ExperimentSummary
newExperimentSummary =
  ExperimentSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe ExperimentState
-> Maybe Text
-> Maybe (HashMap Text Text)
-> ExperimentSummary
ExperimentSummary'
    { $sel:creationTime:ExperimentSummary' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:experimentTemplateId:ExperimentSummary' :: Maybe Text
experimentTemplateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:state:ExperimentSummary' :: Maybe ExperimentState
state = Maybe ExperimentState
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ExperimentSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ExperimentSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The time that the experiment was created.
experimentSummary_creationTime :: Lens.Lens' ExperimentSummary (Prelude.Maybe Prelude.UTCTime)
experimentSummary_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ExperimentSummary -> f ExperimentSummary
experimentSummary_creationTime = (ExperimentSummary -> Maybe POSIX)
-> (ExperimentSummary -> Maybe POSIX -> ExperimentSummary)
-> Lens
     ExperimentSummary ExperimentSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:ExperimentSummary' :: ExperimentSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: ExperimentSummary
s@ExperimentSummary' {} Maybe POSIX
a -> ExperimentSummary
s {$sel:creationTime:ExperimentSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: ExperimentSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ExperimentSummary -> f ExperimentSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ExperimentSummary
-> f ExperimentSummary
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 ID of the experiment template.
experimentSummary_experimentTemplateId :: Lens.Lens' ExperimentSummary (Prelude.Maybe Prelude.Text)
experimentSummary_experimentTemplateId :: (Maybe Text -> f (Maybe Text))
-> ExperimentSummary -> f ExperimentSummary
experimentSummary_experimentTemplateId = (ExperimentSummary -> Maybe Text)
-> (ExperimentSummary -> Maybe Text -> ExperimentSummary)
-> Lens
     ExperimentSummary ExperimentSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentSummary' {Maybe Text
experimentTemplateId :: Maybe Text
$sel:experimentTemplateId:ExperimentSummary' :: ExperimentSummary -> Maybe Text
experimentTemplateId} -> Maybe Text
experimentTemplateId) (\s :: ExperimentSummary
s@ExperimentSummary' {} Maybe Text
a -> ExperimentSummary
s {$sel:experimentTemplateId:ExperimentSummary' :: Maybe Text
experimentTemplateId = Maybe Text
a} :: ExperimentSummary)

-- | The state of the experiment.
experimentSummary_state :: Lens.Lens' ExperimentSummary (Prelude.Maybe ExperimentState)
experimentSummary_state :: (Maybe ExperimentState -> f (Maybe ExperimentState))
-> ExperimentSummary -> f ExperimentSummary
experimentSummary_state = (ExperimentSummary -> Maybe ExperimentState)
-> (ExperimentSummary
    -> Maybe ExperimentState -> ExperimentSummary)
-> Lens
     ExperimentSummary
     ExperimentSummary
     (Maybe ExperimentState)
     (Maybe ExperimentState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentSummary' {Maybe ExperimentState
state :: Maybe ExperimentState
$sel:state:ExperimentSummary' :: ExperimentSummary -> Maybe ExperimentState
state} -> Maybe ExperimentState
state) (\s :: ExperimentSummary
s@ExperimentSummary' {} Maybe ExperimentState
a -> ExperimentSummary
s {$sel:state:ExperimentSummary' :: Maybe ExperimentState
state = Maybe ExperimentState
a} :: ExperimentSummary)

-- | The ID of the experiment.
experimentSummary_id :: Lens.Lens' ExperimentSummary (Prelude.Maybe Prelude.Text)
experimentSummary_id :: (Maybe Text -> f (Maybe Text))
-> ExperimentSummary -> f ExperimentSummary
experimentSummary_id = (ExperimentSummary -> Maybe Text)
-> (ExperimentSummary -> Maybe Text -> ExperimentSummary)
-> Lens
     ExperimentSummary ExperimentSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentSummary' {Maybe Text
id :: Maybe Text
$sel:id:ExperimentSummary' :: ExperimentSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: ExperimentSummary
s@ExperimentSummary' {} Maybe Text
a -> ExperimentSummary
s {$sel:id:ExperimentSummary' :: Maybe Text
id = Maybe Text
a} :: ExperimentSummary)

-- | The tags for the experiment.
experimentSummary_tags :: Lens.Lens' ExperimentSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
experimentSummary_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ExperimentSummary -> f ExperimentSummary
experimentSummary_tags = (ExperimentSummary -> Maybe (HashMap Text Text))
-> (ExperimentSummary
    -> Maybe (HashMap Text Text) -> ExperimentSummary)
-> Lens
     ExperimentSummary
     ExperimentSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ExperimentSummary' :: ExperimentSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ExperimentSummary
s@ExperimentSummary' {} Maybe (HashMap Text Text)
a -> ExperimentSummary
s {$sel:tags:ExperimentSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ExperimentSummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ExperimentSummary -> f ExperimentSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ExperimentSummary
-> f ExperimentSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ExperimentSummary where
  parseJSON :: Value -> Parser ExperimentSummary
parseJSON =
    String
-> (Object -> Parser ExperimentSummary)
-> Value
-> Parser ExperimentSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExperimentSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe ExperimentState
-> Maybe Text
-> Maybe (HashMap Text Text)
-> ExperimentSummary
ExperimentSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe ExperimentState
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> ExperimentSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe ExperimentState
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> ExperimentSummary)
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
"creationTime")
            Parser
  (Maybe Text
   -> Maybe ExperimentState
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> ExperimentSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe ExperimentState
      -> Maybe Text -> Maybe (HashMap Text Text) -> ExperimentSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"experimentTemplateId")
            Parser
  (Maybe ExperimentState
   -> Maybe Text -> Maybe (HashMap Text Text) -> ExperimentSummary)
-> Parser (Maybe ExperimentState)
-> Parser
     (Maybe Text -> Maybe (HashMap Text Text) -> ExperimentSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ExperimentState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe Text -> Maybe (HashMap Text Text) -> ExperimentSummary)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> ExperimentSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
            Parser (Maybe (HashMap Text Text) -> ExperimentSummary)
-> Parser (Maybe (HashMap Text Text)) -> Parser ExperimentSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ExperimentSummary

instance Prelude.NFData ExperimentSummary