{-# 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.UpdateAuthorizer
(
UpdateAuthorizer (..),
newUpdateAuthorizer,
updateAuthorizer_patchOperations,
updateAuthorizer_restApiId,
updateAuthorizer_authorizerId,
Authorizer (..),
newAuthorizer,
authorizer_authorizerUri,
authorizer_identityValidationExpression,
authorizer_providerARNs,
authorizer_name,
authorizer_id,
authorizer_authorizerResultTtlInSeconds,
authorizer_authType,
authorizer_type,
authorizer_identitySource,
authorizer_authorizerCredentials,
)
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 UpdateAuthorizer = UpdateAuthorizer'
{
UpdateAuthorizer -> Maybe [PatchOperation]
patchOperations :: Prelude.Maybe [PatchOperation],
UpdateAuthorizer -> Text
restApiId :: Prelude.Text,
UpdateAuthorizer -> Text
authorizerId :: Prelude.Text
}
deriving (UpdateAuthorizer -> UpdateAuthorizer -> Bool
(UpdateAuthorizer -> UpdateAuthorizer -> Bool)
-> (UpdateAuthorizer -> UpdateAuthorizer -> Bool)
-> Eq UpdateAuthorizer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAuthorizer -> UpdateAuthorizer -> Bool
$c/= :: UpdateAuthorizer -> UpdateAuthorizer -> Bool
== :: UpdateAuthorizer -> UpdateAuthorizer -> Bool
$c== :: UpdateAuthorizer -> UpdateAuthorizer -> Bool
Prelude.Eq, ReadPrec [UpdateAuthorizer]
ReadPrec UpdateAuthorizer
Int -> ReadS UpdateAuthorizer
ReadS [UpdateAuthorizer]
(Int -> ReadS UpdateAuthorizer)
-> ReadS [UpdateAuthorizer]
-> ReadPrec UpdateAuthorizer
-> ReadPrec [UpdateAuthorizer]
-> Read UpdateAuthorizer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAuthorizer]
$creadListPrec :: ReadPrec [UpdateAuthorizer]
readPrec :: ReadPrec UpdateAuthorizer
$creadPrec :: ReadPrec UpdateAuthorizer
readList :: ReadS [UpdateAuthorizer]
$creadList :: ReadS [UpdateAuthorizer]
readsPrec :: Int -> ReadS UpdateAuthorizer
$creadsPrec :: Int -> ReadS UpdateAuthorizer
Prelude.Read, Int -> UpdateAuthorizer -> ShowS
[UpdateAuthorizer] -> ShowS
UpdateAuthorizer -> String
(Int -> UpdateAuthorizer -> ShowS)
-> (UpdateAuthorizer -> String)
-> ([UpdateAuthorizer] -> ShowS)
-> Show UpdateAuthorizer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAuthorizer] -> ShowS
$cshowList :: [UpdateAuthorizer] -> ShowS
show :: UpdateAuthorizer -> String
$cshow :: UpdateAuthorizer -> String
showsPrec :: Int -> UpdateAuthorizer -> ShowS
$cshowsPrec :: Int -> UpdateAuthorizer -> ShowS
Prelude.Show, (forall x. UpdateAuthorizer -> Rep UpdateAuthorizer x)
-> (forall x. Rep UpdateAuthorizer x -> UpdateAuthorizer)
-> Generic UpdateAuthorizer
forall x. Rep UpdateAuthorizer x -> UpdateAuthorizer
forall x. UpdateAuthorizer -> Rep UpdateAuthorizer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAuthorizer x -> UpdateAuthorizer
$cfrom :: forall x. UpdateAuthorizer -> Rep UpdateAuthorizer x
Prelude.Generic)
newUpdateAuthorizer ::
Prelude.Text ->
Prelude.Text ->
UpdateAuthorizer
newUpdateAuthorizer :: Text -> Text -> UpdateAuthorizer
newUpdateAuthorizer Text
pRestApiId_ Text
pAuthorizerId_ =
UpdateAuthorizer' :: Maybe [PatchOperation] -> Text -> Text -> UpdateAuthorizer
UpdateAuthorizer'
{ $sel:patchOperations:UpdateAuthorizer' :: Maybe [PatchOperation]
patchOperations =
Maybe [PatchOperation]
forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:UpdateAuthorizer' :: Text
restApiId = Text
pRestApiId_,
$sel:authorizerId:UpdateAuthorizer' :: Text
authorizerId = Text
pAuthorizerId_
}
updateAuthorizer_patchOperations :: Lens.Lens' UpdateAuthorizer (Prelude.Maybe [PatchOperation])
updateAuthorizer_patchOperations :: (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateAuthorizer -> f UpdateAuthorizer
updateAuthorizer_patchOperations = (UpdateAuthorizer -> Maybe [PatchOperation])
-> (UpdateAuthorizer -> Maybe [PatchOperation] -> UpdateAuthorizer)
-> Lens
UpdateAuthorizer
UpdateAuthorizer
(Maybe [PatchOperation])
(Maybe [PatchOperation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAuthorizer' {Maybe [PatchOperation]
patchOperations :: Maybe [PatchOperation]
$sel:patchOperations:UpdateAuthorizer' :: UpdateAuthorizer -> Maybe [PatchOperation]
patchOperations} -> Maybe [PatchOperation]
patchOperations) (\s :: UpdateAuthorizer
s@UpdateAuthorizer' {} Maybe [PatchOperation]
a -> UpdateAuthorizer
s {$sel:patchOperations:UpdateAuthorizer' :: Maybe [PatchOperation]
patchOperations = Maybe [PatchOperation]
a} :: UpdateAuthorizer) ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateAuthorizer -> f UpdateAuthorizer)
-> ((Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> (Maybe [PatchOperation] -> f (Maybe [PatchOperation]))
-> UpdateAuthorizer
-> f UpdateAuthorizer
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
updateAuthorizer_restApiId :: Lens.Lens' UpdateAuthorizer Prelude.Text
updateAuthorizer_restApiId :: (Text -> f Text) -> UpdateAuthorizer -> f UpdateAuthorizer
updateAuthorizer_restApiId = (UpdateAuthorizer -> Text)
-> (UpdateAuthorizer -> Text -> UpdateAuthorizer)
-> Lens UpdateAuthorizer UpdateAuthorizer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAuthorizer' {Text
restApiId :: Text
$sel:restApiId:UpdateAuthorizer' :: UpdateAuthorizer -> Text
restApiId} -> Text
restApiId) (\s :: UpdateAuthorizer
s@UpdateAuthorizer' {} Text
a -> UpdateAuthorizer
s {$sel:restApiId:UpdateAuthorizer' :: Text
restApiId = Text
a} :: UpdateAuthorizer)
updateAuthorizer_authorizerId :: Lens.Lens' UpdateAuthorizer Prelude.Text
updateAuthorizer_authorizerId :: (Text -> f Text) -> UpdateAuthorizer -> f UpdateAuthorizer
updateAuthorizer_authorizerId = (UpdateAuthorizer -> Text)
-> (UpdateAuthorizer -> Text -> UpdateAuthorizer)
-> Lens UpdateAuthorizer UpdateAuthorizer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAuthorizer' {Text
authorizerId :: Text
$sel:authorizerId:UpdateAuthorizer' :: UpdateAuthorizer -> Text
authorizerId} -> Text
authorizerId) (\s :: UpdateAuthorizer
s@UpdateAuthorizer' {} Text
a -> UpdateAuthorizer
s {$sel:authorizerId:UpdateAuthorizer' :: Text
authorizerId = Text
a} :: UpdateAuthorizer)
instance Core.AWSRequest UpdateAuthorizer where
type AWSResponse UpdateAuthorizer = Authorizer
request :: UpdateAuthorizer -> Request UpdateAuthorizer
request = Service -> UpdateAuthorizer -> Request UpdateAuthorizer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateAuthorizer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAuthorizer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateAuthorizer))
-> Logger
-> Service
-> Proxy UpdateAuthorizer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAuthorizer)))
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 Authorizer
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateAuthorizer
instance Prelude.NFData UpdateAuthorizer
instance Core.ToHeaders UpdateAuthorizer where
toHeaders :: UpdateAuthorizer -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateAuthorizer -> 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 UpdateAuthorizer where
toJSON :: UpdateAuthorizer -> Value
toJSON UpdateAuthorizer' {Maybe [PatchOperation]
Text
authorizerId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:authorizerId:UpdateAuthorizer' :: UpdateAuthorizer -> Text
$sel:restApiId:UpdateAuthorizer' :: UpdateAuthorizer -> Text
$sel:patchOperations:UpdateAuthorizer' :: UpdateAuthorizer -> 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 UpdateAuthorizer where
toPath :: UpdateAuthorizer -> ByteString
toPath UpdateAuthorizer' {Maybe [PatchOperation]
Text
authorizerId :: Text
restApiId :: Text
patchOperations :: Maybe [PatchOperation]
$sel:authorizerId:UpdateAuthorizer' :: UpdateAuthorizer -> Text
$sel:restApiId:UpdateAuthorizer' :: UpdateAuthorizer -> Text
$sel:patchOperations:UpdateAuthorizer' :: UpdateAuthorizer -> Maybe [PatchOperation]
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
ByteString
"/authorizers/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
authorizerId
]
instance Core.ToQuery UpdateAuthorizer where
toQuery :: UpdateAuthorizer -> QueryString
toQuery = QueryString -> UpdateAuthorizer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty