{-# 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.QuickSight.Types.S3Source where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.InputColumn
import Amazonka.QuickSight.Types.UploadSettings
data S3Source = S3Source'
{
S3Source -> Maybe UploadSettings
uploadSettings :: Prelude.Maybe UploadSettings,
S3Source -> Text
dataSourceArn :: Prelude.Text,
S3Source -> NonEmpty InputColumn
inputColumns :: Prelude.NonEmpty InputColumn
}
deriving (S3Source -> S3Source -> Bool
(S3Source -> S3Source -> Bool)
-> (S3Source -> S3Source -> Bool) -> Eq S3Source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3Source -> S3Source -> Bool
$c/= :: S3Source -> S3Source -> Bool
== :: S3Source -> S3Source -> Bool
$c== :: S3Source -> S3Source -> Bool
Prelude.Eq, ReadPrec [S3Source]
ReadPrec S3Source
Int -> ReadS S3Source
ReadS [S3Source]
(Int -> ReadS S3Source)
-> ReadS [S3Source]
-> ReadPrec S3Source
-> ReadPrec [S3Source]
-> Read S3Source
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3Source]
$creadListPrec :: ReadPrec [S3Source]
readPrec :: ReadPrec S3Source
$creadPrec :: ReadPrec S3Source
readList :: ReadS [S3Source]
$creadList :: ReadS [S3Source]
readsPrec :: Int -> ReadS S3Source
$creadsPrec :: Int -> ReadS S3Source
Prelude.Read, Int -> S3Source -> ShowS
[S3Source] -> ShowS
S3Source -> String
(Int -> S3Source -> ShowS)
-> (S3Source -> String) -> ([S3Source] -> ShowS) -> Show S3Source
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3Source] -> ShowS
$cshowList :: [S3Source] -> ShowS
show :: S3Source -> String
$cshow :: S3Source -> String
showsPrec :: Int -> S3Source -> ShowS
$cshowsPrec :: Int -> S3Source -> ShowS
Prelude.Show, (forall x. S3Source -> Rep S3Source x)
-> (forall x. Rep S3Source x -> S3Source) -> Generic S3Source
forall x. Rep S3Source x -> S3Source
forall x. S3Source -> Rep S3Source x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3Source x -> S3Source
$cfrom :: forall x. S3Source -> Rep S3Source x
Prelude.Generic)
newS3Source ::
Prelude.Text ->
Prelude.NonEmpty InputColumn ->
S3Source
newS3Source :: Text -> NonEmpty InputColumn -> S3Source
newS3Source Text
pDataSourceArn_ NonEmpty InputColumn
pInputColumns_ =
S3Source' :: Maybe UploadSettings -> Text -> NonEmpty InputColumn -> S3Source
S3Source'
{ $sel:uploadSettings:S3Source' :: Maybe UploadSettings
uploadSettings = Maybe UploadSettings
forall a. Maybe a
Prelude.Nothing,
$sel:dataSourceArn:S3Source' :: Text
dataSourceArn = Text
pDataSourceArn_,
$sel:inputColumns:S3Source' :: NonEmpty InputColumn
inputColumns = Tagged (NonEmpty InputColumn) (Identity (NonEmpty InputColumn))
-> Tagged (NonEmpty InputColumn) (Identity (NonEmpty InputColumn))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty InputColumn) (Identity (NonEmpty InputColumn))
-> Tagged (NonEmpty InputColumn) (Identity (NonEmpty InputColumn)))
-> NonEmpty InputColumn -> NonEmpty InputColumn
forall t b. AReview t b -> b -> t
Lens.# NonEmpty InputColumn
pInputColumns_
}
s3Source_uploadSettings :: Lens.Lens' S3Source (Prelude.Maybe UploadSettings)
s3Source_uploadSettings :: (Maybe UploadSettings -> f (Maybe UploadSettings))
-> S3Source -> f S3Source
s3Source_uploadSettings = (S3Source -> Maybe UploadSettings)
-> (S3Source -> Maybe UploadSettings -> S3Source)
-> Lens
S3Source S3Source (Maybe UploadSettings) (Maybe UploadSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Source' {Maybe UploadSettings
uploadSettings :: Maybe UploadSettings
$sel:uploadSettings:S3Source' :: S3Source -> Maybe UploadSettings
uploadSettings} -> Maybe UploadSettings
uploadSettings) (\s :: S3Source
s@S3Source' {} Maybe UploadSettings
a -> S3Source
s {$sel:uploadSettings:S3Source' :: Maybe UploadSettings
uploadSettings = Maybe UploadSettings
a} :: S3Source)
s3Source_dataSourceArn :: Lens.Lens' S3Source Prelude.Text
s3Source_dataSourceArn :: (Text -> f Text) -> S3Source -> f S3Source
s3Source_dataSourceArn = (S3Source -> Text)
-> (S3Source -> Text -> S3Source)
-> Lens S3Source S3Source Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Source' {Text
dataSourceArn :: Text
$sel:dataSourceArn:S3Source' :: S3Source -> Text
dataSourceArn} -> Text
dataSourceArn) (\s :: S3Source
s@S3Source' {} Text
a -> S3Source
s {$sel:dataSourceArn:S3Source' :: Text
dataSourceArn = Text
a} :: S3Source)
s3Source_inputColumns :: Lens.Lens' S3Source (Prelude.NonEmpty InputColumn)
s3Source_inputColumns :: (NonEmpty InputColumn -> f (NonEmpty InputColumn))
-> S3Source -> f S3Source
s3Source_inputColumns = (S3Source -> NonEmpty InputColumn)
-> (S3Source -> NonEmpty InputColumn -> S3Source)
-> Lens
S3Source S3Source (NonEmpty InputColumn) (NonEmpty InputColumn)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3Source' {NonEmpty InputColumn
inputColumns :: NonEmpty InputColumn
$sel:inputColumns:S3Source' :: S3Source -> NonEmpty InputColumn
inputColumns} -> NonEmpty InputColumn
inputColumns) (\s :: S3Source
s@S3Source' {} NonEmpty InputColumn
a -> S3Source
s {$sel:inputColumns:S3Source' :: NonEmpty InputColumn
inputColumns = NonEmpty InputColumn
a} :: S3Source) ((NonEmpty InputColumn -> f (NonEmpty InputColumn))
-> S3Source -> f S3Source)
-> ((NonEmpty InputColumn -> f (NonEmpty InputColumn))
-> NonEmpty InputColumn -> f (NonEmpty InputColumn))
-> (NonEmpty InputColumn -> f (NonEmpty InputColumn))
-> S3Source
-> f S3Source
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty InputColumn -> f (NonEmpty InputColumn))
-> NonEmpty InputColumn -> f (NonEmpty InputColumn)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON S3Source where
parseJSON :: Value -> Parser S3Source
parseJSON =
String -> (Object -> Parser S3Source) -> Value -> Parser S3Source
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3Source"
( \Object
x ->
Maybe UploadSettings -> Text -> NonEmpty InputColumn -> S3Source
S3Source'
(Maybe UploadSettings -> Text -> NonEmpty InputColumn -> S3Source)
-> Parser (Maybe UploadSettings)
-> Parser (Text -> NonEmpty InputColumn -> S3Source)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe UploadSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UploadSettings")
Parser (Text -> NonEmpty InputColumn -> S3Source)
-> Parser Text -> Parser (NonEmpty InputColumn -> S3Source)
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
"DataSourceArn")
Parser (NonEmpty InputColumn -> S3Source)
-> Parser (NonEmpty InputColumn) -> Parser S3Source
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty InputColumn)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InputColumns")
)
instance Prelude.Hashable S3Source
instance Prelude.NFData S3Source
instance Core.ToJSON S3Source where
toJSON :: S3Source -> Value
toJSON S3Source' {Maybe UploadSettings
NonEmpty InputColumn
Text
inputColumns :: NonEmpty InputColumn
dataSourceArn :: Text
uploadSettings :: Maybe UploadSettings
$sel:inputColumns:S3Source' :: S3Source -> NonEmpty InputColumn
$sel:dataSourceArn:S3Source' :: S3Source -> Text
$sel:uploadSettings:S3Source' :: S3Source -> Maybe UploadSettings
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"UploadSettings" Text -> UploadSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(UploadSettings -> Pair) -> Maybe UploadSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UploadSettings
uploadSettings,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataSourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InputColumns" Text -> NonEmpty InputColumn -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty InputColumn
inputColumns)
]
)