{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.CloudFront.Types.ResponseHeadersPolicyList
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFront.Types.ResponseHeadersPolicyList where

import Amazonka.CloudFront.Types.ResponseHeadersPolicySummary
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

-- | A list of response headers policies.
--
-- /See:/ 'newResponseHeadersPolicyList' smart constructor.
data ResponseHeadersPolicyList = ResponseHeadersPolicyList'
  { -- | The response headers policies in the list.
    ResponseHeadersPolicyList -> Maybe [ResponseHeadersPolicySummary]
items :: Prelude.Maybe [ResponseHeadersPolicySummary],
    -- | If there are more items in the list than are in this response, this
    -- element is present. It contains the value that you should use in the
    -- @Marker@ field of a subsequent request to continue listing response
    -- headers policies where you left off.
    ResponseHeadersPolicyList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of response headers policies requested.
    ResponseHeadersPolicyList -> Int
maxItems :: Prelude.Int,
    -- | The number of response headers policies returned.
    ResponseHeadersPolicyList -> Int
quantity :: Prelude.Int
  }
  deriving (ResponseHeadersPolicyList -> ResponseHeadersPolicyList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResponseHeadersPolicyList -> ResponseHeadersPolicyList -> Bool
$c/= :: ResponseHeadersPolicyList -> ResponseHeadersPolicyList -> Bool
== :: ResponseHeadersPolicyList -> ResponseHeadersPolicyList -> Bool
$c== :: ResponseHeadersPolicyList -> ResponseHeadersPolicyList -> Bool
Prelude.Eq, ReadPrec [ResponseHeadersPolicyList]
ReadPrec ResponseHeadersPolicyList
Int -> ReadS ResponseHeadersPolicyList
ReadS [ResponseHeadersPolicyList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResponseHeadersPolicyList]
$creadListPrec :: ReadPrec [ResponseHeadersPolicyList]
readPrec :: ReadPrec ResponseHeadersPolicyList
$creadPrec :: ReadPrec ResponseHeadersPolicyList
readList :: ReadS [ResponseHeadersPolicyList]
$creadList :: ReadS [ResponseHeadersPolicyList]
readsPrec :: Int -> ReadS ResponseHeadersPolicyList
$creadsPrec :: Int -> ReadS ResponseHeadersPolicyList
Prelude.Read, Int -> ResponseHeadersPolicyList -> ShowS
[ResponseHeadersPolicyList] -> ShowS
ResponseHeadersPolicyList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResponseHeadersPolicyList] -> ShowS
$cshowList :: [ResponseHeadersPolicyList] -> ShowS
show :: ResponseHeadersPolicyList -> String
$cshow :: ResponseHeadersPolicyList -> String
showsPrec :: Int -> ResponseHeadersPolicyList -> ShowS
$cshowsPrec :: Int -> ResponseHeadersPolicyList -> ShowS
Prelude.Show, forall x.
Rep ResponseHeadersPolicyList x -> ResponseHeadersPolicyList
forall x.
ResponseHeadersPolicyList -> Rep ResponseHeadersPolicyList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ResponseHeadersPolicyList x -> ResponseHeadersPolicyList
$cfrom :: forall x.
ResponseHeadersPolicyList -> Rep ResponseHeadersPolicyList x
Prelude.Generic)

-- |
-- Create a value of 'ResponseHeadersPolicyList' 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:
--
-- 'items', 'responseHeadersPolicyList_items' - The response headers policies in the list.
--
-- 'nextMarker', 'responseHeadersPolicyList_nextMarker' - If there are more items in the list than are in this response, this
-- element is present. It contains the value that you should use in the
-- @Marker@ field of a subsequent request to continue listing response
-- headers policies where you left off.
--
-- 'maxItems', 'responseHeadersPolicyList_maxItems' - The maximum number of response headers policies requested.
--
-- 'quantity', 'responseHeadersPolicyList_quantity' - The number of response headers policies returned.
newResponseHeadersPolicyList ::
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'quantity'
  Prelude.Int ->
  ResponseHeadersPolicyList
newResponseHeadersPolicyList :: Int -> Int -> ResponseHeadersPolicyList
newResponseHeadersPolicyList Int
pMaxItems_ Int
pQuantity_ =
  ResponseHeadersPolicyList'
    { $sel:items:ResponseHeadersPolicyList' :: Maybe [ResponseHeadersPolicySummary]
items = forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:ResponseHeadersPolicyList' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ResponseHeadersPolicyList' :: Int
maxItems = Int
pMaxItems_,
      $sel:quantity:ResponseHeadersPolicyList' :: Int
quantity = Int
pQuantity_
    }

-- | The response headers policies in the list.
responseHeadersPolicyList_items :: Lens.Lens' ResponseHeadersPolicyList (Prelude.Maybe [ResponseHeadersPolicySummary])
responseHeadersPolicyList_items :: Lens'
  ResponseHeadersPolicyList (Maybe [ResponseHeadersPolicySummary])
