{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WAFRegional.ListWebACLs
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- Returns an array of WebACLSummary objects in the response.
module Amazonka.WAFRegional.ListWebACLs
  ( -- * Creating a Request
    ListWebACLs (..),
    newListWebACLs,

    -- * Request Lenses
    listWebACLs_limit,
    listWebACLs_nextMarker,

    -- * Destructuring the Response
    ListWebACLsResponse (..),
    newListWebACLsResponse,

    -- * Response Lenses
    listWebACLsResponse_nextMarker,
    listWebACLsResponse_webACLs,
    listWebACLsResponse_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.WAFRegional.Types

-- | /See:/ 'newListWebACLs' smart constructor.
data ListWebACLs = ListWebACLs'
  { -- | Specifies the number of @WebACL@ objects that you want AWS WAF to return
    -- for this request. If you have more @WebACL@ objects than the number that
    -- you specify for @Limit@, the response includes a @NextMarker@ value that
    -- you can use to get another batch of @WebACL@ objects.
    ListWebACLs -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | If you specify a value for @Limit@ and you have more @WebACL@ objects
    -- than the number that you specify for @Limit@, AWS WAF returns a
    -- @NextMarker@ value in the response that allows you to list another group
    -- of @WebACL@ objects. For the second and subsequent @ListWebACLs@
    -- requests, specify the value of @NextMarker@ from the previous response
    -- to get information about another batch of @WebACL@ objects.
    ListWebACLs -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text
  }
  deriving (ListWebACLs -> ListWebACLs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWebACLs -> ListWebACLs -> Bool
$c/= :: ListWebACLs -> ListWebACLs -> Bool
== :: ListWebACLs -> ListWebACLs -> Bool
$c== :: ListWebACLs -> ListWebACLs -> Bool
Prelude.Eq, ReadPrec [ListWebACLs]
ReadPrec ListWebACLs
Int -> ReadS ListWebACLs
ReadS [ListWebACLs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWebACLs]
$creadListPrec :: ReadPrec [ListWebACLs]
readPrec :: ReadPrec ListWebACLs
$creadPrec :: ReadPrec ListWebACLs
readList :: ReadS [ListWebACLs]
$creadList :: ReadS [ListWebACLs]
readsPrec :: Int -> ReadS ListWebACLs
$creadsPrec :: Int -> ReadS ListWebACLs
Prelude.Read, Int -> ListWebACLs -> ShowS
[ListWebACLs] -> ShowS
ListWebACLs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWebACLs] -> ShowS
$cshowList :: [ListWebACLs] -> ShowS
show :: ListWebACLs -> String
$cshow :: ListWebACLs -> String
showsPrec :: Int -> ListWebACLs -> ShowS
$cshowsPrec :: Int -> ListWebACLs -> ShowS
Prelude.Show, forall x. Rep ListWebACLs x -> ListWebACLs
forall x. ListWebACLs -> Rep ListWebACLs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWebACLs x -> ListWebACLs
$cfrom :: forall x. ListWebACLs -> Rep ListWebACLs x
Prelude.Generic)

-- |
-- Create a value of 'ListWebACLs' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'limit', 'listWebACLs_limit' - Specifies the number of @WebACL@ objects that you want AWS WAF to return
-- for this request. If you have more @WebACL@ objects than the number that
-- you specify for @Limit@, the response includes a @NextMarker@ value that
-- you can use to get another batch of @WebACL@ objects.
--
-- 'nextMarker', 'listWebACLs_nextMarker' - If you specify a value for @Limit@ and you have more @WebACL@ objects
-- than the number that you specify for @Limit@, AWS WAF returns a
-- @NextMarker@ value in the response that allows you to list another group
-- of @WebACL@ objects. For the second and subsequent @ListWebACLs@
-- requests, specify the value of @NextMarker@ from the previous response
-- to get information about another batch of @WebACL@ objects.
newListWebACLs ::
  ListWebACLs
newListWebACLs :: ListWebACLs
newListWebACLs =
  ListWebACLs'
    { $sel:limit:ListWebACLs' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:ListWebACLs' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the number of @WebACL@ objects that you want AWS WAF to return
-- for this request. If you have more @WebACL@ objects than the number that
-- you specify for @Limit@, the response includes a @NextMarker@ value that
-- you can use to get another batch of @WebACL@ objects.
listWebACLs_limit :: Lens.Lens' ListWebACLs (Prelude.Maybe Prelude.Natural)
listWebACLs_limit :: Lens' ListWebACLs (Maybe Natural)
listWebACLs_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWebACLs' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListWebACLs' :: ListWebACLs -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListWebACLs
s@ListWebACLs' {} Maybe Natural
a -> ListWebACLs
s {$sel:limit:ListWebACLs' :: Maybe Natural
limit = Maybe Natural
a} :: ListWebACLs)

-- | If you specify a value for @Limit@ and you have more @WebACL@ objects
-- than the number that you specify for @Limit@, AWS WAF returns a
-- @NextMarker@ value in the response that allows you to list another group
-- of @WebACL@ objects. For the second and subsequent @ListWebACLs@
-- requests, specify the value of @NextMarker@ from the previous response
-- to get information about another batch of @WebACL@ objects.
listWebACLs_nextMarker :: Lens.Lens' ListWebACLs (Prelude.Maybe Prelude.Text)
listWebACLs_nextMarker :: Lens' ListWebACLs (Maybe Text)
listWebACLs_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWebACLs' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListWebACLs' :: ListWebACLs -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListWebACLs
s@ListWebACLs' {} Maybe Text
a -> ListWebACLs
s {$sel:nextMarker:ListWebACLs' :: Maybe Text
nextMarker = Maybe Text
a} :: ListWebACLs)

instance Core.AWSRequest ListWebACLs where
  type AWSResponse ListWebACLs = ListWebACLsResponse
  request :: (Service -> Service) -> ListWebACLs -> Request ListWebACLs
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 ListWebACLs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListWebACLs)))
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 [WebACLSummary] -> Int -> ListWebACLsResponse
ListWebACLsResponse'
            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
"NextMarker")
            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
"WebACLs" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 ListWebACLs where
  hashWithSalt :: Int -> ListWebACLs -> Int
hashWithSalt Int
_salt ListWebACLs' {Maybe Natural
Maybe Text
nextMarker :: Maybe Text
limit :: Maybe Natural
$sel:nextMarker:ListWebACLs' :: ListWebACLs -> Maybe Text
$sel:limit:ListWebACLs' :: ListWebACLs -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker

instance Prelude.NFData ListWebACLs where
  rnf :: ListWebACLs -> ()
rnf ListWebACLs' {Maybe Natural
Maybe Text
nextMarker :: Maybe Text
limit :: Maybe Natural
$sel:nextMarker:ListWebACLs' :: ListWebACLs -> Maybe Text
$sel:limit:ListWebACLs' :: ListWebACLs -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker

instance Data.ToHeaders ListWebACLs where
  toHeaders :: ListWebACLs -> 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_Regional_20161128.ListWebACLs" ::
                          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 ListWebACLs where
  toJSON :: ListWebACLs -> Value
toJSON ListWebACLs' {Maybe Natural
Maybe Text
nextMarker :: Maybe Text
limit :: Maybe Natural
$sel:nextMarker:ListWebACLs' :: ListWebACLs -> Maybe Text
$sel:limit:ListWebACLs' :: ListWebACLs -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Limit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
            (Key
"NextMarker" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextMarker
          ]
      )

instance Data.ToPath ListWebACLs where
  toPath :: ListWebACLs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListWebACLs where
  toQuery :: ListWebACLs -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListWebACLsResponse' smart constructor.
data ListWebACLsResponse = ListWebACLsResponse'
  { -- | If you have more @WebACL@ objects than the number that you specified for
    -- @Limit@ in the request, the response includes a @NextMarker@ value. To
    -- list more @WebACL@ objects, submit another @ListWebACLs@ request, and
    -- specify the @NextMarker@ value from the response in the @NextMarker@
    -- value in the next request.
    ListWebACLsResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | An array of WebACLSummary objects.
    ListWebACLsResponse -> Maybe [WebACLSummary]
webACLs :: Prelude.Maybe [WebACLSummary],
    -- | The response's http status code.
    ListWebACLsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListWebACLsResponse -> ListWebACLsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWebACLsResponse -> ListWebACLsResponse -> Bool
$c/= :: ListWebACLsResponse -> ListWebACLsResponse -> Bool
== :: ListWebACLsResponse -> ListWebACLsResponse -> Bool
$c== :: ListWebACLsResponse -> ListWebACLsResponse -> Bool
Prelude.Eq, ReadPrec [ListWebACLsResponse]
ReadPrec ListWebACLsResponse
Int -> ReadS ListWebACLsResponse
ReadS [ListWebACLsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWebACLsResponse]
$creadListPrec :: ReadPrec [ListWebACLsResponse]
readPrec :: ReadPrec ListWebACLsResponse
$creadPrec :: ReadPrec ListWebACLsResponse
readList :: ReadS [ListWebACLsResponse]
$creadList :: ReadS [ListWebACLsResponse]
readsPrec :: Int -> ReadS ListWebACLsResponse
$creadsPrec :: Int -> ReadS ListWebACLsResponse
Prelude.Read, Int -> ListWebACLsResponse -> ShowS
[ListWebACLsResponse] -> ShowS
ListWebACLsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWebACLsResponse] -> ShowS
$cshowList :: [ListWebACLsResponse] -> ShowS
show :: ListWebACLsResponse -> String
$cshow :: ListWebACLsResponse -> String
showsPrec :: Int -> ListWebACLsResponse -> ShowS
$cshowsPrec :: Int -> ListWebACLsResponse -> ShowS
Prelude.Show, forall x. Rep ListWebACLsResponse x -> ListWebACLsResponse
forall x. ListWebACLsResponse -> Rep ListWebACLsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWebACLsResponse x -> ListWebACLsResponse
$cfrom :: forall x. ListWebACLsResponse -> Rep ListWebACLsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListWebACLsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextMarker', 'listWebACLsResponse_nextMarker' - If you have more @WebACL@ objects than the number that you specified for
-- @Limit@ in the request, the response includes a @NextMarker@ value. To
-- list more @WebACL@ objects, submit another @ListWebACLs@ request, and
-- specify the @NextMarker@ value from the response in the @NextMarker@
-- value in the next request.
--
-- 'webACLs', 'listWebACLsResponse_webACLs' - An array of WebACLSummary objects.
--
-- 'httpStatus', 'listWebACLsResponse_httpStatus' - The response's http status code.
newListWebACLsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListWebACLsResponse
newListWebACLsResponse :: Int -> ListWebACLsResponse
newListWebACLsResponse Int
pHttpStatus_ =
  ListWebACLsResponse'
    { $sel:nextMarker:ListWebACLsResponse' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
      $sel:webACLs:ListWebACLsResponse' :: Maybe [WebACLSummary]
webACLs = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListWebACLsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If you have more @WebACL@ objects than the number that you specified for
-- @Limit@ in the request, the response includes a @NextMarker@ value. To
-- list more @WebACL@ objects, submit another @ListWebACLs@ request, and
-- specify the @NextMarker@ value from the response in the @NextMarker@
-- value in the next request.
listWebACLsResponse_nextMarker :: Lens.Lens' ListWebACLsResponse (Prelude.Maybe Prelude.Text)
listWebACLsResponse_nextMarker :: Lens' ListWebACLsResponse (Maybe Text)
listWebACLsResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWebACLsResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListWebACLsResponse' :: ListWebACLsResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListWebACLsResponse
s@ListWebACLsResponse' {} Maybe Text
a -> ListWebACLsResponse
s {$sel:nextMarker:ListWebACLsResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListWebACLsResponse)

-- | An array of WebACLSummary objects.
listWebACLsResponse_webACLs :: Lens.Lens' ListWebACLsResponse (Prelude.Maybe [WebACLSummary])
listWebACLsResponse_webACLs :: Lens' ListWebACLsResponse (Maybe [WebACLSummary])
listWebACLsResponse_webACLs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWebACLsResponse' {Maybe [WebACLSummary]
webACLs :: Maybe [WebACLSummary]
$sel:webACLs:ListWebACLsResponse' :: ListWebACLsResponse -> Maybe [WebACLSummary]
webACLs} -> Maybe [WebACLSummary]
webACLs) (\s :: ListWebACLsResponse
s@ListWebACLsResponse' {} Maybe [WebACLSummary]
a -> ListWebACLsResponse
s {$sel:webACLs:ListWebACLsResponse' :: Maybe [WebACLSummary]
webACLs = Maybe [WebACLSummary]
a} :: ListWebACLsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
listWebACLsResponse_httpStatus :: Lens.Lens' ListWebACLsResponse Prelude.Int
listWebACLsResponse_httpStatus :: Lens' ListWebACLsResponse Int
listWebACLsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWebACLsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListWebACLsResponse' :: ListWebACLsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListWebACLsResponse
s@ListWebACLsResponse' {} Int
a -> ListWebACLsResponse
s {$sel:httpStatus:ListWebACLsResponse' :: Int
httpStatus = Int
a} :: ListWebACLsResponse)

instance Prelude.NFData ListWebACLsResponse where
  rnf :: ListWebACLsResponse -> ()
rnf ListWebACLsResponse' {Int
Maybe [WebACLSummary]
Maybe Text
httpStatus :: Int
webACLs :: Maybe [WebACLSummary]
nextMarker :: Maybe Text
$sel:httpStatus:ListWebACLsResponse' :: ListWebACLsResponse -> Int
$sel:webACLs:ListWebACLsResponse' :: ListWebACLsResponse -> Maybe [WebACLSummary]
$sel:nextMarker:ListWebACLsResponse' :: ListWebACLsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [WebACLSummary]
webACLs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus