{-# 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.GetIPSet
(
GetIPSet (..),
newGetIPSet,
getIPSet_iPSetId,
GetIPSetResponse (..),
newGetIPSetResponse,
getIPSetResponse_iPSet,
getIPSetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAF.Types
data GetIPSet = GetIPSet'
{
GetIPSet -> Text
iPSetId :: Prelude.Text
}
deriving (GetIPSet -> GetIPSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIPSet -> GetIPSet -> Bool
$c/= :: GetIPSet -> GetIPSet -> Bool
== :: GetIPSet -> GetIPSet -> Bool
$c== :: GetIPSet -> GetIPSet -> Bool
Prelude.Eq, ReadPrec [GetIPSet]
ReadPrec GetIPSet
Int -> ReadS GetIPSet
ReadS [GetIPSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIPSet]
$creadListPrec :: ReadPrec [GetIPSet]
readPrec :: ReadPrec GetIPSet
$creadPrec :: ReadPrec GetIPSet
readList :: ReadS [GetIPSet]
$creadList :: ReadS [GetIPSet]
readsPrec :: Int -> ReadS GetIPSet
$creadsPrec :: Int -> ReadS GetIPSet
Prelude.Read, Int -> GetIPSet -> ShowS
[GetIPSet] -> ShowS
GetIPSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIPSet] -> ShowS
$cshowList :: [GetIPSet] -> ShowS
show :: GetIPSet -> String
$cshow :: GetIPSet -> String
showsPrec :: Int -> GetIPSet -> ShowS
$cshowsPrec :: Int -> GetIPSet -> ShowS
Prelude.Show, forall x. Rep GetIPSet x -> GetIPSet
forall x. GetIPSet -> Rep GetIPSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIPSet x -> GetIPSet
$cfrom :: forall x. GetIPSet -> Rep GetIPSet x
Prelude.Generic)
newGetIPSet ::
Prelude.Text ->
GetIPSet
newGetIPSet :: Text -> GetIPSet
newGetIPSet Text
pIPSetId_ =
GetIPSet' {$sel:iPSetId:GetIPSet' :: Text
iPSetId = Text
pIPSetId_}
getIPSet_iPSetId :: Lens.Lens' GetIPSet Prelude.Text
getIPSet_iPSetId :: Lens' GetIPSet Text
getIPSet_iPSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSet' {Text
iPSetId :: Text
$sel:iPSetId:GetIPSet' :: GetIPSet -> Text
iPSetId} -> Text
iPSetId) (\s :: GetIPSet
s@GetIPSet' {} Text
a -> GetIPSet
s {$sel:iPSetId:GetIPSet' :: Text
iPSetId = Text
a} :: GetIPSet)
instance Core.AWSRequest GetIPSet where
type AWSResponse GetIPSet = GetIPSetResponse
request :: (Service -> Service) -> GetIPSet -> Request GetIPSet
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetIPSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetIPSet)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe IPSet -> Int -> GetIPSetResponse
GetIPSetResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"IPSet")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetIPSet where
hashWithSalt :: Int -> GetIPSet -> Int
hashWithSalt Int
_salt GetIPSet' {Text
iPSetId :: Text
$sel:iPSetId:GetIPSet' :: GetIPSet -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
iPSetId
instance Prelude.NFData GetIPSet where
rnf :: GetIPSet -> ()
rnf GetIPSet' {Text
iPSetId :: Text
$sel:iPSetId:GetIPSet' :: GetIPSet -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
iPSetId
instance Data.ToHeaders GetIPSet where
toHeaders :: GetIPSet -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"AWSWAF_20150824.GetIPSet" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetIPSet where
toJSON :: GetIPSet -> Value
toJSON GetIPSet' {Text
iPSetId :: Text
$sel:iPSetId:GetIPSet' :: GetIPSet -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"IPSetId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
iPSetId)]
)
instance Data.ToPath GetIPSet where
toPath :: GetIPSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetIPSet where
toQuery :: GetIPSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetIPSetResponse = GetIPSetResponse'
{
GetIPSetResponse -> Maybe IPSet
iPSet :: Prelude.Maybe IPSet,
GetIPSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetIPSetResponse -> GetIPSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIPSetResponse -> GetIPSetResponse -> Bool
$c/= :: GetIPSetResponse -> GetIPSetResponse -> Bool
== :: GetIPSetResponse -> GetIPSetResponse -> Bool
$c== :: GetIPSetResponse -> GetIPSetResponse -> Bool
Prelude.Eq, ReadPrec [GetIPSetResponse]
ReadPrec GetIPSetResponse
Int -> ReadS GetIPSetResponse
ReadS [GetIPSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIPSetResponse]
$creadListPrec :: ReadPrec [GetIPSetResponse]
readPrec :: ReadPrec GetIPSetResponse
$creadPrec :: ReadPrec GetIPSetResponse
readList :: ReadS [GetIPSetResponse]
$creadList :: ReadS [GetIPSetResponse]
readsPrec :: Int -> ReadS GetIPSetResponse
$creadsPrec :: Int -> ReadS GetIPSetResponse
Prelude.Read, Int -> GetIPSetResponse -> ShowS
[GetIPSetResponse] -> ShowS
GetIPSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIPSetResponse] -> ShowS
$cshowList :: [GetIPSetResponse] -> ShowS
show :: GetIPSetResponse -> String
$cshow :: GetIPSetResponse -> String
showsPrec :: Int -> GetIPSetResponse -> ShowS
$cshowsPrec :: Int -> GetIPSetResponse -> ShowS
Prelude.Show, forall x. Rep GetIPSetResponse x -> GetIPSetResponse
forall x. GetIPSetResponse -> Rep GetIPSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIPSetResponse x -> GetIPSetResponse
$cfrom :: forall x. GetIPSetResponse -> Rep GetIPSetResponse x
Prelude.Generic)
newGetIPSetResponse ::
Prelude.Int ->
GetIPSetResponse
newGetIPSetResponse :: Int -> GetIPSetResponse
newGetIPSetResponse Int
pHttpStatus_ =
GetIPSetResponse'
{ $sel:iPSet:GetIPSetResponse' :: Maybe IPSet
iPSet = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetIPSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getIPSetResponse_iPSet :: Lens.Lens' GetIPSetResponse (Prelude.Maybe IPSet)
getIPSetResponse_iPSet :: Lens' GetIPSetResponse (Maybe IPSet)
getIPSetResponse_iPSet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Maybe IPSet
iPSet :: Maybe IPSet
$sel:iPSet:GetIPSetResponse' :: GetIPSetResponse -> Maybe IPSet
iPSet} -> Maybe IPSet
iPSet) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Maybe IPSet
a -> GetIPSetResponse
s {$sel:iPSet:GetIPSetResponse' :: Maybe IPSet
iPSet = Maybe IPSet
a} :: GetIPSetResponse)
getIPSetResponse_httpStatus :: Lens.Lens' GetIPSetResponse Prelude.Int
getIPSetResponse_httpStatus :: Lens' GetIPSetResponse Int
getIPSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetIPSetResponse' :: GetIPSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Int
a -> GetIPSetResponse
s {$sel:httpStatus:GetIPSetResponse' :: Int
httpStatus = Int
a} :: GetIPSetResponse)
instance Prelude.NFData GetIPSetResponse where
rnf :: GetIPSetResponse -> ()
rnf GetIPSetResponse' {Int
Maybe IPSet
httpStatus :: Int
iPSet :: Maybe IPSet
$sel:httpStatus:GetIPSetResponse' :: GetIPSetResponse -> Int
$sel:iPSet:GetIPSetResponse' :: GetIPSetResponse -> Maybe IPSet
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe IPSet
iPSet
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus