{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaTailor.CreateProgram
-- 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)
--
-- Creates a program.
module Amazonka.MediaTailor.CreateProgram
  ( -- * Creating a Request
    CreateProgram (..),
    newCreateProgram,

    -- * Request Lenses
    createProgram_adBreaks,
    createProgram_channelName,
    createProgram_programName,
    createProgram_vodSourceName,
    createProgram_scheduleConfiguration,
    createProgram_sourceLocationName,

    -- * Destructuring the Response
    CreateProgramResponse (..),
    newCreateProgramResponse,

    -- * Response Lenses
    createProgramResponse_creationTime,
    createProgramResponse_sourceLocationName,
    createProgramResponse_arn,
    createProgramResponse_programName,
    createProgramResponse_adBreaks,
    createProgramResponse_channelName,
    createProgramResponse_scheduledStartTime,
    createProgramResponse_vodSourceName,
    createProgramResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaTailor.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateProgram' smart constructor.
data CreateProgram = CreateProgram'
  { -- | The ad break configuration settings.
    CreateProgram -> Maybe [AdBreak]
adBreaks :: Prelude.Maybe [AdBreak],
    -- | The identifier for the channel you are working on.
    CreateProgram -> Text
channelName :: Prelude.Text,
    -- | The identifier for the program you are working on.
    CreateProgram -> Text
programName :: Prelude.Text,
    -- | The name that\'s used to refer to a VOD source.
    CreateProgram -> Text
vodSourceName :: Prelude.Text,
    -- | The schedule configuration settings.
    CreateProgram -> ScheduleConfiguration
scheduleConfiguration :: ScheduleConfiguration,
    -- | The name of the source location.
    CreateProgram -> Text
sourceLocationName :: Prelude.Text
  }
  deriving (CreateProgram -> CreateProgram -> Bool
(CreateProgram -> CreateProgram -> Bool)
-> (CreateProgram -> CreateProgram -> Bool) -> Eq CreateProgram
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProgram -> CreateProgram -> Bool
$c/= :: CreateProgram -> CreateProgram -> Bool
== :: CreateProgram -> CreateProgram -> Bool
$c== :: CreateProgram -> CreateProgram -> Bool
Prelude.Eq, ReadPrec [CreateProgram]
ReadPrec CreateProgram
Int -> ReadS CreateProgram
ReadS [CreateProgram]
(Int -> ReadS CreateProgram)
-> ReadS [CreateProgram]
-> ReadPrec CreateProgram
-> ReadPrec [CreateProgram]
-> Read CreateProgram
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProgram]
$creadListPrec :: ReadPrec [CreateProgram]
readPrec :: ReadPrec CreateProgram
$creadPrec :: ReadPrec CreateProgram
readList :: ReadS [CreateProgram]
$creadList :: ReadS [CreateProgram]
readsPrec :: Int -> ReadS CreateProgram
$creadsPrec :: Int -> ReadS CreateProgram
Prelude.Read, Int -> CreateProgram -> ShowS
[CreateProgram] -> ShowS
CreateProgram -> String
(Int -> CreateProgram -> ShowS)
-> (CreateProgram -> String)
-> ([CreateProgram] -> ShowS)
-> Show CreateProgram
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProgram] -> ShowS
$cshowList :: [CreateProgram] -> ShowS
show :: CreateProgram -> String
$cshow :: CreateProgram -> String
showsPrec :: Int -> CreateProgram -> ShowS
$cshowsPrec :: Int -> CreateProgram -> ShowS
Prelude.Show, (forall x. CreateProgram -> Rep CreateProgram x)
-> (forall x. Rep CreateProgram x -> CreateProgram)
-> Generic CreateProgram
forall x. Rep CreateProgram x -> CreateProgram
forall x. CreateProgram -> Rep CreateProgram x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProgram x -> CreateProgram
$cfrom :: forall x. CreateProgram -> Rep CreateProgram x
Prelude.Generic)

