{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:uploadSettings:S3Source' :: Maybe UploadSettings
uploadSettings = forall a. Maybe a
Prelude.Nothing,
$sel:dataSourceArn:S3Source' :: Text
dataSourceArn = Text
pDataSourceArn_,
$sel:inputColumns:S3Source' :: NonEmpty InputColumn
inputColumns = 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 InputColumn
pInputColumns_
}
s3Source_uploadSettings :: Lens.Lens' S3Source (Prelude.Maybe UploadSettings)
s3Source_uploadSettings :: Lens' S3Source (Maybe UploadSettings)
s3Source_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 :: Lens' S3Source Text
s3Source_dataSourceArn = 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 :: Lens' S3Source (NonEmpty InputColumn)
s3Source_inputColumns = 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) 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 S3Source where
parseJSON :: Value -> Parser S3Source
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"S3Source"
( \Object
x ->
Maybe UploadSettings -> Text -> NonEmpty InputColumn -> S3Source
S3Source'
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
"UploadSettings")
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
"DataSourceArn")
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
"InputColumns")
)
instance Prelude.Hashable S3Source where
hashWithSalt :: Int -> S3Source -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UploadSettings
uploadSettings
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSourceArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty InputColumn
inputColumns
instance Prelude.NFData S3Source where
rnf :: S3Source -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe UploadSettings
uploadSettings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataSourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty InputColumn
inputColumns
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"UploadSettings" 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 UploadSettings
uploadSettings,
forall a. a -> Maybe a
Prelude.Just (Key
"DataSourceArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
dataSourceArn),
forall a. a -> Maybe a
Prelude.Just (Key
"InputColumns" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty InputColumn
inputColumns)
]
)