{-# 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.ListResourcesForWebACL
(
ListResourcesForWebACL (..),
newListResourcesForWebACL,
listResourcesForWebACL_resourceType,
listResourcesForWebACL_webACLId,
ListResourcesForWebACLResponse (..),
newListResourcesForWebACLResponse,
listResourcesForWebACLResponse_resourceArns,
listResourcesForWebACLResponse_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 ListResourcesForWebACL = ListResourcesForWebACL'
{
ListResourcesForWebACL -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
ListResourcesForWebACL -> Text
webACLId :: Prelude.Text
}
deriving (ListResourcesForWebACL -> ListResourcesForWebACL -> Bool
(ListResourcesForWebACL -> ListResourcesForWebACL -> Bool)
-> (ListResourcesForWebACL -> ListResourcesForWebACL -> Bool)
-> Eq ListResourcesForWebACL
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesForWebACL -> ListResourcesForWebACL -> Bool
$c/= :: ListResourcesForWebACL -> ListResourcesForWebACL -> Bool
== :: ListResourcesForWebACL -> ListResourcesForWebACL -> Bool
$c== :: ListResourcesForWebACL -> ListResourcesForWebACL -> Bool
Prelude.Eq, ReadPrec [ListResourcesForWebACL]
ReadPrec ListResourcesForWebACL
Int -> ReadS ListResourcesForWebACL
ReadS [ListResourcesForWebACL]
(Int -> ReadS ListResourcesForWebACL)
-> ReadS [ListResourcesForWebACL]
-> ReadPrec ListResourcesForWebACL
-> ReadPrec [ListResourcesForWebACL]
-> Read ListResourcesForWebACL
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesForWebACL]
$creadListPrec :: ReadPrec [ListResourcesForWebACL]
readPrec :: ReadPrec ListResourcesForWebACL
$creadPrec :: ReadPrec ListResourcesForWebACL
readList :: ReadS [ListResourcesForWebACL]
$creadList :: ReadS [ListResourcesForWebACL]
readsPrec :: Int -> ReadS ListResourcesForWebACL
$creadsPrec :: Int -> ReadS ListResourcesForWebACL
Prelude.Read, Int -> ListResourcesForWebACL -> ShowS
[ListResourcesForWebACL] -> ShowS
ListResourcesForWebACL -> String
(Int -> ListResourcesForWebACL -> ShowS)
-> (ListResourcesForWebACL -> String)
-> ([ListResourcesForWebACL] -> ShowS)
-> Show ListResourcesForWebACL
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesForWebACL] -> ShowS
$cshowList :: [ListResourcesForWebACL] -> ShowS
show :: ListResourcesForWebACL -> String
$cshow :: ListResourcesForWebACL -> String
showsPrec :: Int -> ListResourcesForWebACL -> ShowS
$cshowsPrec :: Int -> ListResourcesForWebACL -> ShowS
Prelude.Show, (forall x. ListResourcesForWebACL -> Rep ListResourcesForWebACL x)
-> (forall x.
Rep ListResourcesForWebACL x -> ListResourcesForWebACL)
-> Generic ListResourcesForWebACL
forall x. Rep ListResourcesForWebACL x -> ListResourcesForWebACL
forall x. ListResourcesForWebACL -> Rep ListResourcesForWebACL x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResourcesForWebACL x -> ListResourcesForWebACL
$cfrom :: forall x. ListResourcesForWebACL -> Rep ListResourcesForWebACL x
Prelude.Generic)
newListResourcesForWebACL ::
Prelude.Text ->
ListResourcesForWebACL
newListResourcesForWebACL :: Text -> ListResourcesForWebACL
newListResourcesForWebACL Text
pWebACLId_ =
ListResourcesForWebACL' :: Maybe ResourceType -> Text -> ListResourcesForWebACL
ListResourcesForWebACL'
{ $sel:resourceType:ListResourcesForWebACL' :: Maybe ResourceType
resourceType =
Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
$sel:webACLId:ListResourcesForWebACL' :: Text
webACLId = Text
pWebACLId_
}
listResourcesForWebACL_resourceType :: Lens.Lens' ListResourcesForWebACL (Prelude.Maybe ResourceType)
listResourcesForWebACL_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> ListResourcesForWebACL -> f ListResourcesForWebACL
listResourcesForWebACL_resourceType = (ListResourcesForWebACL -> Maybe ResourceType)
-> (ListResourcesForWebACL
-> Maybe ResourceType -> ListResourcesForWebACL)
-> Lens
ListResourcesForWebACL
ListResourcesForWebACL
(Maybe ResourceType)
(Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForWebACL' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:ListResourcesForWebACL' :: ListResourcesForWebACL -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: ListResourcesForWebACL
s@ListResourcesForWebACL' {} Maybe ResourceType
a -> ListResourcesForWebACL
s {$sel:resourceType:ListResourcesForWebACL' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: ListResourcesForWebACL)
listResourcesForWebACL_webACLId :: Lens.Lens' ListResourcesForWebACL Prelude.Text
listResourcesForWebACL_webACLId :: (Text -> f Text)
-> ListResourcesForWebACL -> f ListResourcesForWebACL
listResourcesForWebACL_webACLId = (ListResourcesForWebACL -> Text)
-> (ListResourcesForWebACL -> Text -> ListResourcesForWebACL)
-> Lens ListResourcesForWebACL ListResourcesForWebACL Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForWebACL' {Text
webACLId :: Text
$sel:webACLId:ListResourcesForWebACL' :: ListResourcesForWebACL -> Text
webACLId} -> Text
webACLId) (\s :: ListResourcesForWebACL
s@ListResourcesForWebACL' {} Text
a -> ListResourcesForWebACL
s {$sel:webACLId:ListResourcesForWebACL' :: Text
webACLId = Text
a} :: ListResourcesForWebACL)
instance Core.AWSRequest ListResourcesForWebACL where
type
AWSResponse ListResourcesForWebACL =
ListResourcesForWebACLResponse
request :: ListResourcesForWebACL -> Request ListResourcesForWebACL
request = Service -> ListResourcesForWebACL -> Request ListResourcesForWebACL
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListResourcesForWebACL
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListResourcesForWebACL)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListResourcesForWebACL))
-> Logger
-> Service
-> Proxy ListResourcesForWebACL
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListResourcesForWebACL)))
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 [Text] -> Int -> ListResourcesForWebACLResponse
ListResourcesForWebACLResponse'
(Maybe [Text] -> Int -> ListResourcesForWebACLResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> ListResourcesForWebACLResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceArns" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListResourcesForWebACLResponse)
-> Either String Int
-> Either String ListResourcesForWebACLResponse
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 ListResourcesForWebACL
instance Prelude.NFData ListResourcesForWebACL
instance Core.ToHeaders ListResourcesForWebACL where
toHeaders :: ListResourcesForWebACL -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListResourcesForWebACL -> 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.ListResourcesForWebACL" ::
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 ListResourcesForWebACL where
toJSON :: ListResourcesForWebACL -> Value
toJSON ListResourcesForWebACL' {Maybe ResourceType
Text
webACLId :: Text
resourceType :: Maybe ResourceType
$sel:webACLId:ListResourcesForWebACL' :: ListResourcesForWebACL -> Text
$sel:resourceType:ListResourcesForWebACL' :: ListResourcesForWebACL -> Maybe ResourceType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ResourceType" Text -> ResourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ResourceType -> Pair) -> Maybe ResourceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceType
resourceType,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WebACLId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
webACLId)
]
)
instance Core.ToPath ListResourcesForWebACL where
toPath :: ListResourcesForWebACL -> ByteString
toPath = ByteString -> ListResourcesForWebACL -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListResourcesForWebACL where
toQuery :: ListResourcesForWebACL -> QueryString
toQuery = QueryString -> ListResourcesForWebACL -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListResourcesForWebACLResponse = ListResourcesForWebACLResponse'
{
ListResourcesForWebACLResponse -> Maybe [Text]
resourceArns :: Prelude.Maybe [Prelude.Text],
ListResourcesForWebACLResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool
(ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool)
-> (ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool)
-> Eq ListResourcesForWebACLResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool
$c/= :: ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool
== :: ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool
$c== :: ListResourcesForWebACLResponse
-> ListResourcesForWebACLResponse -> Bool
Prelude.Eq, ReadPrec [ListResourcesForWebACLResponse]
ReadPrec ListResourcesForWebACLResponse
Int -> ReadS ListResourcesForWebACLResponse
ReadS [ListResourcesForWebACLResponse]
(Int -> ReadS ListResourcesForWebACLResponse)
-> ReadS [ListResourcesForWebACLResponse]
-> ReadPrec ListResourcesForWebACLResponse
-> ReadPrec [ListResourcesForWebACLResponse]
-> Read ListResourcesForWebACLResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesForWebACLResponse]
$creadListPrec :: ReadPrec [ListResourcesForWebACLResponse]
readPrec :: ReadPrec ListResourcesForWebACLResponse
$creadPrec :: ReadPrec ListResourcesForWebACLResponse
readList :: ReadS [ListResourcesForWebACLResponse]
$creadList :: ReadS [ListResourcesForWebACLResponse]
readsPrec :: Int -> ReadS ListResourcesForWebACLResponse
$creadsPrec :: Int -> ReadS ListResourcesForWebACLResponse
Prelude.Read, Int -> ListResourcesForWebACLResponse -> ShowS
[ListResourcesForWebACLResponse] -> ShowS
ListResourcesForWebACLResponse -> String
(Int -> ListResourcesForWebACLResponse -> ShowS)
-> (ListResourcesForWebACLResponse -> String)
-> ([ListResourcesForWebACLResponse] -> ShowS)
-> Show ListResourcesForWebACLResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesForWebACLResponse] -> ShowS
$cshowList :: [ListResourcesForWebACLResponse] -> ShowS
show :: ListResourcesForWebACLResponse -> String
$cshow :: ListResourcesForWebACLResponse -> String
showsPrec :: Int -> ListResourcesForWebACLResponse -> ShowS
$cshowsPrec :: Int -> ListResourcesForWebACLResponse -> ShowS
Prelude.Show, (forall x.
ListResourcesForWebACLResponse
-> Rep ListResourcesForWebACLResponse x)
-> (forall x.
Rep ListResourcesForWebACLResponse x
-> ListResourcesForWebACLResponse)
-> Generic ListResourcesForWebACLResponse
forall x.
Rep ListResourcesForWebACLResponse x
-> ListResourcesForWebACLResponse
forall x.
ListResourcesForWebACLResponse
-> Rep ListResourcesForWebACLResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesForWebACLResponse x
-> ListResourcesForWebACLResponse
$cfrom :: forall x.
ListResourcesForWebACLResponse
-> Rep ListResourcesForWebACLResponse x
Prelude.Generic)
newListResourcesForWebACLResponse ::
Prelude.Int ->
ListResourcesForWebACLResponse
newListResourcesForWebACLResponse :: Int -> ListResourcesForWebACLResponse
newListResourcesForWebACLResponse Int
pHttpStatus_ =
ListResourcesForWebACLResponse' :: Maybe [Text] -> Int -> ListResourcesForWebACLResponse
ListResourcesForWebACLResponse'
{ $sel:resourceArns:ListResourcesForWebACLResponse' :: Maybe [Text]
resourceArns =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListResourcesForWebACLResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listResourcesForWebACLResponse_resourceArns :: Lens.Lens' ListResourcesForWebACLResponse (Prelude.Maybe [Prelude.Text])
listResourcesForWebACLResponse_resourceArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListResourcesForWebACLResponse
-> f ListResourcesForWebACLResponse
listResourcesForWebACLResponse_resourceArns = (ListResourcesForWebACLResponse -> Maybe [Text])
-> (ListResourcesForWebACLResponse
-> Maybe [Text] -> ListResourcesForWebACLResponse)
-> Lens
ListResourcesForWebACLResponse
ListResourcesForWebACLResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForWebACLResponse' {Maybe [Text]
resourceArns :: Maybe [Text]
$sel:resourceArns:ListResourcesForWebACLResponse' :: ListResourcesForWebACLResponse -> Maybe [Text]
resourceArns} -> Maybe [Text]
resourceArns) (\s :: ListResourcesForWebACLResponse
s@ListResourcesForWebACLResponse' {} Maybe [Text]
a -> ListResourcesForWebACLResponse
s {$sel:resourceArns:ListResourcesForWebACLResponse' :: Maybe [Text]
resourceArns = Maybe [Text]
a} :: ListResourcesForWebACLResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> ListResourcesForWebACLResponse
-> f ListResourcesForWebACLResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListResourcesForWebACLResponse
-> f ListResourcesForWebACLResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listResourcesForWebACLResponse_httpStatus :: Lens.Lens' ListResourcesForWebACLResponse Prelude.Int
listResourcesForWebACLResponse_httpStatus :: (Int -> f Int)
-> ListResourcesForWebACLResponse
-> f ListResourcesForWebACLResponse
listResourcesForWebACLResponse_httpStatus = (ListResourcesForWebACLResponse -> Int)
-> (ListResourcesForWebACLResponse
-> Int -> ListResourcesForWebACLResponse)
-> Lens
ListResourcesForWebACLResponse
ListResourcesForWebACLResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesForWebACLResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListResourcesForWebACLResponse' :: ListResourcesForWebACLResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListResourcesForWebACLResponse
s@ListResourcesForWebACLResponse' {} Int
a -> ListResourcesForWebACLResponse
s {$sel:httpStatus:ListResourcesForWebACLResponse' :: Int
httpStatus = Int
a} :: ListResourcesForWebACLResponse)
instance
Prelude.NFData
ListResourcesForWebACLResponse