{-# 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.Shield.ListProtections
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists all Protection objects for the account.
--
-- This operation returns paginated results.
module Amazonka.Shield.ListProtections
  ( -- * Creating a Request
    ListProtections (..),
    newListProtections,

    -- * Request Lenses
    listProtections_nextToken,
    listProtections_maxResults,

    -- * Destructuring the Response
    ListProtectionsResponse (..),
    newListProtectionsResponse,

    -- * Response Lenses
    listProtectionsResponse_protections,
    listProtectionsResponse_nextToken,
    listProtectionsResponse_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.Shield.Types

-- | /See:/ 'newListProtections' smart constructor.
data ListProtections = ListProtections'
  { -- | The @ListProtectionsRequest.NextToken@ value from a previous call to
    -- @ListProtections@. Pass null if this is the first call.
    ListProtections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of Protection objects to return. If you leave this
    -- blank, Shield Advanced returns the first 20 results.
    --
    -- This is a maximum value. Shield Advanced might return the results in
    -- smaller batches. That is, the number of objects returned could be less
    -- than @MaxResults@, even if there are still more objects yet to return.
    -- If there are more objects to return, Shield Advanced returns a value in
    -- @NextToken@ that you can use in your next request, to get the next batch
    -- of objects.
    ListProtections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListProtections -> ListProtections -> Bool
(ListProtections -> ListProtections -> Bool)
-> (ListProtections -> ListProtections -> Bool)
-> Eq ListProtections
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtections -> ListProtections -> Bool
$c/= :: ListProtections -> ListProtections -> Bool
== :: ListProtections -> ListProtections -> Bool
$c== :: ListProtections -> ListProtections -> Bool
Prelude.Eq, ReadPrec [ListProtections]
ReadPrec ListProtections
Int -> ReadS ListProtections
ReadS [ListProtections]
(Int -> ReadS ListProtections)
-> ReadS [ListProtections]
-> ReadPrec ListProtections
-> ReadPrec [ListProtections]
-> Read ListProtections
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtections]
$creadListPrec :: ReadPrec [ListProtections]
readPrec :: ReadPrec ListProtections
$creadPrec :: ReadPrec ListProtections
readList :: ReadS [ListProtections]
$creadList :: ReadS [ListProtections]
readsPrec :: Int -> ReadS ListProtections
$creadsPrec :: Int -> ReadS ListProtections
Prelude.Read, Int -> ListProtections -> ShowS
[ListProtections] -> ShowS
ListProtections -> String
(Int -> ListProtections -> ShowS)
-> (ListProtections -> String)
-> ([ListProtections] -> ShowS)
-> Show ListProtections
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtections] -> ShowS
$cshowList :: [ListProtections] -> ShowS
show :: ListProtections -> String
$cshow :: ListProtections -> String
showsPrec :: Int -> ListProtections -> ShowS
$cshowsPrec :: Int -> ListProtections -> ShowS
Prelude.Show, (forall x. ListProtections -> Rep ListProtections x)
-> (forall x. Rep ListProtections x -> ListProtections)
-> Generic ListProtections
forall x. Rep ListProtections x -> ListProtections
forall x. ListProtections -> Rep ListProtections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProtections x -> ListProtections
$cfrom :: forall x. ListProtections -> Rep ListProtections x
Prelude.Generic)

-- |
-- Create a value of 'ListProtections' 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:
--
-- 'nextToken', 'listProtections_nextToken' - The @ListProtectionsRequest.NextToken@ value from a previous call to
-- @ListProtections@. Pass null if this is the first call.
--
-- 'maxResults', 'listProtections_maxResults' - The maximum number of Protection objects to return. If you leave this
-- blank, Shield Advanced returns the first 20 results.
--
-- This is a maximum value. Shield Advanced might return the results in
-- smaller batches. That is, the number of objects returned could be less
-- than @MaxResults@, even if there are still more objects yet to return.
-- If there are more objects to return, Shield Advanced returns a value in
-- @NextToken@ that you can use in your next request, to get the next batch
-- of objects.
newListProtections ::
  ListProtections
newListProtections :: ListProtections
newListProtections =
  ListProtections' :: Maybe Text -> Maybe Natural -> ListProtections
ListProtections'
    { $sel:nextToken:ListProtections' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListProtections' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The @ListProtectionsRequest.NextToken@ value from a previous call to
-- @ListProtections@. Pass null if this is the first call.
listProtections_nextToken :: Lens.Lens' ListProtections (Prelude.Maybe Prelude.Text)
listProtections_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProtections -> f ListProtections
listProtections_nextToken = (ListProtections -> Maybe Text)
-> (ListProtections -> Maybe Text -> ListProtections)
-> Lens ListProtections ListProtections (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtections' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtections
s@ListProtections' {} Maybe Text
a -> ListProtections
s {$sel:nextToken:ListProtections' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtections)

-- | The maximum number of Protection objects to return. If you leave this
-- blank, Shield Advanced returns the first 20 results.
--
-- This is a maximum value. Shield Advanced might return the results in
-- smaller batches. That is, the number of objects returned could be less
-- than @MaxResults@, even if there are still more objects yet to return.
-- If there are more objects to return, Shield Advanced returns a value in
-- @NextToken@ that you can use in your next request, to get the next batch
-- of objects.
listProtections_maxResults :: Lens.Lens' ListProtections (Prelude.Maybe Prelude.Natural)
listProtections_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListProtections -> f ListProtections
listProtections_maxResults = (ListProtections -> Maybe Natural)
-> (ListProtections -> Maybe Natural -> ListProtections)
-> Lens
     ListProtections ListProtections (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtections' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListProtections
s@ListProtections' {} Maybe Natural
a -> ListProtections
s {$sel:maxResults:ListProtections' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListProtections)

instance Core.AWSPager ListProtections where
  page :: ListProtections
-> AWSResponse ListProtections -> Maybe ListProtections
page ListProtections
rq AWSResponse ListProtections
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListProtections
ListProtectionsResponse
rs
            ListProtectionsResponse
-> Getting (First Text) ListProtectionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListProtectionsResponse
-> Const (First Text) ListProtectionsResponse
Lens' ListProtectionsResponse (Maybe Text)
listProtectionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListProtectionsResponse
 -> Const (First Text) ListProtectionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListProtectionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListProtections
forall a. Maybe a
Prelude.Nothing
    | Maybe [Protection] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListProtections
ListProtectionsResponse
rs
            ListProtectionsResponse
-> Getting
     (First [Protection]) ListProtectionsResponse [Protection]
-> Maybe [Protection]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Protection]
 -> Const (First [Protection]) (Maybe [Protection]))
-> ListProtectionsResponse
-> Const (First [Protection]) ListProtectionsResponse
Lens' ListProtectionsResponse (Maybe [Protection])
listProtectionsResponse_protections
              ((Maybe [Protection]
  -> Const (First [Protection]) (Maybe [Protection]))
 -> ListProtectionsResponse
 -> Const (First [Protection]) ListProtectionsResponse)
-> (([Protection] -> Const (First [Protection]) [Protection])
    -> Maybe [Protection]
    -> Const (First [Protection]) (Maybe [Protection]))
-> Getting
     (First [Protection]) ListProtectionsResponse [Protection]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Protection] -> Const (First [Protection]) [Protection])
-> Maybe [Protection]
-> Const (First [Protection]) (Maybe [Protection])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListProtections
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListProtections -> Maybe ListProtections
forall a. a -> Maybe a
Prelude.Just (ListProtections -> Maybe ListProtections)
-> ListProtections -> Maybe ListProtections
forall a b. (a -> b) -> a -> b
Prelude.$
        ListProtections
rq
          ListProtections
-> (ListProtections -> ListProtections) -> ListProtections
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListProtections -> Identity ListProtections
Lens ListProtections ListProtections (Maybe Text) (Maybe Text)
listProtections_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListProtections -> Identity ListProtections)
-> Maybe Text -> ListProtections -> ListProtections
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListProtections
ListProtectionsResponse
rs
          ListProtectionsResponse
-> Getting (First Text) ListProtectionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListProtectionsResponse
-> Const (First Text) ListProtectionsResponse
Lens' ListProtectionsResponse (Maybe Text)
listProtectionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListProtectionsResponse
 -> Const (First Text) ListProtectionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListProtectionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListProtections where
  type
    AWSResponse ListProtections =
      ListProtectionsResponse
  request :: ListProtections -> Request ListProtections
