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

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

-- | Provides information about when an origin group fails over.
--
-- /See:/ 'newAwsCloudFrontDistributionOriginGroupFailover' smart constructor.
data AwsCloudFrontDistributionOriginGroupFailover = AwsCloudFrontDistributionOriginGroupFailover'
  { -- | Information about the status codes that cause an origin group to fail
    -- over.
    AwsCloudFrontDistributionOriginGroupFailover
-> Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
statusCodes :: Prelude.Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
  }
  deriving (AwsCloudFrontDistributionOriginGroupFailover
-> AwsCloudFrontDistributionOriginGroupFailover -> Bool
(AwsCloudFrontDistributionOriginGroupFailover
 -> AwsCloudFrontDistributionOriginGroupFailover -> Bool)
-> (AwsCloudFrontDistributionOriginGroupFailover
    -> AwsCloudFrontDistributionOriginGroupFailover -> Bool)
-> Eq AwsCloudFrontDistributionOriginGroupFailover
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsCloudFrontDistributionOriginGroupFailover
-> AwsCloudFrontDistributionOriginGroupFailover -> Bool
$c/= :: AwsCloudFrontDistributionOriginGroupFailover
-> AwsCloudFrontDistributionOriginGroupFailover -> Bool
== :: AwsCloudFrontDistributionOriginGroupFailover
-> AwsCloudFrontDistributionOriginGroupFailover -> Bool
$c== :: AwsCloudFrontDistributionOriginGroupFailover
-> AwsCloudFrontDistributionOriginGroupFailover -> Bool
Prelude.Eq, ReadPrec [AwsCloudFrontDistributionOriginGroupFailover]
ReadPrec AwsCloudFrontDistributionOriginGroupFailover
Int -> ReadS AwsCloudFrontDistributionOriginGroupFailover
ReadS [AwsCloudFrontDistributionOriginGroupFailover]
(Int -> ReadS AwsCloudFrontDistributionOriginGroupFailover)
-> ReadS [AwsCloudFrontDistributionOriginGroupFailover]
-> ReadPrec AwsCloudFrontDistributionOriginGroupFailover
-> ReadPrec [AwsCloudFrontDistributionOriginGroupFailover]
-> Read AwsCloudFrontDistributionOriginGroupFailover
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsCloudFrontDistributionOriginGroupFailover]
$creadListPrec :: ReadPrec [AwsCloudFrontDistributionOriginGroupFailover]
readPrec :: ReadPrec AwsCloudFrontDistributionOriginGroupFailover
$creadPrec :: ReadPrec AwsCloudFrontDistributionOriginGroupFailover
readList :: ReadS [AwsCloudFrontDistributionOriginGroupFailover]
$creadList :: ReadS [AwsCloudFrontDistributionOriginGroupFailover]
readsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginGroupFailover
$creadsPrec :: Int -> ReadS AwsCloudFrontDistributionOriginGroupFailover
Prelude.Read, Int -> AwsCloudFrontDistributionOriginGroupFailover -> ShowS
[AwsCloudFrontDistributionOriginGroupFailover] -> ShowS
AwsCloudFrontDistributionOriginGroupFailover -> String
(Int -> AwsCloudFrontDistributionOriginGroupFailover -> ShowS)
-> (AwsCloudFrontDistributionOriginGroupFailover -> String)
-> ([AwsCloudFrontDistributionOriginGroupFailover] -> ShowS)
-> Show AwsCloudFrontDistributionOriginGroupFailover
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsCloudFrontDistributionOriginGroupFailover] -> ShowS
$cshowList :: [AwsCloudFrontDistributionOriginGroupFailover] -> ShowS
show :: AwsCloudFrontDistributionOriginGroupFailover -> String
$cshow :: AwsCloudFrontDistributionOriginGroupFailover -> String
showsPrec :: Int -> AwsCloudFrontDistributionOriginGroupFailover -> ShowS
$cshowsPrec :: Int -> AwsCloudFrontDistributionOriginGroupFailover -> ShowS
Prelude.Show, (forall x.
 AwsCloudFrontDistributionOriginGroupFailover
 -> Rep AwsCloudFrontDistributionOriginGroupFailover x)
-> (forall x.
    Rep AwsCloudFrontDistributionOriginGroupFailover x
    -> AwsCloudFrontDistributionOriginGroupFailover)
-> Generic AwsCloudFrontDistributionOriginGroupFailover
forall x.
Rep AwsCloudFrontDistributionOriginGroupFailover x
-> AwsCloudFrontDistributionOriginGroupFailover
forall x.
AwsCloudFrontDistributionOriginGroupFailover
-> Rep AwsCloudFrontDistributionOriginGroupFailover x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsCloudFrontDistributionOriginGroupFailover x
-> AwsCloudFrontDistributionOriginGroupFailover
$cfrom :: forall x.
AwsCloudFrontDistributionOriginGroupFailover
-> Rep AwsCloudFrontDistributionOriginGroupFailover x
Prelude.Generic)

-- |
-- Create a value of 'AwsCloudFrontDistributionOriginGroupFailover' 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:
--
-- 'statusCodes', 'awsCloudFrontDistributionOriginGroupFailover_statusCodes' - Information about the status codes that cause an origin group to fail
-- over.
newAwsCloudFrontDistributionOriginGroupFailover ::
  AwsCloudFrontDistributionOriginGroupFailover
newAwsCloudFrontDistributionOriginGroupFailover :: AwsCloudFrontDistributionOriginGroupFailover
newAwsCloudFrontDistributionOriginGroupFailover =
  AwsCloudFrontDistributionOriginGroupFailover' :: Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
-> AwsCloudFrontDistributionOriginGroupFailover
AwsCloudFrontDistributionOriginGroupFailover'
    { $sel:statusCodes:AwsCloudFrontDistributionOriginGroupFailover' :: Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
statusCodes =
        Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the status codes that cause an origin group to fail
-- over.
awsCloudFrontDistributionOriginGroupFailover_statusCodes :: Lens.Lens' AwsCloudFrontDistributionOriginGroupFailover (Prelude.Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes)
awsCloudFrontDistributionOriginGroupFailover_statusCodes :: (Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
 -> f (Maybe
         AwsCloudFrontDistributionOriginGroupFailoverStatusCodes))
-> AwsCloudFrontDistributionOriginGroupFailover
-> f AwsCloudFrontDistributionOriginGroupFailover
awsCloudFrontDistributionOriginGroupFailover_statusCodes = (AwsCloudFrontDistributionOriginGroupFailover
 -> Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes)
-> (AwsCloudFrontDistributionOriginGroupFailover
    -> Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
    -> AwsCloudFrontDistributionOriginGroupFailover)
-> Lens
     AwsCloudFrontDistributionOriginGroupFailover
     AwsCloudFrontDistributionOriginGroupFailover
     (Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes)
     (Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsCloudFrontDistributionOriginGroupFailover' {Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
statusCodes :: Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
$sel:statusCodes:AwsCloudFrontDistributionOriginGroupFailover' :: AwsCloudFrontDistributionOriginGroupFailover
-> Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
statusCodes} -> Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
statusCodes) (\s :: AwsCloudFrontDistributionOriginGroupFailover
s@AwsCloudFrontDistributionOriginGroupFailover' {} Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
a -> AwsCloudFrontDistributionOriginGroupFailover
s {$sel:statusCodes:AwsCloudFrontDistributionOriginGroupFailover' :: Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
statusCodes = Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
a} :: AwsCloudFrontDistributionOriginGroupFailover)

instance
  Core.FromJSON
    AwsCloudFrontDistributionOriginGroupFailover
  where
  parseJSON :: Value -> Parser AwsCloudFrontDistributionOriginGroupFailover
parseJSON =
    String
-> (Object -> Parser AwsCloudFrontDistributionOriginGroupFailover)
-> Value
-> Parser AwsCloudFrontDistributionOriginGroupFailover
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsCloudFrontDistributionOriginGroupFailover"
      ( \Object
x ->
          Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
-> AwsCloudFrontDistributionOriginGroupFailover
AwsCloudFrontDistributionOriginGroupFailover'
            (Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes
 -> AwsCloudFrontDistributionOriginGroupFailover)
-> Parser
     (Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes)
-> Parser AwsCloudFrontDistributionOriginGroupFailover
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe AwsCloudFrontDistributionOriginGroupFailoverStatusCodes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusCodes")
      )

instance
  Prelude.Hashable
    AwsCloudFrontDistributionOriginGroupFailover

instance
  Prelude.NFData
    AwsCloudFrontDistributionOriginGroupFailover

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