{-# 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.SageMaker.Types.CaptureOption
-- 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.SageMaker.Types.CaptureOption where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.CaptureMode

-- |
--
-- /See:/ 'newCaptureOption' smart constructor.
data CaptureOption = CaptureOption'
  { CaptureOption -> CaptureMode
captureMode :: CaptureMode
  }
  deriving (CaptureOption -> CaptureOption -> Bool
(CaptureOption -> CaptureOption -> Bool)
-> (CaptureOption -> CaptureOption -> Bool) -> Eq CaptureOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptureOption -> CaptureOption -> Bool
$c/= :: CaptureOption -> CaptureOption -> Bool
== :: CaptureOption -> CaptureOption -> Bool
$c== :: CaptureOption -> CaptureOption -> Bool
Prelude.Eq, ReadPrec [CaptureOption]
ReadPrec CaptureOption
Int -> ReadS CaptureOption
ReadS [CaptureOption]
(Int -> ReadS CaptureOption)
-> ReadS [CaptureOption]
-> ReadPrec CaptureOption
-> ReadPrec [CaptureOption]
-> Read CaptureOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptureOption]
$creadListPrec :: ReadPrec [CaptureOption]
readPrec :: ReadPrec CaptureOption
$creadPrec :: ReadPrec CaptureOption
readList :: ReadS [CaptureOption]
$creadList :: ReadS [CaptureOption]
readsPrec :: Int -> ReadS CaptureOption
$creadsPrec :: Int -> ReadS CaptureOption
Prelude.Read, Int -> CaptureOption -> ShowS
[CaptureOption] -> ShowS
CaptureOption -> String
(Int -> CaptureOption -> ShowS)
-> (CaptureOption -> String)
-> ([CaptureOption] -> ShowS)
-> Show CaptureOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptureOption] -> ShowS
$cshowList :: [CaptureOption] -> ShowS
show :: CaptureOption -> String
$cshow :: CaptureOption -> String
showsPrec :: Int -> CaptureOption -> ShowS
$cshowsPrec :: Int -> CaptureOption -> ShowS
Prelude.Show, (forall x. CaptureOption -> Rep CaptureOption x)
-> (forall x. Rep CaptureOption x -> CaptureOption)
-> Generic CaptureOption
forall x. Rep CaptureOption x -> CaptureOption
forall x. CaptureOption -> Rep CaptureOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CaptureOption x -> CaptureOption
$cfrom :: forall x. CaptureOption -> Rep CaptureOption x
Prelude.Generic)

-- |
-- Create a value of 'CaptureOption' 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:
--
-- 'captureMode', 'captureOption_captureMode' -
newCaptureOption ::
  -- | 'captureMode'
  CaptureMode ->
  CaptureOption
newCaptureOption :: CaptureMode -> CaptureOption
newCaptureOption CaptureMode
pCaptureMode_ =
  CaptureOption' :: CaptureMode -> CaptureOption
CaptureOption' {$sel:captureMode:CaptureOption' :: CaptureMode
captureMode = CaptureMode
pCaptureMode_}

-- |
captureOption_captureMode :: Lens.Lens' CaptureOption CaptureMode
captureOption_captureMode :: (CaptureMode -> f CaptureMode) -> CaptureOption -> f CaptureOption
captureOption_captureMode = (CaptureOption -> CaptureMode)
-> (CaptureOption -> CaptureMode -> CaptureOption)
-> Lens CaptureOption CaptureOption CaptureMode CaptureMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptureOption' {CaptureMode
captureMode :: CaptureMode
$sel:captureMode:CaptureOption' :: CaptureOption -> CaptureMode
captureMode} -> CaptureMode
captureMode) (\s :: CaptureOption
s@CaptureOption' {} CaptureMode
a -> CaptureOption
s {$sel:captureMode:CaptureOption' :: CaptureMode
captureMode = CaptureMode
a} :: CaptureOption)

instance Core.FromJSON CaptureOption where
  parseJSON :: Value -> Parser CaptureOption
parseJSON =
    String
-> (Object -> Parser CaptureOption)
-> Value
-> Parser CaptureOption
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CaptureOption"
      ( \Object
x ->
          CaptureMode -> CaptureOption
CaptureOption' (CaptureMode -> CaptureOption)
-> Parser CaptureMode -> Parser CaptureOption
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser CaptureMode
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CaptureMode")
      )

instance Prelude.Hashable CaptureOption

instance Prelude.NFData CaptureOption

instance Core.ToJSON CaptureOption where
  toJSON :: CaptureOption -> Value
toJSON CaptureOption' {CaptureMode
captureMode :: CaptureMode
$sel:captureMode:CaptureOption' :: CaptureOption -> CaptureMode
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"CaptureMode" Text -> CaptureMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CaptureMode
captureMode)]
      )