{-# 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.ActionSource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ActionSource = ActionSource'
{
ActionSource -> Maybe Text
sourceType :: Prelude.Maybe Prelude.Text,
ActionSource -> Maybe Text
sourceId :: Prelude.Maybe Prelude.Text,
ActionSource -> Text
sourceUri :: Prelude.Text
}
deriving (ActionSource -> ActionSource -> Bool
(ActionSource -> ActionSource -> Bool)
-> (ActionSource -> ActionSource -> Bool) -> Eq ActionSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionSource -> ActionSource -> Bool
$c/= :: ActionSource -> ActionSource -> Bool
== :: ActionSource -> ActionSource -> Bool
$c== :: ActionSource -> ActionSource -> Bool
Prelude.Eq, ReadPrec [ActionSource]
ReadPrec ActionSource
Int -> ReadS ActionSource
ReadS [ActionSource]
(Int -> ReadS ActionSource)
-> ReadS [ActionSource]
-> ReadPrec ActionSource
-> ReadPrec [ActionSource]
-> Read ActionSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionSource]
$creadListPrec :: ReadPrec [ActionSource]
readPrec :: ReadPrec ActionSource
$creadPrec :: ReadPrec ActionSource
readList :: ReadS [ActionSource]
$creadList :: ReadS [ActionSource]
readsPrec :: Int -> ReadS ActionSource
$creadsPrec :: Int -> ReadS ActionSource
Prelude.Read, Int -> ActionSource -> ShowS
[ActionSource] -> ShowS
ActionSource -> String
(Int -> ActionSource -> ShowS)
-> (ActionSource -> String)
-> ([ActionSource] -> ShowS)
-> Show ActionSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionSource] -> ShowS
$cshowList :: [ActionSource] -> ShowS
show :: ActionSource -> String
$cshow :: ActionSource -> String
showsPrec :: Int -> ActionSource -> ShowS
$cshowsPrec :: Int -> ActionSource -> ShowS
Prelude.Show, (forall x. ActionSource -> Rep ActionSource x)
-> (forall x. Rep ActionSource x -> ActionSource)
-> Generic ActionSource
forall x. Rep ActionSource x -> ActionSource
forall x. ActionSource -> Rep ActionSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionSource x -> ActionSource
$cfrom :: forall x. ActionSource -> Rep ActionSource x
Prelude.Generic)
newActionSource ::
Prelude.Text ->
ActionSource
newActionSource :: Text -> ActionSource
newActionSource Text
pSourceUri_ =
ActionSource' :: Maybe Text -> Maybe Text -> Text -> ActionSource
ActionSource'
{ $sel:sourceType:ActionSource' :: Maybe Text
sourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceId:ActionSource' :: Maybe Text
sourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceUri:ActionSource' :: Text
sourceUri = Text
pSourceUri_
}
actionSource_sourceType :: Lens.Lens' ActionSource (Prelude.Maybe Prelude.Text)
actionSource_sourceType :: (Maybe Text -> f (Maybe Text)) -> ActionSource -> f ActionSource
actionSource_sourceType = (ActionSource -> Maybe Text)
-> (ActionSource -> Maybe Text -> ActionSource)
-> Lens ActionSource ActionSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSource' {Maybe Text
sourceType :: Maybe Text
$sel:sourceType:ActionSource' :: ActionSource -> Maybe Text
sourceType} -> Maybe Text
sourceType) (\s :: ActionSource
s@ActionSource' {} Maybe Text
a -> ActionSource
s {$sel:sourceType:ActionSource' :: Maybe Text
sourceType = Maybe Text
a} :: ActionSource)
actionSource_sourceId :: Lens.Lens' ActionSource (Prelude.Maybe Prelude.Text)
actionSource_sourceId :: (Maybe Text -> f (Maybe Text)) -> ActionSource -> f ActionSource
actionSource_sourceId = (ActionSource -> Maybe Text)
-> (ActionSource -> Maybe Text -> ActionSource)
-> Lens ActionSource ActionSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSource' {Maybe Text
sourceId :: Maybe Text
$sel:sourceId:ActionSource' :: ActionSource -> Maybe Text
sourceId} -> Maybe Text
sourceId) (\s :: ActionSource
s@ActionSource' {} Maybe Text
a -> ActionSource
s {$sel:sourceId:ActionSource' :: Maybe Text
sourceId = Maybe Text
a} :: ActionSource)
actionSource_sourceUri :: Lens.Lens' ActionSource Prelude.Text
actionSource_sourceUri :: (Text -> f Text) -> ActionSource -> f ActionSource
actionSource_sourceUri = (ActionSource -> Text)
-> (ActionSource -> Text -> ActionSource)
-> Lens ActionSource ActionSource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSource' {Text
sourceUri :: Text
$sel:sourceUri:ActionSource' :: ActionSource -> Text
sourceUri} -> Text
sourceUri) (\s :: ActionSource
s@ActionSource' {} Text
a -> ActionSource
s {$sel:sourceUri:ActionSource' :: Text
sourceUri = Text
a} :: ActionSource)
instance Core.FromJSON ActionSource where
parseJSON :: Value -> Parser ActionSource
parseJSON =
String
-> (Object -> Parser ActionSource) -> Value -> Parser ActionSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ActionSource"
( \Object
x ->
Maybe Text -> Maybe Text -> Text -> ActionSource
ActionSource'
(Maybe Text -> Maybe Text -> Text -> ActionSource)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> ActionSource)
forall (f :: * -> *) a b. Functor 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
"SourceType")
Parser (Maybe Text -> Text -> ActionSource)
-> Parser (Maybe Text) -> Parser (Text -> ActionSource)
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
"SourceId")
Parser (Text -> ActionSource) -> Parser Text -> Parser ActionSource
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 ActionSource
instance Prelude.NFData ActionSource
instance Core.ToJSON ActionSource where
toJSON :: ActionSource -> Value
toJSON ActionSource' {Maybe Text
Text
sourceUri :: Text
sourceId :: Maybe Text
sourceType :: Maybe Text
$sel:sourceUri:ActionSource' :: ActionSource -> Text
$sel:sourceId:ActionSource' :: ActionSource -> Maybe Text
$sel:sourceType:ActionSource' :: ActionSource -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SourceType" 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
sourceType,
(Text
"SourceId" 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
sourceId,
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)
]
)