{-# 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.IoTAnalytics.Types.S3DestinationConfiguration where
import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.GlueConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data S3DestinationConfiguration = S3DestinationConfiguration'
{
S3DestinationConfiguration -> Maybe GlueConfiguration
glueConfiguration :: Prelude.Maybe GlueConfiguration,
S3DestinationConfiguration -> Text
bucket :: Prelude.Text,
S3DestinationConfiguration -> Text
key :: Prelude.Text,
S3DestinationConfiguration -> Text
roleArn :: Prelude.Text
}
deriving (S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
(S3DestinationConfiguration -> S3DestinationConfiguration -> Bool)
-> (S3DestinationConfiguration
-> S3DestinationConfiguration -> Bool)
-> Eq S3DestinationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
$c/= :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
== :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
$c== :: S3DestinationConfiguration -> S3DestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [S3DestinationConfiguration]
ReadPrec S3DestinationConfiguration
Int -> ReadS S3DestinationConfiguration
ReadS [S3DestinationConfiguration]
(Int -> ReadS S3DestinationConfiguration)
-> ReadS [S3DestinationConfiguration]
-> ReadPrec S3DestinationConfiguration
-> ReadPrec [S3DestinationConfiguration]
-> Read S3DestinationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3DestinationConfiguration]
$creadListPrec :: ReadPrec [S3DestinationConfiguration]
readPrec :: ReadPrec S3DestinationConfiguration
$creadPrec :: ReadPrec S3DestinationConfiguration
readList :: ReadS [S3DestinationConfiguration]
$creadList :: ReadS [S3DestinationConfiguration]
readsPrec :: Int -> ReadS S3DestinationConfiguration
$creadsPrec :: Int -> ReadS S3DestinationConfiguration
Prelude.Read, Int -> S3DestinationConfiguration -> ShowS
[S3DestinationConfiguration] -> ShowS
S3DestinationConfiguration -> String
(Int -> S3DestinationConfiguration -> ShowS)
-> (S3DestinationConfiguration -> String)
-> ([S3DestinationConfiguration] -> ShowS)
-> Show S3DestinationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3DestinationConfiguration] -> ShowS
$cshowList :: [S3DestinationConfiguration] -> ShowS
show :: S3DestinationConfiguration -> String
$cshow :: S3DestinationConfiguration -> String
showsPrec :: Int -> S3DestinationConfiguration -> ShowS
$cshowsPrec :: Int -> S3DestinationConfiguration -> ShowS
Prelude.Show, (forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x)
-> (forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration)
-> Generic S3DestinationConfiguration
forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration
forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3DestinationConfiguration x -> S3DestinationConfiguration
$cfrom :: forall x.
S3DestinationConfiguration -> Rep S3DestinationConfiguration x
Prelude.Generic)
newS3DestinationConfiguration ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
S3DestinationConfiguration
newS3DestinationConfiguration :: Text -> Text -> Text -> S3DestinationConfiguration
newS3DestinationConfiguration
Text
pBucket_
Text
pKey_
Text
pRoleArn_ =
S3DestinationConfiguration' :: Maybe GlueConfiguration
-> Text -> Text -> Text -> S3DestinationConfiguration
S3DestinationConfiguration'
{ $sel:glueConfiguration:S3DestinationConfiguration' :: Maybe GlueConfiguration
glueConfiguration =
Maybe GlueConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:S3DestinationConfiguration' :: Text
bucket = Text
pBucket_,
$sel:key:S3DestinationConfiguration' :: Text
key = Text
pKey_,
$sel:roleArn:S3DestinationConfiguration' :: Text
roleArn = Text
pRoleArn_
}
s3DestinationConfiguration_glueConfiguration :: Lens.Lens' S3DestinationConfiguration (Prelude.Maybe GlueConfiguration)
s3DestinationConfiguration_glueConfiguration :: (Maybe GlueConfiguration -> f (Maybe GlueConfiguration))
-> S3DestinationConfiguration -> f S3DestinationConfiguration
s3DestinationConfiguration_glueConfiguration = (S3DestinationConfiguration -> Maybe GlueConfiguration)
-> (S3DestinationConfiguration
-> Maybe GlueConfiguration -> S3DestinationConfiguration)
-> Lens
S3DestinationConfiguration
S3DestinationConfiguration
(Maybe GlueConfiguration)
(Maybe GlueConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationConfiguration' {Maybe GlueConfiguration
glueConfiguration :: Maybe GlueConfiguration
$sel:glueConfiguration:S3DestinationConfiguration' :: S3DestinationConfiguration -> Maybe GlueConfiguration
glueConfiguration} -> Maybe GlueConfiguration
glueConfiguration) (\s :: S3DestinationConfiguration
s@S3DestinationConfiguration' {} Maybe GlueConfiguration
a -> S3DestinationConfiguration
s {$sel:glueConfiguration:S3DestinationConfiguration' :: Maybe GlueConfiguration
glueConfiguration = Maybe GlueConfiguration
a} :: S3DestinationConfiguration)
s3DestinationConfiguration_bucket :: Lens.Lens' S3DestinationConfiguration Prelude.Text
s3DestinationConfiguration_bucket :: (Text -> f Text)
-> S3DestinationConfiguration -> f S3DestinationConfiguration
s3DestinationConfiguration_bucket = (S3DestinationConfiguration -> Text)
-> (S3DestinationConfiguration
-> Text -> S3DestinationConfiguration)
-> Lens
S3DestinationConfiguration S3DestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationConfiguration' {Text
bucket :: Text
$sel:bucket:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
bucket} -> Text
bucket) (\s :: S3DestinationConfiguration
s@S3DestinationConfiguration' {} Text
a -> S3DestinationConfiguration
s {$sel:bucket:S3DestinationConfiguration' :: Text
bucket = Text
a} :: S3DestinationConfiguration)
s3DestinationConfiguration_key :: Lens.Lens' S3DestinationConfiguration Prelude.Text
s3DestinationConfiguration_key :: (Text -> f Text)
-> S3DestinationConfiguration -> f S3DestinationConfiguration
s3DestinationConfiguration_key = (S3DestinationConfiguration -> Text)
-> (S3DestinationConfiguration
-> Text -> S3DestinationConfiguration)
-> Lens
S3DestinationConfiguration S3DestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationConfiguration' {Text
key :: Text
$sel:key:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
key} -> Text
key) (\s :: S3DestinationConfiguration
s@S3DestinationConfiguration' {} Text
a -> S3DestinationConfiguration
s {$sel:key:S3DestinationConfiguration' :: Text
key = Text
a} :: S3DestinationConfiguration)
s3DestinationConfiguration_roleArn :: Lens.Lens' S3DestinationConfiguration Prelude.Text
s3DestinationConfiguration_roleArn :: (Text -> f Text)
-> S3DestinationConfiguration -> f S3DestinationConfiguration
s3DestinationConfiguration_roleArn = (S3DestinationConfiguration -> Text)
-> (S3DestinationConfiguration
-> Text -> S3DestinationConfiguration)
-> Lens
S3DestinationConfiguration S3DestinationConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3DestinationConfiguration' {Text
roleArn :: Text
$sel:roleArn:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
roleArn} -> Text
roleArn) (\s :: S3DestinationConfiguration
s@S3DestinationConfiguration' {} Text
a -> S3DestinationConfiguration
s {$sel:roleArn:S3DestinationConfiguration' :: Text
roleArn = Text
a} :: S3DestinationConfiguration)
instance Core.FromJSON S3DestinationConfiguration where
parseJSON :: Value -> Parser S3DestinationConfiguration
parseJSON =
String
-> (Object -> Parser S3DestinationConfiguration)
-> Value
-> Parser S3DestinationConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"S3DestinationConfiguration"
( \Object
x ->
Maybe GlueConfiguration
-> Text -> Text -> Text -> S3DestinationConfiguration
S3DestinationConfiguration'
(Maybe GlueConfiguration
-> Text -> Text -> Text -> S3DestinationConfiguration)
-> Parser (Maybe GlueConfiguration)
-> Parser (Text -> Text -> Text -> S3DestinationConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GlueConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"glueConfiguration")
Parser (Text -> Text -> Text -> S3DestinationConfiguration)
-> Parser Text
-> Parser (Text -> Text -> S3DestinationConfiguration)
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
"bucket")
Parser (Text -> Text -> S3DestinationConfiguration)
-> Parser Text -> Parser (Text -> S3DestinationConfiguration)
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
"key")
Parser (Text -> S3DestinationConfiguration)
-> Parser Text -> Parser S3DestinationConfiguration
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
"roleArn")
)
instance Prelude.Hashable S3DestinationConfiguration
instance Prelude.NFData S3DestinationConfiguration
instance Core.ToJSON S3DestinationConfiguration where
toJSON :: S3DestinationConfiguration -> Value
toJSON S3DestinationConfiguration' {Maybe GlueConfiguration
Text
roleArn :: Text
key :: Text
bucket :: Text
glueConfiguration :: Maybe GlueConfiguration
$sel:roleArn:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
$sel:key:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
$sel:bucket:S3DestinationConfiguration' :: S3DestinationConfiguration -> Text
$sel:glueConfiguration:S3DestinationConfiguration' :: S3DestinationConfiguration -> Maybe GlueConfiguration
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"glueConfiguration" Text -> GlueConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(GlueConfiguration -> Pair)
-> Maybe GlueConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GlueConfiguration
glueConfiguration,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucket),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)