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

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

-- | Action to prepare an input for a future immediate input switch.
--
-- /See:/ 'newInputPrepareScheduleActionSettings' smart constructor.
data InputPrepareScheduleActionSettings = InputPrepareScheduleActionSettings'
  { -- | The name of the input attachment that should be prepared by this action.
    -- If no name is provided, the action will stop the most recent prepare (if
    -- any) when activated.
    InputPrepareScheduleActionSettings -> Maybe Text
inputAttachmentNameReference :: Prelude.Maybe Prelude.Text,
    -- | Settings to let you create a clip of the file input, in order to set up
    -- the input to ingest only a portion of the file.
    InputPrepareScheduleActionSettings -> Maybe InputClippingSettings
inputClippingSettings :: Prelude.Maybe InputClippingSettings,
    -- | The value for the variable portion of the URL for the dynamic input, for
    -- this instance of the input. Each time you use the same dynamic input in
    -- an input switch action, you can provide a different value, in order to
    -- connect the input to a different content source.
    InputPrepareScheduleActionSettings -> Maybe [Text]
urlPath :: Prelude.Maybe [Prelude.Text]
  }
  deriving (InputPrepareScheduleActionSettings
-> InputPrepareScheduleActionSettings -> Bool
(InputPrepareScheduleActionSettings
 -> InputPrepareScheduleActionSettings -> Bool)
-> (InputPrepareScheduleActionSettings
    -> InputPrepareScheduleActionSettings -> Bool)
-> Eq InputPrepareScheduleActionSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InputPrepareScheduleActionSettings
-> InputPrepareScheduleActionSettings -> Bool
$c/= :: InputPrepareScheduleActionSettings
-> InputPrepareScheduleActionSettings -> Bool
== :: InputPrepareScheduleActionSettings
-> InputPrepareScheduleActionSettings -> Bool
$c== :: InputPrepareScheduleActionSettings
-> InputPrepareScheduleActionSettings -> Bool
Prelude.Eq, ReadPrec [InputPrepareScheduleActionSettings]
ReadPrec InputPrepareScheduleActionSettings
Int -> ReadS InputPrepareScheduleActionSettings
ReadS [InputPrepareScheduleActionSettings]
(Int -> ReadS InputPrepareScheduleActionSettings)
-> ReadS [InputPrepareScheduleActionSettings]
-> ReadPrec InputPrepareScheduleActionSettings
-> ReadPrec [InputPrepareScheduleActionSettings]
-> Read InputPrepareScheduleActionSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InputPrepareScheduleActionSettings]
$creadListPrec :: ReadPrec [InputPrepareScheduleActionSettings]
readPrec :: ReadPrec InputPrepareScheduleActionSettings
$creadPrec :: ReadPrec InputPrepareScheduleActionSettings
readList :: ReadS [InputPrepareScheduleActionSettings]
$creadList :: ReadS [InputPrepareScheduleActionSettings]
readsPrec :: Int -> ReadS InputPrepareScheduleActionSettings
$creadsPrec :: Int -> ReadS InputPrepareScheduleActionSettings
Prelude.Read, Int -> InputPrepareScheduleActionSettings -> ShowS
[InputPrepareScheduleActionSettings] -> ShowS
InputPrepareScheduleActionSettings -> String
(Int -> InputPrepareScheduleActionSettings -> ShowS)
-> (InputPrepareScheduleActionSettings -> String)
-> ([InputPrepareScheduleActionSettings] -> ShowS)
-> Show InputPrepareScheduleActionSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InputPrepareScheduleActionSettings] -> ShowS
$cshowList :: [InputPrepareScheduleActionSettings] -> ShowS
show :: InputPrepareScheduleActionSettings -> String
$cshow :: InputPrepareScheduleActionSettings -> String
showsPrec :: Int -> InputPrepareScheduleActionSettings -> ShowS
$cshowsPrec :: Int -> InputPrepareScheduleActionSettings -> ShowS
Prelude.Show, (forall x.
 InputPrepareScheduleActionSettings
 -> Rep InputPrepareScheduleActionSettings x)
-> (forall x.
    Rep InputPrepareScheduleActionSettings x
    -> InputPrepareScheduleActionSettings)
-> Generic InputPrepareScheduleActionSettings
forall x.
Rep InputPrepareScheduleActionSettings x
-> InputPrepareScheduleActionSettings
forall x.
InputPrepareScheduleActionSettings
-> Rep InputPrepareScheduleActionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InputPrepareScheduleActionSettings x
-> InputPrepareScheduleActionSettings
$cfrom :: forall x.
InputPrepareScheduleActionSettings
-> Rep InputPrepareScheduleActionSettings x
Prelude.Generic)