-- |
-- Create a value of 'CreateProgram' 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:
--
-- 'adBreaks', 'createProgram_adBreaks' - The ad break configuration settings.
--
-- 'channelName', 'createProgram_channelName' - The identifier for the channel you are working on.
--
-- 'programName', 'createProgram_programName' - The identifier for the program you are working on.
--
-- 'vodSourceName', 'createProgram_vodSourceName' - The name that\'s used to refer to a VOD source.
--
-- 'scheduleConfiguration', 'createProgram_scheduleConfiguration' - The schedule configuration settings.
--
-- 'sourceLocationName', 'createProgram_sourceLocationName' - The name of the source location.
newCreateProgram ::
  -- | 'channelName'
  Prelude.Text ->
  -- | 'programName'
  Prelude.Text ->
  -- | 'vodSourceName'
  Prelude.Text ->
  -- | 'scheduleConfiguration'
  ScheduleConfiguration ->
  -- | 'sourceLocationName'
  Prelude.Text ->
  CreateProgram
newCreateProgram :: Text
-> Text -> Text -> ScheduleConfiguration -> Text -> CreateProgram
newCreateProgram
  Text
pChannelName_
  Text
pProgramName_
  Text
pVodSourceName_
  ScheduleConfiguration
pScheduleConfiguration_
  Text
pSourceLocationName_ =
    CreateProgram' :: Maybe [AdBreak]
-> Text
-> Text
-> Text
-> ScheduleConfiguration
-> Text
-> CreateProgram
CreateProgram'
      { $sel:adBreaks:CreateProgram' :: Maybe [AdBreak]
adBreaks = Maybe [AdBreak]
forall a. Maybe a
Prelude.Nothing,
        $sel:channelName:CreateProgram' :: Text
channelName = Text
pChannelName_,
        $sel:programName:CreateProgram' :: Text
programName = Text
pProgramName_,
        $sel:vodSourceName:CreateProgram' :: Text
vodSourceName = Text
pVodSourceName_,
        $sel:scheduleConfiguration:CreateProgram' :: ScheduleConfiguration
scheduleConfiguration = ScheduleConfiguration
pScheduleConfiguration_,
        $sel:sourceLocationName:CreateProgram' :: Text
sourceLocationName = Text
pSourceLocationName_
      }

-- | The ad break configuration settings.
createProgram_adBreaks :: Lens.Lens' CreateProgram (Prelude.Maybe [AdBreak])
createProgram_adBreaks :: (Maybe [AdBreak] -> f (Maybe [AdBreak]))
-> CreateProgram -> f CreateProgram
createProgram_adBreaks = (CreateProgram -> Maybe [AdBreak])
-> (CreateProgram -> Maybe [AdBreak] -> CreateProgram)
-> Lens
     CreateProgram CreateProgram (Maybe [AdBreak]) (Maybe [AdBreak])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgram' {Maybe [AdBreak]
adBreaks :: Maybe [AdBreak]
$sel:adBreaks:CreateProgram' :: CreateProgram -> Maybe [AdBreak]
adBreaks} -> Maybe [AdBreak]
adBreaks) (\s :: CreateProgram
s@CreateProgram' {} Maybe [AdBreak]
a -> CreateProgram
s {$sel:adBreaks:CreateProgram' :: Maybe [AdBreak]
adBreaks = Maybe [AdBreak]
a} :: CreateProgram) ((Maybe [AdBreak] -> f (Maybe [AdBreak]))
 -> CreateProgram -> f CreateProgram)
-> ((Maybe [AdBreak] -> f (Maybe [AdBreak]))
    -> Maybe [AdBreak] -> f (Maybe [AdBreak]))
-> (Maybe [AdBreak] -> f (Maybe [AdBreak]))
-> CreateProgram
-> f CreateProgram
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AdBreak] [AdBreak] [AdBreak] [AdBreak]
-> Iso
     (Maybe [AdBreak])
     (Maybe [AdBreak])
     (Maybe [AdBreak])
     (Maybe [AdBreak])
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 [AdBreak] [AdBreak] [AdBreak] [AdBreak]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier for the channel you are working on.
createProgram_channelName :: Lens.Lens' CreateProgram Prelude.Text
createProgram_channelName :: (Text -> f Text) -> CreateProgram -> f CreateProgram
createProgram_channelName = (CreateProgram -> Text)
-> (CreateProgram -> Text -> CreateProgram)
-> Lens CreateProgram CreateProgram Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgram' {Text
channelName :: Text
$sel:channelName:CreateProgram' :: CreateProgram -> Text
channelName} -> Text
channelName) (\s :: CreateProgram
s@CreateProgram' {} Text
a -> CreateProgram
s {$sel:channelName:CreateProgram' :: Text
channelName = Text
a} :: CreateProgram)

