{-# 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.CreatePrefetchSchedule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a prefetch schedule for a playback configuration. A prefetch
-- schedule allows you to tell MediaTailor to fetch and prepare certain ads
-- before an ad break happens. For more information about ad prefetching,
-- see
-- <https://docs.aws.amazon.com/mediatailor/latest/ug/prefetching-ads.html Using ad prefetching>
-- in the /MediaTailor User Guide/.
module Amazonka.MediaTailor.CreatePrefetchSchedule
  ( -- * Creating a Request
    CreatePrefetchSchedule (..),
    newCreatePrefetchSchedule,

    -- * Request Lenses
    createPrefetchSchedule_streamId,
    createPrefetchSchedule_consumption,
    createPrefetchSchedule_name,
    createPrefetchSchedule_playbackConfigurationName,
    createPrefetchSchedule_retrieval,

    -- * Destructuring the Response
    CreatePrefetchScheduleResponse (..),
    newCreatePrefetchScheduleResponse,

    -- * Response Lenses
    createPrefetchScheduleResponse_arn,
    createPrefetchScheduleResponse_consumption,
    createPrefetchScheduleResponse_name,
    createPrefetchScheduleResponse_playbackConfigurationName,
    createPrefetchScheduleResponse_retrieval,
    createPrefetchScheduleResponse_streamId,
    createPrefetchScheduleResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreatePrefetchSchedule' smart constructor.
data CreatePrefetchSchedule = CreatePrefetchSchedule'
  { -- | An optional stream identifier that MediaTailor uses to prefetch ads for
    -- multiple streams that use the same playback configuration. If @StreamId@
    -- is specified, MediaTailor returns all of the prefetch schedules with an
    -- exact match on @StreamId@. If not specified, MediaTailor returns all of
    -- the prefetch schedules for the playback configuration, regardless of
    -- @StreamId@.
    CreatePrefetchSchedule -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The configuration settings for MediaTailor\'s /consumption/ of the
    -- prefetched ads from the ad decision server. Each consumption
    -- configuration contains an end time and an optional start time that
    -- define the /consumption window/. Prefetch schedules automatically expire
    -- no earlier than seven days after the end time.
    CreatePrefetchSchedule -> PrefetchConsumption
consumption :: PrefetchConsumption,
    -- | The name to assign to the schedule request.
    CreatePrefetchSchedule -> Text
name :: Prelude.Text,
    -- | The name to assign to the playback configuration.
    CreatePrefetchSchedule -> Text
playbackConfigurationName :: Prelude.Text,
    -- | The configuration settings for retrieval of prefetched ads from the ad
    -- decision server. Only one set of prefetched ads will be retrieved and
    -- subsequently consumed for each ad break.
    CreatePrefetchSchedule -> PrefetchRetrieval
retrieval :: PrefetchRetrieval
  }
  deriving (CreatePrefetchSchedule -> CreatePrefetchSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePrefetchSchedule -> CreatePrefetchSchedule -> Bool
$c/= :: CreatePrefetchSchedule -> CreatePrefetchSchedule -> Bool
== :: CreatePrefetchSchedule -> CreatePrefetchSchedule -> Bool
$c== :: CreatePrefetchSchedule -> CreatePrefetchSchedule -> Bool
Prelude.Eq, ReadPrec [CreatePrefetchSchedule]
ReadPrec CreatePrefetchSchedule
Int -> ReadS CreatePrefetchSchedule
ReadS [CreatePrefetchSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePrefetchSchedule]
$creadListPrec :: ReadPrec [CreatePrefetchSchedule]
readPrec :: ReadPrec CreatePrefetchSchedule
$creadPrec :: ReadPrec CreatePrefetchSchedule
readList :: ReadS [CreatePrefetchSchedule]
$creadList :: ReadS [CreatePrefetchSchedule]
readsPrec :: Int -> ReadS CreatePrefetchSchedule
$creadsPrec :: Int -> ReadS CreatePrefetchSchedule
Prelude.Read, Int -> CreatePrefetchSchedule -> ShowS
[CreatePrefetchSchedule] -> ShowS
CreatePrefetchSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePrefetchSchedule] -> ShowS
$cshowList :: [CreatePrefetchSchedule] -> ShowS
show :: CreatePrefetchSchedule -> String
$cshow :: CreatePrefetchSchedule -> String
showsPrec :: Int -> CreatePrefetchSchedule -> ShowS
$cshowsPrec :: Int -> CreatePrefetchSchedule -> ShowS
Prelude.Show, forall x. Rep CreatePrefetchSchedule x -> CreatePrefetchSchedule
forall x. CreatePrefetchSchedule -> Rep CreatePrefetchSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePrefetchSchedule x -> CreatePrefetchSchedule
$cfrom :: forall x. CreatePrefetchSchedule -> Rep CreatePrefetchSchedule x
Prelude.Generic)

-- |
-- Create a value of 'CreatePrefetchSchedule' 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:
--
-- 'streamId', 'createPrefetchSchedule_streamId' - An optional stream identifier that MediaTailor uses to prefetch ads for
-- multiple streams that use the same playback configuration. If @StreamId@
-- is specified, MediaTailor returns all of the prefetch schedules with an
-- exact match on @StreamId@. If not specified, MediaTailor returns all of
-- the prefetch schedules for the playback configuration, regardless of
-- @StreamId@.
--
-- 'consumption', 'createPrefetchSchedule_consumption' - The configuration settings for MediaTailor\'s /consumption/ of the
-- prefetched ads from the ad decision server. Each consumption
-- configuration contains an end time and an optional start time that
-- define the /consumption window/. Prefetch schedules automatically expire
-- no earlier than seven days after the end time.
--
-- 'name', 'createPrefetchSchedule_name' - The name to assign to the schedule request.
--
-- 'playbackConfigurationName', 'createPrefetchSchedule_playbackConfigurationName' - The name to assign to the playback configuration.
--
-- 'retrieval', 'createPrefetchSchedule_retrieval' - The configuration settings for retrieval of prefetched ads from the ad
-- decision server. Only one set of prefetched ads will be retrieved and
-- subsequently consumed for each ad break.
newCreatePrefetchSchedule ::
  -- | 'consumption'
  PrefetchConsumption ->
  -- | 'name'
  Prelude.Text ->
  -- | 'playbackConfigurationName'
  Prelude.Text ->
  -- | 'retrieval'
  PrefetchRetrieval ->
  CreatePrefetchSchedule
newCreatePrefetchSchedule :: PrefetchConsumption
-> Text -> Text -> PrefetchRetrieval -> CreatePrefetchSchedule
newCreatePrefetchSchedule
  PrefetchConsumption
pConsumption_
  Text
pName_
  Text
pPlaybackConfigurationName_
  PrefetchRetrieval
pRetrieval_ =
    CreatePrefetchSchedule'
      { $sel:streamId:CreatePrefetchSchedule' :: Maybe Text
streamId = forall a. Maybe a
Prelude.Nothing,
        $sel:consumption:CreatePrefetchSchedule' :: PrefetchConsumption
consumption = PrefetchConsumption
pConsumption_,
        $sel:name:CreatePrefetchSchedule' :: Text
name = Text
pName_,
        $sel:playbackConfigurationName:CreatePrefetchSchedule' :: Text
playbackConfigurationName =
          Text
pPlaybackConfigurationName_,
        $sel:retrieval:CreatePrefetchSchedule' :: PrefetchRetrieval
retrieval = PrefetchRetrieval
pRetrieval_
      }

-- | An optional stream identifier that MediaTailor uses to prefetch ads for
-- multiple streams that use the same playback configuration. If @StreamId@
-- is specified, MediaTailor returns all of the prefetch schedules with an
-- exact match on @StreamId@. If not specified, MediaTailor returns all of
-- the prefetch schedules for the playback configuration, regardless of
-- @StreamId@.
createPrefetchSchedule_streamId :: Lens.Lens' CreatePrefetchSchedule (Prelude.Maybe Prelude.Text)
createPrefetchSchedule_streamId :: Lens' CreatePrefetchSchedule (Maybe Text)
createPrefetchSchedule_streamId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchSchedule' {Maybe Text
streamId :: Maybe Text
$sel:streamId:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: CreatePrefetchSchedule
s@CreatePrefetchSchedule' {} Maybe Text
a -> CreatePrefetchSchedule
s {$sel:streamId:CreatePrefetchSchedule' :: Maybe Text
streamId = Maybe Text
a} :: CreatePrefetchSchedule)

