{-# 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.IVS.Types.DestinationConfiguration
-- 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.IVS.Types.DestinationConfiguration where

import qualified Amazonka.Core as Core
import Amazonka.IVS.Types.S3DestinationConfiguration
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A complex type that describes a location where recorded videos will be
-- stored. Each member represents a type of destination configuration. For
-- recording, you define one and only one type of destination
-- configuration.
--
-- /See:/ 'newDestinationConfiguration' smart constructor.
data DestinationConfiguration = DestinationConfiguration'
  { -- | An S3 destination configuration where recorded videos will be stored.
    DestinationConfiguration -> Maybe S3DestinationConfiguration
s3 :: Prelude.Maybe S3DestinationConfiguration
  }
  deriving (DestinationConfiguration -> DestinationConfiguration -> Bool
(DestinationConfiguration -> DestinationConfiguration -> Bool)
-> (DestinationConfiguration -> DestinationConfiguration -> Bool)
-> Eq DestinationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationConfiguration -> DestinationConfiguration -> Bool
$c/= :: DestinationConfiguration -> DestinationConfiguration -> Bool
== :: DestinationConfiguration -> DestinationConfiguration -> Bool
$c== :: DestinationConfiguration -> DestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [DestinationConfiguration]
ReadPrec DestinationConfiguration
Int -> ReadS DestinationConfiguration
ReadS [DestinationConfiguration]
(Int -> ReadS DestinationConfiguration)
-> ReadS [DestinationConfiguration]
-> ReadPrec DestinationConfiguration
-> ReadPrec [DestinationConfiguration]
-> Read DestinationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationConfiguration]
$creadListPrec :: ReadPrec [DestinationConfiguration]
readPrec :: ReadPrec DestinationConfiguration
$creadPrec :: ReadPrec DestinationConfiguration
readList :: ReadS [DestinationConfiguration]
$creadList :: ReadS [DestinationConfiguration]
readsPrec :: Int -> ReadS DestinationConfiguration
$creadsPrec :: Int -> ReadS DestinationConfiguration
Prelude.Read, Int -> DestinationConfiguration -> ShowS
[DestinationConfiguration] -> ShowS
DestinationConfiguration -> String
(Int -> DestinationConfiguration -> ShowS)
-> (DestinationConfiguration -> String)
-> ([DestinationConfiguration] -> ShowS)
-> Show DestinationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationConfiguration] -> ShowS
$cshowList :: [DestinationConfiguration] -> ShowS
show :: DestinationConfiguration -> String
$cshow :: DestinationConfiguration -> String
showsPrec :: Int -> DestinationConfiguration -> ShowS
$cshowsPrec :: Int -> DestinationConfiguration -> ShowS
Prelude.Show, (forall x.
 DestinationConfiguration -> Rep DestinationConfiguration x)
-> (forall x.
    Rep DestinationConfiguration x -> DestinationConfiguration)
-> Generic DestinationConfiguration
forall x.
Rep DestinationConfiguration x -> DestinationConfiguration
forall x.
DestinationConfiguration -> Rep DestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DestinationConfiguration x -> DestinationConfiguration
$cfrom :: forall x.
DestinationConfiguration -> Rep DestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DestinationConfiguration' 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:
--
-- 's3', 'destinationConfiguration_s3' - An S3 destination configuration where recorded videos will be stored.
newDestinationConfiguration ::
  DestinationConfiguration
newDestinationConfiguration :: DestinationConfiguration
newDestinationConfiguration =
  DestinationConfiguration' :: Maybe S3DestinationConfiguration -> DestinationConfiguration
DestinationConfiguration' {$sel:s3:DestinationConfiguration' :: Maybe S3DestinationConfiguration
s3 = Maybe S3DestinationConfiguration
forall a. Maybe a
Prelude.Nothing}

-- | An S3 destination configuration where recorded videos will be stored.
destinationConfiguration_s3 :: Lens.Lens' DestinationConfiguration (Prelude.Maybe S3DestinationConfiguration)
destinationConfiguration_s3 :: (Maybe S3DestinationConfiguration
 -> f (Maybe S3DestinationConfiguration))
-> DestinationConfiguration -> f DestinationConfiguration
destinationConfiguration_s3 = (DestinationConfiguration -> Maybe S3DestinationConfiguration)
-> (DestinationConfiguration
    -> Maybe S3DestinationConfiguration -> DestinationConfiguration)
-> Lens
     DestinationConfiguration
     DestinationConfiguration
     (Maybe S3DestinationConfiguration)
     (Maybe S3DestinationConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationConfiguration' {Maybe S3DestinationConfiguration
s3 :: Maybe S3DestinationConfiguration
$sel:s3:DestinationConfiguration' :: DestinationConfiguration -> Maybe S3DestinationConfiguration
s3} -> Maybe S3DestinationConfiguration
s3) (\s :: DestinationConfiguration
s@DestinationConfiguration' {} Maybe S3DestinationConfiguration
a -> DestinationConfiguration
s {$sel:s3:DestinationConfiguration' :: Maybe S3DestinationConfiguration
s3 = Maybe S3DestinationConfiguration
a} :: DestinationConfiguration)

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

instance Prelude.Hashable DestinationConfiguration

instance Prelude.NFData DestinationConfiguration

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