request = Service -> ListProtections -> Request ListProtections
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListProtections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProtections)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListProtections))
-> Logger
-> Service
-> Proxy ListProtections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProtections)))
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 [Protection] -> Maybe Text -> Int -> ListProtectionsResponse
ListProtectionsResponse'
            (Maybe [Protection]
 -> Maybe Text -> Int -> ListProtectionsResponse)
-> Either String (Maybe [Protection])
-> Either String (Maybe Text -> Int -> ListProtectionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Protection]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Protections" Either String (Maybe (Maybe [Protection]))
-> Maybe [Protection] -> Either String (Maybe [Protection])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Protection]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListProtectionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListProtectionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> ListProtectionsResponse)
-> Either String Int -> Either String ListProtectionsResponse
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 ListProtections

instance Prelude.NFData ListProtections

instance Core.ToHeaders ListProtections where
  toHeaders :: ListProtections -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListProtections -> 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
"AWSShield_20160616.ListProtections" ::
                          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 ListProtections where
  toJSON :: ListProtections -> Value
toJSON ListProtections' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

-- | /See:/ 'newListProtectionsResponse' smart constructor.
data ListProtectionsResponse = ListProtectionsResponse'
  { -- | The array of enabled Protection objects.
    ListProtectionsResponse -> Maybe [Protection]
protections :: Prelude.Maybe [Protection],
    -- | If you specify a value for @MaxResults@ and you have more Protections
    -- than the value of MaxResults, Shield Advanced returns a NextToken value
    -- in the response that allows you to list another group of Protections.
    -- For the second and subsequent ListProtections requests, specify the
    -- value of NextToken from the previous response to get information about
    -- another batch of Protections.
    --
    -- Shield Advanced might return the list of Protection objects in batches
    -- smaller than the number specified by MaxResults. If there are more
    -- Protection objects to return, Shield Advanced will always also return a
    -- @NextToken@.
    ListProtectionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListProtectionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListProtectionsResponse -> ListProtectionsResponse -> Bool
(ListProtectionsResponse -> ListProtectionsResponse -> Bool)
-> (ListProtectionsResponse -> ListProtectionsResponse -> Bool)
-> Eq ListProtectionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
$c/= :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
== :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
$c== :: ListProtectionsResponse -> ListProtectionsResponse -> Bool
Prelude.Eq, ReadPrec [ListProtectionsResponse]
ReadPrec ListProtectionsResponse
Int -> ReadS ListProtectionsResponse
ReadS [ListProtectionsResponse]
(Int -> ReadS ListProtectionsResponse)
-> ReadS [ListProtectionsResponse]
-> ReadPrec ListProtectionsResponse
-> ReadPrec [ListProtectionsResponse]
-> Read ListProtectionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListProtectionsResponse]
$creadListPrec :: ReadPrec [ListProtectionsResponse]
readPrec :: ReadPrec ListProtectionsResponse
$creadPrec :: ReadPrec ListProtectionsResponse
readList :: ReadS [ListProtectionsResponse]
$creadList :: ReadS [ListProtectionsResponse]
readsPrec :: Int -> ReadS ListProtectionsResponse
$creadsPrec :: Int -> ReadS ListProtectionsResponse
Prelude.Read, Int -> ListProtectionsResponse -> ShowS
[ListProtectionsResponse] -> ShowS
ListProtectionsResponse -> String
(Int -> ListProtectionsResponse -> ShowS)
-> (ListProtectionsResponse -> String)
-> ([ListProtectionsResponse] -> ShowS)
-> Show ListProtectionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListProtectionsResponse] -> ShowS
$cshowList :: [ListProtectionsResponse] -> ShowS
show :: ListProtectionsResponse -> String
$cshow :: ListProtectionsResponse -> String
showsPrec :: Int -> ListProtectionsResponse -> ShowS
$cshowsPrec :: Int -> ListProtectionsResponse -> ShowS
Prelude.Show, (forall x.
 ListProtectionsResponse -> Rep ListProtectionsResponse x)
-> (forall x.
    Rep ListProtectionsResponse x -> ListProtectionsResponse)
