{-# 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.GetRuleGroup
(
GetRuleGroup (..),
newGetRuleGroup,
getRuleGroup_ruleGroupId,
GetRuleGroupResponse (..),
newGetRuleGroupResponse,
getRuleGroupResponse_ruleGroup,
getRuleGroupResponse_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 GetRuleGroup = GetRuleGroup'
{
GetRuleGroup -> Text
ruleGroupId :: Prelude.Text
}
deriving (GetRuleGroup -> GetRuleGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRuleGroup -> GetRuleGroup -> Bool
$c/= :: GetRuleGroup -> GetRuleGroup -> Bool
== :: GetRuleGroup -> GetRuleGroup -> Bool
$c== :: GetRuleGroup -> GetRuleGroup -> Bool
Prelude.Eq, ReadPrec [GetRuleGroup]
ReadPrec GetRuleGroup
Int -> ReadS GetRuleGroup
ReadS [GetRuleGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRuleGroup]
$creadListPrec :: ReadPrec [GetRuleGroup]
readPrec :: ReadPrec GetRuleGroup
$creadPrec :: ReadPrec GetRuleGroup
readList :: ReadS [GetRuleGroup]
$creadList :: ReadS [GetRuleGroup]
readsPrec :: Int -> ReadS GetRuleGroup
$creadsPrec :: Int -> ReadS GetRuleGroup
Prelude.Read, Int -> GetRuleGroup -> ShowS
[GetRuleGroup] -> ShowS
GetRuleGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRuleGroup] -> ShowS
$cshowList :: [GetRuleGroup] -> ShowS
show :: GetRuleGroup -> String
$cshow :: GetRuleGroup -> String
showsPrec :: Int -> GetRuleGroup -> ShowS
$cshowsPrec :: Int -> GetRuleGroup -> ShowS
Prelude.Show, forall x. Rep GetRuleGroup x -> GetRuleGroup
forall x. GetRuleGroup -> Rep GetRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRuleGroup x -> GetRuleGroup
$cfrom :: forall x. GetRuleGroup -> Rep GetRuleGroup x
Prelude.Generic)
newGetRuleGroup ::
Prelude.Text ->
GetRuleGroup
newGetRuleGroup :: Text -> GetRuleGroup
newGetRuleGroup Text
pRuleGroupId_ =
GetRuleGroup' {$sel:ruleGroupId:GetRuleGroup' :: Text
ruleGroupId = Text
pRuleGroupId_}
getRuleGroup_ruleGroupId :: Lens.Lens' GetRuleGroup Prelude.Text
getRuleGroup_ruleGroupId :: Lens' GetRuleGroup Text
getRuleGroup_ruleGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRuleGroup' {Text
ruleGroupId :: Text
$sel:ruleGroupId:GetRuleGroup' :: GetRuleGroup -> Text
ruleGroupId} -> Text
ruleGroupId) (\s :: GetRuleGroup
s@GetRuleGroup' {} Text
a -> GetRuleGroup
s {$sel:ruleGroupId:GetRuleGroup' :: Text
ruleGroupId = Text
a} :: GetRuleGroup)
instance Core.AWSRequest GetRuleGroup where
type AWSResponse GetRuleGroup = GetRuleGroupResponse
request :: (Service -> Service) -> GetRuleGroup -> Request GetRuleGroup
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 GetRuleGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRuleGroup)))
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 RuleGroup -> Int -> GetRuleGroupResponse
GetRuleGroupResponse'
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
"RuleGroup")
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 GetRuleGroup where
hashWithSalt :: Int -> GetRuleGroup -> Int
hashWithSalt Int
_salt GetRuleGroup' {Text
ruleGroupId :: Text
$sel:ruleGroupId:GetRuleGroup' :: GetRuleGroup -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleGroupId
instance Prelude.NFData GetRuleGroup where
rnf :: GetRuleGroup -> ()
rnf GetRuleGroup' {Text
ruleGroupId :: Text
$sel:ruleGroupId:GetRuleGroup' :: GetRuleGroup -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
ruleGroupId
instance Data.ToHeaders GetRuleGroup where
toHeaders :: GetRuleGroup -> 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.GetRuleGroup" ::
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 GetRuleGroup where
toJSON :: GetRuleGroup -> Value
toJSON GetRuleGroup' {Text
ruleGroupId :: Text
$sel:ruleGroupId:GetRuleGroup' :: GetRuleGroup -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"RuleGroupId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
ruleGroupId)]
)
instance Data.ToPath GetRuleGroup where
toPath :: GetRuleGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetRuleGroup where
toQuery :: GetRuleGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetRuleGroupResponse = GetRuleGroupResponse'
{
GetRuleGroupResponse -> Maybe RuleGroup
ruleGroup :: Prelude.Maybe RuleGroup,
GetRuleGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetRuleGroupResponse -> GetRuleGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRuleGroupResponse -> GetRuleGroupResponse -> Bool
$c/= :: GetRuleGroupResponse -> GetRuleGroupResponse -> Bool
== :: GetRuleGroupResponse -> GetRuleGroupResponse -> Bool
$c== :: GetRuleGroupResponse -> GetRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [GetRuleGroupResponse]
ReadPrec GetRuleGroupResponse
Int -> ReadS GetRuleGroupResponse
ReadS [GetRuleGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRuleGroupResponse]
$creadListPrec :: ReadPrec [GetRuleGroupResponse]
readPrec :: ReadPrec GetRuleGroupResponse
$creadPrec :: ReadPrec GetRuleGroupResponse
readList :: ReadS [GetRuleGroupResponse]
$creadList :: ReadS [GetRuleGroupResponse]
readsPrec :: Int -> ReadS GetRuleGroupResponse
$creadsPrec :: Int -> ReadS GetRuleGroupResponse
Prelude.Read, Int -> GetRuleGroupResponse -> ShowS
[GetRuleGroupResponse] -> ShowS
GetRuleGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRuleGroupResponse] -> ShowS
$cshowList :: [GetRuleGroupResponse] -> ShowS
show :: GetRuleGroupResponse -> String
$cshow :: GetRuleGroupResponse -> String
showsPrec :: Int -> GetRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> GetRuleGroupResponse -> ShowS
Prelude.Show, forall x. Rep GetRuleGroupResponse x -> GetRuleGroupResponse
forall x. GetRuleGroupResponse -> Rep GetRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRuleGroupResponse x -> GetRuleGroupResponse
$cfrom :: forall x. GetRuleGroupResponse -> Rep GetRuleGroupResponse x
Prelude.Generic)
newGetRuleGroupResponse ::
Prelude.Int ->
GetRuleGroupResponse
newGetRuleGroupResponse :: Int -> GetRuleGroupResponse
newGetRuleGroupResponse Int
pHttpStatus_ =
GetRuleGroupResponse'
{ $sel:ruleGroup:GetRuleGroupResponse' :: Maybe RuleGroup
ruleGroup = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRuleGroupResponse_ruleGroup :: Lens.Lens' GetRuleGroupResponse (Prelude.Maybe RuleGroup)
getRuleGroupResponse_ruleGroup :: Lens' GetRuleGroupResponse (Maybe RuleGroup)
getRuleGroupResponse_ruleGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRuleGroupResponse' {Maybe RuleGroup
ruleGroup :: Maybe RuleGroup
$sel:ruleGroup:GetRuleGroupResponse' :: GetRuleGroupResponse -> Maybe RuleGroup
ruleGroup} -> Maybe RuleGroup
ruleGroup) (\s :: GetRuleGroupResponse
s@GetRuleGroupResponse' {} Maybe RuleGroup
a -> GetRuleGroupResponse
s {$sel:ruleGroup:GetRuleGroupResponse' :: Maybe RuleGroup
ruleGroup = Maybe RuleGroup
a} :: GetRuleGroupResponse)
getRuleGroupResponse_httpStatus :: Lens.Lens' GetRuleGroupResponse Prelude.Int
getRuleGroupResponse_httpStatus :: Lens' GetRuleGroupResponse Int
getRuleGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRuleGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRuleGroupResponse' :: GetRuleGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRuleGroupResponse
s@GetRuleGroupResponse' {} Int
a -> GetRuleGroupResponse
s {$sel:httpStatus:GetRuleGroupResponse' :: Int
httpStatus = Int
a} :: GetRuleGroupResponse)
instance Prelude.NFData GetRuleGroupResponse where
rnf :: GetRuleGroupResponse -> ()
rnf GetRuleGroupResponse' {Int
Maybe RuleGroup
httpStatus :: Int
ruleGroup :: Maybe RuleGroup
$sel:httpStatus:GetRuleGroupResponse' :: GetRuleGroupResponse -> Int
$sel:ruleGroup:GetRuleGroupResponse' :: GetRuleGroupResponse -> Maybe RuleGroup
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe RuleGroup
ruleGroup
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus