{-# 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.WAFRegional.GetChangeTokenStatus
(
GetChangeTokenStatus (..),
newGetChangeTokenStatus,
getChangeTokenStatus_changeToken,
GetChangeTokenStatusResponse (..),
newGetChangeTokenStatusResponse,
getChangeTokenStatusResponse_changeTokenStatus,
getChangeTokenStatusResponse_httpStatus,
)
where
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
import Amazonka.WAFRegional.Types
data GetChangeTokenStatus = GetChangeTokenStatus'
{
GetChangeTokenStatus -> Text
changeToken :: Prelude.Text
}
deriving (GetChangeTokenStatus -> GetChangeTokenStatus -> Bool
(GetChangeTokenStatus -> GetChangeTokenStatus -> Bool)
-> (GetChangeTokenStatus -> GetChangeTokenStatus -> Bool)
-> Eq GetChangeTokenStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChangeTokenStatus -> GetChangeTokenStatus -> Bool
$c/= :: GetChangeTokenStatus -> GetChangeTokenStatus -> Bool
== :: GetChangeTokenStatus -> GetChangeTokenStatus -> Bool
$c== :: GetChangeTokenStatus -> GetChangeTokenStatus -> Bool
Prelude.Eq, ReadPrec [GetChangeTokenStatus]
ReadPrec GetChangeTokenStatus
Int -> ReadS GetChangeTokenStatus
ReadS [GetChangeTokenStatus]
(Int -> ReadS GetChangeTokenStatus)
-> ReadS [GetChangeTokenStatus]
-> ReadPrec GetChangeTokenStatus
-> ReadPrec [GetChangeTokenStatus]
-> Read GetChangeTokenStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChangeTokenStatus]
$creadListPrec :: ReadPrec [GetChangeTokenStatus]
readPrec :: ReadPrec GetChangeTokenStatus
$creadPrec :: ReadPrec GetChangeTokenStatus
readList :: ReadS [GetChangeTokenStatus]
$creadList :: ReadS [GetChangeTokenStatus]
readsPrec :: Int -> ReadS GetChangeTokenStatus
$creadsPrec :: Int -> ReadS GetChangeTokenStatus
Prelude.Read, Int -> GetChangeTokenStatus -> ShowS
[GetChangeTokenStatus] -> ShowS
GetChangeTokenStatus -> String
(Int -> GetChangeTokenStatus -> ShowS)
-> (GetChangeTokenStatus -> String)
-> ([GetChangeTokenStatus] -> ShowS)
-> Show GetChangeTokenStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChangeTokenStatus] -> ShowS
$cshowList :: [GetChangeTokenStatus] -> ShowS
show :: GetChangeTokenStatus -> String
$cshow :: GetChangeTokenStatus -> String
showsPrec :: Int -> GetChangeTokenStatus -> ShowS
$cshowsPrec :: Int -> GetChangeTokenStatus -> ShowS
Prelude.Show, (forall x. GetChangeTokenStatus -> Rep GetChangeTokenStatus x)
-> (forall x. Rep GetChangeTokenStatus x -> GetChangeTokenStatus)
-> Generic GetChangeTokenStatus
forall x. Rep GetChangeTokenStatus x -> GetChangeTokenStatus
forall x. GetChangeTokenStatus -> Rep GetChangeTokenStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetChangeTokenStatus x -> GetChangeTokenStatus
$cfrom :: forall x. GetChangeTokenStatus -> Rep GetChangeTokenStatus x
Prelude.Generic)
newGetChangeTokenStatus ::
Prelude.Text ->
GetChangeTokenStatus
newGetChangeTokenStatus :: Text -> GetChangeTokenStatus
newGetChangeTokenStatus Text
pChangeToken_ =
GetChangeTokenStatus' :: Text -> GetChangeTokenStatus
GetChangeTokenStatus' {$sel:changeToken:GetChangeTokenStatus' :: Text
changeToken = Text
pChangeToken_}
getChangeTokenStatus_changeToken :: Lens.Lens' GetChangeTokenStatus Prelude.Text
getChangeTokenStatus_changeToken :: (Text -> f Text) -> GetChangeTokenStatus -> f GetChangeTokenStatus
getChangeTokenStatus_changeToken = (GetChangeTokenStatus -> Text)
-> (GetChangeTokenStatus -> Text -> GetChangeTokenStatus)
-> Lens GetChangeTokenStatus GetChangeTokenStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChangeTokenStatus' {Text
changeToken :: Text
$sel:changeToken:GetChangeTokenStatus' :: GetChangeTokenStatus -> Text
changeToken} -> Text
changeToken) (\s :: GetChangeTokenStatus
s@GetChangeTokenStatus' {} Text
a -> GetChangeTokenStatus
s {$sel:changeToken:GetChangeTokenStatus' :: Text
changeToken = Text
a} :: GetChangeTokenStatus)
instance Core.AWSRequest GetChangeTokenStatus where
type
AWSResponse GetChangeTokenStatus =
GetChangeTokenStatusResponse
request :: GetChangeTokenStatus -> Request GetChangeTokenStatus
request = Service -> GetChangeTokenStatus -> Request GetChangeTokenStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetChangeTokenStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetChangeTokenStatus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetChangeTokenStatus))
-> Logger
-> Service
-> Proxy GetChangeTokenStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetChangeTokenStatus)))
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 ChangeTokenStatus -> Int -> GetChangeTokenStatusResponse
GetChangeTokenStatusResponse'
(Maybe ChangeTokenStatus -> Int -> GetChangeTokenStatusResponse)
-> Either String (Maybe ChangeTokenStatus)
-> Either String (Int -> GetChangeTokenStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ChangeTokenStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChangeTokenStatus")
Either String (Int -> GetChangeTokenStatusResponse)
-> Either String Int -> Either String GetChangeTokenStatusResponse
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 GetChangeTokenStatus
instance Prelude.NFData GetChangeTokenStatus
instance Core.ToHeaders GetChangeTokenStatus where
toHeaders :: GetChangeTokenStatus -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetChangeTokenStatus -> 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
"AWSWAF_Regional_20161128.GetChangeTokenStatus" ::
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 GetChangeTokenStatus where
toJSON :: GetChangeTokenStatus -> Value
toJSON GetChangeTokenStatus' {Text
changeToken :: Text
$sel:changeToken:GetChangeTokenStatus' :: GetChangeTokenStatus -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChangeToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
changeToken)]
)
instance Core.ToPath GetChangeTokenStatus where
toPath :: GetChangeTokenStatus -> ByteString
toPath = ByteString -> GetChangeTokenStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetChangeTokenStatus where
toQuery :: GetChangeTokenStatus -> QueryString
toQuery = QueryString -> GetChangeTokenStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetChangeTokenStatusResponse = GetChangeTokenStatusResponse'
{
GetChangeTokenStatusResponse -> Maybe ChangeTokenStatus
changeTokenStatus :: Prelude.Maybe ChangeTokenStatus,
GetChangeTokenStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool
(GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool)
-> (GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool)
-> Eq GetChangeTokenStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool
$c/= :: GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool
== :: GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool
$c== :: GetChangeTokenStatusResponse
-> GetChangeTokenStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetChangeTokenStatusResponse]
ReadPrec GetChangeTokenStatusResponse
Int -> ReadS GetChangeTokenStatusResponse
ReadS [GetChangeTokenStatusResponse]
(Int -> ReadS GetChangeTokenStatusResponse)
-> ReadS [GetChangeTokenStatusResponse]
-> ReadPrec GetChangeTokenStatusResponse
-> ReadPrec [GetChangeTokenStatusResponse]
-> Read GetChangeTokenStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChangeTokenStatusResponse]
$creadListPrec :: ReadPrec [GetChangeTokenStatusResponse]
readPrec :: ReadPrec GetChangeTokenStatusResponse
$creadPrec :: ReadPrec GetChangeTokenStatusResponse
readList :: ReadS [GetChangeTokenStatusResponse]
$creadList :: ReadS [GetChangeTokenStatusResponse]
readsPrec :: Int -> ReadS GetChangeTokenStatusResponse
$creadsPrec :: Int -> ReadS GetChangeTokenStatusResponse
Prelude.Read, Int -> GetChangeTokenStatusResponse -> ShowS
[GetChangeTokenStatusResponse] -> ShowS
GetChangeTokenStatusResponse -> String
(Int -> GetChangeTokenStatusResponse -> ShowS)
-> (GetChangeTokenStatusResponse -> String)
-> ([GetChangeTokenStatusResponse] -> ShowS)
-> Show GetChangeTokenStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChangeTokenStatusResponse] -> ShowS
$cshowList :: [GetChangeTokenStatusResponse] -> ShowS
show :: GetChangeTokenStatusResponse -> String
$cshow :: GetChangeTokenStatusResponse -> String
showsPrec :: Int -> GetChangeTokenStatusResponse -> ShowS
$cshowsPrec :: Int -> GetChangeTokenStatusResponse -> ShowS
Prelude.Show, (forall x.
GetChangeTokenStatusResponse -> Rep GetChangeTokenStatusResponse x)
-> (forall x.
Rep GetChangeTokenStatusResponse x -> GetChangeTokenStatusResponse)
-> Generic GetChangeTokenStatusResponse
forall x.
Rep GetChangeTokenStatusResponse x -> GetChangeTokenStatusResponse
forall x.
GetChangeTokenStatusResponse -> Rep GetChangeTokenStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetChangeTokenStatusResponse x -> GetChangeTokenStatusResponse
$cfrom :: forall x.
GetChangeTokenStatusResponse -> Rep GetChangeTokenStatusResponse x
Prelude.Generic)
newGetChangeTokenStatusResponse ::
Prelude.Int ->
GetChangeTokenStatusResponse
newGetChangeTokenStatusResponse :: Int -> GetChangeTokenStatusResponse
newGetChangeTokenStatusResponse Int
pHttpStatus_ =
GetChangeTokenStatusResponse' :: Maybe ChangeTokenStatus -> Int -> GetChangeTokenStatusResponse
GetChangeTokenStatusResponse'
{ $sel:changeTokenStatus:GetChangeTokenStatusResponse' :: Maybe ChangeTokenStatus
changeTokenStatus =
Maybe ChangeTokenStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetChangeTokenStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getChangeTokenStatusResponse_changeTokenStatus :: Lens.Lens' GetChangeTokenStatusResponse (Prelude.Maybe ChangeTokenStatus)
getChangeTokenStatusResponse_changeTokenStatus :: (Maybe ChangeTokenStatus -> f (Maybe ChangeTokenStatus))
-> GetChangeTokenStatusResponse -> f GetChangeTokenStatusResponse
getChangeTokenStatusResponse_changeTokenStatus = (GetChangeTokenStatusResponse -> Maybe ChangeTokenStatus)
-> (GetChangeTokenStatusResponse
-> Maybe ChangeTokenStatus -> GetChangeTokenStatusResponse)
-> Lens
GetChangeTokenStatusResponse
GetChangeTokenStatusResponse
(Maybe ChangeTokenStatus)
(Maybe ChangeTokenStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChangeTokenStatusResponse' {Maybe ChangeTokenStatus
changeTokenStatus :: Maybe ChangeTokenStatus
$sel:changeTokenStatus:GetChangeTokenStatusResponse' :: GetChangeTokenStatusResponse -> Maybe ChangeTokenStatus
changeTokenStatus} -> Maybe ChangeTokenStatus
changeTokenStatus) (\s :: GetChangeTokenStatusResponse
s@GetChangeTokenStatusResponse' {} Maybe ChangeTokenStatus
a -> GetChangeTokenStatusResponse
s {$sel:changeTokenStatus:GetChangeTokenStatusResponse' :: Maybe ChangeTokenStatus
changeTokenStatus = Maybe ChangeTokenStatus
a} :: GetChangeTokenStatusResponse)
getChangeTokenStatusResponse_httpStatus :: Lens.Lens' GetChangeTokenStatusResponse Prelude.Int
getChangeTokenStatusResponse_httpStatus :: (Int -> f Int)
-> GetChangeTokenStatusResponse -> f GetChangeTokenStatusResponse
getChangeTokenStatusResponse_httpStatus = (GetChangeTokenStatusResponse -> Int)
-> (GetChangeTokenStatusResponse
-> Int -> GetChangeTokenStatusResponse)
-> Lens
GetChangeTokenStatusResponse GetChangeTokenStatusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChangeTokenStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetChangeTokenStatusResponse' :: GetChangeTokenStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetChangeTokenStatusResponse
s@GetChangeTokenStatusResponse' {} Int
a -> GetChangeTokenStatusResponse
s {$sel:httpStatus:GetChangeTokenStatusResponse' :: Int
httpStatus = Int
a} :: GetChangeTokenStatusResponse)
instance Prelude.NFData GetChangeTokenStatusResponse