-- | The identifier for the program you are working on.
createProgram_programName :: Lens.Lens' CreateProgram Prelude.Text
createProgram_programName :: (Text -> f Text) -> CreateProgram -> f CreateProgram
createProgram_programName = (CreateProgram -> Text)
-> (CreateProgram -> Text -> CreateProgram)
-> Lens CreateProgram CreateProgram Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgram' {Text
programName :: Text
$sel:programName:CreateProgram' :: CreateProgram -> Text
programName} -> Text
programName) (\s :: CreateProgram
s@CreateProgram' {} Text
a -> CreateProgram
s {$sel:programName:CreateProgram' :: Text
programName = Text
a} :: CreateProgram)

-- | The name that\'s used to refer to a VOD source.
createProgram_vodSourceName :: Lens.Lens' CreateProgram Prelude.Text
createProgram_vodSourceName :: (Text -> f Text) -> CreateProgram -> f CreateProgram
createProgram_vodSourceName = (CreateProgram -> Text)
-> (CreateProgram -> Text -> CreateProgram)
-> Lens CreateProgram CreateProgram Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgram' {Text
vodSourceName :: Text
$sel:vodSourceName:CreateProgram' :: CreateProgram -> Text
vodSourceName} -> Text
vodSourceName) (\s :: CreateProgram
s@CreateProgram' {} Text
a -> CreateProgram
s {$sel:vodSourceName:CreateProgram' :: Text
vodSourceName = Text
a} :: CreateProgram)

-- | The schedule configuration settings.
createProgram_scheduleConfiguration :: Lens.Lens' CreateProgram ScheduleConfiguration
createProgram_scheduleConfiguration :: (ScheduleConfiguration -> f ScheduleConfiguration)
-> CreateProgram -> f CreateProgram
createProgram_scheduleConfiguration = (CreateProgram -> ScheduleConfiguration)
-> (CreateProgram -> ScheduleConfiguration -> CreateProgram)
-> Lens
     CreateProgram
     CreateProgram
     ScheduleConfiguration
     ScheduleConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgram' {ScheduleConfiguration
scheduleConfiguration :: ScheduleConfiguration
$sel:scheduleConfiguration:CreateProgram' :: CreateProgram -> ScheduleConfiguration
scheduleConfiguration} -> ScheduleConfiguration
scheduleConfiguration) (\s :: CreateProgram
s@CreateProgram' {} ScheduleConfiguration
a -> CreateProgram
s {$sel:scheduleConfiguration:CreateProgram' :: ScheduleConfiguration
scheduleConfiguration = ScheduleConfiguration
a} :: CreateProgram)

-- | The name of the source location.
createProgram_sourceLocationName :: Lens.Lens' CreateProgram Prelude.Text
createProgram_sourceLocationName :: (Text -> f Text) -> CreateProgram -> f CreateProgram
createProgram_sourceLocationName = (CreateProgram -> Text)
-> (CreateProgram -> Text -> CreateProgram)
-> Lens CreateProgram CreateProgram Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgram' {Text
sourceLocationName :: Text
$sel:sourceLocationName:CreateProgram' :: CreateProgram -> Text
sourceLocationName} -> Text
sourceLocationName) (\s :: CreateProgram
s@CreateProgram' {} Text
a -> CreateProgram
s {$sel:sourceLocationName:CreateProgram' :: Text
sourceLocationName = Text
a} :: CreateProgram)

instance Core.AWSRequest CreateProgram where
  type
    AWSResponse CreateProgram =
      CreateProgramResponse
  request :: CreateProgram -> Request CreateProgram
