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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaLive.Types.FrameCaptureCdnSettings
import Amazonka.MediaLive.Types.OutputLocationRef
import qualified Amazonka.Prelude as Prelude

-- | Frame Capture Group Settings
--
-- /See:/ 'newFrameCaptureGroupSettings' smart constructor.
data FrameCaptureGroupSettings = FrameCaptureGroupSettings'
  { -- | Parameters that control interactions with the CDN.
    FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings :: Prelude.Maybe FrameCaptureCdnSettings,
    -- | The destination for the frame capture files. Either the URI for an
    -- Amazon S3 bucket and object, plus a file name prefix (for example,
    -- s3ssl:\/\/sportsDelivery\/highlights\/20180820\/curling-) or the URI for
    -- a MediaStore container, plus a file name prefix (for example,
    -- mediastoressl:\/\/sportsDelivery\/20180820\/curling-). The final file
    -- names consist of the prefix from the destination field (for example,
    -- \"curling-\") + name modifier + the counter (5 digits, starting from
    -- 00001) + extension (which is always .jpg). For example,
    -- curling-low.00001.jpg
    FrameCaptureGroupSettings -> OutputLocationRef
destination :: OutputLocationRef
  }
  deriving (FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
(FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool)
-> (FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool)
-> Eq FrameCaptureGroupSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
$c/= :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
== :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
$c== :: FrameCaptureGroupSettings -> FrameCaptureGroupSettings -> Bool
Prelude.Eq, ReadPrec [FrameCaptureGroupSettings]
ReadPrec FrameCaptureGroupSettings
Int -> ReadS FrameCaptureGroupSettings
ReadS [FrameCaptureGroupSettings]
(Int -> ReadS FrameCaptureGroupSettings)
-> ReadS [FrameCaptureGroupSettings]
-> ReadPrec FrameCaptureGroupSettings
-> ReadPrec [FrameCaptureGroupSettings]
-> Read FrameCaptureGroupSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FrameCaptureGroupSettings]
$creadListPrec :: ReadPrec [FrameCaptureGroupSettings]
readPrec :: ReadPrec FrameCaptureGroupSettings
$creadPrec :: ReadPrec FrameCaptureGroupSettings
readList :: ReadS [FrameCaptureGroupSettings]
$creadList :: ReadS [FrameCaptureGroupSettings]
readsPrec :: Int -> ReadS FrameCaptureGroupSettings
$creadsPrec :: Int -> ReadS FrameCaptureGroupSettings
Prelude.Read, Int -> FrameCaptureGroupSettings -> ShowS
[FrameCaptureGroupSettings] -> ShowS
FrameCaptureGroupSettings -> String
(Int -> FrameCaptureGroupSettings -> ShowS)
-> (FrameCaptureGroupSettings -> String)
-> ([FrameCaptureGroupSettings] -> ShowS)
-> Show FrameCaptureGroupSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FrameCaptureGroupSettings] -> ShowS
$cshowList :: [FrameCaptureGroupSettings] -> ShowS
show :: FrameCaptureGroupSettings -> String
$cshow :: FrameCaptureGroupSettings -> String
showsPrec :: Int -> FrameCaptureGroupSettings -> ShowS
$cshowsPrec :: Int -> FrameCaptureGroupSettings -> ShowS
Prelude.Show, (forall x.
 FrameCaptureGroupSettings -> Rep FrameCaptureGroupSettings x)
-> (forall x.
    Rep FrameCaptureGroupSettings x -> FrameCaptureGroupSettings)
-> Generic FrameCaptureGroupSettings
forall x.
Rep FrameCaptureGroupSettings x -> FrameCaptureGroupSettings
forall x.
FrameCaptureGroupSettings -> Rep FrameCaptureGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FrameCaptureGroupSettings x -> FrameCaptureGroupSettings
$cfrom :: forall x.
FrameCaptureGroupSettings -> Rep FrameCaptureGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'FrameCaptureGroupSettings' 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:
--
-- 'frameCaptureCdnSettings', 'frameCaptureGroupSettings_frameCaptureCdnSettings' - Parameters that control interactions with the CDN.
--
-- 'destination', 'frameCaptureGroupSettings_destination' - The destination for the frame capture files. Either the URI for an
-- Amazon S3 bucket and object, plus a file name prefix (for example,
-- s3ssl:\/\/sportsDelivery\/highlights\/20180820\/curling-) or the URI for
-- a MediaStore container, plus a file name prefix (for example,
-- mediastoressl:\/\/sportsDelivery\/20180820\/curling-). The final file
-- names consist of the prefix from the destination field (for example,
-- \"curling-\") + name modifier + the counter (5 digits, starting from
-- 00001) + extension (which is always .jpg). For example,
-- curling-low.00001.jpg
newFrameCaptureGroupSettings ::
  -- | 'destination'
  OutputLocationRef ->
  FrameCaptureGroupSettings
newFrameCaptureGroupSettings :: OutputLocationRef -> FrameCaptureGroupSettings
newFrameCaptureGroupSettings OutputLocationRef
pDestination_ =
  FrameCaptureGroupSettings' :: Maybe FrameCaptureCdnSettings
-> OutputLocationRef -> FrameCaptureGroupSettings
FrameCaptureGroupSettings'
    { $sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings =
        Maybe FrameCaptureCdnSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:destination:FrameCaptureGroupSettings' :: OutputLocationRef
destination = OutputLocationRef
pDestination_
    }

-- | Parameters that control interactions with the CDN.
frameCaptureGroupSettings_frameCaptureCdnSettings :: Lens.Lens' FrameCaptureGroupSettings (Prelude.Maybe FrameCaptureCdnSettings)
frameCaptureGroupSettings_frameCaptureCdnSettings :: (Maybe FrameCaptureCdnSettings
 -> f (Maybe FrameCaptureCdnSettings))
-> FrameCaptureGroupSettings -> f FrameCaptureGroupSettings
frameCaptureGroupSettings_frameCaptureCdnSettings = (FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings)
-> (FrameCaptureGroupSettings
    -> Maybe FrameCaptureCdnSettings -> FrameCaptureGroupSettings)
-> Lens
     FrameCaptureGroupSettings
     FrameCaptureGroupSettings
     (Maybe FrameCaptureCdnSettings)
     (Maybe FrameCaptureCdnSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureGroupSettings' {Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings :: Maybe FrameCaptureCdnSettings
$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings} -> Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings) (\s :: FrameCaptureGroupSettings
s@FrameCaptureGroupSettings' {} Maybe FrameCaptureCdnSettings
a -> FrameCaptureGroupSettings
s {$sel:frameCaptureCdnSettings:FrameCaptureGroupSettings' :: Maybe FrameCaptureCdnSettings
frameCaptureCdnSettings = Maybe FrameCaptureCdnSettings
a} :: FrameCaptureGroupSettings)

-- | The destination for the frame capture files. Either the URI for an
-- Amazon S3 bucket and object, plus a file name prefix (for example,
-- s3ssl:\/\/sportsDelivery\/highlights\/20180820\/curling-) or the URI for
-- a MediaStore container, plus a file name prefix (for example,
-- mediastoressl:\/\/sportsDelivery\/20180820\/curling-). The final file
-- names consist of the prefix from the destination field (for example,
-- \"curling-\") + name modifier + the counter (5 digits, starting from
-- 00001) + extension (which is always .jpg). For example,
-- curling-low.00001.jpg
frameCaptureGroupSettings_destination :: Lens.Lens' FrameCaptureGroupSettings OutputLocationRef
frameCaptureGroupSettings_destination :: (OutputLocationRef -> f OutputLocationRef)
-> FrameCaptureGroupSettings -> f FrameCaptureGroupSettings
frameCaptureGroupSettings_destination = (FrameCaptureGroupSettings -> OutputLocationRef)
-> (FrameCaptureGroupSettings
    -> OutputLocationRef -> FrameCaptureGroupSettings)
-> Lens
     FrameCaptureGroupSettings
     FrameCaptureGroupSettings
     OutputLocationRef
     OutputLocationRef
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FrameCaptureGroupSettings' {OutputLocationRef
destination :: OutputLocationRef
$sel:destination:FrameCaptureGroupSettings' :: FrameCaptureGroupSettings -> OutputLocationRef
destination} -> OutputLocationRef
destination) (\s :: FrameCaptureGroupSettings
s@FrameCaptureGroupSettings' {} OutputLocationRef
a -> FrameCaptureGroupSettings
s {$sel:destination:FrameCaptureGroupSettings' :: OutputLocationRef
destination = OutputLocationRef
a} :: FrameCaptureGroupSettings)

instance Core.FromJSON FrameCaptureGroupSettings where
  parseJSON :: Value -> Parser FrameCaptureGroupSettings
parseJSON =
    String
-> (Object -> Parser FrameCaptureGroupSettings)
-> Value
-> Parser FrameCaptureGroupSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FrameCaptureGroupSettings"
      ( \Object
x ->
          Maybe FrameCaptureCdnSettings
-> OutputLocationRef -> FrameCaptureGroupSettings
FrameCaptureGroupSettings'
            (Maybe FrameCaptureCdnSettings
 -> OutputLocationRef -> FrameCaptureGroupSettings)
-> Parser (Maybe FrameCaptureCdnSettings)
-> Parser (OutputLocationRef -> FrameCaptureGroupSettings)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe FrameCaptureCdnSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"frameCaptureCdnSettings")
            Parser (OutputLocationRef -> FrameCaptureGroupSettings)
-> Parser OutputLocationRef -> Parser FrameCaptureGroupSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OutputLocationRef
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destination")
      )

instance Prelude.Hashable FrameCaptureGroupSettings

instance Prelude.NFData FrameCaptureGroupSettings

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