{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.DAX.IncreaseReplicationFactor
(
IncreaseReplicationFactor (..),
newIncreaseReplicationFactor,
increaseReplicationFactor_availabilityZones,
increaseReplicationFactor_clusterName,
increaseReplicationFactor_newReplicationFactor,
IncreaseReplicationFactorResponse (..),
newIncreaseReplicationFactorResponse,
increaseReplicationFactorResponse_cluster,
increaseReplicationFactorResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DAX.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data IncreaseReplicationFactor = IncreaseReplicationFactor'
{
IncreaseReplicationFactor -> Maybe [Text]
availabilityZones :: Prelude.Maybe [Prelude.Text],
IncreaseReplicationFactor -> Text
clusterName :: Prelude.Text,
IncreaseReplicationFactor -> Int
newReplicationFactor' :: Prelude.Int
}
deriving (IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool
(IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool)
-> (IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool)
-> Eq IncreaseReplicationFactor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool
$c/= :: IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool
== :: IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool
$c== :: IncreaseReplicationFactor -> IncreaseReplicationFactor -> Bool
Prelude.Eq, ReadPrec [IncreaseReplicationFactor]
ReadPrec IncreaseReplicationFactor
Int -> ReadS IncreaseReplicationFactor
ReadS [IncreaseReplicationFactor]
(Int -> ReadS IncreaseReplicationFactor)
-> ReadS [IncreaseReplicationFactor]
-> ReadPrec IncreaseReplicationFactor
-> ReadPrec [IncreaseReplicationFactor]
-> Read IncreaseReplicationFactor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IncreaseReplicationFactor]
$creadListPrec :: ReadPrec [IncreaseReplicationFactor]
readPrec :: ReadPrec IncreaseReplicationFactor
$creadPrec :: ReadPrec IncreaseReplicationFactor
readList :: ReadS [IncreaseReplicationFactor]
$creadList :: ReadS [IncreaseReplicationFactor]
readsPrec :: Int -> ReadS IncreaseReplicationFactor
$creadsPrec :: Int -> ReadS IncreaseReplicationFactor
Prelude.Read, Int -> IncreaseReplicationFactor -> ShowS
[IncreaseReplicationFactor] -> ShowS
IncreaseReplicationFactor -> String
(Int -> IncreaseReplicationFactor -> ShowS)
-> (IncreaseReplicationFactor -> String)
-> ([IncreaseReplicationFactor] -> ShowS)
-> Show IncreaseReplicationFactor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IncreaseReplicationFactor] -> ShowS
$cshowList :: [IncreaseReplicationFactor] -> ShowS
show :: IncreaseReplicationFactor -> String
$cshow :: IncreaseReplicationFactor -> String
showsPrec :: Int -> IncreaseReplicationFactor -> ShowS
$cshowsPrec :: Int -> IncreaseReplicationFactor -> ShowS
Prelude.Show, (forall x.
IncreaseReplicationFactor -> Rep IncreaseReplicationFactor x)
-> (forall x.
Rep IncreaseReplicationFactor x -> IncreaseReplicationFactor)
-> Generic IncreaseReplicationFactor
forall x.
Rep IncreaseReplicationFactor x -> IncreaseReplicationFactor
forall x.
IncreaseReplicationFactor -> Rep IncreaseReplicationFactor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IncreaseReplicationFactor x -> IncreaseReplicationFactor
$cfrom :: forall x.
IncreaseReplicationFactor -> Rep IncreaseReplicationFactor x
Prelude.Generic)
newIncreaseReplicationFactor ::
Prelude.Text ->
Prelude.Int ->
IncreaseReplicationFactor
newIncreaseReplicationFactor :: Text -> Int -> IncreaseReplicationFactor
newIncreaseReplicationFactor
Text
pClusterName_
Int
pNewReplicationFactor_ =
IncreaseReplicationFactor' :: Maybe [Text] -> Text -> Int -> IncreaseReplicationFactor
IncreaseReplicationFactor'
{ $sel:availabilityZones:IncreaseReplicationFactor' :: Maybe [Text]
availabilityZones =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:clusterName:IncreaseReplicationFactor' :: Text
clusterName = Text
pClusterName_,
$sel:newReplicationFactor':IncreaseReplicationFactor' :: Int
newReplicationFactor' = Int
pNewReplicationFactor_
}
increaseReplicationFactor_availabilityZones :: Lens.Lens' IncreaseReplicationFactor (Prelude.Maybe [Prelude.Text])
increaseReplicationFactor_availabilityZones :: (Maybe [Text] -> f (Maybe [Text]))
-> IncreaseReplicationFactor -> f IncreaseReplicationFactor
increaseReplicationFactor_availabilityZones = (IncreaseReplicationFactor -> Maybe [Text])
-> (IncreaseReplicationFactor
-> Maybe [Text] -> IncreaseReplicationFactor)
-> Lens
IncreaseReplicationFactor
IncreaseReplicationFactor
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseReplicationFactor' {Maybe [Text]
availabilityZones :: Maybe [Text]
$sel:availabilityZones:IncreaseReplicationFactor' :: IncreaseReplicationFactor -> Maybe [Text]
availabilityZones} -> Maybe [Text]
availabilityZones) (\s :: IncreaseReplicationFactor
s@IncreaseReplicationFactor' {} Maybe [Text]
a -> IncreaseReplicationFactor
s {$sel:availabilityZones:IncreaseReplicationFactor' :: Maybe [Text]
availabilityZones = Maybe [Text]
a} :: IncreaseReplicationFactor) ((Maybe [Text] -> f (Maybe [Text]))
-> IncreaseReplicationFactor -> f IncreaseReplicationFactor)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> IncreaseReplicationFactor
-> f IncreaseReplicationFactor
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
increaseReplicationFactor_clusterName :: Lens.Lens' IncreaseReplicationFactor Prelude.Text
increaseReplicationFactor_clusterName :: (Text -> f Text)
-> IncreaseReplicationFactor -> f IncreaseReplicationFactor
increaseReplicationFactor_clusterName = (IncreaseReplicationFactor -> Text)
-> (IncreaseReplicationFactor -> Text -> IncreaseReplicationFactor)
-> Lens
IncreaseReplicationFactor IncreaseReplicationFactor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseReplicationFactor' {Text
clusterName :: Text
$sel:clusterName:IncreaseReplicationFactor' :: IncreaseReplicationFactor -> Text
clusterName} -> Text
clusterName) (\s :: IncreaseReplicationFactor
s@IncreaseReplicationFactor' {} Text
a -> IncreaseReplicationFactor
s {$sel:clusterName:IncreaseReplicationFactor' :: Text
clusterName = Text
a} :: IncreaseReplicationFactor)
increaseReplicationFactor_newReplicationFactor :: Lens.Lens' IncreaseReplicationFactor Prelude.Int
increaseReplicationFactor_newReplicationFactor :: (Int -> f Int)
-> IncreaseReplicationFactor -> f IncreaseReplicationFactor
increaseReplicationFactor_newReplicationFactor = (IncreaseReplicationFactor -> Int)
-> (IncreaseReplicationFactor -> Int -> IncreaseReplicationFactor)
-> Lens IncreaseReplicationFactor IncreaseReplicationFactor Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseReplicationFactor' {Int
newReplicationFactor' :: Int
$sel:newReplicationFactor':IncreaseReplicationFactor' :: IncreaseReplicationFactor -> Int
newReplicationFactor'} -> Int
newReplicationFactor') (\s :: IncreaseReplicationFactor
s@IncreaseReplicationFactor' {} Int
a -> IncreaseReplicationFactor
s {$sel:newReplicationFactor':IncreaseReplicationFactor' :: Int
newReplicationFactor' = Int
a} :: IncreaseReplicationFactor)
instance Core.AWSRequest IncreaseReplicationFactor where
type
AWSResponse IncreaseReplicationFactor =
IncreaseReplicationFactorResponse
request :: IncreaseReplicationFactor -> Request IncreaseReplicationFactor
request = Service
-> IncreaseReplicationFactor -> Request IncreaseReplicationFactor
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy IncreaseReplicationFactor
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse IncreaseReplicationFactor)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse IncreaseReplicationFactor))
-> Logger
-> Service
-> Proxy IncreaseReplicationFactor
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse IncreaseReplicationFactor)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Cluster -> Int -> IncreaseReplicationFactorResponse
IncreaseReplicationFactorResponse'
(Maybe Cluster -> Int -> IncreaseReplicationFactorResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> IncreaseReplicationFactorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Cluster)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Cluster")
Either String (Int -> IncreaseReplicationFactorResponse)
-> Either String Int
-> Either String IncreaseReplicationFactorResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable IncreaseReplicationFactor
instance Prelude.NFData IncreaseReplicationFactor
instance Core.ToHeaders IncreaseReplicationFactor where
toHeaders :: IncreaseReplicationFactor -> ResponseHeaders
toHeaders =
ResponseHeaders -> IncreaseReplicationFactor -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonDAXV3.IncreaseReplicationFactor" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON IncreaseReplicationFactor where
toJSON :: IncreaseReplicationFactor -> Value
toJSON IncreaseReplicationFactor' {Int
Maybe [Text]
Text
newReplicationFactor' :: Int
clusterName :: Text
availabilityZones :: Maybe [Text]
$sel:newReplicationFactor':IncreaseReplicationFactor' :: IncreaseReplicationFactor -> Int
$sel:clusterName:IncreaseReplicationFactor' :: IncreaseReplicationFactor -> Text
$sel:availabilityZones:IncreaseReplicationFactor' :: IncreaseReplicationFactor -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AvailabilityZones" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
availabilityZones,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"NewReplicationFactor"
Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
newReplicationFactor'
)
]
)
instance Core.ToPath IncreaseReplicationFactor where
toPath :: IncreaseReplicationFactor -> ByteString
toPath = ByteString -> IncreaseReplicationFactor -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery IncreaseReplicationFactor where
toQuery :: IncreaseReplicationFactor -> QueryString
toQuery = QueryString -> IncreaseReplicationFactor -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data IncreaseReplicationFactorResponse = IncreaseReplicationFactorResponse'
{
IncreaseReplicationFactorResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
IncreaseReplicationFactorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool
(IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool)
-> (IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool)
-> Eq IncreaseReplicationFactorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool
$c/= :: IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool
== :: IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool
$c== :: IncreaseReplicationFactorResponse
-> IncreaseReplicationFactorResponse -> Bool
Prelude.Eq, ReadPrec [IncreaseReplicationFactorResponse]
ReadPrec IncreaseReplicationFactorResponse
Int -> ReadS IncreaseReplicationFactorResponse
ReadS [IncreaseReplicationFactorResponse]
(Int -> ReadS IncreaseReplicationFactorResponse)
-> ReadS [IncreaseReplicationFactorResponse]
-> ReadPrec IncreaseReplicationFactorResponse
-> ReadPrec [IncreaseReplicationFactorResponse]
-> Read IncreaseReplicationFactorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IncreaseReplicationFactorResponse]
$creadListPrec :: ReadPrec [IncreaseReplicationFactorResponse]
readPrec :: ReadPrec IncreaseReplicationFactorResponse
$creadPrec :: ReadPrec IncreaseReplicationFactorResponse
readList :: ReadS [IncreaseReplicationFactorResponse]
$creadList :: ReadS [IncreaseReplicationFactorResponse]
readsPrec :: Int -> ReadS IncreaseReplicationFactorResponse
$creadsPrec :: Int -> ReadS IncreaseReplicationFactorResponse
Prelude.Read, Int -> IncreaseReplicationFactorResponse -> ShowS
[IncreaseReplicationFactorResponse] -> ShowS
IncreaseReplicationFactorResponse -> String
(Int -> IncreaseReplicationFactorResponse -> ShowS)
-> (IncreaseReplicationFactorResponse -> String)
-> ([IncreaseReplicationFactorResponse] -> ShowS)
-> Show IncreaseReplicationFactorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IncreaseReplicationFactorResponse] -> ShowS
$cshowList :: [IncreaseReplicationFactorResponse] -> ShowS
show :: IncreaseReplicationFactorResponse -> String
$cshow :: IncreaseReplicationFactorResponse -> String
showsPrec :: Int -> IncreaseReplicationFactorResponse -> ShowS
$cshowsPrec :: Int -> IncreaseReplicationFactorResponse -> ShowS
Prelude.Show, (forall x.
IncreaseReplicationFactorResponse
-> Rep IncreaseReplicationFactorResponse x)
-> (forall x.
Rep IncreaseReplicationFactorResponse x
-> IncreaseReplicationFactorResponse)
-> Generic IncreaseReplicationFactorResponse
forall x.
Rep IncreaseReplicationFactorResponse x
-> IncreaseReplicationFactorResponse
forall x.
IncreaseReplicationFactorResponse
-> Rep IncreaseReplicationFactorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep IncreaseReplicationFactorResponse x
-> IncreaseReplicationFactorResponse
$cfrom :: forall x.
IncreaseReplicationFactorResponse
-> Rep IncreaseReplicationFactorResponse x
Prelude.Generic)
newIncreaseReplicationFactorResponse ::
Prelude.Int ->
IncreaseReplicationFactorResponse
newIncreaseReplicationFactorResponse :: Int -> IncreaseReplicationFactorResponse
newIncreaseReplicationFactorResponse Int
pHttpStatus_ =
IncreaseReplicationFactorResponse' :: Maybe Cluster -> Int -> IncreaseReplicationFactorResponse
IncreaseReplicationFactorResponse'
{ $sel:cluster:IncreaseReplicationFactorResponse' :: Maybe Cluster
cluster =
Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:IncreaseReplicationFactorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
increaseReplicationFactorResponse_cluster :: Lens.Lens' IncreaseReplicationFactorResponse (Prelude.Maybe Cluster)
increaseReplicationFactorResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> IncreaseReplicationFactorResponse
-> f IncreaseReplicationFactorResponse
increaseReplicationFactorResponse_cluster = (IncreaseReplicationFactorResponse -> Maybe Cluster)
-> (IncreaseReplicationFactorResponse
-> Maybe Cluster -> IncreaseReplicationFactorResponse)
-> Lens
IncreaseReplicationFactorResponse
IncreaseReplicationFactorResponse
(Maybe Cluster)
(Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseReplicationFactorResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:IncreaseReplicationFactorResponse' :: IncreaseReplicationFactorResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: IncreaseReplicationFactorResponse
s@IncreaseReplicationFactorResponse' {} Maybe Cluster
a -> IncreaseReplicationFactorResponse
s {$sel:cluster:IncreaseReplicationFactorResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: IncreaseReplicationFactorResponse)
increaseReplicationFactorResponse_httpStatus :: Lens.Lens' IncreaseReplicationFactorResponse Prelude.Int
increaseReplicationFactorResponse_httpStatus :: (Int -> f Int)
-> IncreaseReplicationFactorResponse
-> f IncreaseReplicationFactorResponse
increaseReplicationFactorResponse_httpStatus = (IncreaseReplicationFactorResponse -> Int)
-> (IncreaseReplicationFactorResponse
-> Int -> IncreaseReplicationFactorResponse)
-> Lens
IncreaseReplicationFactorResponse
IncreaseReplicationFactorResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IncreaseReplicationFactorResponse' {Int
httpStatus :: Int
$sel:httpStatus:IncreaseReplicationFactorResponse' :: IncreaseReplicationFactorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: IncreaseReplicationFactorResponse
s@IncreaseReplicationFactorResponse' {} Int
a -> IncreaseReplicationFactorResponse
s {$sel:httpStatus:IncreaseReplicationFactorResponse' :: Int
httpStatus = Int
a} :: IncreaseReplicationFactorResponse)
instance
Prelude.NFData
IncreaseReplicationFactorResponse