{-# 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.CloudSearch.Types.ScalingParameters where
import Amazonka.CloudSearch.Types.PartitionInstanceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ScalingParameters = ScalingParameters'
{
ScalingParameters -> Maybe PartitionInstanceType
desiredInstanceType :: Prelude.Maybe PartitionInstanceType,
ScalingParameters -> Maybe Natural
desiredReplicationCount :: Prelude.Maybe Prelude.Natural,
ScalingParameters -> Maybe Natural
desiredPartitionCount :: Prelude.Maybe Prelude.Natural
}
deriving (ScalingParameters -> ScalingParameters -> Bool
(ScalingParameters -> ScalingParameters -> Bool)
-> (ScalingParameters -> ScalingParameters -> Bool)
-> Eq ScalingParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScalingParameters -> ScalingParameters -> Bool
$c/= :: ScalingParameters -> ScalingParameters -> Bool
== :: ScalingParameters -> ScalingParameters -> Bool
$c== :: ScalingParameters -> ScalingParameters -> Bool
Prelude.Eq, ReadPrec [ScalingParameters]
ReadPrec ScalingParameters
Int -> ReadS ScalingParameters
ReadS [ScalingParameters]
(Int -> ReadS ScalingParameters)
-> ReadS [ScalingParameters]
-> ReadPrec ScalingParameters
-> ReadPrec [ScalingParameters]
-> Read ScalingParameters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScalingParameters]
$creadListPrec :: ReadPrec [ScalingParameters]
readPrec :: ReadPrec ScalingParameters
$creadPrec :: ReadPrec ScalingParameters
readList :: ReadS [ScalingParameters]
$creadList :: ReadS [ScalingParameters]
readsPrec :: Int -> ReadS ScalingParameters
$creadsPrec :: Int -> ReadS ScalingParameters
Prelude.Read, Int -> ScalingParameters -> ShowS
[ScalingParameters] -> ShowS
ScalingParameters -> String
(Int -> ScalingParameters -> ShowS)
-> (ScalingParameters -> String)
-> ([ScalingParameters] -> ShowS)
-> Show ScalingParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScalingParameters] -> ShowS
$cshowList :: [ScalingParameters] -> ShowS
show :: ScalingParameters -> String
$cshow :: ScalingParameters -> String
showsPrec :: Int -> ScalingParameters -> ShowS
$cshowsPrec :: Int -> ScalingParameters -> ShowS
Prelude.Show, (forall x. ScalingParameters -> Rep ScalingParameters x)
-> (forall x. Rep ScalingParameters x -> ScalingParameters)
-> Generic ScalingParameters
forall x. Rep ScalingParameters x -> ScalingParameters
forall x. ScalingParameters -> Rep ScalingParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScalingParameters x -> ScalingParameters
$cfrom :: forall x. ScalingParameters -> Rep ScalingParameters x
Prelude.Generic)
newScalingParameters ::
ScalingParameters
newScalingParameters :: ScalingParameters
newScalingParameters =
ScalingParameters' :: Maybe PartitionInstanceType
-> Maybe Natural -> Maybe Natural -> ScalingParameters
ScalingParameters'
{ $sel:desiredInstanceType:ScalingParameters' :: Maybe PartitionInstanceType
desiredInstanceType =
Maybe PartitionInstanceType
forall a. Maybe a
Prelude.Nothing,
$sel:desiredReplicationCount:ScalingParameters' :: Maybe Natural
desiredReplicationCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:desiredPartitionCount:ScalingParameters' :: Maybe Natural
desiredPartitionCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
scalingParameters_desiredInstanceType :: Lens.Lens' ScalingParameters (Prelude.Maybe PartitionInstanceType)
scalingParameters_desiredInstanceType :: (Maybe PartitionInstanceType -> f (Maybe PartitionInstanceType))
-> ScalingParameters -> f ScalingParameters
scalingParameters_desiredInstanceType = (ScalingParameters -> Maybe PartitionInstanceType)
-> (ScalingParameters
-> Maybe PartitionInstanceType -> ScalingParameters)
-> Lens
ScalingParameters
ScalingParameters
(Maybe PartitionInstanceType)
(Maybe PartitionInstanceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingParameters' {Maybe PartitionInstanceType
desiredInstanceType :: Maybe PartitionInstanceType
$sel:desiredInstanceType:ScalingParameters' :: ScalingParameters -> Maybe PartitionInstanceType
desiredInstanceType} -> Maybe PartitionInstanceType
desiredInstanceType) (\s :: ScalingParameters
s@ScalingParameters' {} Maybe PartitionInstanceType
a -> ScalingParameters
s {$sel:desiredInstanceType:ScalingParameters' :: Maybe PartitionInstanceType
desiredInstanceType = Maybe PartitionInstanceType
a} :: ScalingParameters)
scalingParameters_desiredReplicationCount :: Lens.Lens' ScalingParameters (Prelude.Maybe Prelude.Natural)
scalingParameters_desiredReplicationCount :: (Maybe Natural -> f (Maybe Natural))
-> ScalingParameters -> f ScalingParameters
scalingParameters_desiredReplicationCount = (ScalingParameters -> Maybe Natural)
-> (ScalingParameters -> Maybe Natural -> ScalingParameters)
-> Lens
ScalingParameters ScalingParameters (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingParameters' {Maybe Natural
desiredReplicationCount :: Maybe Natural
$sel:desiredReplicationCount:ScalingParameters' :: ScalingParameters -> Maybe Natural
desiredReplicationCount} -> Maybe Natural
desiredReplicationCount) (\s :: ScalingParameters
s@ScalingParameters' {} Maybe Natural
a -> ScalingParameters
s {$sel:desiredReplicationCount:ScalingParameters' :: Maybe Natural
desiredReplicationCount = Maybe Natural
a} :: ScalingParameters)
scalingParameters_desiredPartitionCount :: Lens.Lens' ScalingParameters (Prelude.Maybe Prelude.Natural)
scalingParameters_desiredPartitionCount :: (Maybe Natural -> f (Maybe Natural))
-> ScalingParameters -> f ScalingParameters
scalingParameters_desiredPartitionCount = (ScalingParameters -> Maybe Natural)
-> (ScalingParameters -> Maybe Natural -> ScalingParameters)
-> Lens
ScalingParameters ScalingParameters (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScalingParameters' {Maybe Natural
desiredPartitionCount :: Maybe Natural
$sel:desiredPartitionCount:ScalingParameters' :: ScalingParameters -> Maybe Natural
desiredPartitionCount} -> Maybe Natural
desiredPartitionCount) (\s :: ScalingParameters
s@ScalingParameters' {} Maybe Natural
a -> ScalingParameters
s {$sel:desiredPartitionCount:ScalingParameters' :: Maybe Natural
desiredPartitionCount = Maybe Natural
a} :: ScalingParameters)
instance Core.FromXML ScalingParameters where
parseXML :: [Node] -> Either String ScalingParameters
parseXML [Node]
x =
Maybe PartitionInstanceType
-> Maybe Natural -> Maybe Natural -> ScalingParameters
ScalingParameters'
(Maybe PartitionInstanceType
-> Maybe Natural -> Maybe Natural -> ScalingParameters)
-> Either String (Maybe PartitionInstanceType)
-> Either
String (Maybe Natural -> Maybe Natural -> ScalingParameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe PartitionInstanceType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DesiredInstanceType")
Either String (Maybe Natural -> Maybe Natural -> ScalingParameters)
-> Either String (Maybe Natural)
-> Either String (Maybe Natural -> ScalingParameters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DesiredReplicationCount")
Either String (Maybe Natural -> ScalingParameters)
-> Either String (Maybe Natural) -> Either String ScalingParameters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DesiredPartitionCount")
instance Prelude.Hashable ScalingParameters
instance Prelude.NFData ScalingParameters
instance Core.ToQuery ScalingParameters where
toQuery :: ScalingParameters -> QueryString
toQuery ScalingParameters' {Maybe Natural
Maybe PartitionInstanceType
desiredPartitionCount :: Maybe Natural
desiredReplicationCount :: Maybe Natural
desiredInstanceType :: Maybe PartitionInstanceType
$sel:desiredPartitionCount:ScalingParameters' :: ScalingParameters -> Maybe Natural
$sel:desiredReplicationCount:ScalingParameters' :: ScalingParameters -> Maybe Natural
$sel:desiredInstanceType:ScalingParameters' :: ScalingParameters -> Maybe PartitionInstanceType
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"DesiredInstanceType" ByteString -> Maybe PartitionInstanceType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe PartitionInstanceType
desiredInstanceType,
ByteString
"DesiredReplicationCount"
ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
desiredReplicationCount,
ByteString
"DesiredPartitionCount"
ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
desiredPartitionCount
]