{-# 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.Synthetics.Types.CanaryRunConfigOutput
-- 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.Synthetics.Types.CanaryRunConfigOutput where

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

-- | A structure that contains information about a canary run.
--
-- /See:/ 'newCanaryRunConfigOutput' smart constructor.
data CanaryRunConfigOutput = CanaryRunConfigOutput'
  { -- | How long the canary is allowed to run before it must stop.
    CanaryRunConfigOutput -> Maybe Natural
timeoutInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | Displays whether this canary run used active X-Ray tracing.
    CanaryRunConfigOutput -> Maybe Bool
activeTracing :: Prelude.Maybe Prelude.Bool,
    -- | The maximum amount of memory available to the canary while it is
    -- running, in MB. This value must be a multiple of 64.
    CanaryRunConfigOutput -> Maybe Natural
memoryInMB :: Prelude.Maybe Prelude.Natural
  }
  deriving (CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool
(CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool)
-> (CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool)
-> Eq CanaryRunConfigOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool
$c/= :: CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool
== :: CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool
$c== :: CanaryRunConfigOutput -> CanaryRunConfigOutput -> Bool
Prelude.Eq, ReadPrec [CanaryRunConfigOutput]
ReadPrec CanaryRunConfigOutput
Int -> ReadS CanaryRunConfigOutput
ReadS [CanaryRunConfigOutput]
(Int -> ReadS CanaryRunConfigOutput)
-> ReadS [CanaryRunConfigOutput]
-> ReadPrec CanaryRunConfigOutput
-> ReadPrec [CanaryRunConfigOutput]
-> Read CanaryRunConfigOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CanaryRunConfigOutput]
$creadListPrec :: ReadPrec [CanaryRunConfigOutput]
readPrec :: ReadPrec CanaryRunConfigOutput
$creadPrec :: ReadPrec CanaryRunConfigOutput
readList :: ReadS [CanaryRunConfigOutput]
$creadList :: ReadS [CanaryRunConfigOutput]
readsPrec :: Int -> ReadS CanaryRunConfigOutput
$creadsPrec :: Int -> ReadS CanaryRunConfigOutput
Prelude.Read, Int -> CanaryRunConfigOutput -> ShowS
[CanaryRunConfigOutput] -> ShowS
CanaryRunConfigOutput -> String
(Int -> CanaryRunConfigOutput -> ShowS)
-> (CanaryRunConfigOutput -> String)
-> ([CanaryRunConfigOutput] -> ShowS)
-> Show CanaryRunConfigOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CanaryRunConfigOutput] -> ShowS
$cshowList :: [CanaryRunConfigOutput] -> ShowS
show :: CanaryRunConfigOutput -> String
$cshow :: CanaryRunConfigOutput -> String
showsPrec :: Int -> CanaryRunConfigOutput -> ShowS
$cshowsPrec :: Int -> CanaryRunConfigOutput -> ShowS
Prelude.Show, (forall x. CanaryRunConfigOutput -> Rep CanaryRunConfigOutput x)
-> (forall x. Rep CanaryRunConfigOutput x -> CanaryRunConfigOutput)
-> Generic CanaryRunConfigOutput
forall x. Rep CanaryRunConfigOutput x -> CanaryRunConfigOutput
forall x. CanaryRunConfigOutput -> Rep CanaryRunConfigOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CanaryRunConfigOutput x -> CanaryRunConfigOutput
$cfrom :: forall x. CanaryRunConfigOutput -> Rep CanaryRunConfigOutput x
Prelude.Generic)

-- |
-- Create a value of 'CanaryRunConfigOutput' 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:
--
-- 'timeoutInSeconds', 'canaryRunConfigOutput_timeoutInSeconds' - How long the canary is allowed to run before it must stop.
--
-- 'activeTracing', 'canaryRunConfigOutput_activeTracing' - Displays whether this canary run used active X-Ray tracing.
--
-- 'memoryInMB', 'canaryRunConfigOutput_memoryInMB' - The maximum amount of memory available to the canary while it is
-- running, in MB. This value must be a multiple of 64.
newCanaryRunConfigOutput ::
  CanaryRunConfigOutput
newCanaryRunConfigOutput :: CanaryRunConfigOutput
newCanaryRunConfigOutput =
  CanaryRunConfigOutput' :: Maybe Natural