-- | The configuration settings for MediaTailor\'s /consumption/ of the
-- prefetched ads from the ad decision server. Each consumption
-- configuration contains an end time and an optional start time that
-- define the /consumption window/. Prefetch schedules automatically expire
-- no earlier than seven days after the end time.
createPrefetchSchedule_consumption :: Lens.Lens' CreatePrefetchSchedule PrefetchConsumption
createPrefetchSchedule_consumption :: Lens' CreatePrefetchSchedule PrefetchConsumption
createPrefetchSchedule_consumption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchSchedule' {PrefetchConsumption
consumption :: PrefetchConsumption
$sel:consumption:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchConsumption
consumption} -> PrefetchConsumption
consumption) (\s :: CreatePrefetchSchedule
s@CreatePrefetchSchedule' {} PrefetchConsumption
a -> CreatePrefetchSchedule
s {$sel:consumption:CreatePrefetchSchedule' :: PrefetchConsumption
consumption = PrefetchConsumption
a} :: CreatePrefetchSchedule)

-- | The name to assign to the schedule request.
createPrefetchSchedule_name :: Lens.Lens' CreatePrefetchSchedule Prelude.Text
createPrefetchSchedule_name :: Lens' CreatePrefetchSchedule Text
createPrefetchSchedule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchSchedule' {Text
name :: Text
$sel:name:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
name} -> Text
name) (\s :: CreatePrefetchSchedule
s@CreatePrefetchSchedule' {} Text
a -> CreatePrefetchSchedule
s {$sel:name:CreatePrefetchSchedule' :: Text
name = Text
a} :: CreatePrefetchSchedule)

