{-# 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.MediaConvert.Types.DestinationSettings
-- 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.MediaConvert.Types.DestinationSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.S3DestinationSettings
import qualified Amazonka.Prelude as Prelude

-- | Settings associated with the destination. Will vary based on the type of
-- destination
--
-- /See:/ 'newDestinationSettings' smart constructor.
data DestinationSettings = DestinationSettings'
  { -- | Settings associated with S3 destination
    DestinationSettings -> Maybe S3DestinationSettings
s3Settings :: Prelude.Maybe S3DestinationSettings
  }
  deriving (DestinationSettings -> DestinationSettings -> Bool
(DestinationSettings -> DestinationSettings -> Bool)
-> (DestinationSettings -> DestinationSettings -> Bool)
-> Eq DestinationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationSettings -> DestinationSettings -> Bool
$c/= :: DestinationSettings -> DestinationSettings -> Bool
== :: DestinationSettings -> DestinationSettings -> Bool
$c== :: DestinationSettings -> DestinationSettings -> Bool
Prelude.Eq, ReadPrec [DestinationSettings]
ReadPrec DestinationSettings
Int -> ReadS DestinationSettings
ReadS [DestinationSettings]
(Int -> ReadS DestinationSettings)
-> ReadS [DestinationSettings]
-> ReadPrec DestinationSettings
-> ReadPrec [DestinationSettings]
-> Read DestinationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationSettings]
$creadListPrec :: ReadPrec [DestinationSettings]
readPrec :: ReadPrec DestinationSettings
$creadPrec :: ReadPrec DestinationSettings
readList :: ReadS [DestinationSettings]
$creadList :: ReadS [DestinationSettings]
readsPrec :: Int -> ReadS DestinationSettings
$creadsPrec :: Int -> ReadS DestinationSettings
Prelude.Read, Int -> DestinationSettings -> ShowS
[DestinationSettings] -> ShowS
DestinationSettings -> String
(Int -> DestinationSettings -> ShowS)
-> (DestinationSettings -> String)
-> ([DestinationSettings] -> ShowS)
-> Show DestinationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationSettings] -> ShowS
$cshowList :: [DestinationSettings] -> ShowS
show :: DestinationSettings -> String
$cshow :: DestinationSettings -> String
showsPrec :: Int -> DestinationSettings -> ShowS
$cshowsPrec :: Int -> DestinationSettings -> ShowS
Prelude.Show, (forall x. DestinationSettings -> Rep DestinationSettings x)
-> (forall x. Rep DestinationSettings x -> DestinationSettings)
-> Generic DestinationSettings
forall x. Rep DestinationSettings x -> DestinationSettings
forall x. DestinationSettings -> Rep DestinationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationSettings x -> DestinationSettings
$cfrom :: forall x. DestinationSettings -> Rep DestinationSettings x
Prelude.Generic)

-- |
-- Create a value of 'DestinationSettings' 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:
--
-- 's3Settings', 'destinationSettings_s3Settings' - Settings associated with S3 destination
newDestinationSettings ::
  DestinationSettings
newDestinationSettings :: DestinationSettings
newDestinationSettings =
  DestinationSettings' :: Maybe S3DestinationSettings -> DestinationSettings
DestinationSettings' {$sel:s3Settings:DestinationSettings' :: Maybe S3DestinationSettings
s3Settings = Maybe S3DestinationSettings
forall a. Maybe a
Prelude.Nothing}

-- | Settings associated with S3 destination
destinationSettings_s3Settings :: Lens.Lens' DestinationSettings (Prelude.Maybe S3DestinationSettings)
destinationSettings_s3Settings :: (Maybe S3DestinationSettings -> f (Maybe S3DestinationSettings))
-> DestinationSettings -> f DestinationSettings
destinationSettings_s3Settings = (DestinationSettings -> Maybe S3DestinationSettings)
-> (DestinationSettings
    -> Maybe S3DestinationSettings -> DestinationSettings)
-> Lens
     DestinationSettings
     DestinationSettings
     (Maybe S3DestinationSettings)
     (Maybe S3DestinationSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationSettings' {Maybe S3DestinationSettings
s3Settings :: Maybe S3DestinationSettings
$sel:s3Settings:DestinationSettings' :: DestinationSettings -> Maybe S3DestinationSettings
s3Settings} -> Maybe S3DestinationSettings
s3Settings) (\s :: DestinationSettings
s@DestinationSettings' {} Maybe S3DestinationSettings
a -> DestinationSettings
s {$sel:s3Settings:DestinationSettings' :: Maybe S3DestinationSettings
s3Settings = Maybe S3DestinationSettings
a} :: DestinationSettings)

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

instance Prelude.Hashable DestinationSettings

instance Prelude.NFData DestinationSettings

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