{-# 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.ListPrefetchSchedules
-- 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 new prefetch schedule.
--
-- This operation returns paginated results.
module Amazonka.MediaTailor.ListPrefetchSchedules
  ( -- * Creating a Request
    ListPrefetchSchedules (..),
    newListPrefetchSchedules,

    -- * Request Lenses
    listPrefetchSchedules_nextToken,
    listPrefetchSchedules_maxResults,
    listPrefetchSchedules_streamId,
    listPrefetchSchedules_playbackConfigurationName,

    -- * Destructuring the Response
    ListPrefetchSchedulesResponse (..),
    newListPrefetchSchedulesResponse,

    -- * Response Lenses
    listPrefetchSchedulesResponse_items,
    listPrefetchSchedulesResponse_nextToken,
    listPrefetchSchedulesResponse_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:/ 'newListPrefetchSchedules' smart constructor.
data ListPrefetchSchedules = ListPrefetchSchedules'
  { -- | (Optional) If the playback configuration has more than MaxResults
    -- prefetch schedules, use NextToken to get the second and subsequent pages
    -- of results.
    --
    -- For the first ListPrefetchSchedulesRequest request, omit this value.
    --
    -- For the second and subsequent requests, get the value of NextToken from
    -- the previous response and specify that value for NextToken in the
    -- request.
    --
    -- If the previous response didn\'t include a NextToken element, there are
    -- no more prefetch schedules to get.
    ListPrefetchSchedules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of prefetch schedules that you want MediaTailor to
    -- return in response to the current request. If the playback configuration
    -- has more than MaxResults prefetch schedules, use the value of NextToken
    -- in the response to get the next page of results.
    ListPrefetchSchedules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | An optional filtering parameter whereby MediaTailor filters the prefetch
    -- schedules to include only specific streams.
    ListPrefetchSchedules -> Maybe Text
streamId :: Prelude.Maybe Prelude.Text,
    -- | The name of the playback configuration.
    ListPrefetchSchedules -> Text
playbackConfigurationName :: Prelude.Text
  }
  deriving (ListPrefetchSchedules -> ListPrefetchSchedules -> Bool
(ListPrefetchSchedules -> ListPrefetchSchedules -> Bool)
-> (ListPrefetchSchedules -> ListPrefetchSchedules -> Bool)
-> Eq ListPrefetchSchedules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPrefetchSchedules -> ListPrefetchSchedules -> Bool
$c/= :: ListPrefetchSchedules -> ListPrefetchSchedules -> Bool
== :: ListPrefetchSchedules -> ListPrefetchSchedules -> Bool
$c== :: ListPrefetchSchedules -> ListPrefetchSchedules -> Bool
Prelude.Eq, ReadPrec [ListPrefetchSchedules]
ReadPrec ListPrefetchSchedules
Int -> ReadS ListPrefetchSchedules
ReadS [ListPrefetchSchedules]
(Int -> ReadS ListPrefetchSchedules)
-> ReadS [ListPrefetchSchedules]
-> ReadPrec ListPrefetchSchedules
-> ReadPrec [ListPrefetchSchedules]
-> Read ListPrefetchSchedules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPrefetchSchedules]
$creadListPrec :: ReadPrec [ListPrefetchSchedules]
readPrec :: ReadPrec ListPrefetchSchedules
$creadPrec :: ReadPrec ListPrefetchSchedules
readList :: ReadS [ListPrefetchSchedules]
$creadList :: ReadS [ListPrefetchSchedules]
readsPrec :: Int -> ReadS ListPrefetchSchedules
$creadsPrec :: Int -> ReadS ListPrefetchSchedules
Prelude.Read, Int -> ListPrefetchSchedules -> ShowS
[ListPrefetchSchedules] -> ShowS
ListPrefetchSchedules -> String
(Int -> ListPrefetchSchedules -> ShowS)
-> (ListPrefetchSchedules -> String)
-> ([ListPrefetchSchedules] -> ShowS)
-> Show ListPrefetchSchedules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPrefetchSchedules] -> ShowS
$cshowList :: [ListPrefetchSchedules] -> ShowS
show :: ListPrefetchSchedules -> String
$cshow :: ListPrefetchSchedules -> String
showsPrec :: Int -> ListPrefetchSchedules -> ShowS
$cshowsPrec :: Int -> ListPrefetchSchedules -> ShowS
Prelude.Show, (forall x. ListPrefetchSchedules -> Rep ListPrefetchSchedules x)
-> (forall x. Rep ListPrefetchSchedules x -> ListPrefetchSchedules)
-> Generic ListPrefetchSchedules
forall x. Rep ListPrefetchSchedules x -> ListPrefetchSchedules
forall x. ListPrefetchSchedules -> Rep ListPrefetchSchedules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPrefetchSchedules x -> ListPrefetchSchedules
$cfrom :: forall x. ListPrefetchSchedules -> Rep ListPrefetchSchedules x
Prelude.Generic)

-- |
-- Create a value of 'ListPrefetchSchedules' 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:
--
-- 'nextToken', 'listPrefetchSchedules_nextToken' - (Optional) If the playback configuration has more than MaxResults
-- prefetch schedules, use NextToken to get the second and subsequent pages
-- of results.
--
-- For the first ListPrefetchSchedulesRequest request, omit this value.
--
-- For the second and subsequent requests, get the value of NextToken from
-- the previous response and specify that value for NextToken in the
-- request.
--
-- If the previous response didn\'t include a NextToken element, there are
-- no more prefetch schedules to get.
--
-- 'maxResults', 'listPrefetchSchedules_maxResults' - The maximum number of prefetch schedules that you want MediaTailor to
-- return in response to the current request. If the playback configuration
-- has more than MaxResults prefetch schedules, use the value of NextToken
-- in the response to get the next page of results.
--
-- 'streamId', 'listPrefetchSchedules_streamId' - An optional filtering parameter whereby MediaTailor filters the prefetch
-- schedules to include only specific streams.
--
-- 'playbackConfigurationName', 'listPrefetchSchedules_playbackConfigurationName' - The name of the playback configuration.
newListPrefetchSchedules ::
  -- | 'playbackConfigurationName'
  Prelude.Text ->
  ListPrefetchSchedules
newListPrefetchSchedules :: Text -> ListPrefetchSchedules
newListPrefetchSchedules Text
pPlaybackConfigurationName_ =
  ListPrefetchSchedules' :: Maybe Text
-> Maybe Natural -> Maybe Text -> Text -> ListPrefetchSchedules
ListPrefetchSchedules'
    { $sel:nextToken:ListPrefetchSchedules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPrefetchSchedules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:streamId:ListPrefetchSchedules' :: Maybe Text
streamId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:playbackConfigurationName:ListPrefetchSchedules' :: Text
playbackConfigurationName =
        Text
pPlaybackConfigurationName_
    }

-- | (Optional) If the playback configuration has more than MaxResults
-- prefetch schedules, use NextToken to get the second and subsequent pages
-- of results.
--
-- For the first ListPrefetchSchedulesRequest request, omit this value.
--
-- For the second and subsequent requests, get the value of NextToken from
-- the previous response and specify that value for NextToken in the
-- request.
--
-- If the previous response didn\'t include a NextToken element, there are
-- no more prefetch schedules to get.
listPrefetchSchedules_nextToken :: Lens.Lens' ListPrefetchSchedules (Prelude.Maybe Prelude.Text)
listPrefetchSchedules_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPrefetchSchedules -> f ListPrefetchSchedules
listPrefetchSchedules_nextToken = (ListPrefetchSchedules -> Maybe Text)
-> (ListPrefetchSchedules -> Maybe Text -> ListPrefetchSchedules)
-> Lens
     ListPrefetchSchedules
     ListPrefetchSchedules
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrefetchSchedules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPrefetchSchedules
s@ListPrefetchSchedules' {} Maybe Text
a -> ListPrefetchSchedules
s {$sel:nextToken:ListPrefetchSchedules' :: Maybe Text
nextToken = Maybe Text
a} :: ListPrefetchSchedules)

-- | The maximum number of prefetch schedules that you want MediaTailor to
-- return in response to the current request. If the playback configuration
-- has more than MaxResults prefetch schedules, use the value of NextToken
-- in the response to get the next page of results.
listPrefetchSchedules_maxResults :: Lens.Lens' ListPrefetchSchedules (Prelude.Maybe Prelude.Natural)
listPrefetchSchedules_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPrefetchSchedules -> f ListPrefetchSchedules
listPrefetchSchedules_maxResults = (ListPrefetchSchedules -> Maybe Natural)
-> (ListPrefetchSchedules
    -> Maybe Natural -> ListPrefetchSchedules)