request = Service -> CreateProgram -> Request CreateProgram
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateProgram
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProgram)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateProgram))
-> Logger
-> Service
-> Proxy CreateProgram
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateProgram)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [AdBreak]
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Int
-> CreateProgramResponse
CreateProgramResponse'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [AdBreak]
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Int
 -> CreateProgramResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [AdBreak]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Int
      -> CreateProgramResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CreationTime")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [AdBreak]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Int
   -> CreateProgramResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe [AdBreak]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Int
      -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SourceLocationName")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe [AdBreak]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Int
   -> CreateProgramResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [AdBreak]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Int
      -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Arn")
            Either
  String
  (Maybe Text
   -> Maybe [AdBreak]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Int
   -> CreateProgramResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [AdBreak]
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Int
      -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProgramName")
            Either
  String
  (Maybe [AdBreak]
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Int
   -> CreateProgramResponse)
-> Either String (Maybe [AdBreak])
-> Either
     String
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Int -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [AdBreak]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AdBreaks" Either String (Maybe (Maybe [AdBreak]))
-> Maybe [AdBreak] -> Either String (Maybe [AdBreak])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AdBreak]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Int -> CreateProgramResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe POSIX -> Maybe Text -> Int -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelName")
            Either
  String (Maybe POSIX -> Maybe Text -> Int -> CreateProgramResponse)
-> Either String (Maybe POSIX)
-> Either String (Maybe Text -> Int -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ScheduledStartTime")
            Either String (Maybe Text -> Int -> CreateProgramResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateProgramResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VodSourceName")
            Either String (Int -> CreateProgramResponse)
-> Either String Int -> Either String CreateProgramResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateProgram

instance Prelude.NFData CreateProgram

instance Core.ToHeaders CreateProgram where
  toHeaders :: CreateProgram -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateProgram -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateProgram where
  toJSON :: CreateProgram -> Value
toJSON CreateProgram' {Maybe [AdBreak]
Text
ScheduleConfiguration
sourceLocationName :: Text
scheduleConfiguration :: ScheduleConfiguration
vodSourceName :: Text
programName :: Text
channelName :: Text
adBreaks :: Maybe [AdBreak]
$sel:sourceLocationName:CreateProgram' :: CreateProgram -> Text
$sel:scheduleConfiguration:CreateProgram' :: CreateProgram -> ScheduleConfiguration
$sel:vodSourceName:CreateProgram' :: CreateProgram -> Text
$sel:programName:CreateProgram' :: CreateProgram -> Text
$sel:channelName:CreateProgram' :: CreateProgram -> Text
$sel:adBreaks:CreateProgram' :: CreateProgram -> Maybe [AdBreak]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AdBreaks" Text -> [AdBreak] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AdBreak] -> Pair) -> Maybe [AdBreak] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AdBreak]
adBreaks,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VodSourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vodSourceName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"ScheduleConfiguration"
                  Text -> ScheduleConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ScheduleConfiguration
scheduleConfiguration
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SourceLocationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceLocationName)
          ]
      )

instance Core.ToPath CreateProgram where
  toPath :: CreateProgram -> ByteString
toPath CreateProgram' {Maybe [AdBreak]
Text
ScheduleConfiguration
sourceLocationName :: Text
scheduleConfiguration :: ScheduleConfiguration
vodSourceName :: Text
programName :: Text
channelName :: Text
adBreaks :: Maybe [AdBreak]
$sel:sourceLocationName:CreateProgram' :: CreateProgram -> Text
$sel:scheduleConfiguration:CreateProgram' :: CreateProgram -> ScheduleConfiguration
$sel:vodSourceName:CreateProgram' :: CreateProgram -> Text
$sel:programName:CreateProgram' :: CreateProgram -> Text
$sel:channelName:CreateProgram' :: CreateProgram -> Text
$sel:adBreaks:CreateProgram' :: CreateProgram -> Maybe [AdBreak]
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/channel/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelName,
        ByteString
"/program/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
programName
      ]

instance Core.ToQuery CreateProgram where
  toQuery :: CreateProgram -> QueryString
toQuery = QueryString -> CreateProgram -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateProgramResponse' smart constructor.
data CreateProgramResponse = CreateProgramResponse'
  { -- | The timestamp of when the program was created.
    CreateProgramResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The source location name.
    CreateProgramResponse -> Maybe Text
sourceLocationName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the program.
    CreateProgramResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the program.
    CreateProgramResponse -> Maybe Text
programName :: Prelude.Maybe Prelude.Text,
    -- | The ad break configuration settings.
    CreateProgramResponse -> Maybe [AdBreak]
adBreaks :: Prelude.Maybe [AdBreak],
    -- | The name of the channel that the program belongs to.
    CreateProgramResponse -> Maybe Text
channelName :: Prelude.Maybe Prelude.Text,
    -- | The date and time that the program is scheduled to start in ISO 8601
    -- format and Coordinated Universal Time (UTC). For example, the value
    -- 2021-03-27T17:48:16.751Z represents March 27, 2021 at 17:48:16.751 UTC.
    CreateProgramResponse -> Maybe POSIX
scheduledStartTime :: Prelude.Maybe Core.POSIX,
    -- | The name that\'s used to refer to a VOD source.
    CreateProgramResponse -> Maybe Text
vodSourceName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateProgramResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateProgramResponse -> CreateProgramResponse -> Bool
(CreateProgramResponse -> CreateProgramResponse -> Bool)
-> (CreateProgramResponse -> CreateProgramResponse -> Bool)
-> Eq CreateProgramResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProgramResponse -> CreateProgramResponse -> Bool
$c/= :: CreateProgramResponse -> CreateProgramResponse -> Bool
== :: CreateProgramResponse -> CreateProgramResponse -> Bool
$c== :: CreateProgramResponse -> CreateProgramResponse -> Bool
Prelude.Eq, ReadPrec [CreateProgramResponse]
ReadPrec CreateProgramResponse
Int -> ReadS CreateProgramResponse
ReadS [CreateProgramResponse]
(Int -> ReadS CreateProgramResponse)
-> ReadS [CreateProgramResponse]
-> ReadPrec CreateProgramResponse
-> ReadPrec [CreateProgramResponse]
-> Read CreateProgramResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProgramResponse]
$creadListPrec :: ReadPrec [CreateProgramResponse]
readPrec :: ReadPrec CreateProgramResponse
$creadPrec :: ReadPrec CreateProgramResponse
readList :: ReadS [CreateProgramResponse]
$creadList :: ReadS [CreateProgramResponse]
readsPrec :: Int -> ReadS CreateProgramResponse
$creadsPrec :: Int -> ReadS CreateProgramResponse
Prelude.Read, Int -> CreateProgramResponse -> ShowS
[CreateProgramResponse] -> ShowS
CreateProgramResponse -> String
(Int -> CreateProgramResponse -> ShowS)
-> (CreateProgramResponse -> String)
-> ([CreateProgramResponse] -> ShowS)
-> Show CreateProgramResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProgramResponse] -> ShowS
$cshowList :: [CreateProgramResponse] -> ShowS
show :: CreateProgramResponse -> String
$cshow :: CreateProgramResponse -> String
showsPrec :: Int -> CreateProgramResponse -> ShowS
$cshowsPrec :: Int -> CreateProgramResponse -> ShowS
Prelude.Show, (forall x. CreateProgramResponse -> Rep CreateProgramResponse x)
-> (forall x. Rep CreateProgramResponse x -> CreateProgramResponse)
-> Generic CreateProgramResponse
forall x. Rep CreateProgramResponse x -> CreateProgramResponse
forall x. CreateProgramResponse -> Rep CreateProgramResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProgramResponse x -> CreateProgramResponse
$cfrom :: forall x. CreateProgramResponse -> Rep CreateProgramResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateProgramResponse' 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:
--
-- 'creationTime', 'createProgramResponse_creationTime' - The timestamp of when the program was created.
--
-- 'sourceLocationName', 'createProgramResponse_sourceLocationName' - The source location name.
--
-- 'arn', 'createProgramResponse_arn' - The ARN of the program.
--
-- 'programName', 'createProgramResponse_programName' - The name of the program.
--
-- 'adBreaks', 'createProgramResponse_adBreaks' - The ad break configuration settings.
--
-- 'channelName', 'createProgramResponse_channelName' - The name of the channel that the program belongs to.
--
-- 'scheduledStartTime', 'createProgramResponse_scheduledStartTime' - The date and time that the program is scheduled to start in ISO 8601
-- format and Coordinated Universal Time (UTC). For example, the value
-- 2021-03-27T17:48:16.751Z represents March 27, 2021 at 17:48:16.751 UTC.
--
-- 'vodSourceName', 'createProgramResponse_vodSourceName' - The name that\'s used to refer to a VOD source.
--
-- 'httpStatus', 'createProgramResponse_httpStatus' - The response's http status code.
newCreateProgramResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateProgramResponse
newCreateProgramResponse :: Int -> CreateProgramResponse
newCreateProgramResponse Int
pHttpStatus_ =
  CreateProgramResponse' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [AdBreak]
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Int
-> CreateProgramResponse
CreateProgramResponse'
    { $sel:creationTime:CreateProgramResponse' :: Maybe POSIX
creationTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceLocationName:CreateProgramResponse' :: Maybe Text
sourceLocationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateProgramResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:programName:CreateProgramResponse' :: Maybe Text
programName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:adBreaks:CreateProgramResponse' :: Maybe [AdBreak]
adBreaks = Maybe [AdBreak]
forall a. Maybe a
Prelude.Nothing,
      $sel:channelName:CreateProgramResponse' :: Maybe Text
channelName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduledStartTime:CreateProgramResponse' :: Maybe POSIX
scheduledStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:vodSourceName:CreateProgramResponse' :: Maybe Text
vodSourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateProgramResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The timestamp of when the program was created.
createProgramResponse_creationTime :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.UTCTime)
createProgramResponse_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_creationTime = (CreateProgramResponse -> Maybe POSIX)
-> (CreateProgramResponse -> Maybe POSIX -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:CreateProgramResponse' :: CreateProgramResponse -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe POSIX
a -> CreateProgramResponse
s {$sel:creationTime:CreateProgramResponse' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: CreateProgramResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateProgramResponse -> f CreateProgramResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateProgramResponse
-> f CreateProgramResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The source location name.
createProgramResponse_sourceLocationName :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.Text)
createProgramResponse_sourceLocationName :: (Maybe Text -> f (Maybe Text))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_sourceLocationName = (CreateProgramResponse -> Maybe Text)
-> (CreateProgramResponse -> Maybe Text -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe Text
sourceLocationName :: Maybe Text
$sel:sourceLocationName:CreateProgramResponse' :: CreateProgramResponse -> Maybe Text
sourceLocationName} -> Maybe Text
sourceLocationName) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe Text
a -> CreateProgramResponse
s {$sel:sourceLocationName:CreateProgramResponse' :: Maybe Text
sourceLocationName = Maybe Text
a} :: CreateProgramResponse)

-- | The ARN of the program.
createProgramResponse_arn :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.Text)
createProgramResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_arn = (CreateProgramResponse -> Maybe Text)
-> (CreateProgramResponse -> Maybe Text -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateProgramResponse' :: CreateProgramResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe Text
a -> CreateProgramResponse
s {$sel:arn:CreateProgramResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateProgramResponse)

-- | The name of the program.
createProgramResponse_programName :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.Text)
createProgramResponse_programName :: (Maybe Text -> f (Maybe Text))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_programName = (CreateProgramResponse -> Maybe Text)
-> (CreateProgramResponse -> Maybe Text -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe Text
programName :: Maybe Text
$sel:programName:CreateProgramResponse' :: CreateProgramResponse -> Maybe Text
programName} -> Maybe Text
programName) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe Text
a -> CreateProgramResponse
s {$sel:programName:CreateProgramResponse' :: Maybe Text
programName = Maybe Text
a} :: CreateProgramResponse)

-- | The ad break configuration settings.
createProgramResponse_adBreaks :: Lens.Lens' CreateProgramResponse (Prelude.Maybe [AdBreak])
createProgramResponse_adBreaks :: (Maybe [AdBreak] -> f (Maybe [AdBreak]))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_adBreaks = (CreateProgramResponse -> Maybe [AdBreak])
-> (CreateProgramResponse
    -> Maybe [AdBreak] -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe [AdBreak])
     (Maybe [AdBreak])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe [AdBreak]
adBreaks :: Maybe [AdBreak]
$sel:adBreaks:CreateProgramResponse' :: CreateProgramResponse -> Maybe [AdBreak]
adBreaks} -> Maybe [AdBreak]
adBreaks) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe [AdBreak]
a -> CreateProgramResponse
s {$sel:adBreaks:CreateProgramResponse' :: Maybe [AdBreak]
adBreaks = Maybe [AdBreak]
a} :: CreateProgramResponse) ((Maybe [AdBreak] -> f (Maybe [AdBreak]))
 -> CreateProgramResponse -> f CreateProgramResponse)
