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

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

-- | Provides information about origin groups that are associated with the
-- distribution.
--
-- /See:/ 'newAwsCloudFrontDistributionOriginGroups' smart constructor.
data AwsCloudFrontDistributionOriginGroups = AwsCloudFrontDistributionOriginGroups'
  { -- | The list of origin groups.
    AwsCloudFrontDistributionOriginGroups
-> Maybe [AwsCloudFrontDistributionOriginGroup]
items :: Prelude.Maybe [AwsCloudFrontDistributionOriginGroup]
  }
  deriving (AwsCloudFrontDistributionOriginGroups
-> AwsCloudFrontDistributionOriginGroups -> Bool
(AwsCloudFrontDistributionOriginGroups
 -> AwsCloudFrontDistributionOriginGroups -> Bool)
-> (AwsCloudFrontDistributionOriginGroups
    -> AwsCloudFrontDistributionOriginGroups -> Bool)
-> Eq AwsCloudFrontDistributionOriginGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCloudFrontDistributionOriginGroups
-> AwsCloudFrontDistributionOriginGroups -> Bool
$c/= :: AwsCloudFrontDistributionOriginGroups
-> AwsCloudFrontDistributionOriginGroups -> Bool
== :: AwsCloudFrontDistributionOriginGroups
-> AwsCloudFrontDistributionOriginGroups -> Bool
$c== :: AwsCloudFrontDistributionOriginGroups
-> AwsCloudFrontDistributionOriginGroups -> Bool
Prelude.Eq, ReadPrec [AwsCloudFrontDistributionOriginGroups]
ReadPrec AwsCloudFrontDistributionOriginGroups
Int -> ReadS AwsCloudFrontDistributionOriginGroups
ReadS [AwsCloudFrontDistributionOriginGroups]
(Int -> ReadS AwsCloudFrontDistributionOriginGroups)
-> ReadS [AwsCloudFrontDistributionOriginGroups]
-> ReadPrec AwsCloudFrontDistributionOriginGroups
-> ReadPrec [AwsCloudFrontDistributionOriginGroups]
-> Read AwsCloudFrontDistributionOriginGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCloudFrontDistributionOriginGroups]
$creadListPrec :: ReadPrec [AwsCloudFrontDistributionOriginGroups]
readPrec :: ReadPrec AwsCloudFrontDistributionOriginGroups
$creadPrec :: ReadPrec AwsCloudFrontDistributionOriginGroups
readList :: ReadS [AwsCloudFrontDistributionOriginGroups]
$creadList :: ReadS [AwsCloudFrontDistributionOriginGroups]
readsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginGroups
$creadsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginGroups
Prelude.Read, Int -> AwsCloudFrontDistributionOriginGroups -> ShowS
[AwsCloudFrontDistributionOriginGroups] -> ShowS
AwsCloudFrontDistributionOriginGroups -> String
(Int -> AwsCloudFrontDistributionOriginGroups -> ShowS)
-> (AwsCloudFrontDistributionOriginGroups -> String)
-> ([AwsCloudFrontDistributionOriginGroups] -> ShowS)
-> Show AwsCloudFrontDistributionOriginGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCloudFrontDistributionOriginGroups] -> ShowS
$cshowList :: [AwsCloudFrontDistributionOriginGroups] -> ShowS
show :: AwsCloudFrontDistributionOriginGroups -> String
$cshow :: AwsCloudFrontDistributionOriginGroups -> String
showsPrec :: Int -> AwsCloudFrontDistributionOriginGroups -> ShowS
$cshowsPrec :: Int -> AwsCloudFrontDistributionOriginGroups -> ShowS
Prelude.Show, (forall x.
 AwsCloudFrontDistributionOriginGroups
 -> Rep AwsCloudFrontDistributionOriginGroups x)
-> (forall x.
    Rep AwsCloudFrontDistributionOriginGroups x
    -> AwsCloudFrontDistributionOriginGroups)
-> Generic AwsCloudFrontDistributionOriginGroups
forall x.
Rep AwsCloudFrontDistributionOriginGroups x
-> AwsCloudFrontDistributionOriginGroups
forall x.
AwsCloudFrontDistributionOriginGroups
-> Rep AwsCloudFrontDistributionOriginGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCloudFrontDistributionOriginGroups x
-> AwsCloudFrontDistributionOriginGroups
$cfrom :: forall x.
AwsCloudFrontDistributionOriginGroups
-> Rep AwsCloudFrontDistributionOriginGroups x
Prelude.Generic)

-- |
-- Create a value of 'AwsCloudFrontDistributionOriginGroups' 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', 'awsCloudFrontDistributionOriginGroups_items' - The list of origin groups.
newAwsCloudFrontDistributionOriginGroups ::
  AwsCloudFrontDistributionOriginGroups
newAwsCloudFrontDistributionOriginGroups :: AwsCloudFrontDistributionOriginGroups
newAwsCloudFrontDistributionOriginGroups =
  AwsCloudFrontDistributionOriginGroups' :: Maybe [AwsCloudFrontDistributionOriginGroup]
-> AwsCloudFrontDistributionOriginGroups
AwsCloudFrontDistributionOriginGroups'
    { $sel:items:AwsCloudFrontDistributionOriginGroups' :: Maybe [AwsCloudFrontDistributionOriginGroup]
items =
        Maybe [AwsCloudFrontDistributionOriginGroup]
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of origin groups.
awsCloudFrontDistributionOriginGroups_items :: Lens.Lens' AwsCloudFrontDistributionOriginGroups (Prelude.Maybe [AwsCloudFrontDistributionOriginGroup])
awsCloudFrontDistributionOriginGroups_items :: (Maybe [AwsCloudFrontDistributionOriginGroup]
 -> f (Maybe [AwsCloudFrontDistributionOriginGroup]))
-> AwsCloudFrontDistributionOriginGroups
-> f AwsCloudFrontDistributionOriginGroups
awsCloudFrontDistributionOriginGroups_items = (AwsCloudFrontDistributionOriginGroups
 -> Maybe [AwsCloudFrontDistributionOriginGroup])
-> (AwsCloudFrontDistributionOriginGroups
    -> Maybe [AwsCloudFrontDistributionOriginGroup]
    -> AwsCloudFrontDistributionOriginGroups)
-> Lens
     AwsCloudFrontDistributionOriginGroups
     AwsCloudFrontDistributionOriginGroups
     (Maybe [AwsCloudFrontDistributionOriginGroup])
     (Maybe [AwsCloudFrontDistributionOriginGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginGroups' {Maybe [AwsCloudFrontDistributionOriginGroup]
items :: Maybe [AwsCloudFrontDistributionOriginGroup]
$sel:items:AwsCloudFrontDistributionOriginGroups' :: AwsCloudFrontDistributionOriginGroups
-> Maybe [AwsCloudFrontDistributionOriginGroup]
items} -> Maybe [AwsCloudFrontDistributionOriginGroup]
items) (\s :: AwsCloudFrontDistributionOriginGroups
s@AwsCloudFrontDistributionOriginGroups' {} Maybe [AwsCloudFrontDistributionOriginGroup]
a -> AwsCloudFrontDistributionOriginGroups
s {$sel:items:AwsCloudFrontDistributionOriginGroups' :: Maybe [AwsCloudFrontDistributionOriginGroup]
items = Maybe [AwsCloudFrontDistributionOriginGroup]
a} :: AwsCloudFrontDistributionOriginGroups) ((Maybe [AwsCloudFrontDistributionOriginGroup]
  -> f (Maybe [AwsCloudFrontDistributionOriginGroup]))
 -> AwsCloudFrontDistributionOriginGroups
 -> f AwsCloudFrontDistributionOriginGroups)
-> ((Maybe [AwsCloudFrontDistributionOriginGroup]
     -> f (Maybe [AwsCloudFrontDistributionOriginGroup]))
    -> Maybe [AwsCloudFrontDistributionOriginGroup]
    -> f (Maybe [AwsCloudFrontDistributionOriginGroup]))
-> (Maybe [AwsCloudFrontDistributionOriginGroup]
    -> f (Maybe [AwsCloudFrontDistributionOriginGroup]))
-> AwsCloudFrontDistributionOriginGroups
-> f AwsCloudFrontDistributionOriginGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsCloudFrontDistributionOriginGroup]
  [AwsCloudFrontDistributionOriginGroup]
  [AwsCloudFrontDistributionOriginGroup]
  [AwsCloudFrontDistributionOriginGroup]
-> Iso
     (Maybe [AwsCloudFrontDistributionOriginGroup])
     (Maybe [AwsCloudFrontDistributionOriginGroup])
     (Maybe [AwsCloudFrontDistributionOriginGroup])
     (Maybe [AwsCloudFrontDistributionOriginGroup])
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
  [AwsCloudFrontDistributionOriginGroup]
  [AwsCloudFrontDistributionOriginGroup]
  [AwsCloudFrontDistributionOriginGroup]
  [AwsCloudFrontDistributionOriginGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.Hashable
    AwsCloudFrontDistributionOriginGroups

instance
  Prelude.NFData
    AwsCloudFrontDistributionOriginGroups

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