{-# 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.CloudFrontOriginAccessIdentityList
-- 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.CloudFrontOriginAccessIdentityList where

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

-- | Lists the origin access identities for CloudFront.Send a @GET@ request
-- to the
-- @\/@/@CloudFront API version@/@\/origin-access-identity\/cloudfront@
-- resource. The response includes a @CloudFrontOriginAccessIdentityList@
-- element with zero or more @CloudFrontOriginAccessIdentitySummary@ child
-- elements. By default, your entire list of origin access identities is
-- returned in one single page. If the list is long, you can paginate it
-- using the @MaxItems@ and @Marker@ parameters.
--
-- /See:/ 'newCloudFrontOriginAccessIdentityList' smart constructor.
data CloudFrontOriginAccessIdentityList = CloudFrontOriginAccessIdentityList'
  { -- | A complex type that contains one @CloudFrontOriginAccessIdentitySummary@
    -- element for each origin access identity that was created by the current
    -- Amazon Web Services account.
    CloudFrontOriginAccessIdentityList
-> Maybe [CloudFrontOriginAccessIdentitySummary]
items :: Prelude.Maybe [CloudFrontOriginAccessIdentitySummary],
    -- | If @IsTruncated@ is @true@, this element is present and contains the
    -- value you can use for the @Marker@ request parameter to continue listing
    -- your origin access identities where they left off.
    CloudFrontOriginAccessIdentityList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | Use this when paginating results to indicate where to begin in your list
    -- of origin access identities. The results include identities in the list
    -- that occur after the marker. To get the next page of results, set the
    -- @Marker@ to the value of the @NextMarker@ from the current page\'s
    -- response (which is also the ID of the last identity on that page).
    CloudFrontOriginAccessIdentityList -> Text
marker :: Prelude.Text,
    -- | The maximum number of origin access identities you want in the response
    -- body.
    CloudFrontOriginAccessIdentityList -> Int
maxItems :: Prelude.Int,
    -- | A flag that indicates whether more origin access identities remain to be
    -- listed. If your results were truncated, you can make a follow-up
    -- pagination request using the @Marker@ request parameter to retrieve more
    -- items in the list.
    CloudFrontOriginAccessIdentityList -> Bool
isTruncated :: Prelude.Bool,
    -- | The number of CloudFront origin access identities that were created by
    -- the current Amazon Web Services account.
    CloudFrontOriginAccessIdentityList -> Int
quantity :: Prelude.Int
  }
  deriving (CloudFrontOriginAccessIdentityList
-> CloudFrontOriginAccessIdentityList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudFrontOriginAccessIdentityList
-> CloudFrontOriginAccessIdentityList -> Bool
$c/= :: CloudFrontOriginAccessIdentityList
-> CloudFrontOriginAccessIdentityList -> Bool
== :: CloudFrontOriginAccessIdentityList
-> CloudFrontOriginAccessIdentityList -> Bool
$c== :: CloudFrontOriginAccessIdentityList
-> CloudFrontOriginAccessIdentityList -> Bool
Prelude.Eq, ReadPrec [CloudFrontOriginAccessIdentityList]
ReadPrec CloudFrontOriginAccessIdentityList
Int -> ReadS CloudFrontOriginAccessIdentityList
ReadS [CloudFrontOriginAccessIdentityList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudFrontOriginAccessIdentityList]
$creadListPrec :: ReadPrec [CloudFrontOriginAccessIdentityList]
readPrec :: ReadPrec CloudFrontOriginAccessIdentityList
$creadPrec :: ReadPrec CloudFrontOriginAccessIdentityList
readList :: ReadS [CloudFrontOriginAccessIdentityList]
$creadList :: ReadS [CloudFrontOriginAccessIdentityList]
readsPrec :: Int -> ReadS CloudFrontOriginAccessIdentityList
$creadsPrec :: Int -> ReadS CloudFrontOriginAccessIdentityList
Prelude.Read, Int -> CloudFrontOriginAccessIdentityList -> ShowS
[CloudFrontOriginAccessIdentityList] -> ShowS
CloudFrontOriginAccessIdentityList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudFrontOriginAccessIdentityList] -> ShowS
$cshowList :: [CloudFrontOriginAccessIdentityList] -> ShowS
show :: CloudFrontOriginAccessIdentityList -> String
$cshow :: CloudFrontOriginAccessIdentityList -> String
showsPrec :: Int -> CloudFrontOriginAccessIdentityList -> ShowS
$cshowsPrec :: Int -> CloudFrontOriginAccessIdentityList -> ShowS
Prelude.Show, forall x.
Rep CloudFrontOriginAccessIdentityList x
-> CloudFrontOriginAccessIdentityList
forall x.
CloudFrontOriginAccessIdentityList
-> Rep CloudFrontOriginAccessIdentityList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CloudFrontOriginAccessIdentityList x
-> CloudFrontOriginAccessIdentityList
$cfrom :: forall x.
CloudFrontOriginAccessIdentityList
-> Rep CloudFrontOriginAccessIdentityList x
Prelude.Generic)