-> ((Maybe [AdBreak] -> f (Maybe [AdBreak]))
    -> Maybe [AdBreak] -> f (Maybe [AdBreak]))
-> (Maybe [AdBreak] -> f (Maybe [AdBreak]))
-> CreateProgramResponse
-> f CreateProgramResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [AdBreak] [AdBreak] [AdBreak] [AdBreak]
-> Iso
     (Maybe [AdBreak])
     (Maybe [AdBreak])
     (Maybe [AdBreak])
     (Maybe [AdBreak])
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 [AdBreak] [AdBreak] [AdBreak] [AdBreak]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the channel that the program belongs to.
createProgramResponse_channelName :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.Text)
createProgramResponse_channelName :: (Maybe Text -> f (Maybe Text))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_channelName = (CreateProgramResponse -> Maybe Text)
-> (CreateProgramResponse -> Maybe Text -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe Text
channelName :: Maybe Text
$sel:channelName:CreateProgramResponse' :: CreateProgramResponse -> Maybe Text
channelName} -> Maybe Text
channelName) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe Text
a -> CreateProgramResponse
s {$sel:channelName:CreateProgramResponse' :: Maybe Text
channelName = Maybe Text
a} :: CreateProgramResponse)

-- | The date and time that the program is scheduled to start in ISO 8601
-- format and Coordinated Universal Time (UTC). For example, the value
-- 2021-03-27T17:48:16.751Z represents March 27, 2021 at 17:48:16.751 UTC.
createProgramResponse_scheduledStartTime :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.UTCTime)
createProgramResponse_scheduledStartTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_scheduledStartTime = (CreateProgramResponse -> Maybe POSIX)
-> (CreateProgramResponse -> Maybe POSIX -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe POSIX
scheduledStartTime :: Maybe POSIX
$sel:scheduledStartTime:CreateProgramResponse' :: CreateProgramResponse -> Maybe POSIX
scheduledStartTime} -> Maybe POSIX
scheduledStartTime) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe POSIX
a -> CreateProgramResponse
s {$sel:scheduledStartTime:CreateProgramResponse' :: Maybe POSIX
scheduledStartTime = Maybe POSIX
a} :: CreateProgramResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateProgramResponse -> f CreateProgramResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateProgramResponse
-> f CreateProgramResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The name that\'s used to refer to a VOD source.
createProgramResponse_vodSourceName :: Lens.Lens' CreateProgramResponse (Prelude.Maybe Prelude.Text)
createProgramResponse_vodSourceName :: (Maybe Text -> f (Maybe Text))
-> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_vodSourceName = (CreateProgramResponse -> Maybe Text)
-> (CreateProgramResponse -> Maybe Text -> CreateProgramResponse)
-> Lens
     CreateProgramResponse
     CreateProgramResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Maybe Text
vodSourceName :: Maybe Text
$sel:vodSourceName:CreateProgramResponse' :: CreateProgramResponse -> Maybe Text
vodSourceName} -> Maybe Text
vodSourceName) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Maybe Text
a -> CreateProgramResponse
s {$sel:vodSourceName:CreateProgramResponse' :: Maybe Text
vodSourceName = Maybe Text
a} :: CreateProgramResponse)

-- | The response's http status code.
createProgramResponse_httpStatus :: Lens.Lens' CreateProgramResponse Prelude.Int
createProgramResponse_httpStatus :: (Int -> f Int) -> CreateProgramResponse -> f CreateProgramResponse
createProgramResponse_httpStatus = (CreateProgramResponse -> Int)
-> (CreateProgramResponse -> Int -> CreateProgramResponse)
-> Lens CreateProgramResponse CreateProgramResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProgramResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateProgramResponse' :: CreateProgramResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateProgramResponse
s@CreateProgramResponse' {} Int
a -> CreateProgramResponse
s {$sel:httpStatus:CreateProgramResponse' :: Int
httpStatus = Int
a} :: CreateProgramResponse)

instance Prelude.NFData CreateProgramResponse