-> Lens
     ListPrefetchSchedules
     ListPrefetchSchedules
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrefetchSchedules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPrefetchSchedules
s@ListPrefetchSchedules' {} Maybe Natural
a -> ListPrefetchSchedules
s {$sel:maxResults:ListPrefetchSchedules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPrefetchSchedules)

-- | An optional filtering parameter whereby MediaTailor filters the prefetch
-- schedules to include only specific streams.
listPrefetchSchedules_streamId :: Lens.Lens' ListPrefetchSchedules (Prelude.Maybe Prelude.Text)
listPrefetchSchedules_streamId :: (Maybe Text -> f (Maybe Text))
-> ListPrefetchSchedules -> f ListPrefetchSchedules
listPrefetchSchedules_streamId = (ListPrefetchSchedules -> Maybe Text)
-> (ListPrefetchSchedules -> Maybe Text -> ListPrefetchSchedules)
-> Lens
     ListPrefetchSchedules
     ListPrefetchSchedules
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrefetchSchedules' {Maybe Text
streamId :: Maybe Text
$sel:streamId:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Text
streamId} -> Maybe Text
streamId) (\s :: ListPrefetchSchedules
s@ListPrefetchSchedules' {} Maybe Text
a -> ListPrefetchSchedules
s {$sel:streamId:ListPrefetchSchedules' :: Maybe Text
streamId = Maybe Text
a} :: ListPrefetchSchedules)

-- | The name of the playback configuration.
listPrefetchSchedules_playbackConfigurationName :: Lens.Lens' ListPrefetchSchedules Prelude.Text
listPrefetchSchedules_playbackConfigurationName :: (Text -> f Text)
-> ListPrefetchSchedules -> f ListPrefetchSchedules
listPrefetchSchedules_playbackConfigurationName = (ListPrefetchSchedules -> Text)
-> (ListPrefetchSchedules -> Text -> ListPrefetchSchedules)
-> Lens ListPrefetchSchedules ListPrefetchSchedules Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrefetchSchedules' {Text
playbackConfigurationName :: Text
$sel:playbackConfigurationName:ListPrefetchSchedules' :: ListPrefetchSchedules -> Text
playbackConfigurationName} -> Text
playbackConfigurationName) (\s :: ListPrefetchSchedules
s@ListPrefetchSchedules' {} Text
a -> ListPrefetchSchedules
s {$sel:playbackConfigurationName:ListPrefetchSchedules' :: Text
playbackConfigurationName = Text
a} :: ListPrefetchSchedules)

instance Core.AWSPager ListPrefetchSchedules where
  page :: ListPrefetchSchedules
-> AWSResponse ListPrefetchSchedules -> Maybe ListPrefetchSchedules
page ListPrefetchSchedules
rq AWSResponse ListPrefetchSchedules
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPrefetchSchedules
ListPrefetchSchedulesResponse
rs
            ListPrefetchSchedulesResponse
-> Getting (First Text) ListPrefetchSchedulesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPrefetchSchedulesResponse
-> Const (First Text) ListPrefetchSchedulesResponse
Lens' ListPrefetchSchedulesResponse (Maybe Text)
listPrefetchSchedulesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPrefetchSchedulesResponse
 -> Const (First Text) ListPrefetchSchedulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPrefetchSchedulesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListPrefetchSchedules
forall a. Maybe a
Prelude.Nothing
    | Maybe [PrefetchSchedule] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPrefetchSchedules
ListPrefetchSchedulesResponse
rs
            ListPrefetchSchedulesResponse
-> Getting
     (First [PrefetchSchedule])
     ListPrefetchSchedulesResponse
     [PrefetchSchedule]
-> Maybe [PrefetchSchedule]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [PrefetchSchedule]
 -> Const (First [PrefetchSchedule]) (Maybe [PrefetchSchedule]))
-> ListPrefetchSchedulesResponse
-> Const (First [PrefetchSchedule]) ListPrefetchSchedulesResponse
Lens' ListPrefetchSchedulesResponse (Maybe [PrefetchSchedule])
listPrefetchSchedulesResponse_items
              ((Maybe [PrefetchSchedule]
  -> Const (First [PrefetchSchedule]) (Maybe [PrefetchSchedule]))
 -> ListPrefetchSchedulesResponse
 -> Const (First [PrefetchSchedule]) ListPrefetchSchedulesResponse)
-> (([PrefetchSchedule]
     -> Const (First [PrefetchSchedule]) [PrefetchSchedule])
    -> Maybe [PrefetchSchedule]
    -> Const (First [PrefetchSchedule]) (Maybe [PrefetchSchedule]))
-> Getting
     (First [PrefetchSchedule])
     ListPrefetchSchedulesResponse
     [PrefetchSchedule]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PrefetchSchedule]
 -> Const (First [PrefetchSchedule]) [PrefetchSchedule])
-> Maybe [PrefetchSchedule]
-> Const (First [PrefetchSchedule]) (Maybe [PrefetchSchedule])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListPrefetchSchedules
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListPrefetchSchedules -> Maybe ListPrefetchSchedules
forall a. a -> Maybe a
Prelude.Just (ListPrefetchSchedules -> Maybe ListPrefetchSchedules)
-> ListPrefetchSchedules -> Maybe ListPrefetchSchedules
forall a b. (a -> b) -> a -> b
Prelude.$
        ListPrefetchSchedules
rq
          ListPrefetchSchedules
-> (ListPrefetchSchedules -> ListPrefetchSchedules)
-> ListPrefetchSchedules
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPrefetchSchedules -> Identity ListPrefetchSchedules
Lens
  ListPrefetchSchedules
  ListPrefetchSchedules
  (Maybe Text)
  (Maybe Text)
listPrefetchSchedules_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListPrefetchSchedules -> Identity ListPrefetchSchedules)
-> Maybe Text -> ListPrefetchSchedules -> ListPrefetchSchedules
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPrefetchSchedules
ListPrefetchSchedulesResponse
rs
          ListPrefetchSchedulesResponse
-> Getting (First Text) ListPrefetchSchedulesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPrefetchSchedulesResponse
-> Const (First Text) ListPrefetchSchedulesResponse
Lens' ListPrefetchSchedulesResponse (Maybe Text)
listPrefetchSchedulesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPrefetchSchedulesResponse
 -> Const (First Text) ListPrefetchSchedulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPrefetchSchedulesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPrefetchSchedules where
  type
    AWSResponse ListPrefetchSchedules =
      ListPrefetchSchedulesResponse
  request :: ListPrefetchSchedules -> Request ListPrefetchSchedules
request = Service -> ListPrefetchSchedules -> Request ListPrefetchSchedules
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListPrefetchSchedules
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPrefetchSchedules)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListPrefetchSchedules))
-> Logger
-> Service
-> Proxy ListPrefetchSchedules
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPrefetchSchedules)))
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 [PrefetchSchedule]
-> Maybe Text -> Int -> ListPrefetchSchedulesResponse
ListPrefetchSchedulesResponse'
            (Maybe [PrefetchSchedule]
 -> Maybe Text -> Int -> ListPrefetchSchedulesResponse)
-> Either String (Maybe [PrefetchSchedule])
-> Either
     String (Maybe Text -> Int -> ListPrefetchSchedulesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [PrefetchSchedule]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Items" Either String (Maybe (Maybe [PrefetchSchedule]))
-> Maybe [PrefetchSchedule]
-> Either String (Maybe [PrefetchSchedule])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PrefetchSchedule]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListPrefetchSchedulesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListPrefetchSchedulesResponse)
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
"NextToken")
            Either String (Int -> ListPrefetchSchedulesResponse)
-> Either String Int -> Either String ListPrefetchSchedulesResponse
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 ListPrefetchSchedules

instance Prelude.NFData ListPrefetchSchedules

instance Core.ToHeaders ListPrefetchSchedules where
  toHeaders :: ListPrefetchSchedules -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPrefetchSchedules -> 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 ListPrefetchSchedules where
  toJSON :: ListPrefetchSchedules -> Value
toJSON ListPrefetchSchedules' {Maybe Natural
Maybe Text
Text
playbackConfigurationName :: Text
streamId :: Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:playbackConfigurationName:ListPrefetchSchedules' :: ListPrefetchSchedules -> Text
$sel:streamId:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Text
$sel:maxResults:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Natural
$sel:nextToken:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"StreamId" 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
streamId
          ]
      )

instance Core.ToPath ListPrefetchSchedules where
  toPath :: ListPrefetchSchedules -> ByteString
toPath ListPrefetchSchedules' {Maybe Natural
Maybe Text
Text
playbackConfigurationName :: Text
streamId :: Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:playbackConfigurationName:ListPrefetchSchedules' :: ListPrefetchSchedules -> Text
$sel:streamId:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Text
$sel:maxResults:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Natural
$sel:nextToken:ListPrefetchSchedules' :: ListPrefetchSchedules -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/prefetchSchedule/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
playbackConfigurationName
      ]

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

-- | /See:/ 'newListPrefetchSchedulesResponse' smart constructor.
data ListPrefetchSchedulesResponse = ListPrefetchSchedulesResponse'
  { -- | Lists the prefetch schedules. An empty Items list doesn\'t mean there
    -- aren\'t more items to fetch, just that that page was empty.
    ListPrefetchSchedulesResponse -> Maybe [PrefetchSchedule]
items :: Prelude.Maybe [PrefetchSchedule],
    -- | The value that you will use forNextToken in the next
    -- ListPrefetchSchedulesRequest request.
    ListPrefetchSchedulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPrefetchSchedulesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPrefetchSchedulesResponse
-> ListPrefetchSchedulesResponse -> Bool
(ListPrefetchSchedulesResponse
 -> ListPrefetchSchedulesResponse -> Bool)
-> (ListPrefetchSchedulesResponse
    -> ListPrefetchSchedulesResponse -> Bool)
-> Eq ListPrefetchSchedulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPrefetchSchedulesResponse
-> ListPrefetchSchedulesResponse -> Bool
$c/= :: ListPrefetchSchedulesResponse
-> ListPrefetchSchedulesResponse -> Bool
== :: ListPrefetchSchedulesResponse
-> ListPrefetchSchedulesResponse -> Bool
$c== :: ListPrefetchSchedulesResponse
-> ListPrefetchSchedulesResponse -> Bool
Prelude.Eq, ReadPrec [ListPrefetchSchedulesResponse]
ReadPrec ListPrefetchSchedulesResponse
Int -> ReadS ListPrefetchSchedulesResponse
ReadS [ListPrefetchSchedulesResponse]
(Int -> ReadS ListPrefetchSchedulesResponse)
-> ReadS [ListPrefetchSchedulesResponse]
-> ReadPrec ListPrefetchSchedulesResponse
-> ReadPrec [ListPrefetchSchedulesResponse]
-> Read ListPrefetchSchedulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPrefetchSchedulesResponse]
$creadListPrec :: ReadPrec [ListPrefetchSchedulesResponse]
readPrec :: ReadPrec ListPrefetchSchedulesResponse
$creadPrec :: ReadPrec ListPrefetchSchedulesResponse
readList :: ReadS [ListPrefetchSchedulesResponse]
$creadList :: ReadS [ListPrefetchSchedulesResponse]
readsPrec :: Int -> ReadS ListPrefetchSchedulesResponse
$creadsPrec :: Int -> ReadS ListPrefetchSchedulesResponse
Prelude.Read, Int -> ListPrefetchSchedulesResponse -> ShowS
[ListPrefetchSchedulesResponse] -> ShowS
ListPrefetchSchedulesResponse -> String
(Int -> ListPrefetchSchedulesResponse -> ShowS)
-> (ListPrefetchSchedulesResponse -> String)
-> ([ListPrefetchSchedulesResponse] -> ShowS)
-> Show ListPrefetchSchedulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPrefetchSchedulesResponse] -> ShowS
$cshowList :: [ListPrefetchSchedulesResponse] -> ShowS
show :: ListPrefetchSchedulesResponse -> String
$cshow :: ListPrefetchSchedulesResponse -> String
showsPrec :: Int -> ListPrefetchSchedulesResponse -> ShowS
$cshowsPrec :: Int -> ListPrefetchSchedulesResponse -> ShowS
Prelude.Show, (forall x.
 ListPrefetchSchedulesResponse
 -> Rep ListPrefetchSchedulesResponse x)
-> (forall x.
    Rep ListPrefetchSchedulesResponse x
    -> ListPrefetchSchedulesResponse)
-> Generic ListPrefetchSchedulesResponse
forall x.
Rep ListPrefetchSchedulesResponse x
-> ListPrefetchSchedulesResponse
forall x.
ListPrefetchSchedulesResponse
-> Rep ListPrefetchSchedulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPrefetchSchedulesResponse x
-> ListPrefetchSchedulesResponse
$cfrom :: forall x.
ListPrefetchSchedulesResponse
-> Rep ListPrefetchSchedulesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPrefetchSchedulesResponse' 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:
--
-- 'items', 'listPrefetchSchedulesResponse_items' - Lists the prefetch schedules. An empty Items list doesn\'t mean there
-- aren\'t more items to fetch, just that that page was empty.
--
-- 'nextToken', 'listPrefetchSchedulesResponse_nextToken' - The value that you will use forNextToken in the next
-- ListPrefetchSchedulesRequest request.
--
-- 'httpStatus', 'listPrefetchSchedulesResponse_httpStatus' - The response's http status code.
newListPrefetchSchedulesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPrefetchSchedulesResponse
newListPrefetchSchedulesResponse :: Int -> ListPrefetchSchedulesResponse
newListPrefetchSchedulesResponse Int
pHttpStatus_ =
  ListPrefetchSchedulesResponse' :: Maybe [PrefetchSchedule]
-> Maybe Text -> Int -> ListPrefetchSchedulesResponse
ListPrefetchSchedulesResponse'
    { $sel:items:ListPrefetchSchedulesResponse' :: Maybe [PrefetchSchedule]
items =
        Maybe [PrefetchSchedule]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPrefetchSchedulesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPrefetchSchedulesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Lists the prefetch schedules. An empty Items list doesn\'t mean there
-- aren\'t more items to fetch, just that that page was empty.
listPrefetchSchedulesResponse_items :: Lens.Lens' ListPrefetchSchedulesResponse (Prelude.Maybe [PrefetchSchedule])
listPrefetchSchedulesResponse_items :: (Maybe [PrefetchSchedule] -> f (Maybe [PrefetchSchedule]))
-> ListPrefetchSchedulesResponse -> f ListPrefetchSchedulesResponse
listPrefetchSchedulesResponse_items = (ListPrefetchSchedulesResponse -> Maybe [PrefetchSchedule])
-> (ListPrefetchSchedulesResponse
    -> Maybe [PrefetchSchedule] -> ListPrefetchSchedulesResponse)
-> Lens' ListPrefetchSchedulesResponse (Maybe [PrefetchSchedule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrefetchSchedulesResponse' {Maybe [PrefetchSchedule]
items :: Maybe [PrefetchSchedule]
$sel:items:ListPrefetchSchedulesResponse' :: ListPrefetchSchedulesResponse -> Maybe [PrefetchSchedule]
items} -> Maybe [PrefetchSchedule]
items) (\s :: ListPrefetchSchedulesResponse
s@ListPrefetchSchedulesResponse' {} Maybe [PrefetchSchedule]
a -> ListPrefetchSchedulesResponse
s {$sel:items:ListPrefetchSchedulesResponse' :: Maybe [PrefetchSchedule]
items = Maybe [PrefetchSchedule]
a} :: ListPrefetchSchedulesResponse) ((Maybe [PrefetchSchedule] -> f (Maybe [PrefetchSchedule]))
 -> ListPrefetchSchedulesResponse
 -> f ListPrefetchSchedulesResponse)
-> ((Maybe [PrefetchSchedule] -> f (Maybe [PrefetchSchedule]))
    -> Maybe [PrefetchSchedule] -> f (Maybe [PrefetchSchedule]))
-> (Maybe [PrefetchSchedule] -> f (Maybe [PrefetchSchedule]))
-> ListPrefetchSchedulesResponse
-> f ListPrefetchSchedulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PrefetchSchedule]
  [PrefetchSchedule]
  [PrefetchSchedule]
  [PrefetchSchedule]
-> Iso
     (Maybe [PrefetchSchedule])
     (Maybe [PrefetchSchedule])
     (Maybe [PrefetchSchedule])
     (Maybe [PrefetchSchedule])
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
  [PrefetchSchedule]
  [PrefetchSchedule]
  [PrefetchSchedule]
  [PrefetchSchedule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The value that you will use forNextToken in the next
-- ListPrefetchSchedulesRequest request.
listPrefetchSchedulesResponse_nextToken :: Lens.Lens' ListPrefetchSchedulesResponse (Prelude.Maybe Prelude.Text)
listPrefetchSchedulesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPrefetchSchedulesResponse -> f ListPrefetchSchedulesResponse
listPrefetchSchedulesResponse_nextToken = (ListPrefetchSchedulesResponse -> Maybe Text)
-> (ListPrefetchSchedulesResponse
    -> Maybe Text -> ListPrefetchSchedulesResponse)
-> Lens' ListPrefetchSchedulesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPrefetchSchedulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPrefetchSchedulesResponse' :: ListPrefetchSchedulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPrefetchSchedulesResponse
s@ListPrefetchSchedulesResponse' {} Maybe Text
a -> ListPrefetchSchedulesResponse
s {$sel:nextToken:ListPrefetchSchedulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPrefetchSchedulesResponse)

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

instance Prelude.NFData ListPrefetchSchedulesResponse