{-# 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.GetManagedRuleSet
(
GetManagedRuleSet (..),
newGetManagedRuleSet,
getManagedRuleSet_name,
getManagedRuleSet_scope,
getManagedRuleSet_id,
GetManagedRuleSetResponse (..),
newGetManagedRuleSetResponse,
getManagedRuleSetResponse_lockToken,
getManagedRuleSetResponse_managedRuleSet,
getManagedRuleSetResponse_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 GetManagedRuleSet = GetManagedRuleSet'
{
GetManagedRuleSet -> Text
name :: Prelude.Text,
GetManagedRuleSet -> Scope
scope :: Scope,
GetManagedRuleSet -> Text
id :: Prelude.Text
}
deriving (GetManagedRuleSet -> GetManagedRuleSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetManagedRuleSet -> GetManagedRuleSet -> Bool
$c/= :: GetManagedRuleSet -> GetManagedRuleSet -> Bool
== :: GetManagedRuleSet -> GetManagedRuleSet -> Bool
$c== :: GetManagedRuleSet -> GetManagedRuleSet -> Bool
Prelude.Eq, ReadPrec [GetManagedRuleSet]
ReadPrec GetManagedRuleSet
Int -> ReadS GetManagedRuleSet
ReadS [GetManagedRuleSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetManagedRuleSet]
$creadListPrec :: ReadPrec [GetManagedRuleSet]
readPrec :: ReadPrec GetManagedRuleSet
$creadPrec :: ReadPrec GetManagedRuleSet
readList :: ReadS [GetManagedRuleSet]
$creadList :: ReadS [GetManagedRuleSet]
readsPrec :: Int -> ReadS GetManagedRuleSet
$creadsPrec :: Int -> ReadS GetManagedRuleSet
Prelude.Read, Int -> GetManagedRuleSet -> ShowS
[GetManagedRuleSet] -> ShowS
GetManagedRuleSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetManagedRuleSet] -> ShowS
$cshowList :: [GetManagedRuleSet] -> ShowS
show :: GetManagedRuleSet -> String
$cshow :: GetManagedRuleSet -> String
showsPrec :: Int -> GetManagedRuleSet -> ShowS
$cshowsPrec :: Int -> GetManagedRuleSet -> ShowS
Prelude.Show, forall x. Rep GetManagedRuleSet x -> GetManagedRuleSet
forall x. GetManagedRuleSet -> Rep GetManagedRuleSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetManagedRuleSet x -> GetManagedRuleSet
$cfrom :: forall x. GetManagedRuleSet -> Rep GetManagedRuleSet x
Prelude.Generic)
newGetManagedRuleSet ::
Prelude.Text ->
Scope ->
Prelude.Text ->
GetManagedRuleSet
newGetManagedRuleSet :: Text -> Scope -> Text -> GetManagedRuleSet
newGetManagedRuleSet Text
pName_ Scope
pScope_ Text
pId_ =
GetManagedRuleSet'
{ $sel:name:GetManagedRuleSet' :: Text
name = Text
pName_,
$sel:scope:GetManagedRuleSet' :: Scope
scope = Scope
pScope_,
$sel:id:GetManagedRuleSet' :: Text
id = Text
pId_
}
getManagedRuleSet_name :: Lens.Lens' GetManagedRuleSet Prelude.Text
getManagedRuleSet_name :: Lens' GetManagedRuleSet Text
getManagedRuleSet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetManagedRuleSet' {Text
name :: Text
$sel:name:GetManagedRuleSet' :: GetManagedRuleSet -> Text
name} -> Text
name) (\s :: GetManagedRuleSet
s@GetManagedRuleSet' {} Text
a -> GetManagedRuleSet
s {$sel:name:GetManagedRuleSet' :: Text
name = Text
a} :: GetManagedRuleSet)
getManagedRuleSet_scope :: Lens.Lens' GetManagedRuleSet Scope
getManagedRuleSet_scope :: Lens' GetManagedRuleSet Scope
getManagedRuleSet_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetManagedRuleSet' {Scope
scope :: Scope
$sel:scope:GetManagedRuleSet' :: GetManagedRuleSet -> Scope
scope} -> Scope
scope) (\s :: GetManagedRuleSet
s@GetManagedRuleSet' {} Scope
a -> GetManagedRuleSet
s {$sel:scope:GetManagedRuleSet' :: Scope
scope = Scope
a} :: GetManagedRuleSet)
getManagedRuleSet_id :: Lens.Lens' GetManagedRuleSet Prelude.Text
getManagedRuleSet_id :: Lens' GetManagedRuleSet Text
getManagedRuleSet_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetManagedRuleSet' {Text
id :: Text
$sel:id:GetManagedRuleSet' :: GetManagedRuleSet -> Text
id} -> Text
id) (\s :: GetManagedRuleSet
s@GetManagedRuleSet' {} Text
a -> GetManagedRuleSet
s {$sel:id:GetManagedRuleSet' :: Text
id = Text
a} :: GetManagedRuleSet)
instance Core.AWSRequest GetManagedRuleSet where
type
AWSResponse GetManagedRuleSet =
GetManagedRuleSetResponse
request :: (Service -> Service)
-> GetManagedRuleSet -> Request GetManagedRuleSet
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 GetManagedRuleSet
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetManagedRuleSet)))
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 Text
-> Maybe ManagedRuleSet -> Int -> GetManagedRuleSetResponse
GetManagedRuleSetResponse'
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
"LockToken")
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
"ManagedRuleSet")
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 GetManagedRuleSet where
hashWithSalt :: Int -> GetManagedRuleSet -> Int
hashWithSalt Int
_salt GetManagedRuleSet' {Text
Scope
id :: Text
scope :: Scope
name :: Text
$sel:id:GetManagedRuleSet' :: GetManagedRuleSet -> Text
$sel:scope:GetManagedRuleSet' :: GetManagedRuleSet -> Scope
$sel:name:GetManagedRuleSet' :: GetManagedRuleSet -> 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 GetManagedRuleSet where
rnf :: GetManagedRuleSet -> ()
rnf GetManagedRuleSet' {Text
Scope
id :: Text
scope :: Scope
name :: Text
$sel:id:GetManagedRuleSet' :: GetManagedRuleSet -> Text
$sel:scope:GetManagedRuleSet' :: GetManagedRuleSet -> Scope
$sel:name:GetManagedRuleSet' :: GetManagedRuleSet -> 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 GetManagedRuleSet where
toHeaders :: GetManagedRuleSet -> 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.GetManagedRuleSet" ::
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 GetManagedRuleSet where
toJSON :: GetManagedRuleSet -> Value
toJSON GetManagedRuleSet' {Text
Scope
id :: Text
scope :: Scope
name :: Text
$sel:id:GetManagedRuleSet' :: GetManagedRuleSet -> Text
$sel:scope:GetManagedRuleSet' :: GetManagedRuleSet -> Scope
$sel:name:GetManagedRuleSet' :: GetManagedRuleSet -> 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 GetManagedRuleSet where
toPath :: GetManagedRuleSet -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetManagedRuleSet where
toQuery :: GetManagedRuleSet -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetManagedRuleSetResponse = GetManagedRuleSetResponse'
{
GetManagedRuleSetResponse -> Maybe Text
lockToken :: Prelude.Maybe Prelude.Text,
GetManagedRuleSetResponse -> Maybe ManagedRuleSet
managedRuleSet :: Prelude.Maybe ManagedRuleSet,
GetManagedRuleSetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetManagedRuleSetResponse -> GetManagedRuleSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetManagedRuleSetResponse -> GetManagedRuleSetResponse -> Bool
$c/= :: GetManagedRuleSetResponse -> GetManagedRuleSetResponse -> Bool
== :: GetManagedRuleSetResponse -> GetManagedRuleSetResponse -> Bool
$c== :: GetManagedRuleSetResponse -> GetManagedRuleSetResponse -> Bool
Prelude.Eq, ReadPrec [GetManagedRuleSetResponse]
ReadPrec GetManagedRuleSetResponse
Int -> ReadS GetManagedRuleSetResponse
ReadS [GetManagedRuleSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetManagedRuleSetResponse]
$creadListPrec :: ReadPrec [GetManagedRuleSetResponse]
readPrec :: ReadPrec GetManagedRuleSetResponse
$creadPrec :: ReadPrec GetManagedRuleSetResponse
readList :: ReadS [GetManagedRuleSetResponse]
$creadList :: ReadS [GetManagedRuleSetResponse]
readsPrec :: Int -> ReadS GetManagedRuleSetResponse
$creadsPrec :: Int -> ReadS GetManagedRuleSetResponse
Prelude.Read, Int -> GetManagedRuleSetResponse -> ShowS
[GetManagedRuleSetResponse] -> ShowS
GetManagedRuleSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetManagedRuleSetResponse] -> ShowS
$cshowList :: [GetManagedRuleSetResponse] -> ShowS
show :: GetManagedRuleSetResponse -> String
$cshow :: GetManagedRuleSetResponse -> String
showsPrec :: Int -> GetManagedRuleSetResponse -> ShowS
$cshowsPrec :: Int -> GetManagedRuleSetResponse -> ShowS
Prelude.Show, forall x.
Rep GetManagedRuleSetResponse x -> GetManagedRuleSetResponse
forall x.
GetManagedRuleSetResponse -> Rep GetManagedRuleSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetManagedRuleSetResponse x -> GetManagedRuleSetResponse
$cfrom :: forall x.
GetManagedRuleSetResponse -> Rep GetManagedRuleSetResponse x
Prelude.Generic)
newGetManagedRuleSetResponse ::
Prelude.Int ->
GetManagedRuleSetResponse
newGetManagedRuleSetResponse :: Int -> GetManagedRuleSetResponse
newGetManagedRuleSetResponse Int
pHttpStatus_ =
GetManagedRuleSetResponse'
{ $sel:lockToken:GetManagedRuleSetResponse' :: Maybe Text
lockToken =
forall a. Maybe a
Prelude.Nothing,
$sel:managedRuleSet:GetManagedRuleSetResponse' :: Maybe ManagedRuleSet
managedRuleSet = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetManagedRuleSetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getManagedRuleSetResponse_lockToken :: Lens.Lens' GetManagedRuleSetResponse (Prelude.Maybe Prelude.Text)
getManagedRuleSetResponse_lockToken :: Lens' GetManagedRuleSetResponse (Maybe Text)
getManagedRuleSetResponse_lockToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetManagedRuleSetResponse' {Maybe Text
lockToken :: Maybe Text
$sel:lockToken:GetManagedRuleSetResponse' :: GetManagedRuleSetResponse -> Maybe Text
lockToken} -> Maybe Text
lockToken) (\s :: GetManagedRuleSetResponse
s@GetManagedRuleSetResponse' {} Maybe Text
a -> GetManagedRuleSetResponse
s {$sel:lockToken:GetManagedRuleSetResponse' :: Maybe Text
lockToken = Maybe Text
a} :: GetManagedRuleSetResponse)
getManagedRuleSetResponse_managedRuleSet :: Lens.Lens' GetManagedRuleSetResponse (Prelude.Maybe ManagedRuleSet)
getManagedRuleSetResponse_managedRuleSet :: Lens' GetManagedRuleSetResponse (Maybe ManagedRuleSet)
getManagedRuleSetResponse_managedRuleSet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetManagedRuleSetResponse' {Maybe ManagedRuleSet
managedRuleSet :: Maybe ManagedRuleSet
$sel:managedRuleSet:GetManagedRuleSetResponse' :: GetManagedRuleSetResponse -> Maybe ManagedRuleSet
managedRuleSet} -> Maybe ManagedRuleSet
managedRuleSet) (\s :: GetManagedRuleSetResponse
s@GetManagedRuleSetResponse' {} Maybe ManagedRuleSet
a -> GetManagedRuleSetResponse
s {$sel:managedRuleSet:GetManagedRuleSetResponse' :: Maybe ManagedRuleSet
managedRuleSet = Maybe ManagedRuleSet
a} :: GetManagedRuleSetResponse)
getManagedRuleSetResponse_httpStatus :: Lens.Lens' GetManagedRuleSetResponse Prelude.Int
getManagedRuleSetResponse_httpStatus :: Lens' GetManagedRuleSetResponse Int
getManagedRuleSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetManagedRuleSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetManagedRuleSetResponse' :: GetManagedRuleSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetManagedRuleSetResponse
s@GetManagedRuleSetResponse' {} Int
a -> GetManagedRuleSetResponse
s {$sel:httpStatus:GetManagedRuleSetResponse' :: Int
httpStatus = Int
a} :: GetManagedRuleSetResponse)
instance Prelude.NFData GetManagedRuleSetResponse where
rnf :: GetManagedRuleSetResponse -> ()
rnf GetManagedRuleSetResponse' {Int
Maybe Text
Maybe ManagedRuleSet
httpStatus :: Int
managedRuleSet :: Maybe ManagedRuleSet
lockToken :: Maybe Text
$sel:httpStatus:GetManagedRuleSetResponse' :: GetManagedRuleSetResponse -> Int
$sel:managedRuleSet:GetManagedRuleSetResponse' :: GetManagedRuleSetResponse -> Maybe ManagedRuleSet
$sel:lockToken:GetManagedRuleSetResponse' :: GetManagedRuleSetResponse -> Maybe Text
..} =
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 Maybe ManagedRuleSet
managedRuleSet
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus