{-# 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.WAF.GetChangeToken
(
GetChangeToken (..),
newGetChangeToken,
GetChangeTokenResponse (..),
newGetChangeTokenResponse,
getChangeTokenResponse_changeToken,
getChangeTokenResponse_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.WAF.Types
data GetChangeToken = GetChangeToken'
{
}
deriving (GetChangeToken -> GetChangeToken -> Bool
(GetChangeToken -> GetChangeToken -> Bool)
-> (GetChangeToken -> GetChangeToken -> Bool) -> Eq GetChangeToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChangeToken -> GetChangeToken -> Bool
$c/= :: GetChangeToken -> GetChangeToken -> Bool
== :: GetChangeToken -> GetChangeToken -> Bool
$c== :: GetChangeToken -> GetChangeToken -> Bool
Prelude.Eq, ReadPrec [GetChangeToken]
ReadPrec GetChangeToken
Int -> ReadS GetChangeToken
ReadS [GetChangeToken]
(Int -> ReadS GetChangeToken)
-> ReadS [GetChangeToken]
-> ReadPrec GetChangeToken
-> ReadPrec [GetChangeToken]
-> Read GetChangeToken
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChangeToken]
$creadListPrec :: ReadPrec [GetChangeToken]
readPrec :: ReadPrec GetChangeToken
$creadPrec :: ReadPrec GetChangeToken
readList :: ReadS [GetChangeToken]
$creadList :: ReadS [GetChangeToken]
readsPrec :: Int -> ReadS GetChangeToken
$creadsPrec :: Int -> ReadS GetChangeToken
Prelude.Read, Int -> GetChangeToken -> ShowS
[GetChangeToken] -> ShowS
GetChangeToken -> String
(Int -> GetChangeToken -> ShowS)
-> (GetChangeToken -> String)
-> ([GetChangeToken] -> ShowS)
-> Show GetChangeToken
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChangeToken] -> ShowS
$cshowList :: [GetChangeToken] -> ShowS
show :: GetChangeToken -> String
$cshow :: GetChangeToken -> String
showsPrec :: Int -> GetChangeToken -> ShowS
$cshowsPrec :: Int -> GetChangeToken -> ShowS
Prelude.Show, (forall x. GetChangeToken -> Rep GetChangeToken x)
-> (forall x. Rep GetChangeToken x -> GetChangeToken)
-> Generic GetChangeToken
forall x. Rep GetChangeToken x -> GetChangeToken
forall x. GetChangeToken -> Rep GetChangeToken x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetChangeToken x -> GetChangeToken
$cfrom :: forall x. GetChangeToken -> Rep GetChangeToken x
Prelude.Generic)
newGetChangeToken ::
GetChangeToken
newGetChangeToken :: GetChangeToken
newGetChangeToken = GetChangeToken
GetChangeToken'
instance Core.AWSRequest GetChangeToken where
type
AWSResponse GetChangeToken =
GetChangeTokenResponse
request :: GetChangeToken -> Request GetChangeToken
request = Service -> GetChangeToken -> Request GetChangeToken
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetChangeToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetChangeToken)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetChangeToken))
-> Logger
-> Service
-> Proxy GetChangeToken
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetChangeToken)))
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 Text -> Int -> GetChangeTokenResponse
GetChangeTokenResponse'
(Maybe Text -> Int -> GetChangeTokenResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetChangeTokenResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChangeToken")
Either String (Int -> GetChangeTokenResponse)
-> Either String Int -> Either String GetChangeTokenResponse
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 GetChangeToken
instance Prelude.NFData GetChangeToken
instance Core.ToHeaders GetChangeToken where
toHeaders :: GetChangeToken -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetChangeToken -> 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_20150824.GetChangeToken" ::
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 GetChangeToken where
toJSON :: GetChangeToken -> Value
toJSON = Value -> GetChangeToken -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath GetChangeToken where
toPath :: GetChangeToken -> ByteString
toPath = ByteString -> GetChangeToken -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetChangeToken where
toQuery :: GetChangeToken -> QueryString
toQuery = QueryString -> GetChangeToken -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetChangeTokenResponse = GetChangeTokenResponse'
{
GetChangeTokenResponse -> Maybe Text
changeToken :: Prelude.Maybe Prelude.Text,
GetChangeTokenResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetChangeTokenResponse -> GetChangeTokenResponse -> Bool
(GetChangeTokenResponse -> GetChangeTokenResponse -> Bool)
-> (GetChangeTokenResponse -> GetChangeTokenResponse -> Bool)
-> Eq GetChangeTokenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetChangeTokenResponse -> GetChangeTokenResponse -> Bool
$c/= :: GetChangeTokenResponse -> GetChangeTokenResponse -> Bool
== :: GetChangeTokenResponse -> GetChangeTokenResponse -> Bool
$c== :: GetChangeTokenResponse -> GetChangeTokenResponse -> Bool
Prelude.Eq, ReadPrec [GetChangeTokenResponse]
ReadPrec GetChangeTokenResponse
Int -> ReadS GetChangeTokenResponse
ReadS [GetChangeTokenResponse]
(Int -> ReadS GetChangeTokenResponse)
-> ReadS [GetChangeTokenResponse]
-> ReadPrec GetChangeTokenResponse
-> ReadPrec [GetChangeTokenResponse]
-> Read GetChangeTokenResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetChangeTokenResponse]
$creadListPrec :: ReadPrec [GetChangeTokenResponse]
readPrec :: ReadPrec GetChangeTokenResponse
$creadPrec :: ReadPrec GetChangeTokenResponse
readList :: ReadS [GetChangeTokenResponse]
$creadList :: ReadS [GetChangeTokenResponse]
readsPrec :: Int -> ReadS GetChangeTokenResponse
$creadsPrec :: Int -> ReadS GetChangeTokenResponse
Prelude.Read, Int -> GetChangeTokenResponse -> ShowS
[GetChangeTokenResponse] -> ShowS
GetChangeTokenResponse -> String
(Int -> GetChangeTokenResponse -> ShowS)
-> (GetChangeTokenResponse -> String)
-> ([GetChangeTokenResponse] -> ShowS)
-> Show GetChangeTokenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetChangeTokenResponse] -> ShowS
$cshowList :: [GetChangeTokenResponse] -> ShowS
show :: GetChangeTokenResponse -> String
$cshow :: GetChangeTokenResponse -> String
showsPrec :: Int -> GetChangeTokenResponse -> ShowS
$cshowsPrec :: Int -> GetChangeTokenResponse -> ShowS
Prelude.Show, (forall x. GetChangeTokenResponse -> Rep GetChangeTokenResponse x)
-> (forall x.
Rep GetChangeTokenResponse x -> GetChangeTokenResponse)
-> Generic GetChangeTokenResponse
forall x. Rep GetChangeTokenResponse x -> GetChangeTokenResponse
forall x. GetChangeTokenResponse -> Rep GetChangeTokenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetChangeTokenResponse x -> GetChangeTokenResponse
$cfrom :: forall x. GetChangeTokenResponse -> Rep GetChangeTokenResponse x
Prelude.Generic)
newGetChangeTokenResponse ::
Prelude.Int ->
GetChangeTokenResponse
newGetChangeTokenResponse :: Int -> GetChangeTokenResponse
newGetChangeTokenResponse Int
pHttpStatus_ =
GetChangeTokenResponse' :: Maybe Text -> Int -> GetChangeTokenResponse
GetChangeTokenResponse'
{ $sel:changeToken:GetChangeTokenResponse' :: Maybe Text
changeToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetChangeTokenResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getChangeTokenResponse_changeToken :: Lens.Lens' GetChangeTokenResponse (Prelude.Maybe Prelude.Text)
getChangeTokenResponse_changeToken :: (Maybe Text -> f (Maybe Text))
-> GetChangeTokenResponse -> f GetChangeTokenResponse
getChangeTokenResponse_changeToken = (GetChangeTokenResponse -> Maybe Text)
-> (GetChangeTokenResponse -> Maybe Text -> GetChangeTokenResponse)
-> Lens
GetChangeTokenResponse
GetChangeTokenResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChangeTokenResponse' {Maybe Text
changeToken :: Maybe Text
$sel:changeToken:GetChangeTokenResponse' :: GetChangeTokenResponse -> Maybe Text
changeToken} -> Maybe Text
changeToken) (\s :: GetChangeTokenResponse
s@GetChangeTokenResponse' {} Maybe Text
a -> GetChangeTokenResponse
s {$sel:changeToken:GetChangeTokenResponse' :: Maybe Text
changeToken = Maybe Text
a} :: GetChangeTokenResponse)
getChangeTokenResponse_httpStatus :: Lens.Lens' GetChangeTokenResponse Prelude.Int
getChangeTokenResponse_httpStatus :: (Int -> f Int)
-> GetChangeTokenResponse -> f GetChangeTokenResponse
getChangeTokenResponse_httpStatus = (GetChangeTokenResponse -> Int)
-> (GetChangeTokenResponse -> Int -> GetChangeTokenResponse)
-> Lens GetChangeTokenResponse GetChangeTokenResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetChangeTokenResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetChangeTokenResponse' :: GetChangeTokenResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetChangeTokenResponse
s@GetChangeTokenResponse' {} Int
a -> GetChangeTokenResponse
s {$sel:httpStatus:GetChangeTokenResponse' :: Int
httpStatus = Int
a} :: GetChangeTokenResponse)
instance Prelude.NFData GetChangeTokenResponse