{-# 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.KafkaConnect.UpdateConnector
(
UpdateConnector (..),
newUpdateConnector,
updateConnector_capacity,
updateConnector_connectorArn,
updateConnector_currentVersion,
UpdateConnectorResponse (..),
newUpdateConnectorResponse,
updateConnectorResponse_connectorArn,
updateConnectorResponse_connectorState,
updateConnectorResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KafkaConnect.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateConnector = UpdateConnector'
{
UpdateConnector -> CapacityUpdate
capacity :: CapacityUpdate,
UpdateConnector -> Text
connectorArn :: Prelude.Text,
UpdateConnector -> Text
currentVersion :: Prelude.Text
}
deriving (UpdateConnector -> UpdateConnector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConnector -> UpdateConnector -> Bool
$c/= :: UpdateConnector -> UpdateConnector -> Bool
== :: UpdateConnector -> UpdateConnector -> Bool
$c== :: UpdateConnector -> UpdateConnector -> Bool
Prelude.Eq, ReadPrec [UpdateConnector]
ReadPrec UpdateConnector
Int -> ReadS UpdateConnector
ReadS [UpdateConnector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConnector]
$creadListPrec :: ReadPrec [UpdateConnector]
readPrec :: ReadPrec UpdateConnector
$creadPrec :: ReadPrec UpdateConnector
readList :: ReadS [UpdateConnector]
$creadList :: ReadS [UpdateConnector]
readsPrec :: Int -> ReadS UpdateConnector
$creadsPrec :: Int -> ReadS UpdateConnector
Prelude.Read, Int -> UpdateConnector -> ShowS
[UpdateConnector] -> ShowS
UpdateConnector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConnector] -> ShowS
$cshowList :: [UpdateConnector] -> ShowS
show :: UpdateConnector -> String
$cshow :: UpdateConnector -> String
showsPrec :: Int -> UpdateConnector -> ShowS
$cshowsPrec :: Int -> UpdateConnector -> ShowS
Prelude.Show, forall x. Rep UpdateConnector x -> UpdateConnector
forall x. UpdateConnector -> Rep UpdateConnector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateConnector x -> UpdateConnector
$cfrom :: forall x. UpdateConnector -> Rep UpdateConnector x
Prelude.Generic)
newUpdateConnector ::
CapacityUpdate ->
Prelude.Text ->
Prelude.Text ->
UpdateConnector
newUpdateConnector :: CapacityUpdate -> Text -> Text -> UpdateConnector
newUpdateConnector
CapacityUpdate
pCapacity_
Text
pConnectorArn_
Text
pCurrentVersion_ =
UpdateConnector'
{ $sel:capacity:UpdateConnector' :: CapacityUpdate
capacity = CapacityUpdate
pCapacity_,
$sel:connectorArn:UpdateConnector' :: Text
connectorArn = Text
pConnectorArn_,
$sel:currentVersion:UpdateConnector' :: Text
currentVersion = Text
pCurrentVersion_
}
updateConnector_capacity :: Lens.Lens' UpdateConnector CapacityUpdate
updateConnector_capacity :: Lens' UpdateConnector CapacityUpdate
updateConnector_capacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnector' {CapacityUpdate
capacity :: CapacityUpdate
$sel:capacity:UpdateConnector' :: UpdateConnector -> CapacityUpdate
capacity} -> CapacityUpdate
capacity) (\s :: UpdateConnector
s@UpdateConnector' {} CapacityUpdate
a -> UpdateConnector
s {$sel:capacity:UpdateConnector' :: CapacityUpdate
capacity = CapacityUpdate
a} :: UpdateConnector)
updateConnector_connectorArn :: Lens.Lens' UpdateConnector Prelude.Text
updateConnector_connectorArn :: Lens' UpdateConnector Text
updateConnector_connectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnector' {Text
connectorArn :: Text
$sel:connectorArn:UpdateConnector' :: UpdateConnector -> Text
connectorArn} -> Text
connectorArn) (\s :: UpdateConnector
s@UpdateConnector' {} Text
a -> UpdateConnector
s {$sel:connectorArn:UpdateConnector' :: Text
connectorArn = Text
a} :: UpdateConnector)
updateConnector_currentVersion :: Lens.Lens' UpdateConnector Prelude.Text
updateConnector_currentVersion :: Lens' UpdateConnector Text
updateConnector_currentVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnector' {Text
currentVersion :: Text
$sel:currentVersion:UpdateConnector' :: UpdateConnector -> Text
currentVersion} -> Text
currentVersion) (\s :: UpdateConnector
s@UpdateConnector' {} Text
a -> UpdateConnector
s {$sel:currentVersion:UpdateConnector' :: Text
currentVersion = Text
a} :: UpdateConnector)
instance Core.AWSRequest UpdateConnector where
type
AWSResponse UpdateConnector =
UpdateConnectorResponse
request :: (Service -> Service) -> UpdateConnector -> Request UpdateConnector
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateConnector
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConnector)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe ConnectorState -> Int -> UpdateConnectorResponse
UpdateConnectorResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"connectorArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"connectorState")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateConnector where
hashWithSalt :: Int -> UpdateConnector -> Int
hashWithSalt Int
_salt UpdateConnector' {Text
CapacityUpdate
currentVersion :: Text
connectorArn :: Text
capacity :: CapacityUpdate
$sel:currentVersion:UpdateConnector' :: UpdateConnector -> Text
$sel:connectorArn:UpdateConnector' :: UpdateConnector -> Text
$sel:capacity:UpdateConnector' :: UpdateConnector -> CapacityUpdate
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CapacityUpdate
capacity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectorArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
currentVersion
instance Prelude.NFData UpdateConnector where
rnf :: UpdateConnector -> ()
rnf UpdateConnector' {Text
CapacityUpdate
currentVersion :: Text
connectorArn :: Text
capacity :: CapacityUpdate
$sel:currentVersion:UpdateConnector' :: UpdateConnector -> Text
$sel:connectorArn:UpdateConnector' :: UpdateConnector -> Text
$sel:capacity:UpdateConnector' :: UpdateConnector -> CapacityUpdate
..} =
forall a. NFData a => a -> ()
Prelude.rnf CapacityUpdate
capacity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectorArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
currentVersion
instance Data.ToHeaders UpdateConnector where
toHeaders :: UpdateConnector -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateConnector where
toJSON :: UpdateConnector -> Value
toJSON UpdateConnector' {Text
CapacityUpdate
currentVersion :: Text
connectorArn :: Text
capacity :: CapacityUpdate
$sel:currentVersion:UpdateConnector' :: UpdateConnector -> Text
$sel:connectorArn:UpdateConnector' :: UpdateConnector -> Text
$sel:capacity:UpdateConnector' :: UpdateConnector -> CapacityUpdate
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"capacity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CapacityUpdate
capacity)]
)
instance Data.ToPath UpdateConnector where
toPath :: UpdateConnector -> ByteString
toPath UpdateConnector' {Text
CapacityUpdate
currentVersion :: Text
connectorArn :: Text
capacity :: CapacityUpdate
$sel:currentVersion:UpdateConnector' :: UpdateConnector -> Text
$sel:connectorArn:UpdateConnector' :: UpdateConnector -> Text
$sel:capacity:UpdateConnector' :: UpdateConnector -> CapacityUpdate
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/connectors/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
connectorArn]
instance Data.ToQuery UpdateConnector where
toQuery :: UpdateConnector -> QueryString
toQuery UpdateConnector' {Text
CapacityUpdate
currentVersion :: Text
connectorArn :: Text
capacity :: CapacityUpdate
$sel:currentVersion:UpdateConnector' :: UpdateConnector -> Text
$sel:connectorArn:UpdateConnector' :: UpdateConnector -> Text
$sel:capacity:UpdateConnector' :: UpdateConnector -> CapacityUpdate
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"currentVersion" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
currentVersion]
data UpdateConnectorResponse = UpdateConnectorResponse'
{
UpdateConnectorResponse -> Maybe Text
connectorArn :: Prelude.Maybe Prelude.Text,
UpdateConnectorResponse -> Maybe ConnectorState
connectorState :: Prelude.Maybe ConnectorState,
UpdateConnectorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateConnectorResponse -> UpdateConnectorResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConnectorResponse -> UpdateConnectorResponse -> Bool
$c/= :: UpdateConnectorResponse -> UpdateConnectorResponse -> Bool
== :: UpdateConnectorResponse -> UpdateConnectorResponse -> Bool
$c== :: UpdateConnectorResponse -> UpdateConnectorResponse -> Bool
Prelude.Eq, ReadPrec [UpdateConnectorResponse]
ReadPrec UpdateConnectorResponse
Int -> ReadS UpdateConnectorResponse
ReadS [UpdateConnectorResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConnectorResponse]
$creadListPrec :: ReadPrec [UpdateConnectorResponse]
readPrec :: ReadPrec UpdateConnectorResponse
$creadPrec :: ReadPrec UpdateConnectorResponse
readList :: ReadS [UpdateConnectorResponse]
$creadList :: ReadS [UpdateConnectorResponse]
readsPrec :: Int -> ReadS UpdateConnectorResponse
$creadsPrec :: Int -> ReadS UpdateConnectorResponse
Prelude.Read, Int -> UpdateConnectorResponse -> ShowS
[UpdateConnectorResponse] -> ShowS
UpdateConnectorResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConnectorResponse] -> ShowS
$cshowList :: [UpdateConnectorResponse] -> ShowS
show :: UpdateConnectorResponse -> String
$cshow :: UpdateConnectorResponse -> String
showsPrec :: Int -> UpdateConnectorResponse -> ShowS
$cshowsPrec :: Int -> UpdateConnectorResponse -> ShowS
Prelude.Show, forall x. Rep UpdateConnectorResponse x -> UpdateConnectorResponse
forall x. UpdateConnectorResponse -> Rep UpdateConnectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateConnectorResponse x -> UpdateConnectorResponse
$cfrom :: forall x. UpdateConnectorResponse -> Rep UpdateConnectorResponse x
Prelude.Generic)
newUpdateConnectorResponse ::
Prelude.Int ->
UpdateConnectorResponse
newUpdateConnectorResponse :: Int -> UpdateConnectorResponse
newUpdateConnectorResponse Int
pHttpStatus_ =
UpdateConnectorResponse'
{ $sel:connectorArn:UpdateConnectorResponse' :: Maybe Text
connectorArn =
forall a. Maybe a
Prelude.Nothing,
$sel:connectorState:UpdateConnectorResponse' :: Maybe ConnectorState
connectorState = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateConnectorResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateConnectorResponse_connectorArn :: Lens.Lens' UpdateConnectorResponse (Prelude.Maybe Prelude.Text)
updateConnectorResponse_connectorArn :: Lens' UpdateConnectorResponse (Maybe Text)
updateConnectorResponse_connectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectorResponse' {Maybe Text
connectorArn :: Maybe Text
$sel:connectorArn:UpdateConnectorResponse' :: UpdateConnectorResponse -> Maybe Text
connectorArn} -> Maybe Text
connectorArn) (\s :: UpdateConnectorResponse
s@UpdateConnectorResponse' {} Maybe Text
a -> UpdateConnectorResponse
s {$sel:connectorArn:UpdateConnectorResponse' :: Maybe Text
connectorArn = Maybe Text
a} :: UpdateConnectorResponse)
updateConnectorResponse_connectorState :: Lens.Lens' UpdateConnectorResponse (Prelude.Maybe ConnectorState)
updateConnectorResponse_connectorState :: Lens' UpdateConnectorResponse (Maybe ConnectorState)
updateConnectorResponse_connectorState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectorResponse' {Maybe ConnectorState
connectorState :: Maybe ConnectorState
$sel:connectorState:UpdateConnectorResponse' :: UpdateConnectorResponse -> Maybe ConnectorState
connectorState} -> Maybe ConnectorState
connectorState) (\s :: UpdateConnectorResponse
s@UpdateConnectorResponse' {} Maybe ConnectorState
a -> UpdateConnectorResponse
s {$sel:connectorState:UpdateConnectorResponse' :: Maybe ConnectorState
connectorState = Maybe ConnectorState
a} :: UpdateConnectorResponse)
updateConnectorResponse_httpStatus :: Lens.Lens' UpdateConnectorResponse Prelude.Int
updateConnectorResponse_httpStatus :: Lens' UpdateConnectorResponse Int
updateConnectorResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConnectorResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateConnectorResponse' :: UpdateConnectorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateConnectorResponse
s@UpdateConnectorResponse' {} Int
a -> UpdateConnectorResponse
s {$sel:httpStatus:UpdateConnectorResponse' :: Int
httpStatus = Int
a} :: UpdateConnectorResponse)
instance Prelude.NFData UpdateConnectorResponse where
rnf :: UpdateConnectorResponse -> ()
rnf UpdateConnectorResponse' {Int
Maybe Text
Maybe ConnectorState
httpStatus :: Int
connectorState :: Maybe ConnectorState
connectorArn :: Maybe Text
$sel:httpStatus:UpdateConnectorResponse' :: UpdateConnectorResponse -> Int
$sel:connectorState:UpdateConnectorResponse' :: UpdateConnectorResponse -> Maybe ConnectorState
$sel:connectorArn:UpdateConnectorResponse' :: UpdateConnectorResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectorArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectorState
connectorState
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus