{-# 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.ArtifactSource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ArtifactSourceType
data ArtifactSource = ArtifactSource'
{
ArtifactSource -> Maybe [ArtifactSourceType]
sourceTypes :: Prelude.Maybe [ArtifactSourceType],
ArtifactSource -> Text
sourceUri :: Prelude.Text
}
deriving (ArtifactSource -> ArtifactSource -> Bool
(ArtifactSource -> ArtifactSource -> Bool)
-> (ArtifactSource -> ArtifactSource -> Bool) -> Eq ArtifactSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArtifactSource -> ArtifactSource -> Bool
$c/= :: ArtifactSource -> ArtifactSource -> Bool
== :: ArtifactSource -> ArtifactSource -> Bool
$c== :: ArtifactSource -> ArtifactSource -> Bool
Prelude.Eq, ReadPrec [ArtifactSource]
ReadPrec ArtifactSource
Int -> ReadS ArtifactSource
ReadS [ArtifactSource]
(Int -> ReadS ArtifactSource)
-> ReadS [ArtifactSource]
-> ReadPrec ArtifactSource
-> ReadPrec [ArtifactSource]
-> Read ArtifactSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArtifactSource]
$creadListPrec :: ReadPrec [ArtifactSource]
readPrec :: ReadPrec ArtifactSource
$creadPrec :: ReadPrec ArtifactSource
readList :: ReadS [ArtifactSource]
$creadList :: ReadS [ArtifactSource]
readsPrec :: Int -> ReadS ArtifactSource
$creadsPrec :: Int -> ReadS ArtifactSource
Prelude.Read, Int -> ArtifactSource -> ShowS
[ArtifactSource] -> ShowS
ArtifactSource -> String
(Int -> ArtifactSource -> ShowS)
-> (ArtifactSource -> String)
-> ([ArtifactSource] -> ShowS)
-> Show ArtifactSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArtifactSource] -> ShowS
$cshowList :: [ArtifactSource] -> ShowS
show :: ArtifactSource -> String
$cshow :: ArtifactSource -> String
showsPrec :: Int -> ArtifactSource -> ShowS
$cshowsPrec :: Int -> ArtifactSource -> ShowS
Prelude.Show, (forall x. ArtifactSource -> Rep ArtifactSource x)
-> (forall x. Rep ArtifactSource x -> ArtifactSource)
-> Generic ArtifactSource
forall x. Rep ArtifactSource x -> ArtifactSource
forall x. ArtifactSource -> Rep ArtifactSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArtifactSource x -> ArtifactSource
$cfrom :: forall x. ArtifactSource -> Rep ArtifactSource x
Prelude.Generic)
newArtifactSource ::
Prelude.Text ->
ArtifactSource
newArtifactSource :: Text -> ArtifactSource
newArtifactSource Text
pSourceUri_ =
ArtifactSource' :: Maybe [ArtifactSourceType] -> Text -> ArtifactSource
ArtifactSource'
{ $sel:sourceTypes:ArtifactSource' :: Maybe [ArtifactSourceType]
sourceTypes = Maybe [ArtifactSourceType]
forall a. Maybe a
Prelude.Nothing,
$sel:sourceUri:ArtifactSource' :: Text
sourceUri = Text
pSourceUri_
}
artifactSource_sourceTypes :: Lens.Lens' ArtifactSource (Prelude.Maybe [ArtifactSourceType])
artifactSource_sourceTypes :: (Maybe [ArtifactSourceType] -> f (Maybe [ArtifactSourceType]))
-> ArtifactSource -> f ArtifactSource
artifactSource_sourceTypes = (ArtifactSource -> Maybe [ArtifactSourceType])
-> (ArtifactSource -> Maybe [ArtifactSourceType] -> ArtifactSource)
-> Lens
ArtifactSource
ArtifactSource
(Maybe [ArtifactSourceType])
(Maybe [ArtifactSourceType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactSource' {Maybe [ArtifactSourceType]
sourceTypes :: Maybe [ArtifactSourceType]
$sel:sourceTypes:ArtifactSource' :: ArtifactSource -> Maybe [ArtifactSourceType]
sourceTypes} -> Maybe [ArtifactSourceType]
sourceTypes) (\s :: ArtifactSource
s@ArtifactSource' {} Maybe [ArtifactSourceType]
a -> ArtifactSource
s {$sel:sourceTypes:ArtifactSource' :: Maybe [ArtifactSourceType]
sourceTypes = Maybe [ArtifactSourceType]
a} :: ArtifactSource) ((Maybe [ArtifactSourceType] -> f (Maybe [ArtifactSourceType]))
-> ArtifactSource -> f ArtifactSource)
-> ((Maybe [ArtifactSourceType] -> f (Maybe [ArtifactSourceType]))
-> Maybe [ArtifactSourceType] -> f (Maybe [ArtifactSourceType]))
-> (Maybe [ArtifactSourceType] -> f (Maybe [ArtifactSourceType]))
-> ArtifactSource
-> f ArtifactSource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[ArtifactSourceType]
[ArtifactSourceType]
[ArtifactSourceType]
[ArtifactSourceType]
-> Iso
(Maybe [ArtifactSourceType])
(Maybe [ArtifactSourceType])
(Maybe [ArtifactSourceType])
(Maybe [ArtifactSourceType])
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
[ArtifactSourceType]
[ArtifactSourceType]
[ArtifactSourceType]
[ArtifactSourceType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
artifactSource_sourceUri :: Lens.Lens' ArtifactSource Prelude.Text
artifactSource_sourceUri :: (Text -> f Text) -> ArtifactSource -> f ArtifactSource
artifactSource_sourceUri = (ArtifactSource -> Text)
-> (ArtifactSource -> Text -> ArtifactSource)
-> Lens ArtifactSource ArtifactSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactSource' {Text
sourceUri :: Text
$sel:sourceUri:ArtifactSource' :: ArtifactSource -> Text
sourceUri} -> Text
sourceUri) (\s :: ArtifactSource
s@ArtifactSource' {} Text
a -> ArtifactSource
s {$sel:sourceUri:ArtifactSource' :: Text
sourceUri = Text
a} :: ArtifactSource)
instance Core.FromJSON ArtifactSource where
parseJSON :: Value -> Parser ArtifactSource
parseJSON =
String
-> (Object -> Parser ArtifactSource)
-> Value
-> Parser ArtifactSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ArtifactSource"
( \Object
x ->
Maybe [ArtifactSourceType] -> Text -> ArtifactSource
ArtifactSource'
(Maybe [ArtifactSourceType] -> Text -> ArtifactSource)
-> Parser (Maybe [ArtifactSourceType])
-> Parser (Text -> ArtifactSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [ArtifactSourceType]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SourceTypes" Parser (Maybe (Maybe [ArtifactSourceType]))
-> Maybe [ArtifactSourceType]
-> Parser (Maybe [ArtifactSourceType])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ArtifactSourceType]
forall a. Monoid a => a
Prelude.mempty)
Parser (Text -> ArtifactSource)
-> Parser Text -> Parser ArtifactSource
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
"SourceUri")
)
instance Prelude.Hashable ArtifactSource
instance Prelude.NFData ArtifactSource
instance Core.ToJSON ArtifactSource where
toJSON :: ArtifactSource -> Value
toJSON ArtifactSource' {Maybe [ArtifactSourceType]
Text
sourceUri :: Text
sourceTypes :: Maybe [ArtifactSourceType]
$sel:sourceUri:ArtifactSource' :: ArtifactSource -> Text
$sel:sourceTypes:ArtifactSource' :: ArtifactSource -> Maybe [ArtifactSourceType]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SourceTypes" Text -> [ArtifactSourceType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ArtifactSourceType] -> Pair)
-> Maybe [ArtifactSourceType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ArtifactSourceType]
sourceTypes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SourceUri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceUri)
]
)