{-# 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.SecurityHub.Types.AwsCloudFrontDistributionCacheBehaviors
-- 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)
module Amazonka.SecurityHub.Types.AwsCloudFrontDistributionCacheBehaviors where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsCloudFrontDistributionCacheBehavior

-- | Provides information about caching for the distribution.
--
-- /See:/ 'newAwsCloudFrontDistributionCacheBehaviors' smart constructor.
data AwsCloudFrontDistributionCacheBehaviors = AwsCloudFrontDistributionCacheBehaviors'
  { -- | The cache behaviors for the distribution.
    AwsCloudFrontDistributionCacheBehaviors
-> Maybe [AwsCloudFrontDistributionCacheBehavior]
items :: Prelude.Maybe [AwsCloudFrontDistributionCacheBehavior]
  }
  deriving (AwsCloudFrontDistributionCacheBehaviors
-> AwsCloudFrontDistributionCacheBehaviors -> Bool
(AwsCloudFrontDistributionCacheBehaviors
 -> AwsCloudFrontDistributionCacheBehaviors -> Bool)
-> (AwsCloudFrontDistributionCacheBehaviors
    -> AwsCloudFrontDistributionCacheBehaviors -> Bool)
-> Eq AwsCloudFrontDistributionCacheBehaviors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCloudFrontDistributionCacheBehaviors
-> AwsCloudFrontDistributionCacheBehaviors -> Bool
$c/= :: AwsCloudFrontDistributionCacheBehaviors
-> AwsCloudFrontDistributionCacheBehaviors -> Bool
== :: AwsCloudFrontDistributionCacheBehaviors
-> AwsCloudFrontDistributionCacheBehaviors -> Bool
$c== :: AwsCloudFrontDistributionCacheBehaviors
-> AwsCloudFrontDistributionCacheBehaviors -> Bool
Prelude.Eq, ReadPrec [AwsCloudFrontDistributionCacheBehaviors]
ReadPrec AwsCloudFrontDistributionCacheBehaviors
Int -> ReadS AwsCloudFrontDistributionCacheBehaviors
ReadS [AwsCloudFrontDistributionCacheBehaviors]
(Int -> ReadS AwsCloudFrontDistributionCacheBehaviors)
-> ReadS [AwsCloudFrontDistributionCacheBehaviors]
-> ReadPrec AwsCloudFrontDistributionCacheBehaviors
-> ReadPrec [AwsCloudFrontDistributionCacheBehaviors]
-> Read AwsCloudFrontDistributionCacheBehaviors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCloudFrontDistributionCacheBehaviors]
$creadListPrec :: ReadPrec [AwsCloudFrontDistributionCacheBehaviors]
readPrec :: ReadPrec AwsCloudFrontDistributionCacheBehaviors
$creadPrec :: ReadPrec AwsCloudFrontDistributionCacheBehaviors
readList :: ReadS [AwsCloudFrontDistributionCacheBehaviors]
$creadList :: ReadS [AwsCloudFrontDistributionCacheBehaviors]
readsPrec :: Int -> ReadS AwsCloudFrontDistributionCacheBehaviors
$creadsPrec :: Int -> ReadS AwsCloudFrontDistributionCacheBehaviors
Prelude.Read, Int -> AwsCloudFrontDistributionCacheBehaviors -> ShowS
[AwsCloudFrontDistributionCacheBehaviors] -> ShowS
AwsCloudFrontDistributionCacheBehaviors -> String
(Int -> AwsCloudFrontDistributionCacheBehaviors -> ShowS)
-> (AwsCloudFrontDistributionCacheBehaviors -> String)
-> ([AwsCloudFrontDistributionCacheBehaviors] -> ShowS)
-> Show AwsCloudFrontDistributionCacheBehaviors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCloudFrontDistributionCacheBehaviors] -> ShowS
$cshowList :: [AwsCloudFrontDistributionCacheBehaviors] -> ShowS
show :: AwsCloudFrontDistributionCacheBehaviors -> String
$cshow :: AwsCloudFrontDistributionCacheBehaviors -> String
showsPrec :: Int -> AwsCloudFrontDistributionCacheBehaviors -> ShowS
$cshowsPrec :: Int -> AwsCloudFrontDistributionCacheBehaviors -> ShowS
Prelude.Show, (forall x.
 AwsCloudFrontDistributionCacheBehaviors
 -> Rep AwsCloudFrontDistributionCacheBehaviors x)
-> (forall x.
    Rep AwsCloudFrontDistributionCacheBehaviors x
    -> AwsCloudFrontDistributionCacheBehaviors)
-> Generic AwsCloudFrontDistributionCacheBehaviors
forall x.
Rep AwsCloudFrontDistributionCacheBehaviors x
-> AwsCloudFrontDistributionCacheBehaviors
forall x.
AwsCloudFrontDistributionCacheBehaviors
-> Rep AwsCloudFrontDistributionCacheBehaviors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCloudFrontDistributionCacheBehaviors x
-> AwsCloudFrontDistributionCacheBehaviors
$cfrom :: forall x.
AwsCloudFrontDistributionCacheBehaviors
-> Rep AwsCloudFrontDistributionCacheBehaviors x
Prelude.Generic)

-- |
-- Create a value of 'AwsCloudFrontDistributionCacheBehaviors' 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', 'awsCloudFrontDistributionCacheBehaviors_items' - The cache behaviors for the distribution.
newAwsCloudFrontDistributionCacheBehaviors ::
  AwsCloudFrontDistributionCacheBehaviors
newAwsCloudFrontDistributionCacheBehaviors :: AwsCloudFrontDistributionCacheBehaviors
newAwsCloudFrontDistributionCacheBehaviors =
  AwsCloudFrontDistributionCacheBehaviors' :: Maybe [AwsCloudFrontDistributionCacheBehavior]
-> AwsCloudFrontDistributionCacheBehaviors
AwsCloudFrontDistributionCacheBehaviors'
    { $sel:items:AwsCloudFrontDistributionCacheBehaviors' :: Maybe [AwsCloudFrontDistributionCacheBehavior]
items =
        Maybe [AwsCloudFrontDistributionCacheBehavior]
forall a. Maybe a
Prelude.Nothing
    }

-- | The cache behaviors for the distribution.
awsCloudFrontDistributionCacheBehaviors_items :: Lens.Lens' AwsCloudFrontDistributionCacheBehaviors (Prelude.Maybe [AwsCloudFrontDistributionCacheBehavior])
awsCloudFrontDistributionCacheBehaviors_items :: (Maybe [AwsCloudFrontDistributionCacheBehavior]
 -> f (Maybe [AwsCloudFrontDistributionCacheBehavior]))
-> AwsCloudFrontDistributionCacheBehaviors
-> f AwsCloudFrontDistributionCacheBehaviors
awsCloudFrontDistributionCacheBehaviors_items = (AwsCloudFrontDistributionCacheBehaviors
 -> Maybe [AwsCloudFrontDistributionCacheBehavior])
-> (AwsCloudFrontDistributionCacheBehaviors
    -> Maybe [AwsCloudFrontDistributionCacheBehavior]
    -> AwsCloudFrontDistributionCacheBehaviors)
-> Lens
     AwsCloudFrontDistributionCacheBehaviors
     AwsCloudFrontDistributionCacheBehaviors
     (Maybe [AwsCloudFrontDistributionCacheBehavior])
     (Maybe [AwsCloudFrontDistributionCacheBehavior])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionCacheBehaviors' {Maybe [AwsCloudFrontDistributionCacheBehavior]
items :: Maybe [AwsCloudFrontDistributionCacheBehavior]
$sel:items:AwsCloudFrontDistributionCacheBehaviors' :: AwsCloudFrontDistributionCacheBehaviors
-> Maybe [AwsCloudFrontDistributionCacheBehavior]
items} -> Maybe [AwsCloudFrontDistributionCacheBehavior]
items) (\s :: AwsCloudFrontDistributionCacheBehaviors
s@AwsCloudFrontDistributionCacheBehaviors' {} Maybe [AwsCloudFrontDistributionCacheBehavior]
a -> AwsCloudFrontDistributionCacheBehaviors
s {$sel:items:AwsCloudFrontDistributionCacheBehaviors' :: Maybe [AwsCloudFrontDistributionCacheBehavior]
items = Maybe [AwsCloudFrontDistributionCacheBehavior]
a} :: AwsCloudFrontDistributionCacheBehaviors) ((Maybe [AwsCloudFrontDistributionCacheBehavior]
  -> f (Maybe [AwsCloudFrontDistributionCacheBehavior]))
 -> AwsCloudFrontDistributionCacheBehaviors
 -> f AwsCloudFrontDistributionCacheBehaviors)
-> ((Maybe [AwsCloudFrontDistributionCacheBehavior]
     -> f (Maybe [AwsCloudFrontDistributionCacheBehavior]))
    -> Maybe [AwsCloudFrontDistributionCacheBehavior]
    -> f (Maybe [AwsCloudFrontDistributionCacheBehavior]))
-> (Maybe [AwsCloudFrontDistributionCacheBehavior]
    -> f (Maybe [AwsCloudFrontDistributionCacheBehavior]))
-> AwsCloudFrontDistributionCacheBehaviors
-> f AwsCloudFrontDistributionCacheBehaviors
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsCloudFrontDistributionCacheBehavior]
  [AwsCloudFrontDistributionCacheBehavior]
  [AwsCloudFrontDistributionCacheBehavior]
  [AwsCloudFrontDistributionCacheBehavior]
-> Iso
     (Maybe [AwsCloudFrontDistributionCacheBehavior])
     (Maybe [AwsCloudFrontDistributionCacheBehavior])
     (Maybe [AwsCloudFrontDistributionCacheBehavior])
     (Maybe [AwsCloudFrontDistributionCacheBehavior])
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
  [AwsCloudFrontDistributionCacheBehavior]
  [AwsCloudFrontDistributionCacheBehavior]
  [AwsCloudFrontDistributionCacheBehavior]
  [AwsCloudFrontDistributionCacheBehavior]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AwsCloudFrontDistributionCacheBehaviors
  where
  parseJSON :: Value -> Parser AwsCloudFrontDistributionCacheBehaviors
parseJSON =
    String
-> (Object -> Parser AwsCloudFrontDistributionCacheBehaviors)
-> Value
-> Parser AwsCloudFrontDistributionCacheBehaviors
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCloudFrontDistributionCacheBehaviors"
      ( \Object
x ->
          Maybe [AwsCloudFrontDistributionCacheBehavior]
-> AwsCloudFrontDistributionCacheBehaviors
AwsCloudFrontDistributionCacheBehaviors'
            (Maybe [AwsCloudFrontDistributionCacheBehavior]
 -> AwsCloudFrontDistributionCacheBehaviors)
-> Parser (Maybe [AwsCloudFrontDistributionCacheBehavior])
-> Parser AwsCloudFrontDistributionCacheBehaviors
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser (Maybe (Maybe [AwsCloudFrontDistributionCacheBehavior]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Items" Parser (Maybe (Maybe [AwsCloudFrontDistributionCacheBehavior]))
-> Maybe [AwsCloudFrontDistributionCacheBehavior]
-> Parser (Maybe [AwsCloudFrontDistributionCacheBehavior])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsCloudFrontDistributionCacheBehavior]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    AwsCloudFrontDistributionCacheBehaviors

instance
  Prelude.NFData
    AwsCloudFrontDistributionCacheBehaviors

instance
  Core.ToJSON
    AwsCloudFrontDistributionCacheBehaviors
  where
  toJSON :: AwsCloudFrontDistributionCacheBehaviors -> Value
toJSON AwsCloudFrontDistributionCacheBehaviors' {Maybe [AwsCloudFrontDistributionCacheBehavior]
items :: Maybe [AwsCloudFrontDistributionCacheBehavior]
$sel:items:AwsCloudFrontDistributionCacheBehaviors' :: AwsCloudFrontDistributionCacheBehaviors
-> Maybe [AwsCloudFrontDistributionCacheBehavior]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Items" Text -> [AwsCloudFrontDistributionCacheBehavior] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AwsCloudFrontDistributionCacheBehavior] -> Pair)
-> Maybe [AwsCloudFrontDistributionCacheBehavior] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsCloudFrontDistributionCacheBehavior]
items]
      )