-- | The name to assign to the playback configuration.
createPrefetchSchedule_playbackConfigurationName :: Lens.Lens' CreatePrefetchSchedule Prelude.Text
createPrefetchSchedule_playbackConfigurationName :: Lens' CreatePrefetchSchedule Text
createPrefetchSchedule_playbackConfigurationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchSchedule' {Text
playbackConfigurationName :: Text
$sel:playbackConfigurationName:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
playbackConfigurationName} -> Text
playbackConfigurationName) (\s :: CreatePrefetchSchedule
s@CreatePrefetchSchedule' {} Text
a -> CreatePrefetchSchedule
s {$sel:playbackConfigurationName:CreatePrefetchSchedule' :: Text
playbackConfigurationName = Text
a} :: CreatePrefetchSchedule)

-- | The configuration settings for retrieval of prefetched ads from the ad
-- decision server. Only one set of prefetched ads will be retrieved and
-- subsequently consumed for each ad break.
createPrefetchSchedule_retrieval :: Lens.Lens' CreatePrefetchSchedule PrefetchRetrieval
createPrefetchSchedule_retrieval :: Lens' CreatePrefetchSchedule PrefetchRetrieval
createPrefetchSchedule_retrieval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchSchedule' {PrefetchRetrieval
retrieval :: PrefetchRetrieval
$sel:retrieval:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchRetrieval
retrieval} -> PrefetchRetrieval
retrieval) (\s :: CreatePrefetchSchedule
s@CreatePrefetchSchedule' {} PrefetchRetrieval
a -> CreatePrefetchSchedule
s {$sel:retrieval:CreatePrefetchSchedule' :: PrefetchRetrieval
retrieval = PrefetchRetrieval
a} :: CreatePrefetchSchedule)

instance Core.AWSRequest CreatePrefetchSchedule where
  type
    AWSResponse CreatePrefetchSchedule =
      CreatePrefetchScheduleResponse
  request :: (Service -> Service)
