{-# 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.APIGateway.UpdateClientCertificate
(
UpdateClientCertificate (..),
newUpdateClientCertificate,
updateClientCertificate_patchOperations,
updateClientCertificate_clientCertificateId,
ClientCertificate (..),
newClientCertificate,
clientCertificate_pemEncodedCertificate,
clientCertificate_clientCertificateId,
clientCertificate_createdDate,
clientCertificate_expirationDate,
clientCertificate_description,
clientCertificate_tags,
)
where
import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
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 UpdateClientCertificate = UpdateClientCertificate'
{
UpdateClientCertificate -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateClientCertificate -> Text
clientCertificateId :: Prelude.Text
}
deriving (UpdateClientCertificate -> UpdateClientCertificate -> Bool
(UpdateClientCertificate -> UpdateClientCertificate -> Bool)
-> (UpdateClientCertificate -> UpdateClientCertificate -> Bool)
-> Eq UpdateClientCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateClientCertificate -> UpdateClientCertificate -> Bool
$c/= :: UpdateClientCertificate -> UpdateClientCertificate -> Bool
== :: UpdateClientCertificate -> UpdateClientCertificate -> Bool
$c== :: UpdateClientCertificate -> UpdateClientCertificate -> Bool
Prelude.Eq, ReadPrec [UpdateClientCertificate]
ReadPrec UpdateClientCertificate
Int -> ReadS UpdateClientCertificate
ReadS [UpdateClientCertificate]
(Int -> ReadS UpdateClientCertificate)
-> ReadS [UpdateClientCertificate]
-> ReadPrec UpdateClientCertificate
-> ReadPrec [UpdateClientCertificate]
-> Read UpdateClientCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateClientCertificate]
$creadListPrec :: ReadPrec [UpdateClientCertificate]
readPrec :: ReadPrec UpdateClientCertificate
$creadPrec :: ReadPrec UpdateClientCertificate
readList :: ReadS [UpdateClientCertificate]
$creadList :: ReadS [UpdateClientCertificate]
readsPrec :: Int -> ReadS UpdateClientCertificate
$creadsPrec :: Int -> ReadS UpdateClientCertificate
Prelude.Read, Int -> UpdateClientCertificate -> ShowS
[UpdateClientCertificate] -> ShowS
UpdateClientCertificate -> String
(Int -> UpdateClientCertificate -> ShowS)
-> (UpdateClientCertificate -> String)
-> ([UpdateClientCertificate] -> ShowS)
-> Show UpdateClientCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateClientCertificate] -> ShowS
$cshowList :: [UpdateClientCertificate] -> ShowS
show :: UpdateClientCertificate -> String
$cshow :: UpdateClientCertificate -> String
showsPrec :: Int -> UpdateClientCertificate -> ShowS
$cshowsPrec :: Int -> UpdateClientCertificate -> ShowS
Prelude.Show, (forall x.
UpdateClientCertificate -> Rep UpdateClientCertificate x)
-> (forall x.
Rep UpdateClientCertificate x -> UpdateClientCertificate)
-> Generic UpdateClientCertificate
forall x. Rep UpdateClientCertificate x -> UpdateClientCertificate
forall x. UpdateClientCertificate -> Rep UpdateClientCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateClientCertificate x -> UpdateClientCertificate
$cfrom :: forall x. UpdateClientCertificate -> Rep UpdateClientCertificate x
Prelude.Generic)
newUpdateClientCertificate ::
Prelude.Text ->
UpdateClientCertificate
newUpdateClientCertificate :: Text -> UpdateClientCertificate
newUpdateClientCertificate Text
pClientCertificateId_ =
UpdateClientCertificate' :: Maybe [PatchOperation] -> Text -> UpdateClientCertificate
UpdateClientCertificate'
{ $sel:patchOperations:UpdateClientCertificate' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:clientCertificateId:UpdateClientCertificate' :: Text
clientCertificateId = Text
pClientCertificateId_
}
updateClientCertificate_patchOperations :: Lens.Lens' UpdateClientCertificate (Prelude.Maybe [PatchOperation])
updateClientCertificate_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateClientCertificate -> f UpdateClientCertificate
updateClientCertificate_patchOperations = (UpdateClientCertificate -> Maybe [PatchOperation])
-> (UpdateClientCertificate
-> Maybe [PatchOperation] -> UpdateClientCertificate)
-> Lens
UpdateClientCertificate
UpdateClientCertificate
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClientCertificate' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateClientCertificate' :: UpdateClientCertificate -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateClientCertificate
s@UpdateClientCertificate' {} Maybe [PatchOperation]
a -> UpdateClientCertificate
s {$sel:patchOperations:UpdateClientCertificate' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateClientCertificate) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateClientCertificate -> f UpdateClientCertificate)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateClientCertificate
-> f UpdateClientCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
-> Iso
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
(Maybe [PatchOperation])
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
[PatchOperation] [PatchOperation] [PatchOperation] [PatchOperation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateClientCertificate_clientCertificateId :: Lens.Lens' UpdateClientCertificate Prelude.Text
updateClientCertificate_clientCertificateId :: (Text -> f Text)
-> UpdateClientCertificate -> f UpdateClientCertificate
updateClientCertificate_clientCertificateId = (UpdateClientCertificate -> Text)
-> (UpdateClientCertificate -> Text -> UpdateClientCertificate)
-> Lens UpdateClientCertificate UpdateClientCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClientCertificate' {Text
clientCertificateId :: Text
$sel:clientCertificateId:UpdateClientCertificate' :: UpdateClientCertificate -> Text
clientCertificateId} -> Text
clientCertificateId) (\s :: UpdateClientCertificate
s@UpdateClientCertificate' {} Text
a -> UpdateClientCertificate
s {$sel:clientCertificateId:UpdateClientCertificate' :: Text
clientCertificateId = Text
a} :: UpdateClientCertificate)
instance Core.AWSRequest UpdateClientCertificate where
type
AWSResponse UpdateClientCertificate =
ClientCertificate
request :: UpdateClientCertificate -> Request UpdateClientCertificate
request = Service
-> UpdateClientCertificate -> Request UpdateClientCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateClientCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateClientCertificate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateClientCertificate))
-> Logger
-> Service
-> Proxy UpdateClientCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateClientCertificate)))
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 -> Object -> Either String ClientCertificate
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateClientCertificate
instance Prelude.NFData UpdateClientCertificate
instance Core.ToHeaders UpdateClientCertificate where
toHeaders :: UpdateClientCertificate -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateClientCertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Core.ToJSON UpdateClientCertificate where
toJSON :: UpdateClientCertificate -> Value
toJSON UpdateClientCertificate' {Maybe [PatchOperation]
Text
clientCertificateId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:clientCertificateId:UpdateClientCertificate' :: UpdateClientCertificate -> Text
$sel:patchOperations:UpdateClientCertificate' :: UpdateClientCertificate -> Maybe [PatchOperation]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"patchOperations" Text -> [PatchOperation] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([PatchOperation] -> Pair) -> Maybe [PatchOperation] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PatchOperation]
patchOperations
]
)
instance Core.ToPath UpdateClientCertificate where
toPath :: UpdateClientCertificate -> ByteString
toPath UpdateClientCertificate' {Maybe [PatchOperation]
Text
clientCertificateId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:clientCertificateId:UpdateClientCertificate' :: UpdateClientCertificate -> Text
$sel:patchOperations:UpdateClientCertificate' :: UpdateClientCertificate -> Maybe [PatchOperation]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/clientcertificates/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
clientCertificateId
]
instance Core.ToQuery UpdateClientCertificate where
toQuery :: UpdateClientCertificate -> QueryString
toQuery = QueryString -> UpdateClientCertificate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty