{-# 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.RobOMaker.Types.DataSourceConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RobOMaker.Types.DataSourceType
data DataSourceConfig = DataSourceConfig'
{
DataSourceConfig -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
DataSourceConfig -> Maybe DataSourceType
type' :: Prelude.Maybe DataSourceType,
DataSourceConfig -> Text
name :: Prelude.Text,
DataSourceConfig -> Text
s3Bucket :: Prelude.Text,
DataSourceConfig -> NonEmpty Text
s3Keys :: Prelude.NonEmpty Prelude.Text
}
deriving (DataSourceConfig -> DataSourceConfig -> Bool
(DataSourceConfig -> DataSourceConfig -> Bool)
-> (DataSourceConfig -> DataSourceConfig -> Bool)
-> Eq DataSourceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataSourceConfig -> DataSourceConfig -> Bool
$c/= :: DataSourceConfig -> DataSourceConfig -> Bool
== :: DataSourceConfig -> DataSourceConfig -> Bool
$c== :: DataSourceConfig -> DataSourceConfig -> Bool
Prelude.Eq, ReadPrec [DataSourceConfig]
ReadPrec DataSourceConfig
Int -> ReadS DataSourceConfig
ReadS [DataSourceConfig]
(Int -> ReadS DataSourceConfig)
-> ReadS [DataSourceConfig]
-> ReadPrec DataSourceConfig
-> ReadPrec [DataSourceConfig]
-> Read DataSourceConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataSourceConfig]
$creadListPrec :: ReadPrec [DataSourceConfig]
readPrec :: ReadPrec DataSourceConfig
$creadPrec :: ReadPrec DataSourceConfig
readList :: ReadS [DataSourceConfig]
$creadList :: ReadS [DataSourceConfig]
readsPrec :: Int -> ReadS DataSourceConfig
$creadsPrec :: Int -> ReadS DataSourceConfig
Prelude.Read, Int -> DataSourceConfig -> ShowS
[DataSourceConfig] -> ShowS
DataSourceConfig -> String
(Int -> DataSourceConfig -> ShowS)
-> (DataSourceConfig -> String)
-> ([DataSourceConfig] -> ShowS)
-> Show DataSourceConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataSourceConfig] -> ShowS
$cshowList :: [DataSourceConfig] -> ShowS
show :: DataSourceConfig -> String
$cshow :: DataSourceConfig -> String
showsPrec :: Int -> DataSourceConfig -> ShowS
$cshowsPrec :: Int -> DataSourceConfig -> ShowS
Prelude.Show, (forall x. DataSourceConfig -> Rep DataSourceConfig x)
-> (forall x. Rep DataSourceConfig x -> DataSourceConfig)
-> Generic DataSourceConfig
forall x. Rep DataSourceConfig x -> DataSourceConfig
forall x. DataSourceConfig -> Rep DataSourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataSourceConfig x -> DataSourceConfig
$cfrom :: forall x. DataSourceConfig -> Rep DataSourceConfig x
Prelude.Generic)
newDataSourceConfig ::
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
DataSourceConfig
newDataSourceConfig :: Text -> Text -> NonEmpty Text -> DataSourceConfig
newDataSourceConfig Text
pName_ Text
pS3Bucket_ NonEmpty Text
pS3Keys_ =
DataSourceConfig' :: Maybe Text
-> Maybe DataSourceType
-> Text
-> Text
-> NonEmpty Text
-> DataSourceConfig
DataSourceConfig'
{ $sel:destination:DataSourceConfig' :: Maybe Text
destination = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':DataSourceConfig' :: Maybe DataSourceType
type' = Maybe DataSourceType
forall a. Maybe a
Prelude.Nothing,
$sel:name:DataSourceConfig' :: Text
name = Text
pName_,
$sel:s3Bucket:DataSourceConfig' :: Text
s3Bucket = Text
pS3Bucket_,
$sel:s3Keys:DataSourceConfig' :: NonEmpty Text
s3Keys = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pS3Keys_
}
dataSourceConfig_destination :: Lens.Lens' DataSourceConfig (Prelude.Maybe Prelude.Text)
dataSourceConfig_destination :: (Maybe Text -> f (Maybe Text))
-> DataSourceConfig -> f DataSourceConfig
dataSourceConfig_destination = (DataSourceConfig -> Maybe Text)
-> (DataSourceConfig -> Maybe Text -> DataSourceConfig)
-> Lens DataSourceConfig DataSourceConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceConfig' {Maybe Text
destination :: Maybe Text
$sel:destination:DataSourceConfig' :: DataSourceConfig -> Maybe Text
destination} -> Maybe Text
destination) (\s :: DataSourceConfig
s@DataSourceConfig' {} Maybe Text
a -> DataSourceConfig
s {$sel:destination:DataSourceConfig' :: Maybe Text
destination = Maybe Text
a} :: DataSourceConfig)
dataSourceConfig_type :: Lens.Lens' DataSourceConfig (Prelude.Maybe DataSourceType)
dataSourceConfig_type :: (Maybe DataSourceType -> f (Maybe DataSourceType))
-> DataSourceConfig -> f DataSourceConfig
dataSourceConfig_type = (DataSourceConfig -> Maybe DataSourceType)
-> (DataSourceConfig -> Maybe DataSourceType -> DataSourceConfig)
-> Lens
DataSourceConfig
DataSourceConfig
(Maybe DataSourceType)
(Maybe DataSourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceConfig' {Maybe DataSourceType
type' :: Maybe DataSourceType
$sel:type':DataSourceConfig' :: DataSourceConfig -> Maybe DataSourceType
type'} -> Maybe DataSourceType
type') (\s :: DataSourceConfig
s@DataSourceConfig' {} Maybe DataSourceType
a -> DataSourceConfig
s {$sel:type':DataSourceConfig' :: Maybe DataSourceType
type' = Maybe DataSourceType
a} :: DataSourceConfig)
dataSourceConfig_name :: Lens.Lens' DataSourceConfig Prelude.Text
dataSourceConfig_name :: (Text -> f Text) -> DataSourceConfig -> f DataSourceConfig
dataSourceConfig_name = (DataSourceConfig -> Text)
-> (DataSourceConfig -> Text -> DataSourceConfig)
-> Lens DataSourceConfig DataSourceConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceConfig' {Text
name :: Text
$sel:name:DataSourceConfig' :: DataSourceConfig -> Text
name} -> Text
name) (\s :: DataSourceConfig
s@DataSourceConfig' {} Text
a -> DataSourceConfig
s {$sel:name:DataSourceConfig' :: Text
name = Text
a} :: DataSourceConfig)
dataSourceConfig_s3Bucket :: Lens.Lens' DataSourceConfig Prelude.Text
dataSourceConfig_s3Bucket :: (Text -> f Text) -> DataSourceConfig -> f DataSourceConfig
dataSourceConfig_s3Bucket = (DataSourceConfig -> Text)
-> (DataSourceConfig -> Text -> DataSourceConfig)
-> Lens DataSourceConfig DataSourceConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceConfig' {Text
s3Bucket :: Text
$sel:s3Bucket:DataSourceConfig' :: DataSourceConfig -> Text
s3Bucket} -> Text
s3Bucket) (\s :: DataSourceConfig
s@DataSourceConfig' {} Text
a -> DataSourceConfig
s {$sel:s3Bucket:DataSourceConfig' :: Text
s3Bucket = Text
a} :: DataSourceConfig)
dataSourceConfig_s3Keys :: Lens.Lens' DataSourceConfig (Prelude.NonEmpty Prelude.Text)
dataSourceConfig_s3Keys :: (NonEmpty Text -> f (NonEmpty Text))
-> DataSourceConfig -> f DataSourceConfig
dataSourceConfig_s3Keys = (DataSourceConfig -> NonEmpty Text)
-> (DataSourceConfig -> NonEmpty Text -> DataSourceConfig)
-> Lens
DataSourceConfig DataSourceConfig (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataSourceConfig' {NonEmpty Text
s3Keys :: NonEmpty Text
$sel:s3Keys:DataSourceConfig' :: DataSourceConfig -> NonEmpty Text
s3Keys} -> NonEmpty Text
s3Keys) (\s :: DataSourceConfig
s@DataSourceConfig' {} NonEmpty Text
a -> DataSourceConfig
s {$sel:s3Keys:DataSourceConfig' :: NonEmpty Text
s3Keys = NonEmpty Text
a} :: DataSourceConfig) ((NonEmpty Text -> f (NonEmpty Text))
-> DataSourceConfig -> f DataSourceConfig)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> DataSourceConfig
-> f DataSourceConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON DataSourceConfig where
parseJSON :: Value -> Parser DataSourceConfig
parseJSON =
String
-> (Object -> Parser DataSourceConfig)
-> Value
-> Parser DataSourceConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DataSourceConfig"
( \Object
x ->
Maybe Text
-> Maybe DataSourceType
-> Text
-> Text
-> NonEmpty Text
-> DataSourceConfig
DataSourceConfig'
(Maybe Text
-> Maybe DataSourceType
-> Text
-> Text
-> NonEmpty Text
-> DataSourceConfig)
-> Parser (Maybe Text)
-> Parser
(Maybe DataSourceType
-> Text -> Text -> NonEmpty Text -> DataSourceConfig)
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
"destination")
Parser
(Maybe DataSourceType
-> Text -> Text -> NonEmpty Text -> DataSourceConfig)
-> Parser (Maybe DataSourceType)
-> Parser (Text -> Text -> NonEmpty Text -> DataSourceConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DataSourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
Parser (Text -> Text -> NonEmpty Text -> DataSourceConfig)
-> Parser Text
-> Parser (Text -> NonEmpty Text -> DataSourceConfig)
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 Text -> DataSourceConfig)
-> Parser Text -> Parser (NonEmpty Text -> DataSourceConfig)
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
"s3Bucket")
Parser (NonEmpty Text -> DataSourceConfig)
-> Parser (NonEmpty Text) -> Parser DataSourceConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"s3Keys")
)
instance Prelude.Hashable DataSourceConfig
instance Prelude.NFData DataSourceConfig
instance Core.ToJSON DataSourceConfig where
toJSON :: DataSourceConfig -> Value
toJSON DataSourceConfig' {Maybe Text
Maybe DataSourceType
NonEmpty Text
Text
s3Keys :: NonEmpty Text
s3Bucket :: Text
name :: Text
type' :: Maybe DataSourceType
destination :: Maybe Text
$sel:s3Keys:DataSourceConfig' :: DataSourceConfig -> NonEmpty Text
$sel:s3Bucket:DataSourceConfig' :: DataSourceConfig -> Text
$sel:name:DataSourceConfig' :: DataSourceConfig -> Text
$sel:type':DataSourceConfig' :: DataSourceConfig -> Maybe DataSourceType
$sel:destination:DataSourceConfig' :: DataSourceConfig -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"destination" 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
destination,
(Text
"type" Text -> DataSourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DataSourceType -> Pair) -> Maybe DataSourceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceType
type',
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
"s3Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Bucket),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"s3Keys" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
s3Keys)
]
)