-> Generic ListProtectionsResponse
forall x. Rep ListProtectionsResponse x -> ListProtectionsResponse
forall x. ListProtectionsResponse -> Rep ListProtectionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListProtectionsResponse x -> ListProtectionsResponse
$cfrom :: forall x. ListProtectionsResponse -> Rep ListProtectionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListProtectionsResponse' 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:
--
-- 'protections', 'listProtectionsResponse_protections' - The array of enabled Protection objects.
--
-- 'nextToken', 'listProtectionsResponse_nextToken' - If you specify a value for @MaxResults@ and you have more Protections
-- than the value of MaxResults, Shield Advanced returns a NextToken value
-- in the response that allows you to list another group of Protections.
-- For the second and subsequent ListProtections requests, specify the
-- value of NextToken from the previous response to get information about
-- another batch of Protections.
--
-- Shield Advanced might return the list of Protection objects in batches
-- smaller than the number specified by MaxResults. If there are more
-- Protection objects to return, Shield Advanced will always also return a
-- @NextToken@.
--
-- 'httpStatus', 'listProtectionsResponse_httpStatus' - The response's http status code.
newListProtectionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProtectionsResponse
newListProtectionsResponse :: Int -> ListProtectionsResponse
newListProtectionsResponse Int
pHttpStatus_ =
  ListProtectionsResponse' :: Maybe [Protection] -> Maybe Text -> Int -> ListProtectionsResponse
ListProtectionsResponse'
    { $sel:protections:ListProtectionsResponse' :: Maybe [Protection]
protections =
        Maybe [Protection]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListProtectionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProtectionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The array of enabled Protection objects.
listProtectionsResponse_protections :: Lens.Lens' ListProtectionsResponse (Prelude.Maybe [Protection])
listProtectionsResponse_protections :: (Maybe [Protection] -> f (Maybe [Protection]))
-> ListProtectionsResponse -> f ListProtectionsResponse
listProtectionsResponse_protections = (ListProtectionsResponse -> Maybe [Protection])
-> (ListProtectionsResponse
    -> Maybe [Protection] -> ListProtectionsResponse)
-> Lens' ListProtectionsResponse (Maybe [Protection])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionsResponse' {Maybe [Protection]
protections :: Maybe [Protection]
$sel:protections:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe [Protection]
protections} -> Maybe [Protection]
protections) (\s :: ListProtectionsResponse
s@ListProtectionsResponse' {} Maybe [Protection]
a -> ListProtectionsResponse
s {$sel:protections:ListProtectionsResponse' :: Maybe [Protection]
protections = Maybe [Protection]
a} :: ListProtectionsResponse) ((Maybe [Protection] -> f (Maybe [Protection]))
 -> ListProtectionsResponse -> f ListProtectionsResponse)
-> ((Maybe [Protection] -> f (Maybe [Protection]))
    -> Maybe [Protection] -> f (Maybe [Protection]))
-> (Maybe [Protection] -> f (Maybe [Protection]))
-> ListProtectionsResponse
-> f ListProtectionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Protection] [Protection] [Protection] [Protection]
-> Iso
     (Maybe [Protection])
     (Maybe [Protection])
     (Maybe [Protection])
     (Maybe [Protection])
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 [Protection] [Protection] [Protection] [Protection]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If you specify a value for @MaxResults@ and you have more Protections
-- than the value of MaxResults, Shield Advanced returns a NextToken value
-- in the response that allows you to list another group of Protections.
-- For the second and subsequent ListProtections requests, specify the
-- value of NextToken from the previous response to get information about
-- another batch of Protections.
--
-- Shield Advanced might return the list of Protection objects in batches
-- smaller than the number specified by MaxResults. If there are more
-- Protection objects to return, Shield Advanced will always also return a
-- @NextToken@.
listProtectionsResponse_nextToken :: Lens.Lens' ListProtectionsResponse (Prelude.Maybe Prelude.Text)
listProtectionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListProtectionsResponse -> f ListProtectionsResponse
listProtectionsResponse_nextToken = (ListProtectionsResponse -> Maybe Text)
-> (ListProtectionsResponse
    -> Maybe Text -> ListProtectionsResponse)
-> Lens' ListProtectionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtectionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListProtectionsResponse
s@ListProtectionsResponse' {} Maybe Text
a -> ListProtectionsResponse
s {$sel:nextToken:ListProtectionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListProtectionsResponse)

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

instance Prelude.NFData ListProtectionsResponse