-> CreatePrefetchSchedule -> Request CreatePrefetchSchedule
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreatePrefetchSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreatePrefetchSchedule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe PrefetchConsumption
-> Maybe Text
-> Maybe Text
-> Maybe PrefetchRetrieval
-> Maybe Text
-> Int
-> CreatePrefetchScheduleResponse
CreatePrefetchScheduleResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Consumption")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PlaybackConfigurationName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Retrieval")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"StreamId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreatePrefetchSchedule where
  hashWithSalt :: Int -> CreatePrefetchSchedule -> Int
hashWithSalt Int
_salt CreatePrefetchSchedule' {Maybe Text
Text
PrefetchConsumption
PrefetchRetrieval
retrieval :: PrefetchRetrieval
playbackConfigurationName :: Text
name :: Text
consumption :: PrefetchConsumption
streamId :: Maybe Text
$sel:retrieval:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchRetrieval
$sel:playbackConfigurationName:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:name:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:consumption:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchConsumption
$sel:streamId:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
streamId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PrefetchConsumption
consumption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
playbackConfigurationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PrefetchRetrieval
retrieval

instance Prelude.NFData CreatePrefetchSchedule where
  rnf :: CreatePrefetchSchedule -> ()
rnf CreatePrefetchSchedule' {Maybe Text
Text
PrefetchConsumption
PrefetchRetrieval
retrieval :: PrefetchRetrieval
playbackConfigurationName :: Text
name :: Text
consumption :: PrefetchConsumption
streamId :: Maybe Text
$sel:retrieval:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchRetrieval
$sel:playbackConfigurationName:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:name:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:consumption:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchConsumption
$sel:streamId:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PrefetchConsumption
consumption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
playbackConfigurationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PrefetchRetrieval
retrieval

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

instance Data.ToJSON CreatePrefetchSchedule where
  toJSON :: CreatePrefetchSchedule -> Value
toJSON CreatePrefetchSchedule' {Maybe Text
Text
PrefetchConsumption
PrefetchRetrieval
retrieval :: PrefetchRetrieval
playbackConfigurationName :: Text
name :: Text
consumption :: PrefetchConsumption
streamId :: Maybe Text
$sel:retrieval:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchRetrieval
$sel:playbackConfigurationName:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:name:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:consumption:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchConsumption
$sel:streamId:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"StreamId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
streamId,
            forall a. a -> Maybe a
Prelude.Just (Key
"Consumption" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PrefetchConsumption
consumption),
            forall a. a -> Maybe a
Prelude.Just (Key
"Retrieval" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PrefetchRetrieval
retrieval)
          ]
      )

instance Data.ToPath CreatePrefetchSchedule where
  toPath :: CreatePrefetchSchedule -> ByteString
toPath CreatePrefetchSchedule' {Maybe Text
Text
PrefetchConsumption
PrefetchRetrieval
retrieval :: PrefetchRetrieval
playbackConfigurationName :: Text
name :: Text
consumption :: PrefetchConsumption
streamId :: Maybe Text
$sel:retrieval:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchRetrieval
$sel:playbackConfigurationName:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:name:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Text
$sel:consumption:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> PrefetchConsumption
$sel:streamId:CreatePrefetchSchedule' :: CreatePrefetchSchedule -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/prefetchSchedule/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
playbackConfigurationName,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
name
      ]

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