-> Maybe Bool -> Maybe Natural -> CanaryRunConfigOutput
CanaryRunConfigOutput'
    { $sel:timeoutInSeconds:CanaryRunConfigOutput' :: Maybe Natural
timeoutInSeconds =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:activeTracing:CanaryRunConfigOutput' :: Maybe Bool
activeTracing = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:memoryInMB:CanaryRunConfigOutput' :: Maybe Natural
memoryInMB = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | How long the canary is allowed to run before it must stop.
canaryRunConfigOutput_timeoutInSeconds :: Lens.Lens' CanaryRunConfigOutput (Prelude.Maybe Prelude.Natural)
canaryRunConfigOutput_timeoutInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> CanaryRunConfigOutput -> f CanaryRunConfigOutput
canaryRunConfigOutput_timeoutInSeconds = (CanaryRunConfigOutput -> Maybe Natural)
-> (CanaryRunConfigOutput
    -> Maybe Natural -> CanaryRunConfigOutput)
-> Lens
     CanaryRunConfigOutput
     CanaryRunConfigOutput
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanaryRunConfigOutput' {Maybe Natural
timeoutInSeconds :: Maybe Natural
$sel:timeoutInSeconds:CanaryRunConfigOutput' :: CanaryRunConfigOutput -> Maybe Natural
timeoutInSeconds} -> Maybe Natural
timeoutInSeconds) (\s :: CanaryRunConfigOutput
s@CanaryRunConfigOutput' {} Maybe Natural
a -> CanaryRunConfigOutput
s {$sel:timeoutInSeconds:CanaryRunConfigOutput' :: Maybe Natural
timeoutInSeconds = Maybe Natural
a} :: CanaryRunConfigOutput)

-- | Displays whether this canary run used active X-Ray tracing.
canaryRunConfigOutput_activeTracing :: Lens.Lens' CanaryRunConfigOutput (Prelude.Maybe Prelude.Bool)
canaryRunConfigOutput_activeTracing :: (Maybe Bool -> f (Maybe Bool))
-> CanaryRunConfigOutput -> f CanaryRunConfigOutput
canaryRunConfigOutput_activeTracing = (CanaryRunConfigOutput -> Maybe Bool)
-> (CanaryRunConfigOutput -> Maybe Bool -> CanaryRunConfigOutput)
-> Lens
     CanaryRunConfigOutput
     CanaryRunConfigOutput
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanaryRunConfigOutput' {Maybe Bool
activeTracing :: Maybe Bool
$sel:activeTracing:CanaryRunConfigOutput' :: CanaryRunConfigOutput -> Maybe Bool
activeTracing} -> Maybe Bool
activeTracing) (\s :: CanaryRunConfigOutput
s@CanaryRunConfigOutput' {} Maybe Bool
a -> CanaryRunConfigOutput
s {$sel:activeTracing:CanaryRunConfigOutput' :: Maybe Bool
activeTracing = Maybe Bool
a} :: CanaryRunConfigOutput)

-- | The maximum amount of memory available to the canary while it is
-- running, in MB. This value must be a multiple of 64.
canaryRunConfigOutput_memoryInMB :: Lens.Lens' CanaryRunConfigOutput (Prelude.Maybe Prelude.Natural)
canaryRunConfigOutput_memoryInMB :: (Maybe Natural -> f (Maybe Natural))
-> CanaryRunConfigOutput -> f CanaryRunConfigOutput
canaryRunConfigOutput_memoryInMB = (CanaryRunConfigOutput -> Maybe Natural)
-> (CanaryRunConfigOutput
    -> Maybe Natural -> CanaryRunConfigOutput)
-> Lens
     CanaryRunConfigOutput
     CanaryRunConfigOutput
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CanaryRunConfigOutput' {Maybe Natural
memoryInMB :: Maybe Natural
$sel:memoryInMB:CanaryRunConfigOutput' :: CanaryRunConfigOutput -> Maybe Natural
memoryInMB} -> Maybe Natural
memoryInMB) (\s :: CanaryRunConfigOutput
s@CanaryRunConfigOutput' {} Maybe Natural
a -> CanaryRunConfigOutput
s {$sel:memoryInMB:CanaryRunConfigOutput' :: Maybe Natural
memoryInMB = Maybe Natural
a} :: CanaryRunConfigOutput)

instance Core.FromJSON CanaryRunConfigOutput where
  parseJSON :: Value -> Parser CanaryRunConfigOutput
parseJSON =
    String
-> (Object -> Parser CanaryRunConfigOutput)
-> Value
-> Parser CanaryRunConfigOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CanaryRunConfigOutput"
      ( \Object
x ->
          Maybe Natural
-> Maybe Bool -> Maybe Natural -> CanaryRunConfigOutput
CanaryRunConfigOutput'
            (Maybe Natural
 -> Maybe Bool -> Maybe Natural -> CanaryRunConfigOutput)
-> Parser (Maybe Natural)
-> Parser (Maybe Bool -> Maybe Natural -> CanaryRunConfigOutput)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimeoutInSeconds")
            Parser (Maybe Bool -> Maybe Natural -> CanaryRunConfigOutput)
-> Parser (Maybe Bool)
-> Parser (Maybe Natural -> CanaryRunConfigOutput)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ActiveTracing")
            Parser (Maybe Natural -> CanaryRunConfigOutput)
-> Parser (Maybe Natural) -> Parser CanaryRunConfigOutput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MemoryInMB")
      )

instance Prelude.Hashable CanaryRunConfigOutput

instance Prelude.NFData CanaryRunConfigOutput