{-# 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.AmplifyBackend.DeleteToken
(
DeleteToken (..),
newDeleteToken,
deleteToken_sessionId,
deleteToken_appId,
DeleteTokenResponse (..),
newDeleteTokenResponse,
deleteTokenResponse_isSuccess,
deleteTokenResponse_httpStatus,
)
where
import Amazonka.AmplifyBackend.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 DeleteToken = DeleteToken'
{
DeleteToken -> Text
sessionId :: Prelude.Text,
DeleteToken -> Text
appId :: Prelude.Text
}
deriving (DeleteToken -> DeleteToken -> Bool
(DeleteToken -> DeleteToken -> Bool)
-> (DeleteToken -> DeleteToken -> Bool) -> Eq DeleteToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteToken -> DeleteToken -> Bool
$c/= :: DeleteToken -> DeleteToken -> Bool
== :: DeleteToken -> DeleteToken -> Bool
$c== :: DeleteToken -> DeleteToken -> Bool
Prelude.Eq, ReadPrec [DeleteToken]
ReadPrec DeleteToken
Int -> ReadS DeleteToken
ReadS [DeleteToken]
(Int -> ReadS DeleteToken)
-> ReadS [DeleteToken]
-> ReadPrec DeleteToken
-> ReadPrec [DeleteToken]
-> Read DeleteToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteToken]
$creadListPrec :: ReadPrec [DeleteToken]
readPrec :: ReadPrec DeleteToken
$creadPrec :: ReadPrec DeleteToken
readList :: ReadS [DeleteToken]
$creadList :: ReadS [DeleteToken]
readsPrec :: Int -> ReadS DeleteToken
$creadsPrec :: Int -> ReadS DeleteToken
Prelude.Read, Int -> DeleteToken -> ShowS
[DeleteToken] -> ShowS
DeleteToken -> String
(Int -> DeleteToken -> ShowS)
-> (DeleteToken -> String)
-> ([DeleteToken] -> ShowS)
-> Show DeleteToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteToken] -> ShowS
$cshowList :: [DeleteToken] -> ShowS
show :: DeleteToken -> String
$cshow :: DeleteToken -> String
showsPrec :: Int -> DeleteToken -> ShowS
$cshowsPrec :: Int -> DeleteToken -> ShowS
Prelude.Show, (forall x. DeleteToken -> Rep DeleteToken x)
-> (forall x. Rep DeleteToken x -> DeleteToken)
-> Generic DeleteToken
forall x. Rep DeleteToken x -> DeleteToken
forall x. DeleteToken -> Rep DeleteToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteToken x -> DeleteToken
$cfrom :: forall x. DeleteToken -> Rep DeleteToken x
Prelude.Generic)
newDeleteToken ::
Prelude.Text ->
Prelude.Text ->
DeleteToken
newDeleteToken :: Text -> Text -> DeleteToken
newDeleteToken Text
pSessionId_ Text
pAppId_ =
DeleteToken' :: Text -> Text -> DeleteToken
DeleteToken'
{ $sel:sessionId:DeleteToken' :: Text
sessionId = Text
pSessionId_,
$sel:appId:DeleteToken' :: Text
appId = Text
pAppId_
}
deleteToken_sessionId :: Lens.Lens' DeleteToken Prelude.Text
deleteToken_sessionId :: (Text -> f Text) -> DeleteToken -> f DeleteToken
deleteToken_sessionId = (DeleteToken -> Text)
-> (DeleteToken -> Text -> DeleteToken)
-> Lens DeleteToken DeleteToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteToken' {Text
sessionId :: Text
$sel:sessionId:DeleteToken' :: DeleteToken -> Text
sessionId} -> Text
sessionId) (\s :: DeleteToken
s@DeleteToken' {} Text
a -> DeleteToken
s {$sel:sessionId:DeleteToken' :: Text
sessionId = Text
a} :: DeleteToken)
deleteToken_appId :: Lens.Lens' DeleteToken Prelude.Text
deleteToken_appId :: (Text -> f Text) -> DeleteToken -> f DeleteToken
deleteToken_appId = (DeleteToken -> Text)
-> (DeleteToken -> Text -> DeleteToken)
-> Lens DeleteToken DeleteToken Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteToken' {Text
appId :: Text
$sel:appId:DeleteToken' :: DeleteToken -> Text
appId} -> Text
appId) (\s :: DeleteToken
s@DeleteToken' {} Text
a -> DeleteToken
s {$sel:appId:DeleteToken' :: Text
appId = Text
a} :: DeleteToken)
instance Core.AWSRequest DeleteToken where
type AWSResponse DeleteToken = DeleteTokenResponse
request :: DeleteToken -> Request DeleteToken
request = Service -> DeleteToken -> Request DeleteToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteToken)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteToken))
-> Logger
-> Service
-> Proxy DeleteToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteToken)))
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 Bool -> Int -> DeleteTokenResponse
DeleteTokenResponse'
(Maybe Bool -> Int -> DeleteTokenResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> DeleteTokenResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"isSuccess")
Either String (Int -> DeleteTokenResponse)
-> Either String Int -> Either String DeleteTokenResponse
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 DeleteToken
instance Prelude.NFData DeleteToken
instance Core.ToHeaders DeleteToken where
toHeaders :: DeleteToken -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteToken -> 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 DeleteToken where
toJSON :: DeleteToken -> Value
toJSON = Value -> DeleteToken -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath DeleteToken where
toPath :: DeleteToken -> ByteString
toPath DeleteToken' {Text
appId :: Text
sessionId :: Text
$sel:appId:DeleteToken' :: DeleteToken -> Text
$sel:sessionId:DeleteToken' :: DeleteToken -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/backend/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
ByteString
"/challenge/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
sessionId,
ByteString
"/remove"
]
instance Core.ToQuery DeleteToken where
toQuery :: DeleteToken -> QueryString
toQuery = QueryString -> DeleteToken -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteTokenResponse = DeleteTokenResponse'
{
DeleteTokenResponse -> Maybe Bool
isSuccess :: Prelude.Maybe Prelude.Bool,
DeleteTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteTokenResponse -> DeleteTokenResponse -> Bool
(DeleteTokenResponse -> DeleteTokenResponse -> Bool)
-> (DeleteTokenResponse -> DeleteTokenResponse -> Bool)
-> Eq DeleteTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTokenResponse -> DeleteTokenResponse -> Bool
$c/= :: DeleteTokenResponse -> DeleteTokenResponse -> Bool
== :: DeleteTokenResponse -> DeleteTokenResponse -> Bool
$c== :: DeleteTokenResponse -> DeleteTokenResponse -> Bool
Prelude.Eq, ReadPrec [DeleteTokenResponse]
ReadPrec DeleteTokenResponse
Int -> ReadS DeleteTokenResponse
ReadS [DeleteTokenResponse]
(Int -> ReadS DeleteTokenResponse)
-> ReadS [DeleteTokenResponse]
-> ReadPrec DeleteTokenResponse
-> ReadPrec [DeleteTokenResponse]
-> Read DeleteTokenResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTokenResponse]
$creadListPrec :: ReadPrec [DeleteTokenResponse]
readPrec :: ReadPrec DeleteTokenResponse
$creadPrec :: ReadPrec DeleteTokenResponse
readList :: ReadS [DeleteTokenResponse]
$creadList :: ReadS [DeleteTokenResponse]
readsPrec :: Int -> ReadS DeleteTokenResponse
$creadsPrec :: Int -> ReadS DeleteTokenResponse
Prelude.Read, Int -> DeleteTokenResponse -> ShowS
[DeleteTokenResponse] -> ShowS
DeleteTokenResponse -> String
(Int -> DeleteTokenResponse -> ShowS)
-> (DeleteTokenResponse -> String)
-> ([DeleteTokenResponse] -> ShowS)
-> Show DeleteTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTokenResponse] -> ShowS
$cshowList :: [DeleteTokenResponse] -> ShowS
show :: DeleteTokenResponse -> String
$cshow :: DeleteTokenResponse -> String
showsPrec :: Int -> DeleteTokenResponse -> ShowS
$cshowsPrec :: Int -> DeleteTokenResponse -> ShowS
Prelude.Show, (forall x. DeleteTokenResponse -> Rep DeleteTokenResponse x)
-> (forall x. Rep DeleteTokenResponse x -> DeleteTokenResponse)
-> Generic DeleteTokenResponse
forall x. Rep DeleteTokenResponse x -> DeleteTokenResponse
forall x. DeleteTokenResponse -> Rep DeleteTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTokenResponse x -> DeleteTokenResponse
$cfrom :: forall x. DeleteTokenResponse -> Rep DeleteTokenResponse x
Prelude.Generic)
newDeleteTokenResponse ::
Prelude.Int ->
DeleteTokenResponse
newDeleteTokenResponse :: Int -> DeleteTokenResponse
newDeleteTokenResponse Int
pHttpStatus_ =
DeleteTokenResponse' :: Maybe Bool -> Int -> DeleteTokenResponse
DeleteTokenResponse'
{ $sel:isSuccess:DeleteTokenResponse' :: Maybe Bool
isSuccess = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteTokenResponse_isSuccess :: Lens.Lens' DeleteTokenResponse (Prelude.Maybe Prelude.Bool)
deleteTokenResponse_isSuccess :: (Maybe Bool -> f (Maybe Bool))
-> DeleteTokenResponse -> f DeleteTokenResponse
deleteTokenResponse_isSuccess = (DeleteTokenResponse -> Maybe Bool)
-> (DeleteTokenResponse -> Maybe Bool -> DeleteTokenResponse)
-> Lens
DeleteTokenResponse DeleteTokenResponse (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTokenResponse' {Maybe Bool
isSuccess :: Maybe Bool
$sel:isSuccess:DeleteTokenResponse' :: DeleteTokenResponse -> Maybe Bool
isSuccess} -> Maybe Bool
isSuccess) (\s :: DeleteTokenResponse
s@DeleteTokenResponse' {} Maybe Bool
a -> DeleteTokenResponse
s {$sel:isSuccess:DeleteTokenResponse' :: Maybe Bool
isSuccess = Maybe Bool
a} :: DeleteTokenResponse)
deleteTokenResponse_httpStatus :: Lens.Lens' DeleteTokenResponse Prelude.Int
deleteTokenResponse_httpStatus :: (Int -> f Int) -> DeleteTokenResponse -> f DeleteTokenResponse
deleteTokenResponse_httpStatus = (DeleteTokenResponse -> Int)
-> (DeleteTokenResponse -> Int -> DeleteTokenResponse)
-> Lens DeleteTokenResponse DeleteTokenResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteTokenResponse' :: DeleteTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteTokenResponse
s@DeleteTokenResponse' {} Int
a -> DeleteTokenResponse
s {$sel:httpStatus:DeleteTokenResponse' :: Int
httpStatus = Int
a} :: DeleteTokenResponse)
instance Prelude.NFData DeleteTokenResponse