{-# 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.WAFV2.GetIPSet
(
GetIPSet (..),
newGetIPSet,
getIPSet_name,
getIPSet_scope,
getIPSet_id,
GetIPSetResponse (..),
newGetIPSetResponse,
getIPSetResponse_iPSet,
getIPSetResponse_lockToken,
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.WAFV2.Types
data GetIPSet = GetIPSet'
{
GetIPSet -> Text
name :: Prelude.Text,
GetIPSet -> Scope
scope :: Scope,
GetIPSet -> Text
id :: 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 ->
Scope ->
Prelude.Text ->
GetIPSet
newGetIPSet :: Text -> Scope -> Text -> GetIPSet
newGetIPSet Text
pName_ Scope
pScope_ Text
pId_ =
GetIPSet'
{ $sel:name:GetIPSet' :: Text
name = Text
pName_,
$sel:scope:GetIPSet' :: Scope
scope = Scope
pScope_,
$sel:id:GetIPSet' :: Text
id = Text
pId_
}
getIPSet_name :: Lens.Lens' GetIPSet Prelude.Text
getIPSet_name :: Lens' GetIPSet Text
getIPSet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSet' {Text
name :: Text
$sel:name:GetIPSet' :: GetIPSet -> Text
name} -> Text
name) (\s :: GetIPSet
s@GetIPSet' {} Text
a -> GetIPSet
s {$sel:name:GetIPSet' :: Text
name = Text
a} :: GetIPSet)
getIPSet_scope :: Lens.Lens' GetIPSet Scope
getIPSet_scope :: Lens' GetIPSet Scope
getIPSet_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSet' {Scope
scope :: Scope
$sel:scope:GetIPSet' :: GetIPSet -> Scope
scope} -> Scope
scope) (\s :: GetIPSet
s@GetIPSet' {} Scope
a -> GetIPSet
s {$sel:scope:GetIPSet' :: Scope
scope = Scope
a} :: GetIPSet)
getIPSet_id :: Lens.Lens' GetIPSet Prelude.Text
getIPSet_id :: Lens' GetIPSet Text
getIPSet_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSet' {Text
id :: Text
$sel:id:GetIPSet' :: GetIPSet -> Text
id} -> Text
id) (\s :: GetIPSet
s@GetIPSet' {} Text
a -> GetIPSet
s {$sel:id:GetIPSet' :: Text
id = 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 -> Maybe Text -> 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"LockToken")
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
Scope
id :: Text
scope :: Scope
name :: Text
$sel:id:GetIPSet' :: GetIPSet -> Text
$sel:scope:GetIPSet' :: GetIPSet -> Scope
$sel:name:GetIPSet' :: GetIPSet -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Scope
scope
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetIPSet where
rnf :: GetIPSet -> ()
rnf GetIPSet' {Text
Scope
id :: Text
scope :: Scope
name :: Text
$sel:id:GetIPSet' :: GetIPSet -> Text
$sel:scope:GetIPSet' :: GetIPSet -> Scope
$sel:name:GetIPSet' :: GetIPSet -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Scope
scope
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id
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_20190729.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
Scope
id :: Text
scope :: Scope
name :: Text
$sel:id:GetIPSet' :: GetIPSet -> Text
$sel:scope:GetIPSet' :: GetIPSet -> Scope
$sel:name:GetIPSet' :: GetIPSet -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Scope" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Scope
scope),
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
]
)
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 -> Maybe Text
lockToken :: Prelude.Maybe Prelude.Text,
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:lockToken:GetIPSetResponse' :: Maybe Text
lockToken = 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_lockToken :: Lens.Lens' GetIPSetResponse (Prelude.Maybe Prelude.Text)
getIPSetResponse_lockToken :: Lens' GetIPSetResponse (Maybe Text)
getIPSetResponse_lockToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIPSetResponse' {Maybe Text
lockToken :: Maybe Text
$sel:lockToken:GetIPSetResponse' :: GetIPSetResponse -> Maybe Text
lockToken} -> Maybe Text
lockToken) (\s :: GetIPSetResponse
s@GetIPSetResponse' {} Maybe Text
a -> GetIPSetResponse
s {$sel:lockToken:GetIPSetResponse' :: Maybe Text
lockToken = Maybe Text
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 Text
Maybe IPSet
httpStatus :: Int
lockToken :: Maybe Text
iPSet :: Maybe IPSet
$sel:httpStatus:GetIPSetResponse' :: GetIPSetResponse -> Int
$sel:lockToken:GetIPSetResponse' :: GetIPSetResponse -> Maybe Text
$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 Maybe Text
lockToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus