{-# 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.MediaLive.Types.ArchiveCdnSettings
-- 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.MediaLive.Types.ArchiveCdnSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.ArchiveS3Settings
import qualified Amazonka.Prelude as Prelude

-- | Archive Cdn Settings
--
-- /See:/ 'newArchiveCdnSettings' smart constructor.
data ArchiveCdnSettings = ArchiveCdnSettings'
  { ArchiveCdnSettings -> Maybe ArchiveS3Settings
archiveS3Settings :: Prelude.Maybe ArchiveS3Settings
  }
  deriving (ArchiveCdnSettings -> ArchiveCdnSettings -> Bool
(ArchiveCdnSettings -> ArchiveCdnSettings -> Bool)
-> (ArchiveCdnSettings -> ArchiveCdnSettings -> Bool)
-> Eq ArchiveCdnSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArchiveCdnSettings -> ArchiveCdnSettings -> Bool
$c/= :: ArchiveCdnSettings -> ArchiveCdnSettings -> Bool
== :: ArchiveCdnSettings -> ArchiveCdnSettings -> Bool
$c== :: ArchiveCdnSettings -> ArchiveCdnSettings -> Bool
Prelude.Eq, ReadPrec [ArchiveCdnSettings]
ReadPrec ArchiveCdnSettings
Int -> ReadS ArchiveCdnSettings
ReadS [ArchiveCdnSettings]
(Int -> ReadS ArchiveCdnSettings)
-> ReadS [ArchiveCdnSettings]
-> ReadPrec ArchiveCdnSettings
-> ReadPrec [ArchiveCdnSettings]
-> Read ArchiveCdnSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArchiveCdnSettings]
$creadListPrec :: ReadPrec [ArchiveCdnSettings]
readPrec :: ReadPrec ArchiveCdnSettings
$creadPrec :: ReadPrec ArchiveCdnSettings
readList :: ReadS [ArchiveCdnSettings]
$creadList :: ReadS [ArchiveCdnSettings]
readsPrec :: Int -> ReadS ArchiveCdnSettings
$creadsPrec :: Int -> ReadS ArchiveCdnSettings
Prelude.Read, Int -> ArchiveCdnSettings -> ShowS
[ArchiveCdnSettings] -> ShowS
ArchiveCdnSettings -> String
(Int -> ArchiveCdnSettings -> ShowS)
-> (ArchiveCdnSettings -> String)
-> ([ArchiveCdnSettings] -> ShowS)
-> Show ArchiveCdnSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArchiveCdnSettings] -> ShowS
$cshowList :: [ArchiveCdnSettings] -> ShowS
show :: ArchiveCdnSettings -> String
$cshow :: ArchiveCdnSettings -> String
showsPrec :: Int -> ArchiveCdnSettings -> ShowS
$cshowsPrec :: Int -> ArchiveCdnSettings -> ShowS
Prelude.Show, (forall x. ArchiveCdnSettings -> Rep ArchiveCdnSettings x)
-> (forall x. Rep ArchiveCdnSettings x -> ArchiveCdnSettings)
-> Generic ArchiveCdnSettings
forall x. Rep ArchiveCdnSettings x -> ArchiveCdnSettings
forall x. ArchiveCdnSettings -> Rep ArchiveCdnSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArchiveCdnSettings x -> ArchiveCdnSettings
$cfrom :: forall x. ArchiveCdnSettings -> Rep ArchiveCdnSettings x
Prelude.Generic)

-- |
-- Create a value of 'ArchiveCdnSettings' 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:
--
-- 'archiveS3Settings', 'archiveCdnSettings_archiveS3Settings' - Undocumented member.
newArchiveCdnSettings ::
  ArchiveCdnSettings
newArchiveCdnSettings :: ArchiveCdnSettings
newArchiveCdnSettings =
  ArchiveCdnSettings' :: Maybe ArchiveS3Settings -> ArchiveCdnSettings
ArchiveCdnSettings'
    { $sel:archiveS3Settings:ArchiveCdnSettings' :: Maybe ArchiveS3Settings
archiveS3Settings =
        Maybe ArchiveS3Settings
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
archiveCdnSettings_archiveS3Settings :: Lens.Lens' ArchiveCdnSettings (Prelude.Maybe ArchiveS3Settings)
archiveCdnSettings_archiveS3Settings :: (Maybe ArchiveS3Settings -> f (Maybe ArchiveS3Settings))
-> ArchiveCdnSettings -> f ArchiveCdnSettings
archiveCdnSettings_archiveS3Settings = (ArchiveCdnSettings -> Maybe ArchiveS3Settings)
-> (ArchiveCdnSettings
    -> Maybe ArchiveS3Settings -> ArchiveCdnSettings)
-> Lens
     ArchiveCdnSettings
     ArchiveCdnSettings
     (Maybe ArchiveS3Settings)
     (Maybe ArchiveS3Settings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveCdnSettings' {Maybe ArchiveS3Settings
archiveS3Settings :: Maybe ArchiveS3Settings
$sel:archiveS3Settings:ArchiveCdnSettings' :: ArchiveCdnSettings -> Maybe ArchiveS3Settings
archiveS3Settings} -> Maybe ArchiveS3Settings
archiveS3Settings) (\s :: ArchiveCdnSettings
s@ArchiveCdnSettings' {} Maybe ArchiveS3Settings
a -> ArchiveCdnSettings
s {$sel:archiveS3Settings:ArchiveCdnSettings' :: Maybe ArchiveS3Settings
archiveS3Settings = Maybe ArchiveS3Settings
a} :: ArchiveCdnSettings)

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

instance Prelude.Hashable ArchiveCdnSettings

instance Prelude.NFData ArchiveCdnSettings

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