{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves Protection objects for the account. You can retrieve all
-- protections or you can provide filtering criteria and retrieve just the
-- subset of protections that match the criteria.
--
-- This operation returns paginated results.
module Amazonka.Shield.ListProtections
  ( -- * Creating a Request
    ListProtections (..),
    newListProtections,

    -- * Request Lenses
    listProtections_inclusionFilters,
    listProtections_maxResults,
    listProtections_nextToken,

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

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

-- | /See:/ 'newListProtections' smart constructor.
data ListProtections = ListProtections'
  { -- | Narrows the set of protections that the call retrieves. You can retrieve
    -- a single protection by providing its name or the ARN (Amazon Resource
    -- Name) of its protected resource. You can also retrieve all protections
    -- for a specific resource type. You can provide up to one criteria per
    -- filter type. Shield Advanced returns protections that exactly match all
    -- of the filter criteria that you provide.
    ListProtections -> Maybe InclusionProtectionFilters
inclusionFilters :: Prelude.Maybe InclusionProtectionFilters,
    -- | The greatest number of objects that you want Shield Advanced to return
    -- to the list request. Shield Advanced might return fewer objects than you
    -- indicate in this setting, even if more objects are available. If there
    -- are more objects remaining, Shield Advanced will always also return a
    -- @NextToken@ value in the response.
    --
    -- The default setting is 20.
    ListProtections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | When you request a list of objects from Shield Advanced, if the response
    -- does not include all of the remaining available objects, Shield Advanced
    -- includes a @NextToken@ value in the response. You can retrieve the next
    -- batch of objects by requesting the list again and providing the token
    -- that was returned by the prior call in your request.
    --
    -- You can indicate the maximum number of objects that you want Shield
    -- Advanced to return for a single call with the @MaxResults@ setting.
    -- Shield Advanced will not return more than @MaxResults@ objects, but may
    -- return fewer, even if more objects are still available.
    --
    -- Whenever more objects remain that Shield Advanced has not yet returned
    -- to you, the response will include a @NextToken@ value.
    --
    -- On your first call to a list operation, leave this setting empty.
    ListProtections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListProtections -> ListProtections -> Bool
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]
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
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. 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:
--
-- 'inclusionFilters', 'listProtections_inclusionFilters' - Narrows the set of protections that the call retrieves. You can retrieve
-- a single protection by providing its name or the ARN (Amazon Resource
-- Name) of its protected resource. You can also retrieve all protections
-- for a specific resource type. You can provide up to one criteria per
-- filter type. Shield Advanced returns protections that exactly match all
-- of the filter criteria that you provide.
--
-- 'maxResults', 'listProtections_maxResults' - The greatest number of objects that you want Shield Advanced to return
-- to the list request. Shield Advanced might return fewer objects than you
-- indicate in this setting, even if more objects are available. If there
-- are more objects remaining, Shield Advanced will always also return a
-- @NextToken@ value in the response.
--
-- The default setting is 20.
--
-- 'nextToken', 'listProtections_nextToken' - When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
--
-- On your first call to a list operation, leave this setting empty.
newListProtections ::
  ListProtections
newListProtections :: ListProtections
newListProtections =
  ListProtections'
    { $sel:inclusionFilters:ListProtections' :: Maybe InclusionProtectionFilters
inclusionFilters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListProtections' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListProtections' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Narrows the set of protections that the call retrieves. You can retrieve
-- a single protection by providing its name or the ARN (Amazon Resource
-- Name) of its protected resource. You can also retrieve all protections
-- for a specific resource type. You can provide up to one criteria per
-- filter type. Shield Advanced returns protections that exactly match all
-- of the filter criteria that you provide.
listProtections_inclusionFilters :: Lens.Lens' ListProtections (Prelude.Maybe InclusionProtectionFilters)
listProtections_inclusionFilters :: Lens' ListProtections (Maybe InclusionProtectionFilters)
listProtections_inclusionFilters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListProtections' {Maybe InclusionProtectionFilters
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
inclusionFilters} -> Maybe InclusionProtectionFilters
inclusionFilters) (\s :: ListProtections
s@ListProtections' {} Maybe InclusionProtectionFilters
a -> ListProtections
s {$sel:inclusionFilters:ListProtections' :: Maybe InclusionProtectionFilters
inclusionFilters = Maybe InclusionProtectionFilters
a} :: ListProtections)

-- | The greatest number of objects that you want Shield Advanced to return
-- to the list request. Shield Advanced might return fewer objects than you
-- indicate in this setting, even if more objects are available. If there
-- are more objects remaining, Shield Advanced will always also return a
-- @NextToken@ value in the response.
--
-- The default setting is 20.
listProtections_maxResults :: Lens.Lens' ListProtections (Prelude.Maybe Prelude.Natural)
listProtections_maxResults :: Lens' ListProtections (Maybe Natural)
listProtections_maxResults = 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)

-- | When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
--
-- On your first call to a list operation, leave this setting empty.
listProtections_nextToken :: Lens.Lens' ListProtections (Prelude.Maybe Prelude.Text)
listProtections_nextToken :: Lens' ListProtections (Maybe Text)
listProtections_nextToken = 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)

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

