{-# 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.ChannelSpecification where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.CompressionType
import Amazonka.SageMaker.Types.TrainingInputMode
data ChannelSpecification = ChannelSpecification'
{
ChannelSpecification -> Maybe [CompressionType]
supportedCompressionTypes :: Prelude.Maybe [CompressionType],
ChannelSpecification -> Maybe Bool
isRequired :: Prelude.Maybe Prelude.Bool,
ChannelSpecification -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
ChannelSpecification -> Text
name :: Prelude.Text,
ChannelSpecification -> [Text]
supportedContentTypes :: [Prelude.Text],
ChannelSpecification -> NonEmpty TrainingInputMode
supportedInputModes :: Prelude.NonEmpty TrainingInputMode
}
deriving (ChannelSpecification -> ChannelSpecification -> Bool
(ChannelSpecification -> ChannelSpecification -> Bool)
-> (ChannelSpecification -> ChannelSpecification -> Bool)
-> Eq ChannelSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelSpecification -> ChannelSpecification -> Bool
$c/= :: ChannelSpecification -> ChannelSpecification -> Bool
== :: ChannelSpecification -> ChannelSpecification -> Bool
$c== :: ChannelSpecification -> ChannelSpecification -> Bool
Prelude.Eq, ReadPrec [ChannelSpecification]
ReadPrec ChannelSpecification
Int -> ReadS ChannelSpecification
ReadS [ChannelSpecification]
(Int -> ReadS ChannelSpecification)
-> ReadS [ChannelSpecification]
-> ReadPrec ChannelSpecification
-> ReadPrec [ChannelSpecification]
-> Read ChannelSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelSpecification]
$creadListPrec :: ReadPrec [ChannelSpecification]
readPrec :: ReadPrec ChannelSpecification
$creadPrec :: ReadPrec ChannelSpecification
readList :: ReadS [ChannelSpecification]
$creadList :: ReadS [ChannelSpecification]
readsPrec :: Int -> ReadS ChannelSpecification
$creadsPrec :: Int -> ReadS ChannelSpecification
Prelude.Read, Int -> ChannelSpecification -> ShowS
[ChannelSpecification] -> ShowS
ChannelSpecification -> String
(Int -> ChannelSpecification -> ShowS)
-> (ChannelSpecification -> String)
-> ([ChannelSpecification] -> ShowS)
-> Show ChannelSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelSpecification] -> ShowS
$cshowList :: [ChannelSpecification] -> ShowS
show :: ChannelSpecification -> String
$cshow :: ChannelSpecification -> String
showsPrec :: Int -> ChannelSpecification -> ShowS
$cshowsPrec :: Int -> ChannelSpecification -> ShowS
Prelude.Show, (forall x. ChannelSpecification -> Rep ChannelSpecification x)
-> (forall x. Rep ChannelSpecification x -> ChannelSpecification)
-> Generic ChannelSpecification
forall x. Rep ChannelSpecification x -> ChannelSpecification
forall x. ChannelSpecification -> Rep ChannelSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelSpecification x -> ChannelSpecification
$cfrom :: forall x. ChannelSpecification -> Rep ChannelSpecification x
Prelude.Generic)
newChannelSpecification ::
Prelude.Text ->
Prelude.NonEmpty TrainingInputMode ->
ChannelSpecification
newChannelSpecification :: Text -> NonEmpty TrainingInputMode -> ChannelSpecification
newChannelSpecification Text
pName_ NonEmpty TrainingInputMode
pSupportedInputModes_ =
ChannelSpecification' :: Maybe [CompressionType]
-> Maybe Bool
-> Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification
ChannelSpecification'
{ $sel:supportedCompressionTypes:ChannelSpecification' :: Maybe [CompressionType]
supportedCompressionTypes =
Maybe [CompressionType]
forall a. Maybe a
Prelude.Nothing,
$sel:isRequired:ChannelSpecification' :: Maybe Bool
isRequired = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:description:ChannelSpecification' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:ChannelSpecification' :: Text
name = Text
pName_,
$sel:supportedContentTypes:ChannelSpecification' :: [Text]
supportedContentTypes = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:supportedInputModes:ChannelSpecification' :: NonEmpty TrainingInputMode
supportedInputModes =
Tagged
(NonEmpty TrainingInputMode)
(Identity (NonEmpty TrainingInputMode))
-> Tagged
(NonEmpty TrainingInputMode)
(Identity (NonEmpty TrainingInputMode))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty TrainingInputMode)
(Identity (NonEmpty TrainingInputMode))
-> Tagged
(NonEmpty TrainingInputMode)
(Identity (NonEmpty TrainingInputMode)))
-> NonEmpty TrainingInputMode -> NonEmpty TrainingInputMode
forall t b. AReview t b -> b -> t
Lens.# NonEmpty TrainingInputMode
pSupportedInputModes_
}
channelSpecification_supportedCompressionTypes :: Lens.Lens' ChannelSpecification (Prelude.Maybe [CompressionType])
channelSpecification_supportedCompressionTypes :: (Maybe [CompressionType] -> f (Maybe [CompressionType]))
-> ChannelSpecification -> f ChannelSpecification
channelSpecification_supportedCompressionTypes = (ChannelSpecification -> Maybe [CompressionType])
-> (ChannelSpecification
-> Maybe [CompressionType] -> ChannelSpecification)
-> Lens
ChannelSpecification
ChannelSpecification
(Maybe [CompressionType])
(Maybe [CompressionType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSpecification' {Maybe [CompressionType]
supportedCompressionTypes :: Maybe [CompressionType]
$sel:supportedCompressionTypes:ChannelSpecification' :: ChannelSpecification -> Maybe [CompressionType]
supportedCompressionTypes} -> Maybe [CompressionType]
supportedCompressionTypes) (\s :: ChannelSpecification
s@ChannelSpecification' {} Maybe [CompressionType]
a -> ChannelSpecification
s {$sel:supportedCompressionTypes:ChannelSpecification' :: Maybe [CompressionType]
supportedCompressionTypes = Maybe [CompressionType]
a} :: ChannelSpecification) ((Maybe [CompressionType] -> f (Maybe [CompressionType]))
-> ChannelSpecification -> f ChannelSpecification)
-> ((Maybe [CompressionType] -> f (Maybe [CompressionType]))
-> Maybe [CompressionType] -> f (Maybe [CompressionType]))
-> (Maybe [CompressionType] -> f (Maybe [CompressionType]))
-> ChannelSpecification
-> f ChannelSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CompressionType]
[CompressionType]
[CompressionType]
[CompressionType]
-> Iso
(Maybe [CompressionType])
(Maybe [CompressionType])
(Maybe [CompressionType])
(Maybe [CompressionType])
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
[CompressionType]
[CompressionType]
[CompressionType]
[CompressionType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
channelSpecification_isRequired :: Lens.Lens' ChannelSpecification (Prelude.Maybe Prelude.Bool)
channelSpecification_isRequired :: (Maybe Bool -> f (Maybe Bool))
-> ChannelSpecification -> f ChannelSpecification
channelSpecification_isRequired = (ChannelSpecification -> Maybe Bool)
-> (ChannelSpecification -> Maybe Bool -> ChannelSpecification)
-> Lens
ChannelSpecification ChannelSpecification (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSpecification' {Maybe Bool
isRequired :: Maybe Bool
$sel:isRequired:ChannelSpecification' :: ChannelSpecification -> Maybe Bool
isRequired} -> Maybe Bool
isRequired) (\s :: ChannelSpecification
s@ChannelSpecification' {} Maybe Bool
a -> ChannelSpecification
s {$sel:isRequired:ChannelSpecification' :: Maybe Bool
isRequired = Maybe Bool
a} :: ChannelSpecification)
channelSpecification_description :: Lens.Lens' ChannelSpecification (Prelude.Maybe Prelude.Text)
channelSpecification_description :: (Maybe Text -> f (Maybe Text))
-> ChannelSpecification -> f ChannelSpecification
channelSpecification_description = (ChannelSpecification -> Maybe Text)
-> (ChannelSpecification -> Maybe Text -> ChannelSpecification)
-> Lens
ChannelSpecification ChannelSpecification (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSpecification' {Maybe Text
description :: Maybe Text
$sel:description:ChannelSpecification' :: ChannelSpecification -> Maybe Text
description} -> Maybe Text
description) (\s :: ChannelSpecification
s@ChannelSpecification' {} Maybe Text
a -> ChannelSpecification
s {$sel:description:ChannelSpecification' :: Maybe Text
description = Maybe Text
a} :: ChannelSpecification)
channelSpecification_name :: Lens.Lens' ChannelSpecification Prelude.Text
channelSpecification_name :: (Text -> f Text) -> ChannelSpecification -> f ChannelSpecification
channelSpecification_name = (ChannelSpecification -> Text)
-> (ChannelSpecification -> Text -> ChannelSpecification)
-> Lens ChannelSpecification ChannelSpecification Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSpecification' {Text
name :: Text
$sel:name:ChannelSpecification' :: ChannelSpecification -> Text
name} -> Text
name) (\s :: ChannelSpecification
s@ChannelSpecification' {} Text
a -> ChannelSpecification
s {$sel:name:ChannelSpecification' :: Text
name = Text
a} :: ChannelSpecification)
channelSpecification_supportedContentTypes :: Lens.Lens' ChannelSpecification [Prelude.Text]
channelSpecification_supportedContentTypes :: ([Text] -> f [Text])
-> ChannelSpecification -> f ChannelSpecification
channelSpecification_supportedContentTypes = (ChannelSpecification -> [Text])
-> (ChannelSpecification -> [Text] -> ChannelSpecification)
-> Lens ChannelSpecification ChannelSpecification [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSpecification' {[Text]
supportedContentTypes :: [Text]
$sel:supportedContentTypes:ChannelSpecification' :: ChannelSpecification -> [Text]
supportedContentTypes} -> [Text]
supportedContentTypes) (\s :: ChannelSpecification
s@ChannelSpecification' {} [Text]
a -> ChannelSpecification
s {$sel:supportedContentTypes:ChannelSpecification' :: [Text]
supportedContentTypes = [Text]
a} :: ChannelSpecification) (([Text] -> f [Text])
-> ChannelSpecification -> f ChannelSpecification)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ChannelSpecification
-> f ChannelSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
channelSpecification_supportedInputModes :: Lens.Lens' ChannelSpecification (Prelude.NonEmpty TrainingInputMode)
channelSpecification_supportedInputModes :: (NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode))
-> ChannelSpecification -> f ChannelSpecification
channelSpecification_supportedInputModes = (ChannelSpecification -> NonEmpty TrainingInputMode)
-> (ChannelSpecification
-> NonEmpty TrainingInputMode -> ChannelSpecification)
-> Lens
ChannelSpecification
ChannelSpecification
(NonEmpty TrainingInputMode)
(NonEmpty TrainingInputMode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelSpecification' {NonEmpty TrainingInputMode
supportedInputModes :: NonEmpty TrainingInputMode
$sel:supportedInputModes:ChannelSpecification' :: ChannelSpecification -> NonEmpty TrainingInputMode
supportedInputModes} -> NonEmpty TrainingInputMode
supportedInputModes) (\s :: ChannelSpecification
s@ChannelSpecification' {} NonEmpty TrainingInputMode
a -> ChannelSpecification
s {$sel:supportedInputModes:ChannelSpecification' :: NonEmpty TrainingInputMode
supportedInputModes = NonEmpty TrainingInputMode
a} :: ChannelSpecification) ((NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode))
-> ChannelSpecification -> f ChannelSpecification)
-> ((NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode))
-> NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode))
-> (NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode))
-> ChannelSpecification
-> f ChannelSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode))
-> NonEmpty TrainingInputMode -> f (NonEmpty TrainingInputMode)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON ChannelSpecification where
parseJSON :: Value -> Parser ChannelSpecification
parseJSON =
String
-> (Object -> Parser ChannelSpecification)
-> Value
-> Parser ChannelSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ChannelSpecification"
( \Object
x ->
Maybe [CompressionType]
-> Maybe Bool
-> Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification
ChannelSpecification'
(Maybe [CompressionType]
-> Maybe Bool
-> Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification)
-> Parser (Maybe [CompressionType])
-> Parser
(Maybe Bool
-> Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [CompressionType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SupportedCompressionTypes"
Parser (Maybe (Maybe [CompressionType]))
-> Maybe [CompressionType] -> Parser (Maybe [CompressionType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [CompressionType]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe Bool
-> Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification)
-> Parser (Maybe Bool)
-> Parser
(Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification)
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
"IsRequired")
Parser
(Maybe Text
-> Text
-> [Text]
-> NonEmpty TrainingInputMode
-> ChannelSpecification)
-> Parser (Maybe Text)
-> Parser
(Text
-> [Text] -> NonEmpty TrainingInputMode -> ChannelSpecification)
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
"Description")
Parser
(Text
-> [Text] -> NonEmpty TrainingInputMode -> ChannelSpecification)
-> Parser Text
-> Parser
([Text] -> NonEmpty TrainingInputMode -> ChannelSpecification)
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
"Name")
Parser
([Text] -> NonEmpty TrainingInputMode -> ChannelSpecification)
-> Parser [Text]
-> Parser (NonEmpty TrainingInputMode -> ChannelSpecification)
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
"SupportedContentTypes"
Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser (NonEmpty TrainingInputMode -> ChannelSpecification)
-> Parser (NonEmpty TrainingInputMode)
-> Parser ChannelSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty TrainingInputMode)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SupportedInputModes")
)
instance Prelude.Hashable ChannelSpecification
instance Prelude.NFData ChannelSpecification
instance Core.ToJSON ChannelSpecification where
toJSON :: ChannelSpecification -> Value
toJSON ChannelSpecification' {[Text]
Maybe Bool
Maybe [CompressionType]
Maybe Text
NonEmpty TrainingInputMode
Text
supportedInputModes :: NonEmpty TrainingInputMode
supportedContentTypes :: [Text]
name :: Text
description :: Maybe Text
isRequired :: Maybe Bool
supportedCompressionTypes :: Maybe [CompressionType]
$sel:supportedInputModes:ChannelSpecification' :: ChannelSpecification -> NonEmpty TrainingInputMode
$sel:supportedContentTypes:ChannelSpecification' :: ChannelSpecification -> [Text]
$sel:name:ChannelSpecification' :: ChannelSpecification -> Text
$sel:description:ChannelSpecification' :: ChannelSpecification -> Maybe Text
$sel:isRequired:ChannelSpecification' :: ChannelSpecification -> Maybe Bool
$sel:supportedCompressionTypes:ChannelSpecification' :: ChannelSpecification -> Maybe [CompressionType]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SupportedCompressionTypes" Text -> [CompressionType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([CompressionType] -> Pair)
-> Maybe [CompressionType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CompressionType]
supportedCompressionTypes,
(Text
"IsRequired" 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
isRequired,
(Text
"Description" 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
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"SupportedContentTypes"
Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
supportedContentTypes
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SupportedInputModes" Text -> NonEmpty TrainingInputMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty TrainingInputMode
supportedInputModes)
]
)