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

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

-- | Settings related to your File output group. MediaConvert uses this group
-- of settings to generate a single standalone file, rather than a
-- streaming package. When you work directly in your JSON job
-- specification, include this object and any required children when you
-- set Type, under OutputGroupSettings, to FILE_GROUP_SETTINGS.
--
-- /See:/ 'newFileGroupSettings' smart constructor.
data FileGroupSettings = FileGroupSettings'
  { -- | Use Destination (Destination) to specify the S3 output location and the
    -- output filename base. Destination accepts format identifiers. If you do
    -- not specify the base filename in the URI, the service will use the
    -- filename of the input file. If your job has multiple inputs, the service
    -- uses the filename of the first input file.
    FileGroupSettings -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
    -- | Settings associated with the destination. Will vary based on the type of
    -- destination
    FileGroupSettings -> Maybe DestinationSettings
destinationSettings :: Prelude.Maybe DestinationSettings
  }
  deriving (FileGroupSettings -> FileGroupSettings -> Bool
(FileGroupSettings -> FileGroupSettings -> Bool)
-> (FileGroupSettings -> FileGroupSettings -> Bool)
-> Eq FileGroupSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileGroupSettings -> FileGroupSettings -> Bool
$c/= :: FileGroupSettings -> FileGroupSettings -> Bool
== :: FileGroupSettings -> FileGroupSettings -> Bool
$c== :: FileGroupSettings -> FileGroupSettings -> Bool
Prelude.Eq, ReadPrec [FileGroupSettings]
ReadPrec FileGroupSettings
Int -> ReadS FileGroupSettings
ReadS [FileGroupSettings]
(Int -> ReadS FileGroupSettings)
-> ReadS [FileGroupSettings]
-> ReadPrec FileGroupSettings
-> ReadPrec [FileGroupSettings]
-> Read FileGroupSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FileGroupSettings]
$creadListPrec :: ReadPrec [FileGroupSettings]
readPrec :: ReadPrec FileGroupSettings
$creadPrec :: ReadPrec FileGroupSettings
readList :: ReadS [FileGroupSettings]
$creadList :: ReadS [FileGroupSettings]
readsPrec :: Int -> ReadS FileGroupSettings
$creadsPrec :: Int -> ReadS FileGroupSettings
Prelude.Read, Int -> FileGroupSettings -> ShowS
[FileGroupSettings] -> ShowS
FileGroupSettings -> String
(Int -> FileGroupSettings -> ShowS)
-> (FileGroupSettings -> String)
-> ([FileGroupSettings] -> ShowS)
-> Show FileGroupSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileGroupSettings] -> ShowS
$cshowList :: [FileGroupSettings] -> ShowS
show :: FileGroupSettings -> String
$cshow :: FileGroupSettings -> String
showsPrec :: Int -> FileGroupSettings -> ShowS
$cshowsPrec :: Int -> FileGroupSettings -> ShowS
Prelude.Show, (forall x. FileGroupSettings -> Rep FileGroupSettings x)
-> (forall x. Rep FileGroupSettings x -> FileGroupSettings)
-> Generic FileGroupSettings
forall x. Rep FileGroupSettings x -> FileGroupSettings
forall x. FileGroupSettings -> Rep FileGroupSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileGroupSettings x -> FileGroupSettings
$cfrom :: forall x. FileGroupSettings -> Rep FileGroupSettings x
Prelude.Generic)

-- |
-- Create a value of 'FileGroupSettings' 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:
--
-- 'destination', 'fileGroupSettings_destination' - Use Destination (Destination) to specify the S3 output location and the
-- output filename base. Destination accepts format identifiers. If you do
-- not specify the base filename in the URI, the service will use the
-- filename of the input file. If your job has multiple inputs, the service
-- uses the filename of the first input file.
--
-- 'destinationSettings', 'fileGroupSettings_destinationSettings' - Settings associated with the destination. Will vary based on the type of
-- destination
newFileGroupSettings ::
  FileGroupSettings
newFileGroupSettings :: FileGroupSettings
newFileGroupSettings =
  FileGroupSettings' :: Maybe Text -> Maybe DestinationSettings -> FileGroupSettings
FileGroupSettings'
    { $sel:destination:FileGroupSettings' :: Maybe Text
destination = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationSettings:FileGroupSettings' :: Maybe DestinationSettings
destinationSettings = Maybe DestinationSettings
forall a. Maybe a
Prelude.Nothing
    }

-- | Use Destination (Destination) to specify the S3 output location and the
-- output filename base. Destination accepts format identifiers. If you do
-- not specify the base filename in the URI, the service will use the
-- filename of the input file. If your job has multiple inputs, the service
-- uses the filename of the first input file.
fileGroupSettings_destination :: Lens.Lens' FileGroupSettings (Prelude.Maybe Prelude.Text)
fileGroupSettings_destination :: (Maybe Text -> f (Maybe Text))
-> FileGroupSettings -> f FileGroupSettings
fileGroupSettings_destination = (FileGroupSettings -> Maybe Text)
-> (FileGroupSettings -> Maybe Text -> FileGroupSettings)
-> Lens
     FileGroupSettings FileGroupSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileGroupSettings' {Maybe Text
destination :: Maybe Text
$sel:destination:FileGroupSettings' :: FileGroupSettings -> Maybe Text
destination} -> Maybe Text
destination) (\s :: FileGroupSettings
s@FileGroupSettings' {} Maybe Text
a -> FileGroupSettings
s {$sel:destination:FileGroupSettings' :: Maybe Text
destination = Maybe Text
a} :: FileGroupSettings)

-- | Settings associated with the destination. Will vary based on the type of
-- destination
fileGroupSettings_destinationSettings :: Lens.Lens' FileGroupSettings (Prelude.Maybe DestinationSettings)
fileGroupSettings_destinationSettings :: (Maybe DestinationSettings -> f (Maybe DestinationSettings))
-> FileGroupSettings -> f FileGroupSettings
fileGroupSettings_destinationSettings = (FileGroupSettings -> Maybe DestinationSettings)
-> (FileGroupSettings
    -> Maybe DestinationSettings -> FileGroupSettings)
-> Lens
     FileGroupSettings
     FileGroupSettings
     (Maybe DestinationSettings)
     (Maybe DestinationSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FileGroupSettings' {Maybe DestinationSettings
destinationSettings :: Maybe DestinationSettings
$sel:destinationSettings:FileGroupSettings' :: FileGroupSettings -> Maybe DestinationSettings
destinationSettings} -> Maybe DestinationSettings
destinationSettings) (\s :: FileGroupSettings
s@FileGroupSettings' {} Maybe DestinationSettings
a -> FileGroupSettings
s {$sel:destinationSettings:FileGroupSettings' :: Maybe DestinationSettings
destinationSettings = Maybe DestinationSettings
a} :: FileGroupSettings)

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

instance Prelude.Hashable FileGroupSettings

instance Prelude.NFData FileGroupSettings

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