{-# 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.GetWebACLForResource
(
GetWebACLForResource (..),
newGetWebACLForResource,
getWebACLForResource_resourceArn,
GetWebACLForResourceResponse (..),
newGetWebACLForResourceResponse,
getWebACLForResourceResponse_webACLSummary,
getWebACLForResourceResponse_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 GetWebACLForResource = GetWebACLForResource'
{
GetWebACLForResource -> Text
resourceArn :: Prelude.Text
}
deriving (GetWebACLForResource -> GetWebACLForResource -> Bool
(GetWebACLForResource -> GetWebACLForResource -> Bool)
-> (GetWebACLForResource -> GetWebACLForResource -> Bool)
-> Eq GetWebACLForResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWebACLForResource -> GetWebACLForResource -> Bool
$c/= :: GetWebACLForResource -> GetWebACLForResource -> Bool
== :: GetWebACLForResource -> GetWebACLForResource -> Bool
$c== :: GetWebACLForResource -> GetWebACLForResource -> Bool
Prelude.Eq, ReadPrec [GetWebACLForResource]
ReadPrec GetWebACLForResource
Int -> ReadS GetWebACLForResource
ReadS [GetWebACLForResource]
(Int -> ReadS GetWebACLForResource)
-> ReadS [GetWebACLForResource]
-> ReadPrec GetWebACLForResource
-> ReadPrec [GetWebACLForResource]
-> Read GetWebACLForResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWebACLForResource]
$creadListPrec :: ReadPrec [GetWebACLForResource]
readPrec :: ReadPrec GetWebACLForResource
$creadPrec :: ReadPrec GetWebACLForResource
readList :: ReadS [GetWebACLForResource]
$creadList :: ReadS [GetWebACLForResource]
readsPrec :: Int -> ReadS GetWebACLForResource
$creadsPrec :: Int -> ReadS GetWebACLForResource
Prelude.Read, Int -> GetWebACLForResource -> ShowS
[GetWebACLForResource] -> ShowS
GetWebACLForResource -> String
(Int -> GetWebACLForResource -> ShowS)
-> (GetWebACLForResource -> String)
-> ([GetWebACLForResource] -> ShowS)
-> Show GetWebACLForResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWebACLForResource] -> ShowS
$cshowList :: [GetWebACLForResource] -> ShowS
show :: GetWebACLForResource -> String
$cshow :: GetWebACLForResource -> String
showsPrec :: Int -> GetWebACLForResource -> ShowS
$cshowsPrec :: Int -> GetWebACLForResource -> ShowS
Prelude.Show, (forall x. GetWebACLForResource -> Rep GetWebACLForResource x)
-> (forall x. Rep GetWebACLForResource x -> GetWebACLForResource)
-> Generic GetWebACLForResource
forall x. Rep GetWebACLForResource x -> GetWebACLForResource
forall x. GetWebACLForResource -> Rep GetWebACLForResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetWebACLForResource x -> GetWebACLForResource
$cfrom :: forall x. GetWebACLForResource -> Rep GetWebACLForResource x
Prelude.Generic)
newGetWebACLForResource ::
Prelude.Text ->
GetWebACLForResource
newGetWebACLForResource :: Text -> GetWebACLForResource
newGetWebACLForResource Text
pResourceArn_ =
GetWebACLForResource' :: Text -> GetWebACLForResource
GetWebACLForResource' {$sel:resourceArn:GetWebACLForResource' :: Text
resourceArn = Text
pResourceArn_}
getWebACLForResource_resourceArn :: Lens.Lens' GetWebACLForResource Prelude.Text
getWebACLForResource_resourceArn :: (Text -> f Text) -> GetWebACLForResource -> f GetWebACLForResource
getWebACLForResource_resourceArn = (GetWebACLForResource -> Text)
-> (GetWebACLForResource -> Text -> GetWebACLForResource)
-> Lens GetWebACLForResource GetWebACLForResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWebACLForResource' {Text
resourceArn :: Text
$sel:resourceArn:GetWebACLForResource' :: GetWebACLForResource -> Text
resourceArn} -> Text
resourceArn) (\s :: GetWebACLForResource
s@GetWebACLForResource' {} Text
a -> GetWebACLForResource
s {$sel:resourceArn:GetWebACLForResource' :: Text
resourceArn = Text
a} :: GetWebACLForResource)
instance Core.AWSRequest GetWebACLForResource where
type
AWSResponse GetWebACLForResource =
GetWebACLForResourceResponse
request :: GetWebACLForResource -> Request GetWebACLForResource
request = Service -> GetWebACLForResource -> Request GetWebACLForResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetWebACLForResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetWebACLForResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetWebACLForResource))
-> Logger
-> Service
-> Proxy GetWebACLForResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetWebACLForResource)))
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 WebACLSummary -> Int -> GetWebACLForResourceResponse
GetWebACLForResourceResponse'
(Maybe WebACLSummary -> Int -> GetWebACLForResourceResponse)
-> Either String (Maybe WebACLSummary)
-> Either String (Int -> GetWebACLForResourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe WebACLSummary)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"WebACLSummary")
Either String (Int -> GetWebACLForResourceResponse)
-> Either String Int -> Either String GetWebACLForResourceResponse
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 GetWebACLForResource
instance Prelude.NFData GetWebACLForResource
instance Core.ToHeaders GetWebACLForResource where
toHeaders :: GetWebACLForResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetWebACLForResource -> 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.GetWebACLForResource" ::
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 GetWebACLForResource where
toJSON :: GetWebACLForResource -> Value
toJSON GetWebACLForResource' {Text
resourceArn :: Text
$sel:resourceArn:GetWebACLForResource' :: GetWebACLForResource -> 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
"ResourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn)]
)
instance Core.ToPath GetWebACLForResource where
toPath :: GetWebACLForResource -> ByteString
toPath = ByteString -> GetWebACLForResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetWebACLForResource where
toQuery :: GetWebACLForResource -> QueryString
toQuery = QueryString -> GetWebACLForResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetWebACLForResourceResponse = GetWebACLForResourceResponse'
{
GetWebACLForResourceResponse -> Maybe WebACLSummary
webACLSummary :: Prelude.Maybe WebACLSummary,
GetWebACLForResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool
(GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool)
-> (GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool)
-> Eq GetWebACLForResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool
$c/= :: GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool
== :: GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool
$c== :: GetWebACLForResourceResponse
-> GetWebACLForResourceResponse -> Bool
Prelude.Eq, ReadPrec [GetWebACLForResourceResponse]
ReadPrec GetWebACLForResourceResponse
Int -> ReadS GetWebACLForResourceResponse
ReadS [GetWebACLForResourceResponse]
(Int -> ReadS GetWebACLForResourceResponse)
-> ReadS [GetWebACLForResourceResponse]
-> ReadPrec GetWebACLForResourceResponse
-> ReadPrec [GetWebACLForResourceResponse]
-> Read GetWebACLForResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWebACLForResourceResponse]
$creadListPrec :: ReadPrec [GetWebACLForResourceResponse]
readPrec :: ReadPrec GetWebACLForResourceResponse
$creadPrec :: ReadPrec GetWebACLForResourceResponse
readList :: ReadS [GetWebACLForResourceResponse]
$creadList :: ReadS [GetWebACLForResourceResponse]
readsPrec :: Int -> ReadS GetWebACLForResourceResponse
$creadsPrec :: Int -> ReadS GetWebACLForResourceResponse
Prelude.Read, Int -> GetWebACLForResourceResponse -> ShowS
[GetWebACLForResourceResponse] -> ShowS
GetWebACLForResourceResponse -> String
(Int -> GetWebACLForResourceResponse -> ShowS)
-> (GetWebACLForResourceResponse -> String)
-> ([GetWebACLForResourceResponse] -> ShowS)
-> Show GetWebACLForResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWebACLForResourceResponse] -> ShowS
$cshowList :: [GetWebACLForResourceResponse] -> ShowS
show :: GetWebACLForResourceResponse -> String
$cshow :: GetWebACLForResourceResponse -> String
showsPrec :: Int -> GetWebACLForResourceResponse -> ShowS
$cshowsPrec :: Int -> GetWebACLForResourceResponse -> ShowS
Prelude.Show, (forall x.
GetWebACLForResourceResponse -> Rep GetWebACLForResourceResponse x)
-> (forall x.
Rep GetWebACLForResourceResponse x -> GetWebACLForResourceResponse)
-> Generic GetWebACLForResourceResponse
forall x.
Rep GetWebACLForResourceResponse x -> GetWebACLForResourceResponse
forall x.
GetWebACLForResourceResponse -> Rep GetWebACLForResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetWebACLForResourceResponse x -> GetWebACLForResourceResponse
$cfrom :: forall x.
GetWebACLForResourceResponse -> Rep GetWebACLForResourceResponse x
Prelude.Generic)
newGetWebACLForResourceResponse ::
Prelude.Int ->
GetWebACLForResourceResponse
newGetWebACLForResourceResponse :: Int -> GetWebACLForResourceResponse
newGetWebACLForResourceResponse Int
pHttpStatus_ =
GetWebACLForResourceResponse' :: Maybe WebACLSummary -> Int -> GetWebACLForResourceResponse
GetWebACLForResourceResponse'
{ $sel:webACLSummary:GetWebACLForResourceResponse' :: Maybe WebACLSummary
webACLSummary =
Maybe WebACLSummary
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetWebACLForResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getWebACLForResourceResponse_webACLSummary :: Lens.Lens' GetWebACLForResourceResponse (Prelude.Maybe WebACLSummary)
getWebACLForResourceResponse_webACLSummary :: (Maybe WebACLSummary -> f (Maybe WebACLSummary))
-> GetWebACLForResourceResponse -> f GetWebACLForResourceResponse
getWebACLForResourceResponse_webACLSummary = (GetWebACLForResourceResponse -> Maybe WebACLSummary)
-> (GetWebACLForResourceResponse
-> Maybe WebACLSummary -> GetWebACLForResourceResponse)
-> Lens
GetWebACLForResourceResponse
GetWebACLForResourceResponse
(Maybe WebACLSummary)
(Maybe WebACLSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWebACLForResourceResponse' {Maybe WebACLSummary
webACLSummary :: Maybe WebACLSummary
$sel:webACLSummary:GetWebACLForResourceResponse' :: GetWebACLForResourceResponse -> Maybe WebACLSummary
webACLSummary} -> Maybe WebACLSummary
webACLSummary) (\s :: GetWebACLForResourceResponse
s@GetWebACLForResourceResponse' {} Maybe WebACLSummary
a -> GetWebACLForResourceResponse
s {$sel:webACLSummary:GetWebACLForResourceResponse' :: Maybe WebACLSummary
webACLSummary = Maybe WebACLSummary
a} :: GetWebACLForResourceResponse)
getWebACLForResourceResponse_httpStatus :: Lens.Lens' GetWebACLForResourceResponse Prelude.Int
getWebACLForResourceResponse_httpStatus :: (Int -> f Int)
-> GetWebACLForResourceResponse -> f GetWebACLForResourceResponse
getWebACLForResourceResponse_httpStatus = (GetWebACLForResourceResponse -> Int)
-> (GetWebACLForResourceResponse
-> Int -> GetWebACLForResourceResponse)
-> Lens
GetWebACLForResourceResponse GetWebACLForResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWebACLForResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetWebACLForResourceResponse' :: GetWebACLForResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetWebACLForResourceResponse
s@GetWebACLForResourceResponse' {} Int
a -> GetWebACLForResourceResponse
s {$sel:httpStatus:GetWebACLForResourceResponse' :: Int
httpStatus = Int
a} :: GetWebACLForResourceResponse)
instance Prelude.NFData GetWebACLForResourceResponse