-- |
-- Create a value of 'CloudFrontOriginAccessIdentityList' 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', 'cloudFrontOriginAccessIdentityList_items' - A complex type that contains one @CloudFrontOriginAccessIdentitySummary@
-- element for each origin access identity that was created by the current
-- Amazon Web Services account.
--
-- 'nextMarker', 'cloudFrontOriginAccessIdentityList_nextMarker' - If @IsTruncated@ is @true@, this element is present and contains the
-- value you can use for the @Marker@ request parameter to continue listing
-- your origin access identities where they left off.
--
-- 'marker', 'cloudFrontOriginAccessIdentityList_marker' - Use this when paginating results to indicate where to begin in your list
-- of origin access identities. The results include identities in the list
-- that occur after the marker. To get the next page of results, set the
-- @Marker@ to the value of the @NextMarker@ from the current page\'s
-- response (which is also the ID of the last identity on that page).
--
-- 'maxItems', 'cloudFrontOriginAccessIdentityList_maxItems' - The maximum number of origin access identities you want in the response
-- body.
--
-- 'isTruncated', 'cloudFrontOriginAccessIdentityList_isTruncated' - A flag that indicates whether more origin access identities remain to be
-- listed. If your results were truncated, you can make a follow-up
-- pagination request using the @Marker@ request parameter to retrieve more
-- items in the list.
--
-- 'quantity', 'cloudFrontOriginAccessIdentityList_quantity' - The number of CloudFront origin access identities that were created by
-- the current Amazon Web Services account.
newCloudFrontOriginAccessIdentityList ::
  -- | 'marker'
  Prelude.Text ->
  -- | 'maxItems'
  Prelude.Int ->
  -- | 'isTruncated'
  Prelude.Bool ->
  -- | 'quantity'
  Prelude.Int ->
  CloudFrontOriginAccessIdentityList
newCloudFrontOriginAccessIdentityList :: Text -> Int -> Bool -> Int -> CloudFrontOriginAccessIdentityList
newCloudFrontOriginAccessIdentityList
  Text
pMarker_
  Int
pMaxItems_
  Bool
pIsTruncated_
  Int
pQuantity_ =
    CloudFrontOriginAccessIdentityList'
      { $sel:items:CloudFrontOriginAccessIdentityList' :: Maybe [CloudFrontOriginAccessIdentitySummary]
items =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextMarker:CloudFrontOriginAccessIdentityList' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
        $sel:marker:CloudFrontOriginAccessIdentityList' :: Text
marker = Text
pMarker_,
        $sel:maxItems:CloudFrontOriginAccessIdentityList' :: Int
maxItems = Int
pMaxItems_,
        $sel:isTruncated:CloudFrontOriginAccessIdentityList' :: Bool
isTruncated = Bool
pIsTruncated_,
        $sel:quantity:CloudFrontOriginAccessIdentityList' :: Int
quantity = Int
pQuantity_
      }

-- | A complex type that contains one @CloudFrontOriginAccessIdentitySummary@
-- element for each origin access identity that was created by the current
-- Amazon Web Services account.
cloudFrontOriginAccessIdentityList_items :: Lens.Lens' CloudFrontOriginAccessIdentityList (Prelude.Maybe [CloudFrontOriginAccessIdentitySummary])
cloudFrontOriginAccessIdentityList_items :: Lens'
  CloudFrontOriginAccessIdentityList
  (Maybe [CloudFrontOriginAccessIdentitySummary])
cloudFrontOriginAccessIdentityList_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentityList' {Maybe [CloudFrontOriginAccessIdentitySummary]
items :: Maybe [CloudFrontOriginAccessIdentitySummary]
$sel:items:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList
-> Maybe [CloudFrontOriginAccessIdentitySummary]
items} -> Maybe [CloudFrontOriginAccessIdentitySummary]
items) (\s :: CloudFrontOriginAccessIdentityList
s@CloudFrontOriginAccessIdentityList' {} Maybe [CloudFrontOriginAccessIdentitySummary]
a -> CloudFrontOriginAccessIdentityList
s {$sel:items:CloudFrontOriginAccessIdentityList' :: Maybe [CloudFrontOriginAccessIdentitySummary]
items = Maybe [CloudFrontOriginAccessIdentitySummary]
a} :: CloudFrontOriginAccessIdentityList) 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 @IsTruncated@ is @true@, this element is present and contains the
-- value you can use for the @Marker@ request parameter to continue listing
-- your origin access identities where they left off.
cloudFrontOriginAccessIdentityList_nextMarker :: Lens.Lens' CloudFrontOriginAccessIdentityList (Prelude.Maybe Prelude.Text)
cloudFrontOriginAccessIdentityList_nextMarker :: Lens' CloudFrontOriginAccessIdentityList (Maybe Text)
cloudFrontOriginAccessIdentityList_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentityList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: CloudFrontOriginAccessIdentityList
s@CloudFrontOriginAccessIdentityList' {} Maybe Text
a -> CloudFrontOriginAccessIdentityList
s {$sel:nextMarker:CloudFrontOriginAccessIdentityList' :: Maybe Text
nextMarker = Maybe Text
a} :: CloudFrontOriginAccessIdentityList)

-- | Use this when paginating results to indicate where to begin in your list
-- of origin access identities. The results include identities in the list
-- that occur after the marker. To get the next page of results, set the
-- @Marker@ to the value of the @NextMarker@ from the current page\'s
-- response (which is also the ID of the last identity on that page).
cloudFrontOriginAccessIdentityList_marker :: Lens.Lens' CloudFrontOriginAccessIdentityList Prelude.Text
cloudFrontOriginAccessIdentityList_marker :: Lens' CloudFrontOriginAccessIdentityList Text
cloudFrontOriginAccessIdentityList_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentityList' {Text
marker :: Text
$sel:marker:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Text
marker} -> Text
marker) (\s :: CloudFrontOriginAccessIdentityList
s@CloudFrontOriginAccessIdentityList' {} Text
a -> CloudFrontOriginAccessIdentityList
s {$sel:marker:CloudFrontOriginAccessIdentityList' :: Text
marker = Text
a} :: CloudFrontOriginAccessIdentityList)

-- | The maximum number of origin access identities you want in the response
-- body.
cloudFrontOriginAccessIdentityList_maxItems :: Lens.Lens' CloudFrontOriginAccessIdentityList Prelude.Int
cloudFrontOriginAccessIdentityList_maxItems :: Lens' CloudFrontOriginAccessIdentityList Int
cloudFrontOriginAccessIdentityList_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentityList' {Int
maxItems :: Int
$sel:maxItems:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Int
maxItems} -> Int
maxItems) (\s :: CloudFrontOriginAccessIdentityList
s@CloudFrontOriginAccessIdentityList' {} Int
a -> CloudFrontOriginAccessIdentityList
s {$sel:maxItems:CloudFrontOriginAccessIdentityList' :: Int
maxItems = Int
a} :: CloudFrontOriginAccessIdentityList)