-- |
-- Create a value of 'InputPrepareScheduleActionSettings' 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:
--
-- 'inputAttachmentNameReference', 'inputPrepareScheduleActionSettings_inputAttachmentNameReference' - The name of the input attachment that should be prepared by this action.
-- If no name is provided, the action will stop the most recent prepare (if
-- any) when activated.
--
-- 'inputClippingSettings', 'inputPrepareScheduleActionSettings_inputClippingSettings' - Settings to let you create a clip of the file input, in order to set up
-- the input to ingest only a portion of the file.
--
-- 'urlPath', 'inputPrepareScheduleActionSettings_urlPath' - The value for the variable portion of the URL for the dynamic input, for
-- this instance of the input. Each time you use the same dynamic input in
-- an input switch action, you can provide a different value, in order to
-- connect the input to a different content source.
newInputPrepareScheduleActionSettings ::
  InputPrepareScheduleActionSettings
newInputPrepareScheduleActionSettings :: InputPrepareScheduleActionSettings
newInputPrepareScheduleActionSettings =
  InputPrepareScheduleActionSettings' :: Maybe Text
-> Maybe InputClippingSettings
-> Maybe [Text]
-> InputPrepareScheduleActionSettings
InputPrepareScheduleActionSettings'
    { $sel:inputAttachmentNameReference:InputPrepareScheduleActionSettings' :: Maybe Text
inputAttachmentNameReference =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inputClippingSettings:InputPrepareScheduleActionSettings' :: Maybe InputClippingSettings
inputClippingSettings = Maybe InputClippingSettings
forall a. Maybe a
Prelude.Nothing,
      $sel:urlPath:InputPrepareScheduleActionSettings' :: Maybe [Text]
urlPath = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the input attachment that should be prepared by this action.
-- If no name is provided, the action will stop the most recent prepare (if
-- any) when activated.
inputPrepareScheduleActionSettings_inputAttachmentNameReference :: Lens.Lens' InputPrepareScheduleActionSettings (Prelude.Maybe Prelude.Text)
inputPrepareScheduleActionSettings_inputAttachmentNameReference :: (Maybe Text -> f (Maybe Text))
-> InputPrepareScheduleActionSettings
-> f InputPrepareScheduleActionSettings
inputPrepareScheduleActionSettings_inputAttachmentNameReference = (InputPrepareScheduleActionSettings -> Maybe Text)
-> (InputPrepareScheduleActionSettings
    -> Maybe Text -> InputPrepareScheduleActionSettings)
-> Lens
     InputPrepareScheduleActionSettings
     InputPrepareScheduleActionSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputPrepareScheduleActionSettings' {Maybe Text
inputAttachmentNameReference :: Maybe Text
$sel:inputAttachmentNameReference:InputPrepareScheduleActionSettings' :: InputPrepareScheduleActionSettings -> Maybe Text
inputAttachmentNameReference} -> Maybe Text
inputAttachmentNameReference) (\s :: InputPrepareScheduleActionSettings
s@InputPrepareScheduleActionSettings' {} Maybe Text
a -> InputPrepareScheduleActionSettings
s {$sel:inputAttachmentNameReference:InputPrepareScheduleActionSettings' :: Maybe Text
inputAttachmentNameReference = Maybe Text
a} :: InputPrepareScheduleActionSettings)

-- | Settings to let you create a clip of the file input, in order to set up
-- the input to ingest only a portion of the file.
inputPrepareScheduleActionSettings_inputClippingSettings :: Lens.Lens' InputPrepareScheduleActionSettings (Prelude.Maybe InputClippingSettings)
inputPrepareScheduleActionSettings_inputClippingSettings :: (Maybe InputClippingSettings -> f (Maybe InputClippingSettings))
-> InputPrepareScheduleActionSettings
-> f InputPrepareScheduleActionSettings
inputPrepareScheduleActionSettings_inputClippingSettings = (InputPrepareScheduleActionSettings -> Maybe InputClippingSettings)
-> (InputPrepareScheduleActionSettings
    -> Maybe InputClippingSettings
    -> InputPrepareScheduleActionSettings)
-> Lens
     InputPrepareScheduleActionSettings
     InputPrepareScheduleActionSettings
     (Maybe InputClippingSettings)
     (Maybe InputClippingSettings)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputPrepareScheduleActionSettings' {Maybe InputClippingSettings
inputClippingSettings :: Maybe InputClippingSettings
$sel:inputClippingSettings:InputPrepareScheduleActionSettings' :: InputPrepareScheduleActionSettings -> Maybe InputClippingSettings
inputClippingSettings} -> Maybe InputClippingSettings
inputClippingSettings) (\s :: InputPrepareScheduleActionSettings
s@InputPrepareScheduleActionSettings' {} Maybe InputClippingSettings
a -> InputPrepareScheduleActionSettings
s {$sel:inputClippingSettings:InputPrepareScheduleActionSettings' :: Maybe InputClippingSettings
inputClippingSettings = Maybe InputClippingSettings
a} :: InputPrepareScheduleActionSettings)

-- | The value for the variable portion of the URL for the dynamic input, for
-- this instance of the input. Each time you use the same dynamic input in
-- an input switch action, you can provide a different value, in order to
-- connect the input to a different content source.
inputPrepareScheduleActionSettings_urlPath :: Lens.Lens' InputPrepareScheduleActionSettings (Prelude.Maybe [Prelude.Text])
inputPrepareScheduleActionSettings_urlPath :: (Maybe [Text] -> f (Maybe [Text]))
-> InputPrepareScheduleActionSettings
-> f InputPrepareScheduleActionSettings
inputPrepareScheduleActionSettings_urlPath = (InputPrepareScheduleActionSettings -> Maybe [Text])
-> (InputPrepareScheduleActionSettings
    -> Maybe [Text] -> InputPrepareScheduleActionSettings)
-> Lens
     InputPrepareScheduleActionSettings
     InputPrepareScheduleActionSettings
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InputPrepareScheduleActionSettings' {Maybe [Text]
urlPath :: Maybe [Text]
$sel:urlPath:InputPrepareScheduleActionSettings' :: InputPrepareScheduleActionSettings -> Maybe [Text]
urlPath} -> Maybe [Text]
urlPath) (\s :: InputPrepareScheduleActionSettings
s@InputPrepareScheduleActionSettings' {} Maybe [Text]
a -> InputPrepareScheduleActionSettings
s {$sel:urlPath:InputPrepareScheduleActionSettings' :: Maybe [Text]
urlPath = Maybe [Text]
a} :: InputPrepareScheduleActionSettings) ((Maybe [Text] -> f (Maybe [Text]))
 -> InputPrepareScheduleActionSettings
 -> f InputPrepareScheduleActionSettings)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InputPrepareScheduleActionSettings
-> f InputPrepareScheduleActionSettings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    InputPrepareScheduleActionSettings
  where
  parseJSON :: Value -> Parser InputPrepareScheduleActionSettings
parseJSON =
    String
-> (Object -> Parser InputPrepareScheduleActionSettings)
-> Value
-> Parser InputPrepareScheduleActionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InputPrepareScheduleActionSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe InputClippingSettings
-> Maybe [Text]
-> InputPrepareScheduleActionSettings
InputPrepareScheduleActionSettings'
            (Maybe Text
 -> Maybe InputClippingSettings
 -> Maybe [Text]
 -> InputPrepareScheduleActionSettings)
-> Parser (Maybe Text)
-> Parser
     (Maybe InputClippingSettings
      -> Maybe [Text] -> InputPrepareScheduleActionSettings)
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
"inputAttachmentNameReference")
            Parser
  (Maybe InputClippingSettings
   -> Maybe [Text] -> InputPrepareScheduleActionSettings)
-> Parser (Maybe InputClippingSettings)
-> Parser (Maybe [Text] -> InputPrepareScheduleActionSettings)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe InputClippingSettings)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"inputClippingSettings")
            Parser (Maybe [Text] -> InputPrepareScheduleActionSettings)
-> Parser (Maybe [Text])
-> Parser InputPrepareScheduleActionSettings
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"urlPath" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    InputPrepareScheduleActionSettings

instance
  Prelude.NFData
    InputPrepareScheduleActionSettings

instance
  Core.ToJSON
    InputPrepareScheduleActionSettings
  where
  toJSON :: InputPrepareScheduleActionSettings -> Value
toJSON InputPrepareScheduleActionSettings' {Maybe [Text]
Maybe Text
Maybe InputClippingSettings
urlPath :: Maybe [Text]
inputClippingSettings :: Maybe InputClippingSettings
inputAttachmentNameReference :: Maybe Text
$sel:urlPath:InputPrepareScheduleActionSettings' :: InputPrepareScheduleActionSettings -> Maybe [Text]
$sel:inputClippingSettings:InputPrepareScheduleActionSettings' :: InputPrepareScheduleActionSettings -> Maybe InputClippingSettings
$sel:inputAttachmentNameReference:InputPrepareScheduleActionSettings' :: InputPrepareScheduleActionSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"inputAttachmentNameReference" 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
inputAttachmentNameReference,
            (Text
"inputClippingSettings" Text -> InputClippingSettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InputClippingSettings -> Pair)
-> Maybe InputClippingSettings -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InputClippingSettings
inputClippingSettings,
            (Text
"urlPath" 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]
urlPath
          ]
      )