responseHeadersPolicyList_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseHeadersPolicyList' {Maybe [ResponseHeadersPolicySummary]
items :: Maybe [ResponseHeadersPolicySummary]
$sel:items:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Maybe [ResponseHeadersPolicySummary]
items} -> Maybe [ResponseHeadersPolicySummary]
items) (\s :: ResponseHeadersPolicyList
s@ResponseHeadersPolicyList' {} Maybe [ResponseHeadersPolicySummary]
a -> ResponseHeadersPolicyList
s {$sel:items:ResponseHeadersPolicyList' :: Maybe [ResponseHeadersPolicySummary]
items = Maybe [ResponseHeadersPolicySummary]
a} :: ResponseHeadersPolicyList) 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

-- | If there are more items in the list than are in this response, this
-- element is present. It contains the value that you should use in the
-- @Marker@ field of a subsequent request to continue listing response
-- headers policies where you left off.
responseHeadersPolicyList_nextMarker :: Lens.Lens' ResponseHeadersPolicyList (Prelude.Maybe Prelude.Text)
responseHeadersPolicyList_nextMarker :: Lens' ResponseHeadersPolicyList (Maybe Text)
responseHeadersPolicyList_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseHeadersPolicyList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ResponseHeadersPolicyList
s@ResponseHeadersPolicyList' {} Maybe Text
a -> ResponseHeadersPolicyList
s {$sel:nextMarker:ResponseHeadersPolicyList' :: Maybe Text
nextMarker = Maybe Text
a} :: ResponseHeadersPolicyList)

-- | The maximum number of response headers policies requested.
responseHeadersPolicyList_maxItems :: Lens.Lens' ResponseHeadersPolicyList Prelude.Int
responseHeadersPolicyList_maxItems :: Lens' ResponseHeadersPolicyList Int
responseHeadersPolicyList_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseHeadersPolicyList' {Int
maxItems :: Int
$sel:maxItems:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Int
maxItems} -> Int
maxItems) (\s :: ResponseHeadersPolicyList
s@ResponseHeadersPolicyList' {} Int
a -> ResponseHeadersPolicyList
s {$sel:maxItems:ResponseHeadersPolicyList' :: Int
maxItems = Int
a} :: ResponseHeadersPolicyList)

-- | The number of response headers policies returned.
responseHeadersPolicyList_quantity :: Lens.Lens' ResponseHeadersPolicyList Prelude.Int
responseHeadersPolicyList_quantity :: Lens' ResponseHeadersPolicyList Int
responseHeadersPolicyList_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResponseHeadersPolicyList' {Int
quantity :: Int
$sel:quantity:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Int
quantity} -> Int
quantity) (\s :: ResponseHeadersPolicyList
s@ResponseHeadersPolicyList' {} Int
a -> ResponseHeadersPolicyList
s {$sel:quantity:ResponseHeadersPolicyList' :: Int
quantity = Int
a} :: ResponseHeadersPolicyList)

instance Data.FromXML ResponseHeadersPolicyList where
  parseXML :: [Node] -> Either String ResponseHeadersPolicyList
parseXML [Node]
x =
    Maybe [ResponseHeadersPolicySummary]
-> Maybe Text -> Int -> Int -> ResponseHeadersPolicyList
ResponseHeadersPolicyList'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                      forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Items"
                      forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                      forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may
                        (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"ResponseHeadersPolicySummary")
                  )
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextMarker")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"MaxItems")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"Quantity")

instance Prelude.Hashable ResponseHeadersPolicyList where
  hashWithSalt :: Int -> ResponseHeadersPolicyList -> Int
hashWithSalt Int
_salt ResponseHeadersPolicyList' {Int
Maybe [ResponseHeadersPolicySummary]
Maybe Text
quantity :: Int
maxItems :: Int
nextMarker :: Maybe Text
items :: Maybe [ResponseHeadersPolicySummary]
$sel:quantity:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Int
$sel:maxItems:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Int
$sel:nextMarker:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Maybe Text
$sel:items:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Maybe [ResponseHeadersPolicySummary]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ResponseHeadersPolicySummary]
items
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
maxItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
quantity

instance Prelude.NFData ResponseHeadersPolicyList where
  rnf :: ResponseHeadersPolicyList -> ()
rnf ResponseHeadersPolicyList' {Int
Maybe [ResponseHeadersPolicySummary]
Maybe Text
quantity :: Int
maxItems :: Int
nextMarker :: Maybe Text
items :: Maybe [ResponseHeadersPolicySummary]
$sel:quantity:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Int
$sel:maxItems:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Int
$sel:nextMarker:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Maybe Text
$sel:items:ResponseHeadersPolicyList' :: ResponseHeadersPolicyList -> Maybe [ResponseHeadersPolicySummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ResponseHeadersPolicySummary]
items
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Int
maxItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
quantity