-- | /See:/ 'newCreatePrefetchScheduleResponse' smart constructor.
data CreatePrefetchScheduleResponse = CreatePrefetchScheduleResponse'
  { -- | The ARN to assign to the prefetch schedule.
    CreatePrefetchScheduleResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The configuration settings for MediaTailor\'s /consumption/ of the
    -- prefetched ads from the ad decision server. Each consumption
    -- configuration contains an end time and an optional start time that
    -- define the /consumption window/. Prefetch schedules automatically expire
    -- no earlier than seven days after the end time.
    CreatePrefetchScheduleResponse -> Maybe PrefetchConsumption
consumption :: Prelude.Maybe PrefetchConsumption,
    -- | The name to assign to the prefetch schedule.
    CreatePrefetchScheduleResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The name to assign to the playback configuration.
    CreatePrefetchScheduleResponse -> Maybe Text
playbackConfigurationName :: Prelude.Maybe Prelude.Text,
    -- | The configuration settings for retrieval of prefetched ads from the ad
    -- decision server. Only one set of prefetched ads will be retrieved and
    -- subsequently consumed for each ad break.
    CreatePrefetchScheduleResponse -> Maybe PrefetchRetrieval
retrieval :: Prelude.Maybe PrefetchRetrieval,
    -- | An optional stream identifier that MediaTailor uses to prefetch ads for
    -- multiple streams that use the same playback configuration. If @StreamId@
    -- is specified, MediaTailor returns all of the prefetch schedules with an
    -- exact match on @StreamId@. If not specified, MediaTailor returns all of
    -- the prefetch schedules for the playback configuration, regardless of
    -- @StreamId@.
    CreatePrefetchScheduleResponse -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreatePrefetchScheduleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreatePrefetchScheduleResponse
-> CreatePrefetchScheduleResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePrefetchScheduleResponse
-> CreatePrefetchScheduleResponse -> Bool
$c/= :: CreatePrefetchScheduleResponse
-> CreatePrefetchScheduleResponse -> Bool
== :: CreatePrefetchScheduleResponse
-> CreatePrefetchScheduleResponse -> Bool
$c== :: CreatePrefetchScheduleResponse
-> CreatePrefetchScheduleResponse -> Bool
Prelude.Eq, ReadPrec [CreatePrefetchScheduleResponse]
ReadPrec CreatePrefetchScheduleResponse
Int -> ReadS CreatePrefetchScheduleResponse
ReadS [CreatePrefetchScheduleResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePrefetchScheduleResponse]
$creadListPrec :: ReadPrec [CreatePrefetchScheduleResponse]
readPrec :: ReadPrec CreatePrefetchScheduleResponse
$creadPrec :: ReadPrec CreatePrefetchScheduleResponse
readList :: ReadS [CreatePrefetchScheduleResponse]
$creadList :: ReadS [CreatePrefetchScheduleResponse]
readsPrec :: Int -> ReadS CreatePrefetchScheduleResponse
$creadsPrec :: Int -> ReadS CreatePrefetchScheduleResponse
Prelude.Read, Int -> CreatePrefetchScheduleResponse -> ShowS
[CreatePrefetchScheduleResponse] -> ShowS
CreatePrefetchScheduleResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePrefetchScheduleResponse] -> ShowS
$cshowList :: [CreatePrefetchScheduleResponse] -> ShowS
show :: CreatePrefetchScheduleResponse -> String
$cshow :: CreatePrefetchScheduleResponse -> String
showsPrec :: Int -> CreatePrefetchScheduleResponse -> ShowS
$cshowsPrec :: Int -> CreatePrefetchScheduleResponse -> ShowS
Prelude.Show, forall x.
Rep CreatePrefetchScheduleResponse x
-> CreatePrefetchScheduleResponse
forall x.
CreatePrefetchScheduleResponse
-> Rep CreatePrefetchScheduleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePrefetchScheduleResponse x
-> CreatePrefetchScheduleResponse
$cfrom :: forall x.
CreatePrefetchScheduleResponse
-> Rep CreatePrefetchScheduleResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePrefetchScheduleResponse' 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:
--
-- 'arn', 'createPrefetchScheduleResponse_arn' - The ARN to assign to the prefetch schedule.
--
-- 'consumption', 'createPrefetchScheduleResponse_consumption' - The configuration settings for MediaTailor\'s /consumption/ of the
-- prefetched ads from the ad decision server. Each consumption
-- configuration contains an end time and an optional start time that
-- define the /consumption window/. Prefetch schedules automatically expire
-- no earlier than seven days after the end time.
--
-- 'name', 'createPrefetchScheduleResponse_name' - The name to assign to the prefetch schedule.
--
-- 'playbackConfigurationName', 'createPrefetchScheduleResponse_playbackConfigurationName' - The name to assign to the playback configuration.
--
-- 'retrieval', 'createPrefetchScheduleResponse_retrieval' - The configuration settings for retrieval of prefetched ads from the ad
-- decision server. Only one set of prefetched ads will be retrieved and
-- subsequently consumed for each ad break.
--
-- 'streamId', 'createPrefetchScheduleResponse_streamId' - An optional stream identifier that MediaTailor uses to prefetch ads for
-- multiple streams that use the same playback configuration. If @StreamId@
-- is specified, MediaTailor returns all of the prefetch schedules with an
-- exact match on @StreamId@. If not specified, MediaTailor returns all of
-- the prefetch schedules for the playback configuration, regardless of
-- @StreamId@.
--
-- 'httpStatus', 'createPrefetchScheduleResponse_httpStatus' - The response's http status code.
newCreatePrefetchScheduleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreatePrefetchScheduleResponse
newCreatePrefetchScheduleResponse :: Int -> CreatePrefetchScheduleResponse
newCreatePrefetchScheduleResponse Int
pHttpStatus_ =
  CreatePrefetchScheduleResponse'
    { $sel:arn:CreatePrefetchScheduleResponse' :: Maybe Text
arn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:consumption:CreatePrefetchScheduleResponse' :: Maybe PrefetchConsumption
consumption = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreatePrefetchScheduleResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:playbackConfigurationName:CreatePrefetchScheduleResponse' :: Maybe Text
playbackConfigurationName = forall a. Maybe a
Prelude.Nothing,
      $sel:retrieval:CreatePrefetchScheduleResponse' :: Maybe PrefetchRetrieval
retrieval = forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:CreatePrefetchScheduleResponse' :: Maybe Text
streamId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreatePrefetchScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN to assign to the prefetch schedule.
createPrefetchScheduleResponse_arn :: Lens.Lens' CreatePrefetchScheduleResponse (Prelude.Maybe Prelude.Text)
createPrefetchScheduleResponse_arn :: Lens' CreatePrefetchScheduleResponse (Maybe Text)
createPrefetchScheduleResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchScheduleResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreatePrefetchScheduleResponse
s@CreatePrefetchScheduleResponse' {} Maybe Text
a -> CreatePrefetchScheduleResponse
s {$sel:arn:CreatePrefetchScheduleResponse' :: Maybe Text
arn = Maybe Text
a} :: CreatePrefetchScheduleResponse)

-- | The configuration settings for MediaTailor\'s /consumption/ of the
-- prefetched ads from the ad decision server. Each consumption
-- configuration contains an end time and an optional start time that
-- define the /consumption window/. Prefetch schedules automatically expire
-- no earlier than seven days after the end time.
createPrefetchScheduleResponse_consumption :: Lens.Lens' CreatePrefetchScheduleResponse (Prelude.Maybe PrefetchConsumption)
createPrefetchScheduleResponse_consumption :: Lens' CreatePrefetchScheduleResponse (Maybe PrefetchConsumption)
createPrefetchScheduleResponse_consumption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchScheduleResponse' {Maybe PrefetchConsumption
consumption :: Maybe PrefetchConsumption
$sel:consumption:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe PrefetchConsumption
consumption} -> Maybe PrefetchConsumption
consumption) (\s :: CreatePrefetchScheduleResponse
s@CreatePrefetchScheduleResponse' {} Maybe PrefetchConsumption
a -> CreatePrefetchScheduleResponse
s {$sel:consumption:CreatePrefetchScheduleResponse' :: Maybe PrefetchConsumption
consumption = Maybe PrefetchConsumption
a} :: CreatePrefetchScheduleResponse)

-- | The name to assign to the prefetch schedule.
createPrefetchScheduleResponse_name :: Lens.Lens' CreatePrefetchScheduleResponse (Prelude.Maybe Prelude.Text)
createPrefetchScheduleResponse_name :: Lens' CreatePrefetchScheduleResponse (Maybe Text)
createPrefetchScheduleResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchScheduleResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreatePrefetchScheduleResponse
s@CreatePrefetchScheduleResponse' {} Maybe Text
a -> CreatePrefetchScheduleResponse
s {$sel:name:CreatePrefetchScheduleResponse' :: Maybe Text
name = Maybe Text
a} :: CreatePrefetchScheduleResponse)

-- | The name to assign to the playback configuration.
createPrefetchScheduleResponse_playbackConfigurationName :: Lens.Lens' CreatePrefetchScheduleResponse (Prelude.Maybe Prelude.Text)
createPrefetchScheduleResponse_playbackConfigurationName :: Lens' CreatePrefetchScheduleResponse (Maybe Text)
createPrefetchScheduleResponse_playbackConfigurationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchScheduleResponse' {Maybe Text
playbackConfigurationName :: Maybe Text
$sel:playbackConfigurationName:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
playbackConfigurationName} -> Maybe Text
playbackConfigurationName) (\s :: CreatePrefetchScheduleResponse
s@CreatePrefetchScheduleResponse' {} Maybe Text
a -> CreatePrefetchScheduleResponse
s {$sel:playbackConfigurationName:CreatePrefetchScheduleResponse' :: Maybe Text
playbackConfigurationName = Maybe Text
a} :: CreatePrefetchScheduleResponse)

-- | The configuration settings for retrieval of prefetched ads from the ad
-- decision server. Only one set of prefetched ads will be retrieved and
-- subsequently consumed for each ad break.
createPrefetchScheduleResponse_retrieval :: Lens.Lens' CreatePrefetchScheduleResponse (Prelude.Maybe PrefetchRetrieval)
createPrefetchScheduleResponse_retrieval :: Lens' CreatePrefetchScheduleResponse (Maybe PrefetchRetrieval)
createPrefetchScheduleResponse_retrieval = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchScheduleResponse' {Maybe PrefetchRetrieval
retrieval :: Maybe PrefetchRetrieval
$sel:retrieval:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe PrefetchRetrieval
retrieval} -> Maybe PrefetchRetrieval
retrieval) (\s :: CreatePrefetchScheduleResponse
s@CreatePrefetchScheduleResponse' {} Maybe PrefetchRetrieval
a -> CreatePrefetchScheduleResponse
s {$sel:retrieval:CreatePrefetchScheduleResponse' :: Maybe PrefetchRetrieval
retrieval = Maybe PrefetchRetrieval
a} :: CreatePrefetchScheduleResponse)

-- | An optional stream identifier that MediaTailor uses to prefetch ads for
-- multiple streams that use the same playback configuration. If @StreamId@
-- is specified, MediaTailor returns all of the prefetch schedules with an
-- exact match on @StreamId@. If not specified, MediaTailor returns all of
-- the prefetch schedules for the playback configuration, regardless of
-- @StreamId@.
createPrefetchScheduleResponse_streamId :: Lens.Lens' CreatePrefetchScheduleResponse (Prelude.Maybe Prelude.Text)
createPrefetchScheduleResponse_streamId :: Lens' CreatePrefetchScheduleResponse (Maybe Text)
createPrefetchScheduleResponse_streamId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePrefetchScheduleResponse' {Maybe Text
streamId :: Maybe Text
$sel:streamId:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: CreatePrefetchScheduleResponse
s@CreatePrefetchScheduleResponse' {} Maybe Text
a -> CreatePrefetchScheduleResponse
s {$sel:streamId:CreatePrefetchScheduleResponse' :: Maybe Text
streamId = Maybe Text
a} :: CreatePrefetchScheduleResponse)

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

instance
  Prelude.NFData
    CreatePrefetchScheduleResponse
  where
  rnf :: CreatePrefetchScheduleResponse -> ()
rnf CreatePrefetchScheduleResponse' {Int
Maybe Text
Maybe PrefetchConsumption
Maybe PrefetchRetrieval
httpStatus :: Int
streamId :: Maybe Text
retrieval :: Maybe PrefetchRetrieval
playbackConfigurationName :: Maybe Text
name :: Maybe Text
consumption :: Maybe PrefetchConsumption
arn :: Maybe Text
$sel:httpStatus:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Int
$sel:streamId:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
$sel:retrieval:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe PrefetchRetrieval
$sel:playbackConfigurationName:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
$sel:name:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
$sel:consumption:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe PrefetchConsumption
$sel:arn:CreatePrefetchScheduleResponse' :: CreatePrefetchScheduleResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PrefetchConsumption
consumption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
playbackConfigurationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PrefetchRetrieval
retrieval
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
streamId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus