{-# 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.CognitoIdentityProvider.RevokeToken
(
RevokeToken (..),
newRevokeToken,
revokeToken_clientSecret,
revokeToken_token,
revokeToken_clientId,
RevokeTokenResponse (..),
newRevokeTokenResponse,
revokeTokenResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.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 RevokeToken = RevokeToken'
{
RevokeToken -> Maybe (Sensitive Text)
clientSecret :: Prelude.Maybe (Core.Sensitive Prelude.Text),
RevokeToken -> Sensitive Text
token :: Core.Sensitive Prelude.Text,
RevokeToken -> Sensitive Text
clientId :: Core.Sensitive Prelude.Text
}
deriving (RevokeToken -> RevokeToken -> Bool
(RevokeToken -> RevokeToken -> Bool)
-> (RevokeToken -> RevokeToken -> Bool) -> Eq RevokeToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeToken -> RevokeToken -> Bool
$c/= :: RevokeToken -> RevokeToken -> Bool
== :: RevokeToken -> RevokeToken -> Bool
$c== :: RevokeToken -> RevokeToken -> Bool
Prelude.Eq, Int -> RevokeToken -> ShowS
[RevokeToken] -> ShowS
RevokeToken -> String
(Int -> RevokeToken -> ShowS)
-> (RevokeToken -> String)
-> ([RevokeToken] -> ShowS)
-> Show RevokeToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeToken] -> ShowS
$cshowList :: [RevokeToken] -> ShowS
show :: RevokeToken -> String
$cshow :: RevokeToken -> String
showsPrec :: Int -> RevokeToken -> ShowS
$cshowsPrec :: Int -> RevokeToken -> ShowS
Prelude.Show, (forall x. RevokeToken -> Rep RevokeToken x)
-> (forall x. Rep RevokeToken x -> RevokeToken)
-> Generic RevokeToken
forall x. Rep RevokeToken x -> RevokeToken
forall x. RevokeToken -> Rep RevokeToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeToken x -> RevokeToken
$cfrom :: forall x. RevokeToken -> Rep RevokeToken x
Prelude.Generic)
newRevokeToken ::
Prelude.Text ->
Prelude.Text ->
RevokeToken
newRevokeToken :: Text -> Text -> RevokeToken
newRevokeToken Text
pToken_ Text
pClientId_ =
RevokeToken' :: Maybe (Sensitive Text)
-> Sensitive Text -> Sensitive Text -> RevokeToken
RevokeToken'
{ $sel:clientSecret:RevokeToken' :: Maybe (Sensitive Text)
clientSecret = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:token:RevokeToken' :: Sensitive Text
token = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pToken_,
$sel:clientId:RevokeToken' :: Sensitive Text
clientId = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pClientId_
}
revokeToken_clientSecret :: Lens.Lens' RevokeToken (Prelude.Maybe Prelude.Text)
revokeToken_clientSecret :: (Maybe Text -> f (Maybe Text)) -> RevokeToken -> f RevokeToken
revokeToken_clientSecret = (RevokeToken -> Maybe (Sensitive Text))
-> (RevokeToken -> Maybe (Sensitive Text) -> RevokeToken)
-> Lens
RevokeToken
RevokeToken
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeToken' {Maybe (Sensitive Text)
clientSecret :: Maybe (Sensitive Text)
$sel:clientSecret:RevokeToken' :: RevokeToken -> Maybe (Sensitive Text)
clientSecret} -> Maybe (Sensitive Text)
clientSecret) (\s :: RevokeToken
s@RevokeToken' {} Maybe (Sensitive Text)
a -> RevokeToken
s {$sel:clientSecret:RevokeToken' :: Maybe (Sensitive Text)
clientSecret = Maybe (Sensitive Text)
a} :: RevokeToken) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> RevokeToken -> f RevokeToken)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> RevokeToken
-> f RevokeToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
revokeToken_token :: Lens.Lens' RevokeToken Prelude.Text
revokeToken_token :: (Text -> f Text) -> RevokeToken -> f RevokeToken
revokeToken_token = (RevokeToken -> Sensitive Text)
-> (RevokeToken -> Sensitive Text -> RevokeToken)
-> Lens RevokeToken RevokeToken (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeToken' {Sensitive Text
token :: Sensitive Text
$sel:token:RevokeToken' :: RevokeToken -> Sensitive Text
token} -> Sensitive Text
token) (\s :: RevokeToken
s@RevokeToken' {} Sensitive Text
a -> RevokeToken
s {$sel:token:RevokeToken' :: Sensitive Text
token = Sensitive Text
a} :: RevokeToken) ((Sensitive Text -> f (Sensitive Text))
-> RevokeToken -> f RevokeToken)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> RevokeToken
-> f RevokeToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
revokeToken_clientId :: Lens.Lens' RevokeToken Prelude.Text
revokeToken_clientId :: (Text -> f Text) -> RevokeToken -> f RevokeToken
revokeToken_clientId = (RevokeToken -> Sensitive Text)
-> (RevokeToken -> Sensitive Text -> RevokeToken)
-> Lens RevokeToken RevokeToken (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeToken' {Sensitive Text
clientId :: Sensitive Text
$sel:clientId:RevokeToken' :: RevokeToken -> Sensitive Text
clientId} -> Sensitive Text
clientId) (\s :: RevokeToken
s@RevokeToken' {} Sensitive Text
a -> RevokeToken
s {$sel:clientId:RevokeToken' :: Sensitive Text
clientId = Sensitive Text
a} :: RevokeToken) ((Sensitive Text -> f (Sensitive Text))
-> RevokeToken -> f RevokeToken)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> RevokeToken
-> f RevokeToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest RevokeToken where
type AWSResponse RevokeToken = RevokeTokenResponse
request :: RevokeToken -> Request RevokeToken
request = Service -> RevokeToken -> Request RevokeToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RevokeToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RevokeToken)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RevokeToken))
-> Logger
-> Service
-> Proxy RevokeToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RevokeToken)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RevokeTokenResponse
RevokeTokenResponse'
(Int -> RevokeTokenResponse)
-> Either String Int -> Either String RevokeTokenResponse
forall (f :: * -> *) a b. Functor 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 RevokeToken
instance Prelude.NFData RevokeToken
instance Core.ToHeaders RevokeToken where
toHeaders :: RevokeToken -> ResponseHeaders
toHeaders =
ResponseHeaders -> RevokeToken -> 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
"AWSCognitoIdentityProviderService.RevokeToken" ::
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 RevokeToken where
toJSON :: RevokeToken -> Value
toJSON RevokeToken' {Maybe (Sensitive Text)
Sensitive Text
clientId :: Sensitive Text
token :: Sensitive Text
clientSecret :: Maybe (Sensitive Text)
$sel:clientId:RevokeToken' :: RevokeToken -> Sensitive Text
$sel:token:RevokeToken' :: RevokeToken -> Sensitive Text
$sel:clientSecret:RevokeToken' :: RevokeToken -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ClientSecret" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
clientSecret,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Token" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
token),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
clientId)
]
)
instance Core.ToPath RevokeToken where
toPath :: RevokeToken -> ByteString
toPath = ByteString -> RevokeToken -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RevokeToken where
toQuery :: RevokeToken -> QueryString
toQuery = QueryString -> RevokeToken -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RevokeTokenResponse = RevokeTokenResponse'
{
RevokeTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RevokeTokenResponse -> RevokeTokenResponse -> Bool
(RevokeTokenResponse -> RevokeTokenResponse -> Bool)
-> (RevokeTokenResponse -> RevokeTokenResponse -> Bool)
-> Eq RevokeTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RevokeTokenResponse -> RevokeTokenResponse -> Bool
$c/= :: RevokeTokenResponse -> RevokeTokenResponse -> Bool
== :: RevokeTokenResponse -> RevokeTokenResponse -> Bool
$c== :: RevokeTokenResponse -> RevokeTokenResponse -> Bool
Prelude.Eq, ReadPrec [RevokeTokenResponse]
ReadPrec RevokeTokenResponse
Int -> ReadS RevokeTokenResponse
ReadS [RevokeTokenResponse]
(Int -> ReadS RevokeTokenResponse)
-> ReadS [RevokeTokenResponse]
-> ReadPrec RevokeTokenResponse
-> ReadPrec [RevokeTokenResponse]
-> Read RevokeTokenResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RevokeTokenResponse]
$creadListPrec :: ReadPrec [RevokeTokenResponse]
readPrec :: ReadPrec RevokeTokenResponse
$creadPrec :: ReadPrec RevokeTokenResponse
readList :: ReadS [RevokeTokenResponse]
$creadList :: ReadS [RevokeTokenResponse]
readsPrec :: Int -> ReadS RevokeTokenResponse
$creadsPrec :: Int -> ReadS RevokeTokenResponse
Prelude.Read, Int -> RevokeTokenResponse -> ShowS
[RevokeTokenResponse] -> ShowS
RevokeTokenResponse -> String
(Int -> RevokeTokenResponse -> ShowS)
-> (RevokeTokenResponse -> String)
-> ([RevokeTokenResponse] -> ShowS)
-> Show RevokeTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RevokeTokenResponse] -> ShowS
$cshowList :: [RevokeTokenResponse] -> ShowS
show :: RevokeTokenResponse -> String
$cshow :: RevokeTokenResponse -> String
showsPrec :: Int -> RevokeTokenResponse -> ShowS
$cshowsPrec :: Int -> RevokeTokenResponse -> ShowS
Prelude.Show, (forall x. RevokeTokenResponse -> Rep RevokeTokenResponse x)
-> (forall x. Rep RevokeTokenResponse x -> RevokeTokenResponse)
-> Generic RevokeTokenResponse
forall x. Rep RevokeTokenResponse x -> RevokeTokenResponse
forall x. RevokeTokenResponse -> Rep RevokeTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RevokeTokenResponse x -> RevokeTokenResponse
$cfrom :: forall x. RevokeTokenResponse -> Rep RevokeTokenResponse x
Prelude.Generic)
newRevokeTokenResponse ::
Prelude.Int ->
RevokeTokenResponse
newRevokeTokenResponse :: Int -> RevokeTokenResponse
newRevokeTokenResponse Int
pHttpStatus_ =
RevokeTokenResponse' :: Int -> RevokeTokenResponse
RevokeTokenResponse' {$sel:httpStatus:RevokeTokenResponse' :: Int
httpStatus = Int
pHttpStatus_}
revokeTokenResponse_httpStatus :: Lens.Lens' RevokeTokenResponse Prelude.Int
revokeTokenResponse_httpStatus :: (Int -> f Int) -> RevokeTokenResponse -> f RevokeTokenResponse
revokeTokenResponse_httpStatus = (RevokeTokenResponse -> Int)
-> (RevokeTokenResponse -> Int -> RevokeTokenResponse)
-> Lens RevokeTokenResponse RevokeTokenResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RevokeTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:RevokeTokenResponse' :: RevokeTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RevokeTokenResponse
s@RevokeTokenResponse' {} Int
a -> RevokeTokenResponse
s {$sel:httpStatus:RevokeTokenResponse' :: Int
httpStatus = Int
a} :: RevokeTokenResponse)
instance Prelude.NFData RevokeTokenResponse