-- | A flag that indicates whether more origin access identities remain to be
-- listed. If your results were truncated, you can make a follow-up
-- pagination request using the @Marker@ request parameter to retrieve more
-- items in the list.
cloudFrontOriginAccessIdentityList_isTruncated :: Lens.Lens' CloudFrontOriginAccessIdentityList Prelude.Bool
cloudFrontOriginAccessIdentityList_isTruncated :: Lens' CloudFrontOriginAccessIdentityList Bool
cloudFrontOriginAccessIdentityList_isTruncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentityList' {Bool
isTruncated :: Bool
$sel:isTruncated:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Bool
isTruncated} -> Bool
isTruncated) (\s :: CloudFrontOriginAccessIdentityList
s@CloudFrontOriginAccessIdentityList' {} Bool
a -> CloudFrontOriginAccessIdentityList
s {$sel:isTruncated:CloudFrontOriginAccessIdentityList' :: Bool
isTruncated = Bool
a} :: CloudFrontOriginAccessIdentityList)

-- | The number of CloudFront origin access identities that were created by
-- the current Amazon Web Services account.
cloudFrontOriginAccessIdentityList_quantity :: Lens.Lens' CloudFrontOriginAccessIdentityList Prelude.Int
cloudFrontOriginAccessIdentityList_quantity :: Lens' CloudFrontOriginAccessIdentityList Int
cloudFrontOriginAccessIdentityList_quantity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFrontOriginAccessIdentityList' {Int
quantity :: Int
$sel:quantity:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Int
quantity} -> Int
quantity) (\s :: CloudFrontOriginAccessIdentityList
s@CloudFrontOriginAccessIdentityList' {} Int
a -> CloudFrontOriginAccessIdentityList
s {$sel:quantity:CloudFrontOriginAccessIdentityList' :: Int
quantity = Int
a} :: CloudFrontOriginAccessIdentityList)

instance
  Data.FromXML
    CloudFrontOriginAccessIdentityList
  where
  parseXML :: [Node] -> Either String CloudFrontOriginAccessIdentityList
parseXML [Node]
x =
    Maybe [CloudFrontOriginAccessIdentitySummary]
-> Maybe Text
-> Text
-> Int
-> Bool
-> Int
-> CloudFrontOriginAccessIdentityList
CloudFrontOriginAccessIdentityList'
      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
"CloudFrontOriginAccessIdentitySummary"
                        )
                  )
      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
"Marker")
      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
"IsTruncated")
      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
    CloudFrontOriginAccessIdentityList
  where
  hashWithSalt :: Int -> CloudFrontOriginAccessIdentityList -> Int
hashWithSalt
    Int
_salt
    CloudFrontOriginAccessIdentityList' {Bool
Int
Maybe [CloudFrontOriginAccessIdentitySummary]
Maybe Text
Text
quantity :: Int
isTruncated :: Bool
maxItems :: Int
marker :: Text
nextMarker :: Maybe Text
items :: Maybe [CloudFrontOriginAccessIdentitySummary]
$sel:quantity:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Int
$sel:isTruncated:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Bool
$sel:maxItems:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Int
$sel:marker:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Text
$sel:nextMarker:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList -> Maybe Text
$sel:items:CloudFrontOriginAccessIdentityList' :: CloudFrontOriginAccessIdentityList
-> Maybe [CloudFrontOriginAccessIdentitySummary]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CloudFrontOriginAccessIdentitySummary]
items
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
marker
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
maxItems
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
isTruncated
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
quantity

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