{-# 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.WAFRegional.GetRuleGroup
(
GetRuleGroup (..),
newGetRuleGroup,
getRuleGroup_ruleGroupId,
GetRuleGroupResponse (..),
newGetRuleGroupResponse,
getRuleGroupResponse_ruleGroup,
getRuleGroupResponse_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.WAFRegional.Types
data GetRuleGroup = GetRuleGroup'
{
GetRuleGroup -> Text
ruleGroupId :: Prelude.Text
}
deriving (GetRuleGroup -> GetRuleGroup -> Bool
(GetRuleGroup -> GetRuleGroup -> Bool)
-> (GetRuleGroup -> GetRuleGroup -> Bool) -> Eq GetRuleGroup
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]
(Int -> ReadS GetRuleGroup)
-> ReadS [GetRuleGroup]
-> ReadPrec GetRuleGroup
-> ReadPrec [GetRuleGroup]
-> Read 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
(Int -> GetRuleGroup -> ShowS)
-> (GetRuleGroup -> String)
-> ([GetRuleGroup] -> ShowS)
-> Show GetRuleGroup
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. GetRuleGroup -> Rep GetRuleGroup x)
-> (forall x. Rep GetRuleGroup x -> GetRuleGroup)
-> Generic GetRuleGroup
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' :: Text -> GetRuleGroup
GetRuleGroup' {$sel:ruleGroupId:GetRuleGroup' :: Text
ruleGroupId = Text
pRuleGroupId_}
getRuleGroup_ruleGroupId :: Lens.Lens' GetRuleGroup Prelude.Text
getRuleGroup_ruleGroupId :: (Text -> f Text) -> GetRuleGroup -> f GetRuleGroup
getRuleGroup_ruleGroupId = (GetRuleGroup -> Text)
-> (GetRuleGroup -> Text -> GetRuleGroup)
-> Lens GetRuleGroup GetRuleGroup Text Text
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 :: GetRuleGroup -> Request GetRuleGroup
request = Service -> GetRuleGroup -> Request GetRuleGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetRuleGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRuleGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRuleGroup))
-> Logger
-> Service
-> Proxy GetRuleGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRuleGroup)))
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 RuleGroup -> Int -> GetRuleGroupResponse
GetRuleGroupResponse'
(Maybe RuleGroup -> Int -> GetRuleGroupResponse)
-> Either String (Maybe RuleGroup)
-> Either String (Int -> GetRuleGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RuleGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RuleGroup")
Either String (Int -> GetRuleGroupResponse)
-> Either String Int -> Either String GetRuleGroupResponse
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 GetRuleGroup
instance Prelude.NFData GetRuleGroup
instance Core.ToHeaders GetRuleGroup where
toHeaders :: GetRuleGroup -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRuleGroup -> 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_Regional_20161128.GetRuleGroup" ::
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 GetRuleGroup where
toJSON :: GetRuleGroup -> Value
toJSON GetRuleGroup' {Text
ruleGroupId :: Text
$sel:ruleGroupId:GetRuleGroup' :: GetRuleGroup -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RuleGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleGroupId)]
)
instance Core.ToPath GetRuleGroup where
toPath :: GetRuleGroup -> ByteString
toPath = ByteString -> GetRuleGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetRuleGroup where
toQuery :: GetRuleGroup -> QueryString
toQuery = QueryString -> GetRuleGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetRuleGroupResponse -> GetRuleGroupResponse -> Bool)
-> (GetRuleGroupResponse -> GetRuleGroupResponse -> Bool)
-> Eq GetRuleGroupResponse
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]
(Int -> ReadS GetRuleGroupResponse)
-> ReadS [GetRuleGroupResponse]
-> ReadPrec GetRuleGroupResponse
-> ReadPrec [GetRuleGroupResponse]
-> Read 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
(Int -> GetRuleGroupResponse -> ShowS)
-> (GetRuleGroupResponse -> String)
-> ([GetRuleGroupResponse] -> ShowS)
-> Show GetRuleGroupResponse
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. GetRuleGroupResponse -> Rep GetRuleGroupResponse x)
-> (forall x. Rep GetRuleGroupResponse x -> GetRuleGroupResponse)
-> Generic GetRuleGroupResponse
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' :: Maybe RuleGroup -> Int -> GetRuleGroupResponse
GetRuleGroupResponse'
{ $sel:ruleGroup:GetRuleGroupResponse' :: Maybe RuleGroup
ruleGroup = Maybe RuleGroup
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getRuleGroupResponse_ruleGroup :: Lens.Lens' GetRuleGroupResponse (Prelude.Maybe RuleGroup)
getRuleGroupResponse_ruleGroup :: (Maybe RuleGroup -> f (Maybe RuleGroup))
-> GetRuleGroupResponse -> f GetRuleGroupResponse
getRuleGroupResponse_ruleGroup = (GetRuleGroupResponse -> Maybe RuleGroup)
-> (GetRuleGroupResponse
-> Maybe RuleGroup -> GetRuleGroupResponse)
-> Lens
GetRuleGroupResponse
GetRuleGroupResponse
(Maybe RuleGroup)
(Maybe 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 :: (Int -> f Int) -> GetRuleGroupResponse -> f GetRuleGroupResponse
getRuleGroupResponse_httpStatus = (GetRuleGroupResponse -> Int)
-> (GetRuleGroupResponse -> Int -> GetRuleGroupResponse)
-> Lens GetRuleGroupResponse GetRuleGroupResponse Int Int
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