{-# 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.DMS.Types.ElasticsearchSettings where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ElasticsearchSettings = ElasticsearchSettings'
{
ElasticsearchSettings -> Maybe Int
fullLoadErrorPercentage :: Prelude.Maybe Prelude.Int,
ElasticsearchSettings -> Maybe Int
errorRetryDuration :: Prelude.Maybe Prelude.Int,
ElasticsearchSettings -> Text
serviceAccessRoleArn :: Prelude.Text,
ElasticsearchSettings -> Text
endpointUri :: Prelude.Text
}
deriving (ElasticsearchSettings -> ElasticsearchSettings -> Bool
(ElasticsearchSettings -> ElasticsearchSettings -> Bool)
-> (ElasticsearchSettings -> ElasticsearchSettings -> Bool)
-> Eq ElasticsearchSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ElasticsearchSettings -> ElasticsearchSettings -> Bool
$c/= :: ElasticsearchSettings -> ElasticsearchSettings -> Bool
== :: ElasticsearchSettings -> ElasticsearchSettings -> Bool
$c== :: ElasticsearchSettings -> ElasticsearchSettings -> Bool
Prelude.Eq, ReadPrec [ElasticsearchSettings]
ReadPrec ElasticsearchSettings
Int -> ReadS ElasticsearchSettings
ReadS [ElasticsearchSettings]
(Int -> ReadS ElasticsearchSettings)
-> ReadS [ElasticsearchSettings]
-> ReadPrec ElasticsearchSettings
-> ReadPrec [ElasticsearchSettings]
-> Read ElasticsearchSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ElasticsearchSettings]
$creadListPrec :: ReadPrec [ElasticsearchSettings]
readPrec :: ReadPrec ElasticsearchSettings
$creadPrec :: ReadPrec ElasticsearchSettings
readList :: ReadS [ElasticsearchSettings]
$creadList :: ReadS [ElasticsearchSettings]
readsPrec :: Int -> ReadS ElasticsearchSettings
$creadsPrec :: Int -> ReadS ElasticsearchSettings
Prelude.Read, Int -> ElasticsearchSettings -> ShowS
[ElasticsearchSettings] -> ShowS
ElasticsearchSettings -> String
(Int -> ElasticsearchSettings -> ShowS)
-> (ElasticsearchSettings -> String)
-> ([ElasticsearchSettings] -> ShowS)
-> Show ElasticsearchSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ElasticsearchSettings] -> ShowS
$cshowList :: [ElasticsearchSettings] -> ShowS
show :: ElasticsearchSettings -> String
$cshow :: ElasticsearchSettings -> String
showsPrec :: Int -> ElasticsearchSettings -> ShowS
$cshowsPrec :: Int -> ElasticsearchSettings -> ShowS
Prelude.Show, (forall x. ElasticsearchSettings -> Rep ElasticsearchSettings x)
-> (forall x. Rep ElasticsearchSettings x -> ElasticsearchSettings)
-> Generic ElasticsearchSettings
forall x. Rep ElasticsearchSettings x -> ElasticsearchSettings
forall x. ElasticsearchSettings -> Rep ElasticsearchSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ElasticsearchSettings x -> ElasticsearchSettings
$cfrom :: forall x. ElasticsearchSettings -> Rep ElasticsearchSettings x
Prelude.Generic)
newElasticsearchSettings ::
Prelude.Text ->
Prelude.Text ->
ElasticsearchSettings
newElasticsearchSettings :: Text -> Text -> ElasticsearchSettings
newElasticsearchSettings
Text
pServiceAccessRoleArn_
Text
pEndpointUri_ =
ElasticsearchSettings' :: Maybe Int -> Maybe Int -> Text -> Text -> ElasticsearchSettings
ElasticsearchSettings'
{ $sel:fullLoadErrorPercentage:ElasticsearchSettings' :: Maybe Int
fullLoadErrorPercentage =
Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:errorRetryDuration:ElasticsearchSettings' :: Maybe Int
errorRetryDuration = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:serviceAccessRoleArn:ElasticsearchSettings' :: Text
serviceAccessRoleArn = Text
pServiceAccessRoleArn_,
$sel:endpointUri:ElasticsearchSettings' :: Text
endpointUri = Text
pEndpointUri_
}
elasticsearchSettings_fullLoadErrorPercentage :: Lens.Lens' ElasticsearchSettings (Prelude.Maybe Prelude.Int)
elasticsearchSettings_fullLoadErrorPercentage :: (Maybe Int -> f (Maybe Int))
-> ElasticsearchSettings -> f ElasticsearchSettings
elasticsearchSettings_fullLoadErrorPercentage = (ElasticsearchSettings -> Maybe Int)
-> (ElasticsearchSettings -> Maybe Int -> ElasticsearchSettings)
-> Lens
ElasticsearchSettings ElasticsearchSettings (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ElasticsearchSettings' {Maybe Int
fullLoadErrorPercentage :: Maybe Int
$sel:fullLoadErrorPercentage:ElasticsearchSettings' :: ElasticsearchSettings -> Maybe Int
fullLoadErrorPercentage} -> Maybe Int
fullLoadErrorPercentage) (\s :: ElasticsearchSettings
s@ElasticsearchSettings' {} Maybe Int
a -> ElasticsearchSettings
s {$sel:fullLoadErrorPercentage:ElasticsearchSettings' :: Maybe Int
fullLoadErrorPercentage = Maybe Int
a} :: ElasticsearchSettings)
elasticsearchSettings_errorRetryDuration :: Lens.Lens' ElasticsearchSettings (Prelude.Maybe Prelude.Int)
elasticsearchSettings_errorRetryDuration :: (Maybe Int -> f (Maybe Int))
-> ElasticsearchSettings -> f ElasticsearchSettings
elasticsearchSettings_errorRetryDuration = (ElasticsearchSettings -> Maybe Int)
-> (ElasticsearchSettings -> Maybe Int -> ElasticsearchSettings)
-> Lens
ElasticsearchSettings ElasticsearchSettings (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ElasticsearchSettings' {Maybe Int
errorRetryDuration :: Maybe Int
$sel:errorRetryDuration:ElasticsearchSettings' :: ElasticsearchSettings -> Maybe Int
errorRetryDuration} -> Maybe Int
errorRetryDuration) (\s :: ElasticsearchSettings
s@ElasticsearchSettings' {} Maybe Int
a -> ElasticsearchSettings
s {$sel:errorRetryDuration:ElasticsearchSettings' :: Maybe Int
errorRetryDuration = Maybe Int
a} :: ElasticsearchSettings)
elasticsearchSettings_serviceAccessRoleArn :: Lens.Lens' ElasticsearchSettings Prelude.Text
elasticsearchSettings_serviceAccessRoleArn :: (Text -> f Text)
-> ElasticsearchSettings -> f ElasticsearchSettings
elasticsearchSettings_serviceAccessRoleArn = (ElasticsearchSettings -> Text)
-> (ElasticsearchSettings -> Text -> ElasticsearchSettings)
-> Lens ElasticsearchSettings ElasticsearchSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ElasticsearchSettings' {Text
serviceAccessRoleArn :: Text
$sel:serviceAccessRoleArn:ElasticsearchSettings' :: ElasticsearchSettings -> Text
serviceAccessRoleArn} -> Text
serviceAccessRoleArn) (\s :: ElasticsearchSettings
s@ElasticsearchSettings' {} Text
a -> ElasticsearchSettings
s {$sel:serviceAccessRoleArn:ElasticsearchSettings' :: Text
serviceAccessRoleArn = Text
a} :: ElasticsearchSettings)
elasticsearchSettings_endpointUri :: Lens.Lens' ElasticsearchSettings Prelude.Text
elasticsearchSettings_endpointUri :: (Text -> f Text)
-> ElasticsearchSettings -> f ElasticsearchSettings
elasticsearchSettings_endpointUri = (ElasticsearchSettings -> Text)
-> (ElasticsearchSettings -> Text -> ElasticsearchSettings)
-> Lens ElasticsearchSettings ElasticsearchSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ElasticsearchSettings' {Text
endpointUri :: Text
$sel:endpointUri:ElasticsearchSettings' :: ElasticsearchSettings -> Text
endpointUri} -> Text
endpointUri) (\s :: ElasticsearchSettings
s@ElasticsearchSettings' {} Text
a -> ElasticsearchSettings
s {$sel:endpointUri:ElasticsearchSettings' :: Text
endpointUri = Text
a} :: ElasticsearchSettings)
instance Core.FromJSON ElasticsearchSettings where
parseJSON :: Value -> Parser ElasticsearchSettings
parseJSON =
String
-> (Object -> Parser ElasticsearchSettings)
-> Value
-> Parser ElasticsearchSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ElasticsearchSettings"
( \Object
x ->
Maybe Int -> Maybe Int -> Text -> Text -> ElasticsearchSettings
ElasticsearchSettings'
(Maybe Int -> Maybe Int -> Text -> Text -> ElasticsearchSettings)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Text -> Text -> ElasticsearchSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FullLoadErrorPercentage")
Parser (Maybe Int -> Text -> Text -> ElasticsearchSettings)
-> Parser (Maybe Int)
-> Parser (Text -> Text -> ElasticsearchSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ErrorRetryDuration")
Parser (Text -> Text -> ElasticsearchSettings)
-> Parser Text -> Parser (Text -> ElasticsearchSettings)
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
"ServiceAccessRoleArn")
Parser (Text -> ElasticsearchSettings)
-> Parser Text -> Parser ElasticsearchSettings
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
"EndpointUri")
)
instance Prelude.Hashable ElasticsearchSettings
instance Prelude.NFData ElasticsearchSettings
instance Core.ToJSON ElasticsearchSettings where
toJSON :: ElasticsearchSettings -> Value
toJSON ElasticsearchSettings' {Maybe Int
Text
endpointUri :: Text
serviceAccessRoleArn :: Text
errorRetryDuration :: Maybe Int
fullLoadErrorPercentage :: Maybe Int
$sel:endpointUri:ElasticsearchSettings' :: ElasticsearchSettings -> Text
$sel:serviceAccessRoleArn:ElasticsearchSettings' :: ElasticsearchSettings -> Text
$sel:errorRetryDuration:ElasticsearchSettings' :: ElasticsearchSettings -> Maybe Int
$sel:fullLoadErrorPercentage:ElasticsearchSettings' :: ElasticsearchSettings -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"FullLoadErrorPercentage" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
fullLoadErrorPercentage,
(Text
"ErrorRetryDuration" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
errorRetryDuration,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ServiceAccessRoleArn"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceAccessRoleArn
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"EndpointUri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointUri)
]
)