{-# 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.Kafka.UpdateBrokerCount
(
UpdateBrokerCount (..),
newUpdateBrokerCount,
updateBrokerCount_clusterArn,
updateBrokerCount_currentVersion,
updateBrokerCount_targetNumberOfBrokerNodes,
UpdateBrokerCountResponse (..),
newUpdateBrokerCountResponse,
updateBrokerCountResponse_clusterArn,
updateBrokerCountResponse_clusterOperationArn,
updateBrokerCountResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Kafka.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 UpdateBrokerCount = UpdateBrokerCount'
{
UpdateBrokerCount -> Text
clusterArn :: Prelude.Text,
UpdateBrokerCount -> Text
currentVersion :: Prelude.Text,
UpdateBrokerCount -> Natural
targetNumberOfBrokerNodes :: Prelude.Natural
}
deriving (UpdateBrokerCount -> UpdateBrokerCount -> Bool
(UpdateBrokerCount -> UpdateBrokerCount -> Bool)
-> (UpdateBrokerCount -> UpdateBrokerCount -> Bool)
-> Eq UpdateBrokerCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBrokerCount -> UpdateBrokerCount -> Bool
$c/= :: UpdateBrokerCount -> UpdateBrokerCount -> Bool
== :: UpdateBrokerCount -> UpdateBrokerCount -> Bool
$c== :: UpdateBrokerCount -> UpdateBrokerCount -> Bool
Prelude.Eq, ReadPrec [UpdateBrokerCount]
ReadPrec UpdateBrokerCount
Int -> ReadS UpdateBrokerCount
ReadS [UpdateBrokerCount]
(Int -> ReadS UpdateBrokerCount)
-> ReadS [UpdateBrokerCount]
-> ReadPrec UpdateBrokerCount
-> ReadPrec [UpdateBrokerCount]
-> Read UpdateBrokerCount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBrokerCount]
$creadListPrec :: ReadPrec [UpdateBrokerCount]
readPrec :: ReadPrec UpdateBrokerCount
$creadPrec :: ReadPrec UpdateBrokerCount
readList :: ReadS [UpdateBrokerCount]
$creadList :: ReadS [UpdateBrokerCount]
readsPrec :: Int -> ReadS UpdateBrokerCount
$creadsPrec :: Int -> ReadS UpdateBrokerCount
Prelude.Read, Int -> UpdateBrokerCount -> ShowS
[UpdateBrokerCount] -> ShowS
UpdateBrokerCount -> String
(Int -> UpdateBrokerCount -> ShowS)
-> (UpdateBrokerCount -> String)
-> ([UpdateBrokerCount] -> ShowS)
-> Show UpdateBrokerCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBrokerCount] -> ShowS
$cshowList :: [UpdateBrokerCount] -> ShowS
show :: UpdateBrokerCount -> String
$cshow :: UpdateBrokerCount -> String
showsPrec :: Int -> UpdateBrokerCount -> ShowS
$cshowsPrec :: Int -> UpdateBrokerCount -> ShowS
Prelude.Show, (forall x. UpdateBrokerCount -> Rep UpdateBrokerCount x)
-> (forall x. Rep UpdateBrokerCount x -> UpdateBrokerCount)
-> Generic UpdateBrokerCount
forall x. Rep UpdateBrokerCount x -> UpdateBrokerCount
forall x. UpdateBrokerCount -> Rep UpdateBrokerCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBrokerCount x -> UpdateBrokerCount
$cfrom :: forall x. UpdateBrokerCount -> Rep UpdateBrokerCount x
Prelude.Generic)
newUpdateBrokerCount ::
Prelude.Text ->
Prelude.Text ->
Prelude.Natural ->
UpdateBrokerCount
newUpdateBrokerCount :: Text -> Text -> Natural -> UpdateBrokerCount
newUpdateBrokerCount
Text
pClusterArn_
Text
pCurrentVersion_
Natural
pTargetNumberOfBrokerNodes_ =
UpdateBrokerCount' :: Text -> Text -> Natural -> UpdateBrokerCount
UpdateBrokerCount'
{ $sel:clusterArn:UpdateBrokerCount' :: Text
clusterArn = Text
pClusterArn_,
$sel:currentVersion:UpdateBrokerCount' :: Text
currentVersion = Text
pCurrentVersion_,
$sel:targetNumberOfBrokerNodes:UpdateBrokerCount' :: Natural
targetNumberOfBrokerNodes =
Natural
pTargetNumberOfBrokerNodes_
}
updateBrokerCount_clusterArn :: Lens.Lens' UpdateBrokerCount Prelude.Text
updateBrokerCount_clusterArn :: (Text -> f Text) -> UpdateBrokerCount -> f UpdateBrokerCount
updateBrokerCount_clusterArn = (UpdateBrokerCount -> Text)
-> (UpdateBrokerCount -> Text -> UpdateBrokerCount)
-> Lens UpdateBrokerCount UpdateBrokerCount Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBrokerCount' {Text
clusterArn :: Text
$sel:clusterArn:UpdateBrokerCount' :: UpdateBrokerCount -> Text
clusterArn} -> Text
clusterArn) (\s :: UpdateBrokerCount
s@UpdateBrokerCount' {} Text
a -> UpdateBrokerCount
s {$sel:clusterArn:UpdateBrokerCount' :: Text
clusterArn = Text
a} :: UpdateBrokerCount)
updateBrokerCount_currentVersion :: Lens.Lens' UpdateBrokerCount Prelude.Text
updateBrokerCount_currentVersion :: (Text -> f Text) -> UpdateBrokerCount -> f UpdateBrokerCount
updateBrokerCount_currentVersion = (UpdateBrokerCount -> Text)
-> (UpdateBrokerCount -> Text -> UpdateBrokerCount)
-> Lens UpdateBrokerCount UpdateBrokerCount Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBrokerCount' {Text
currentVersion :: Text
$sel:currentVersion:UpdateBrokerCount' :: UpdateBrokerCount -> Text
currentVersion} -> Text
currentVersion) (\s :: UpdateBrokerCount
s@UpdateBrokerCount' {} Text
a -> UpdateBrokerCount
s {$sel:currentVersion:UpdateBrokerCount' :: Text
currentVersion = Text
a} :: UpdateBrokerCount)
updateBrokerCount_targetNumberOfBrokerNodes :: Lens.Lens' UpdateBrokerCount Prelude.Natural
updateBrokerCount_targetNumberOfBrokerNodes :: (Natural -> f Natural) -> UpdateBrokerCount -> f UpdateBrokerCount
updateBrokerCount_targetNumberOfBrokerNodes = (UpdateBrokerCount -> Natural)
-> (UpdateBrokerCount -> Natural -> UpdateBrokerCount)
-> Lens UpdateBrokerCount UpdateBrokerCount Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBrokerCount' {Natural
targetNumberOfBrokerNodes :: Natural
$sel:targetNumberOfBrokerNodes:UpdateBrokerCount' :: UpdateBrokerCount -> Natural
targetNumberOfBrokerNodes} -> Natural
targetNumberOfBrokerNodes) (\s :: UpdateBrokerCount
s@UpdateBrokerCount' {} Natural
a -> UpdateBrokerCount
s {$sel:targetNumberOfBrokerNodes:UpdateBrokerCount' :: Natural
targetNumberOfBrokerNodes = Natural
a} :: UpdateBrokerCount)
instance Core.AWSRequest UpdateBrokerCount where
type
AWSResponse UpdateBrokerCount =
UpdateBrokerCountResponse
request :: UpdateBrokerCount -> Request UpdateBrokerCount
request = Service -> UpdateBrokerCount -> Request UpdateBrokerCount
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateBrokerCount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateBrokerCount)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateBrokerCount))
-> Logger
-> Service
-> Proxy UpdateBrokerCount
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateBrokerCount)))
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 Text -> Maybe Text -> Int -> UpdateBrokerCountResponse
UpdateBrokerCountResponse'
(Maybe Text -> Maybe Text -> Int -> UpdateBrokerCountResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> UpdateBrokerCountResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"clusterArn")
Either String (Maybe Text -> Int -> UpdateBrokerCountResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateBrokerCountResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"clusterOperationArn")
Either String (Int -> UpdateBrokerCountResponse)
-> Either String Int -> Either String UpdateBrokerCountResponse
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 UpdateBrokerCount
instance Prelude.NFData UpdateBrokerCount
instance Core.ToHeaders UpdateBrokerCount where
toHeaders :: UpdateBrokerCount -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateBrokerCount -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateBrokerCount where
toJSON :: UpdateBrokerCount -> Value
toJSON UpdateBrokerCount' {Natural
Text
targetNumberOfBrokerNodes :: Natural
currentVersion :: Text
clusterArn :: Text
$sel:targetNumberOfBrokerNodes:UpdateBrokerCount' :: UpdateBrokerCount -> Natural
$sel:currentVersion:UpdateBrokerCount' :: UpdateBrokerCount -> Text
$sel:clusterArn:UpdateBrokerCount' :: UpdateBrokerCount -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"currentVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
currentVersion),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"targetNumberOfBrokerNodes"
Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
targetNumberOfBrokerNodes
)
]
)
instance Core.ToPath UpdateBrokerCount where
toPath :: UpdateBrokerCount -> ByteString
toPath UpdateBrokerCount' {Natural
Text
targetNumberOfBrokerNodes :: Natural
currentVersion :: Text
clusterArn :: Text
$sel:targetNumberOfBrokerNodes:UpdateBrokerCount' :: UpdateBrokerCount -> Natural
$sel:currentVersion:UpdateBrokerCount' :: UpdateBrokerCount -> Text
$sel:clusterArn:UpdateBrokerCount' :: UpdateBrokerCount -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v1/clusters/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
clusterArn,
ByteString
"/nodes/count"
]
instance Core.ToQuery UpdateBrokerCount where
toQuery :: UpdateBrokerCount -> QueryString
toQuery = QueryString -> UpdateBrokerCount -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateBrokerCountResponse = UpdateBrokerCountResponse'
{
UpdateBrokerCountResponse -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
UpdateBrokerCountResponse -> Maybe Text
clusterOperationArn :: Prelude.Maybe Prelude.Text,
UpdateBrokerCountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool
(UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool)
-> (UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool)
-> Eq UpdateBrokerCountResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool
$c/= :: UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool
== :: UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool
$c== :: UpdateBrokerCountResponse -> UpdateBrokerCountResponse -> Bool
Prelude.Eq, ReadPrec [UpdateBrokerCountResponse]
ReadPrec UpdateBrokerCountResponse
Int -> ReadS UpdateBrokerCountResponse
ReadS [UpdateBrokerCountResponse]
(Int -> ReadS UpdateBrokerCountResponse)
-> ReadS [UpdateBrokerCountResponse]
-> ReadPrec UpdateBrokerCountResponse
-> ReadPrec [UpdateBrokerCountResponse]
-> Read UpdateBrokerCountResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBrokerCountResponse]
$creadListPrec :: ReadPrec [UpdateBrokerCountResponse]
readPrec :: ReadPrec UpdateBrokerCountResponse
$creadPrec :: ReadPrec UpdateBrokerCountResponse
readList :: ReadS [UpdateBrokerCountResponse]
$creadList :: ReadS [UpdateBrokerCountResponse]
readsPrec :: Int -> ReadS UpdateBrokerCountResponse
$creadsPrec :: Int -> ReadS UpdateBrokerCountResponse
Prelude.Read, Int -> UpdateBrokerCountResponse -> ShowS
[UpdateBrokerCountResponse] -> ShowS
UpdateBrokerCountResponse -> String
(Int -> UpdateBrokerCountResponse -> ShowS)
-> (UpdateBrokerCountResponse -> String)
-> ([UpdateBrokerCountResponse] -> ShowS)
-> Show UpdateBrokerCountResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBrokerCountResponse] -> ShowS
$cshowList :: [UpdateBrokerCountResponse] -> ShowS
show :: UpdateBrokerCountResponse -> String
$cshow :: UpdateBrokerCountResponse -> String
showsPrec :: Int -> UpdateBrokerCountResponse -> ShowS
$cshowsPrec :: Int -> UpdateBrokerCountResponse -> ShowS
Prelude.Show, (forall x.
UpdateBrokerCountResponse -> Rep UpdateBrokerCountResponse x)
-> (forall x.
Rep UpdateBrokerCountResponse x -> UpdateBrokerCountResponse)
-> Generic UpdateBrokerCountResponse
forall x.
Rep UpdateBrokerCountResponse x -> UpdateBrokerCountResponse
forall x.
UpdateBrokerCountResponse -> Rep UpdateBrokerCountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateBrokerCountResponse x -> UpdateBrokerCountResponse
$cfrom :: forall x.
UpdateBrokerCountResponse -> Rep UpdateBrokerCountResponse x
Prelude.Generic)
newUpdateBrokerCountResponse ::
Prelude.Int ->
UpdateBrokerCountResponse
newUpdateBrokerCountResponse :: Int -> UpdateBrokerCountResponse
newUpdateBrokerCountResponse Int
pHttpStatus_ =
UpdateBrokerCountResponse' :: Maybe Text -> Maybe Text -> Int -> UpdateBrokerCountResponse
UpdateBrokerCountResponse'
{ $sel:clusterArn:UpdateBrokerCountResponse' :: Maybe Text
clusterArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clusterOperationArn:UpdateBrokerCountResponse' :: Maybe Text
clusterOperationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateBrokerCountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateBrokerCountResponse_clusterArn :: Lens.Lens' UpdateBrokerCountResponse (Prelude.Maybe Prelude.Text)
updateBrokerCountResponse_clusterArn :: (Maybe Text -> f (Maybe Text))
-> UpdateBrokerCountResponse -> f UpdateBrokerCountResponse
updateBrokerCountResponse_clusterArn = (UpdateBrokerCountResponse -> Maybe Text)
-> (UpdateBrokerCountResponse
-> Maybe Text -> UpdateBrokerCountResponse)
-> Lens
UpdateBrokerCountResponse
UpdateBrokerCountResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBrokerCountResponse' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:UpdateBrokerCountResponse' :: UpdateBrokerCountResponse -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: UpdateBrokerCountResponse
s@UpdateBrokerCountResponse' {} Maybe Text
a -> UpdateBrokerCountResponse
s {$sel:clusterArn:UpdateBrokerCountResponse' :: Maybe Text
clusterArn = Maybe Text
a} :: UpdateBrokerCountResponse)
updateBrokerCountResponse_clusterOperationArn :: Lens.Lens' UpdateBrokerCountResponse (Prelude.Maybe Prelude.Text)
updateBrokerCountResponse_clusterOperationArn :: (Maybe Text -> f (Maybe Text))
-> UpdateBrokerCountResponse -> f UpdateBrokerCountResponse
updateBrokerCountResponse_clusterOperationArn = (UpdateBrokerCountResponse -> Maybe Text)
-> (UpdateBrokerCountResponse
-> Maybe Text -> UpdateBrokerCountResponse)
-> Lens
UpdateBrokerCountResponse
UpdateBrokerCountResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBrokerCountResponse' {Maybe Text
clusterOperationArn :: Maybe Text
$sel:clusterOperationArn:UpdateBrokerCountResponse' :: UpdateBrokerCountResponse -> Maybe Text
clusterOperationArn} -> Maybe Text
clusterOperationArn) (\s :: UpdateBrokerCountResponse
s@UpdateBrokerCountResponse' {} Maybe Text
a -> UpdateBrokerCountResponse
s {$sel:clusterOperationArn:UpdateBrokerCountResponse' :: Maybe Text
clusterOperationArn = Maybe Text
a} :: UpdateBrokerCountResponse)
updateBrokerCountResponse_httpStatus :: Lens.Lens' UpdateBrokerCountResponse Prelude.Int
updateBrokerCountResponse_httpStatus :: (Int -> f Int)
-> UpdateBrokerCountResponse -> f UpdateBrokerCountResponse
updateBrokerCountResponse_httpStatus = (UpdateBrokerCountResponse -> Int)
-> (UpdateBrokerCountResponse -> Int -> UpdateBrokerCountResponse)
-> Lens UpdateBrokerCountResponse UpdateBrokerCountResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBrokerCountResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateBrokerCountResponse' :: UpdateBrokerCountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateBrokerCountResponse
s@UpdateBrokerCountResponse' {} Int
a -> UpdateBrokerCountResponse
s {$sel:httpStatus:UpdateBrokerCountResponse' :: Int
httpStatus = Int
a} :: UpdateBrokerCountResponse)
instance Prelude.NFData UpdateBrokerCountResponse