{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:destination:DataSourceConfig' :: Maybe Text
destination = forall a. Maybe a
Prelude.Nothing,
$sel:type':DataSourceConfig' :: Maybe DataSourceType
type' = 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 = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pS3Keys_
}
dataSourceConfig_destination :: Lens.Lens' DataSourceConfig (Prelude.Maybe Prelude.Text)
dataSourceConfig_destination :: Lens' DataSourceConfig (Maybe Text)
dataSourceConfig_destination = 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 :: Lens' DataSourceConfig (Maybe DataSourceType)
dataSourceConfig_type = 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 :: Lens' DataSourceConfig Text
dataSourceConfig_name = 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 :: Lens' DataSourceConfig Text
dataSourceConfig_s3Bucket = 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 :: Lens' DataSourceConfig (NonEmpty Text)
dataSourceConfig_s3Keys = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON DataSourceConfig where
parseJSON :: Value -> Parser DataSourceConfig
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DataSourceConfig"
( \Object
x ->
Maybe Text
-> Maybe DataSourceType
-> Text
-> Text
-> NonEmpty Text
-> DataSourceConfig
DataSourceConfig'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"destination")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"type")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"s3Bucket")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"s3Keys")
)
instance Prelude.Hashable DataSourceConfig where
hashWithSalt :: Int -> DataSourceConfig -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destination
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSourceType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Bucket
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
s3Keys
instance Prelude.NFData DataSourceConfig where
rnf :: DataSourceConfig -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destination
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSourceType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Bucket
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
s3Keys
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"destination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destination,
(Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceType
type',
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"s3Bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Bucket),
forall a. a -> Maybe a
Prelude.Just (Key
"s3Keys" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
s3Keys)
]
)