instance Core.AWSRequest ListProtections where
  type
    AWSResponse ListProtections =
      ListProtectionsResponse
  request :: (Service -> Service) -> ListProtections -> Request ListProtections
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 ListProtections
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListProtections)))
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 [Protection] -> Int -> ListProtectionsResponse
ListProtectionsResponse'
            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
"NextToken")
            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
"Protections" 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 ListProtections where
  hashWithSalt :: Int -> ListProtections -> Int
hashWithSalt Int
_salt ListProtections' {Maybe Natural
Maybe Text
Maybe InclusionProtectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InclusionProtectionFilters
inclusionFilters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListProtections where
  rnf :: ListProtections -> ()
rnf ListProtections' {Maybe Natural
Maybe Text
Maybe InclusionProtectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InclusionProtectionFilters
inclusionFilters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListProtections where
  toHeaders :: ListProtections -> 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
"AWSShield_20160616.ListProtections" ::
                          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 ListProtections where
  toJSON :: ListProtections -> Value
toJSON ListProtections' {Maybe Natural
Maybe Text
Maybe InclusionProtectionFilters
nextToken :: Maybe Text
maxResults :: Maybe Natural
inclusionFilters :: Maybe InclusionProtectionFilters
$sel:nextToken:ListProtections' :: ListProtections -> Maybe Text
$sel:maxResults:ListProtections' :: ListProtections -> Maybe Natural
$sel:inclusionFilters:ListProtections' :: ListProtections -> Maybe InclusionProtectionFilters
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"InclusionFilters" 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 InclusionProtectionFilters
inclusionFilters,
            (Key
"MaxResults" 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
maxResults,
            (Key
"NextToken" 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
nextToken
          ]
      )

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

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

-- | /See:/ 'newListProtectionsResponse' smart constructor.
data ListProtectionsResponse = ListProtectionsResponse'
  { -- | When you request a list of objects from Shield Advanced, if the response
    -- does not include all of the remaining available objects, Shield Advanced
    -- includes a @NextToken@ value in the response. You can retrieve the next
    -- batch of objects by requesting the list again and providing the token
    -- that was returned by the prior call in your request.
    --
    -- You can indicate the maximum number of objects that you want Shield
    -- Advanced to return for a single call with the @MaxResults@ setting.
    -- Shield Advanced will not return more than @MaxResults@ objects, but may
    -- return fewer, even if more objects are still available.
    --
    -- Whenever more objects remain that Shield Advanced has not yet returned
    -- to you, the response will include a @NextToken@ value.
    ListProtectionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The array of enabled Protection objects.
    ListProtectionsResponse -> Maybe [Protection]
protections :: Prelude.Maybe [Protection],
    -- | The response's http status code.
    ListProtectionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListProtectionsResponse -> ListProtectionsResponse -> Bool
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]
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
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. 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:
--
-- 'nextToken', 'listProtectionsResponse_nextToken' - When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
--
-- 'protections', 'listProtectionsResponse_protections' - The array of enabled Protection objects.
--
-- 'httpStatus', 'listProtectionsResponse_httpStatus' - The response's http status code.
newListProtectionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListProtectionsResponse
newListProtectionsResponse :: Int -> ListProtectionsResponse
newListProtectionsResponse Int
pHttpStatus_ =
  ListProtectionsResponse'
    { $sel:nextToken:ListProtectionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:protections:ListProtectionsResponse' :: Maybe [Protection]
protections = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListProtectionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | When you request a list of objects from Shield Advanced, if the response
-- does not include all of the remaining available objects, Shield Advanced
-- includes a @NextToken@ value in the response. You can retrieve the next
-- batch of objects by requesting the list again and providing the token
-- that was returned by the prior call in your request.
--
-- You can indicate the maximum number of objects that you want Shield
-- Advanced to return for a single call with the @MaxResults@ setting.
-- Shield Advanced will not return more than @MaxResults@ objects, but may
-- return fewer, even if more objects are still available.
--
-- Whenever more objects remain that Shield Advanced has not yet returned
-- to you, the response will include a @NextToken@ value.
listProtectionsResponse_nextToken :: Lens.Lens' ListProtectionsResponse (Prelude.Maybe Prelude.Text)
listProtectionsResponse_nextToken :: Lens' ListProtectionsResponse (Maybe Text)
listProtectionsResponse_nextToken = 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 array of enabled Protection objects.
listProtectionsResponse_protections :: Lens.Lens' ListProtectionsResponse (Prelude.Maybe [Protection])
listProtectionsResponse_protections :: Lens' ListProtectionsResponse (Maybe [Protection])
listProtectionsResponse_protections = 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) 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.
listProtectionsResponse_httpStatus :: Lens.Lens' ListProtectionsResponse Prelude.Int
listProtectionsResponse_httpStatus :: Lens' ListProtectionsResponse Int
listProtectionsResponse_httpStatus = 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 where
  rnf :: ListProtectionsResponse -> ()
rnf ListProtectionsResponse' {Int
Maybe [Protection]
Maybe Text
httpStatus :: Int
protections :: Maybe [Protection]
nextToken :: Maybe Text
$sel:httpStatus:ListProtectionsResponse' :: ListProtectionsResponse -> Int
$sel:protections:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe [Protection]
$sel:nextToken:ListProtectionsResponse' :: ListProtectionsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Protection]
protections
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus