{-# 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 #-}
module Amazonka.SageMaker.Types.DataCaptureConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.CaptureContentTypeHeader
import Amazonka.SageMaker.Types.CaptureOption
data DataCaptureConfig = DataCaptureConfig'
{ :: Prelude.Maybe CaptureContentTypeHeader,
DataCaptureConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
DataCaptureConfig -> Maybe Bool
enableCapture :: Prelude.Maybe Prelude.Bool,
DataCaptureConfig -> Natural
initialSamplingPercentage :: Prelude.Natural,
DataCaptureConfig -> Text
destinationS3Uri :: Prelude.Text,
DataCaptureConfig -> NonEmpty CaptureOption
captureOptions :: Prelude.NonEmpty CaptureOption
}
deriving (DataCaptureConfig -> DataCaptureConfig -> Bool
(DataCaptureConfig -> DataCaptureConfig -> Bool)
-> (DataCaptureConfig -> DataCaptureConfig -> Bool)
-> Eq DataCaptureConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataCaptureConfig -> DataCaptureConfig -> Bool
$c/= :: DataCaptureConfig -> DataCaptureConfig -> Bool
== :: DataCaptureConfig -> DataCaptureConfig -> Bool
$c== :: DataCaptureConfig -> DataCaptureConfig -> Bool
Prelude.Eq, ReadPrec [DataCaptureConfig]
ReadPrec DataCaptureConfig
Int -> ReadS DataCaptureConfig
ReadS [DataCaptureConfig]
(Int -> ReadS DataCaptureConfig)
-> ReadS [DataCaptureConfig]
-> ReadPrec DataCaptureConfig
-> ReadPrec [DataCaptureConfig]
-> Read DataCaptureConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataCaptureConfig]
$creadListPrec :: ReadPrec [DataCaptureConfig]
readPrec :: ReadPrec DataCaptureConfig
$creadPrec :: ReadPrec DataCaptureConfig
readList :: ReadS [DataCaptureConfig]
$creadList :: ReadS [DataCaptureConfig]
readsPrec :: Int -> ReadS DataCaptureConfig
$creadsPrec :: Int -> ReadS DataCaptureConfig
Prelude.Read, Int -> DataCaptureConfig -> ShowS
[DataCaptureConfig] -> ShowS
DataCaptureConfig -> String
(Int -> DataCaptureConfig -> ShowS)
-> (DataCaptureConfig -> String)
-> ([DataCaptureConfig] -> ShowS)
-> Show DataCaptureConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataCaptureConfig] -> ShowS
$cshowList :: [DataCaptureConfig] -> ShowS
show :: DataCaptureConfig -> String
$cshow :: DataCaptureConfig -> String
showsPrec :: Int -> DataCaptureConfig -> ShowS
$cshowsPrec :: Int -> DataCaptureConfig -> ShowS
Prelude.Show, (forall x. DataCaptureConfig -> Rep DataCaptureConfig x)
-> (forall x. Rep DataCaptureConfig x -> DataCaptureConfig)
-> Generic DataCaptureConfig
forall x. Rep DataCaptureConfig x -> DataCaptureConfig
forall x. DataCaptureConfig -> Rep DataCaptureConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataCaptureConfig x -> DataCaptureConfig
$cfrom :: forall x. DataCaptureConfig -> Rep DataCaptureConfig x
Prelude.Generic)
newDataCaptureConfig ::
Prelude.Natural ->
Prelude.Text ->
Prelude.NonEmpty CaptureOption ->
DataCaptureConfig
newDataCaptureConfig :: Natural -> Text -> NonEmpty CaptureOption -> DataCaptureConfig
newDataCaptureConfig
Natural
pInitialSamplingPercentage_
Text
pDestinationS3Uri_
NonEmpty CaptureOption
pCaptureOptions_ =
DataCaptureConfig' :: Maybe CaptureContentTypeHeader
-> Maybe Text
-> Maybe Bool
-> Natural
-> Text
-> NonEmpty CaptureOption
-> DataCaptureConfig
DataCaptureConfig'
{ $sel:captureContentTypeHeader:DataCaptureConfig' :: Maybe CaptureContentTypeHeader
captureContentTypeHeader =
Maybe CaptureContentTypeHeader
forall a. Maybe a
Prelude.Nothing,
$sel:kmsKeyId:DataCaptureConfig' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enableCapture:DataCaptureConfig' :: Maybe Bool
enableCapture = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:initialSamplingPercentage:DataCaptureConfig' :: Natural
initialSamplingPercentage =
Natural
pInitialSamplingPercentage_,
$sel:destinationS3Uri:DataCaptureConfig' :: Text
destinationS3Uri = Text
pDestinationS3Uri_,
$sel:captureOptions:DataCaptureConfig' :: NonEmpty CaptureOption
captureOptions =
Tagged (NonEmpty CaptureOption) (Identity (NonEmpty CaptureOption))
-> Tagged
(NonEmpty CaptureOption) (Identity (NonEmpty CaptureOption))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty CaptureOption) (Identity (NonEmpty CaptureOption))
-> Tagged
(NonEmpty CaptureOption) (Identity (NonEmpty CaptureOption)))
-> NonEmpty CaptureOption -> NonEmpty CaptureOption
forall t b. AReview t b -> b -> t
Lens.# NonEmpty CaptureOption
pCaptureOptions_
}
dataCaptureConfig_captureContentTypeHeader :: Lens.Lens' DataCaptureConfig (Prelude.Maybe CaptureContentTypeHeader)
= (DataCaptureConfig -> Maybe CaptureContentTypeHeader)
-> (DataCaptureConfig
-> Maybe CaptureContentTypeHeader -> DataCaptureConfig)
-> Lens
DataCaptureConfig
DataCaptureConfig
(Maybe CaptureContentTypeHeader)
(Maybe CaptureContentTypeHeader)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCaptureConfig' {Maybe CaptureContentTypeHeader
captureContentTypeHeader :: Maybe CaptureContentTypeHeader
$sel:captureContentTypeHeader:DataCaptureConfig' :: DataCaptureConfig -> Maybe CaptureContentTypeHeader
captureContentTypeHeader} -> Maybe CaptureContentTypeHeader
captureContentTypeHeader) (\s :: DataCaptureConfig
s@DataCaptureConfig' {} Maybe CaptureContentTypeHeader
a -> DataCaptureConfig
s {$sel:captureContentTypeHeader:DataCaptureConfig' :: Maybe CaptureContentTypeHeader
captureContentTypeHeader = Maybe CaptureContentTypeHeader
a} :: DataCaptureConfig)
dataCaptureConfig_kmsKeyId :: Lens.Lens' DataCaptureConfig (Prelude.Maybe Prelude.Text)
dataCaptureConfig_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> DataCaptureConfig -> f DataCaptureConfig
dataCaptureConfig_kmsKeyId = (DataCaptureConfig -> Maybe Text)
-> (DataCaptureConfig -> Maybe Text -> DataCaptureConfig)
-> Lens
DataCaptureConfig DataCaptureConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCaptureConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:DataCaptureConfig' :: DataCaptureConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: DataCaptureConfig
s@DataCaptureConfig' {} Maybe Text
a -> DataCaptureConfig
s {$sel:kmsKeyId:DataCaptureConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: DataCaptureConfig)
dataCaptureConfig_enableCapture :: Lens.Lens' DataCaptureConfig (Prelude.Maybe Prelude.Bool)
dataCaptureConfig_enableCapture :: (Maybe Bool -> f (Maybe Bool))
-> DataCaptureConfig -> f DataCaptureConfig
dataCaptureConfig_enableCapture = (DataCaptureConfig -> Maybe Bool)
-> (DataCaptureConfig -> Maybe Bool -> DataCaptureConfig)
-> Lens
DataCaptureConfig DataCaptureConfig (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCaptureConfig' {Maybe Bool
enableCapture :: Maybe Bool
$sel:enableCapture:DataCaptureConfig' :: DataCaptureConfig -> Maybe Bool
enableCapture} -> Maybe Bool
enableCapture) (\s :: DataCaptureConfig
s@DataCaptureConfig' {} Maybe Bool
a -> DataCaptureConfig
s {$sel:enableCapture:DataCaptureConfig' :: Maybe Bool
enableCapture = Maybe Bool
a} :: DataCaptureConfig)
dataCaptureConfig_initialSamplingPercentage :: Lens.Lens' DataCaptureConfig Prelude.Natural
dataCaptureConfig_initialSamplingPercentage :: (Natural -> f Natural) -> DataCaptureConfig -> f DataCaptureConfig
dataCaptureConfig_initialSamplingPercentage = (DataCaptureConfig -> Natural)
-> (DataCaptureConfig -> Natural -> DataCaptureConfig)
-> Lens DataCaptureConfig DataCaptureConfig Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCaptureConfig' {Natural
initialSamplingPercentage :: Natural
$sel:initialSamplingPercentage:DataCaptureConfig' :: DataCaptureConfig -> Natural
initialSamplingPercentage} -> Natural
initialSamplingPercentage) (\s :: DataCaptureConfig
s@DataCaptureConfig' {} Natural
a -> DataCaptureConfig
s {$sel:initialSamplingPercentage:DataCaptureConfig' :: Natural
initialSamplingPercentage = Natural
a} :: DataCaptureConfig)
dataCaptureConfig_destinationS3Uri :: Lens.Lens' DataCaptureConfig Prelude.Text
dataCaptureConfig_destinationS3Uri :: (Text -> f Text) -> DataCaptureConfig -> f DataCaptureConfig
dataCaptureConfig_destinationS3Uri = (DataCaptureConfig -> Text)
-> (DataCaptureConfig -> Text -> DataCaptureConfig)
-> Lens DataCaptureConfig DataCaptureConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCaptureConfig' {Text
destinationS3Uri :: Text
$sel:destinationS3Uri:DataCaptureConfig' :: DataCaptureConfig -> Text
destinationS3Uri} -> Text
destinationS3Uri) (\s :: DataCaptureConfig
s@DataCaptureConfig' {} Text
a -> DataCaptureConfig
s {$sel:destinationS3Uri:DataCaptureConfig' :: Text
destinationS3Uri = Text
a} :: DataCaptureConfig)
dataCaptureConfig_captureOptions :: Lens.Lens' DataCaptureConfig (Prelude.NonEmpty CaptureOption)
dataCaptureConfig_captureOptions :: (NonEmpty CaptureOption -> f (NonEmpty CaptureOption))
-> DataCaptureConfig -> f DataCaptureConfig
dataCaptureConfig_captureOptions = (DataCaptureConfig -> NonEmpty CaptureOption)
-> (DataCaptureConfig
-> NonEmpty CaptureOption -> DataCaptureConfig)
-> Lens
DataCaptureConfig
DataCaptureConfig
(NonEmpty CaptureOption)
(NonEmpty CaptureOption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataCaptureConfig' {NonEmpty CaptureOption
captureOptions :: NonEmpty CaptureOption
$sel:captureOptions:DataCaptureConfig' :: DataCaptureConfig -> NonEmpty CaptureOption
captureOptions} -> NonEmpty CaptureOption
captureOptions) (\s :: DataCaptureConfig
s@DataCaptureConfig' {} NonEmpty CaptureOption
a -> DataCaptureConfig
s {$sel:captureOptions:DataCaptureConfig' :: NonEmpty CaptureOption
captureOptions = NonEmpty CaptureOption
a} :: DataCaptureConfig) ((NonEmpty CaptureOption -> f (NonEmpty CaptureOption))
-> DataCaptureConfig -> f DataCaptureConfig)
-> ((NonEmpty CaptureOption -> f (NonEmpty CaptureOption))
-> NonEmpty CaptureOption -> f (NonEmpty CaptureOption))
-> (NonEmpty CaptureOption -> f (NonEmpty CaptureOption))
-> DataCaptureConfig
-> f DataCaptureConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty CaptureOption -> f (NonEmpty CaptureOption))
-> NonEmpty CaptureOption -> f (NonEmpty CaptureOption)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON DataCaptureConfig where
parseJSON :: Value -> Parser DataCaptureConfig
parseJSON =
String
-> (Object -> Parser DataCaptureConfig)
-> Value
-> Parser DataCaptureConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DataCaptureConfig"
( \Object
x ->
Maybe CaptureContentTypeHeader
-> Maybe Text
-> Maybe Bool
-> Natural
-> Text
-> NonEmpty CaptureOption
-> DataCaptureConfig
DataCaptureConfig'
(Maybe CaptureContentTypeHeader
-> Maybe Text
-> Maybe Bool
-> Natural
-> Text
-> NonEmpty CaptureOption
-> DataCaptureConfig)
-> Parser (Maybe CaptureContentTypeHeader)
-> Parser
(Maybe Text
-> Maybe Bool
-> Natural
-> Text
-> NonEmpty CaptureOption
-> DataCaptureConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CaptureContentTypeHeader)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CaptureContentTypeHeader")
Parser
(Maybe Text
-> Maybe Bool
-> Natural
-> Text
-> NonEmpty CaptureOption
-> DataCaptureConfig)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool
-> Natural -> Text -> NonEmpty CaptureOption -> DataCaptureConfig)
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
"KmsKeyId")
Parser
(Maybe Bool
-> Natural -> Text -> NonEmpty CaptureOption -> DataCaptureConfig)
-> Parser (Maybe Bool)
-> Parser
(Natural -> Text -> NonEmpty CaptureOption -> DataCaptureConfig)
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
"EnableCapture")
Parser
(Natural -> Text -> NonEmpty CaptureOption -> DataCaptureConfig)
-> Parser Natural
-> Parser (Text -> NonEmpty CaptureOption -> DataCaptureConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InitialSamplingPercentage")
Parser (Text -> NonEmpty CaptureOption -> DataCaptureConfig)
-> Parser Text
-> Parser (NonEmpty CaptureOption -> DataCaptureConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DestinationS3Uri")
Parser (NonEmpty CaptureOption -> DataCaptureConfig)
-> Parser (NonEmpty CaptureOption) -> Parser DataCaptureConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty CaptureOption)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CaptureOptions")
)
instance Prelude.Hashable DataCaptureConfig
instance Prelude.NFData DataCaptureConfig
instance Core.ToJSON DataCaptureConfig where
toJSON :: DataCaptureConfig -> Value
toJSON DataCaptureConfig' {Natural
Maybe Bool
Maybe Text
Maybe CaptureContentTypeHeader
NonEmpty CaptureOption
Text
captureOptions :: NonEmpty CaptureOption
destinationS3Uri :: Text
initialSamplingPercentage :: Natural
enableCapture :: Maybe Bool
kmsKeyId :: Maybe Text
captureContentTypeHeader :: Maybe CaptureContentTypeHeader
$sel:captureOptions:DataCaptureConfig' :: DataCaptureConfig -> NonEmpty CaptureOption
$sel:destinationS3Uri:DataCaptureConfig' :: DataCaptureConfig -> Text
$sel:initialSamplingPercentage:DataCaptureConfig' :: DataCaptureConfig -> Natural
$sel:enableCapture:DataCaptureConfig' :: DataCaptureConfig -> Maybe Bool
$sel:kmsKeyId:DataCaptureConfig' :: DataCaptureConfig -> Maybe Text
$sel:captureContentTypeHeader:DataCaptureConfig' :: DataCaptureConfig -> Maybe CaptureContentTypeHeader
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CaptureContentTypeHeader" Text -> CaptureContentTypeHeader -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CaptureContentTypeHeader -> Pair)
-> Maybe CaptureContentTypeHeader -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CaptureContentTypeHeader
captureContentTypeHeader,
(Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
(Text
"EnableCapture" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableCapture,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"InitialSamplingPercentage"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
initialSamplingPercentage
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DestinationS3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationS3Uri),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CaptureOptions" Text -> NonEmpty CaptureOption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty CaptureOption
captureOptions)
]
)