{-# 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.DeletePrefetchSchedule
-- 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)
--
-- Deletes a prefetch schedule for a specific playback configuration. If
-- you call DeletePrefetchSchedule on an expired prefetch schedule,
-- MediaTailor returns an HTTP 404 status code.
module Amazonka.MediaTailor.DeletePrefetchSchedule
  ( -- * Creating a Request
    DeletePrefetchSchedule (..),
    newDeletePrefetchSchedule,

    -- * Request Lenses
    deletePrefetchSchedule_name,
    deletePrefetchSchedule_playbackConfigurationName,

    -- * Destructuring the Response
    DeletePrefetchScheduleResponse (..),
    newDeletePrefetchScheduleResponse,

    -- * Response Lenses
    deletePrefetchScheduleResponse_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:/ 'newDeletePrefetchSchedule' smart constructor.
data DeletePrefetchSchedule = DeletePrefetchSchedule'
  { -- | The identifier for the playback configuration.
    DeletePrefetchSchedule -> Text
name :: Prelude.Text,
    -- | The name of the playback configuration.
    DeletePrefetchSchedule -> Text
playbackConfigurationName :: Prelude.Text
  }
  deriving (DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool
(DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool)
-> (DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool)
-> Eq DeletePrefetchSchedule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool
$c/= :: DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool
== :: DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool
$c== :: DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool
Prelude.Eq, ReadPrec [DeletePrefetchSchedule]
ReadPrec DeletePrefetchSchedule
Int -> ReadS DeletePrefetchSchedule
ReadS [DeletePrefetchSchedule]
(Int -> ReadS DeletePrefetchSchedule)
-> ReadS [DeletePrefetchSchedule]
-> ReadPrec DeletePrefetchSchedule
-> ReadPrec [DeletePrefetchSchedule]
-> Read DeletePrefetchSchedule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePrefetchSchedule]
$creadListPrec :: ReadPrec [DeletePrefetchSchedule]
readPrec :: ReadPrec DeletePrefetchSchedule
$creadPrec :: ReadPrec DeletePrefetchSchedule
readList :: ReadS [DeletePrefetchSchedule]
$creadList :: ReadS [DeletePrefetchSchedule]
readsPrec :: Int -> ReadS DeletePrefetchSchedule
$creadsPrec :: Int -> ReadS DeletePrefetchSchedule
Prelude.Read, Int -> DeletePrefetchSchedule -> ShowS
[DeletePrefetchSchedule] -> ShowS
DeletePrefetchSchedule -> String
(Int -> DeletePrefetchSchedule -> ShowS)
-> (DeletePrefetchSchedule -> String)
-> ([DeletePrefetchSchedule] -> ShowS)
-> Show DeletePrefetchSchedule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePrefetchSchedule] -> ShowS
$cshowList :: [DeletePrefetchSchedule] -> ShowS
show :: DeletePrefetchSchedule -> String
$cshow :: DeletePrefetchSchedule -> String
showsPrec :: Int -> DeletePrefetchSchedule -> ShowS
$cshowsPrec :: Int -> DeletePrefetchSchedule -> ShowS
Prelude.Show, (forall x. DeletePrefetchSchedule -> Rep DeletePrefetchSchedule x)
-> (forall x.
    Rep DeletePrefetchSchedule x -> DeletePrefetchSchedule)
-> Generic DeletePrefetchSchedule
forall x. Rep DeletePrefetchSchedule x -> DeletePrefetchSchedule
forall x. DeletePrefetchSchedule -> Rep DeletePrefetchSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePrefetchSchedule x -> DeletePrefetchSchedule
$cfrom :: forall x. DeletePrefetchSchedule -> Rep DeletePrefetchSchedule x
Prelude.Generic)

-- |
-- Create a value of 'DeletePrefetchSchedule' 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:
--
-- 'name', 'deletePrefetchSchedule_name' - The identifier for the playback configuration.
--
-- 'playbackConfigurationName', 'deletePrefetchSchedule_playbackConfigurationName' - The name of the playback configuration.
newDeletePrefetchSchedule ::
  -- | 'name'
  Prelude.Text ->
  -- | 'playbackConfigurationName'
  Prelude.Text ->
  DeletePrefetchSchedule
newDeletePrefetchSchedule :: Text -> Text -> DeletePrefetchSchedule
newDeletePrefetchSchedule
  Text
pName_
  Text
pPlaybackConfigurationName_ =
    DeletePrefetchSchedule' :: Text -> Text -> DeletePrefetchSchedule
DeletePrefetchSchedule'
      { $sel:name:DeletePrefetchSchedule' :: Text
name = Text
pName_,
        $sel:playbackConfigurationName:DeletePrefetchSchedule' :: Text
playbackConfigurationName =
          Text
pPlaybackConfigurationName_
      }

-- | The identifier for the playback configuration.
deletePrefetchSchedule_name :: Lens.Lens' DeletePrefetchSchedule Prelude.Text
deletePrefetchSchedule_name :: (Text -> f Text)
-> DeletePrefetchSchedule -> f DeletePrefetchSchedule
deletePrefetchSchedule_name = (DeletePrefetchSchedule -> Text)
-> (DeletePrefetchSchedule -> Text -> DeletePrefetchSchedule)
-> Lens DeletePrefetchSchedule DeletePrefetchSchedule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePrefetchSchedule' {Text
name :: Text
$sel:name:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
name} -> Text
name) (\s :: DeletePrefetchSchedule
s@DeletePrefetchSchedule' {} Text
a -> DeletePrefetchSchedule
s {$sel:name:DeletePrefetchSchedule' :: Text
name = Text
a} :: DeletePrefetchSchedule)

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

instance Core.AWSRequest DeletePrefetchSchedule where
  type
    AWSResponse DeletePrefetchSchedule =
      DeletePrefetchScheduleResponse
  request :: DeletePrefetchSchedule -> Request DeletePrefetchSchedule
request = Service -> DeletePrefetchSchedule -> Request DeletePrefetchSchedule
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePrefetchSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePrefetchSchedule)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeletePrefetchSchedule))
-> Logger
-> Service
-> Proxy DeletePrefetchSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePrefetchSchedule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeletePrefetchScheduleResponse
DeletePrefetchScheduleResponse'
            (Int -> DeletePrefetchScheduleResponse)
-> Either String Int
-> Either String DeletePrefetchScheduleResponse
forall (f :: * -> *) a b. Functor 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 DeletePrefetchSchedule

instance Prelude.NFData DeletePrefetchSchedule

instance Core.ToHeaders DeletePrefetchSchedule where
  toHeaders :: DeletePrefetchSchedule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeletePrefetchSchedule -> 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.ToPath DeletePrefetchSchedule where
  toPath :: DeletePrefetchSchedule -> ByteString
toPath DeletePrefetchSchedule' {Text
playbackConfigurationName :: Text
name :: Text
$sel:playbackConfigurationName:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
$sel:name:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> 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,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name
      ]

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

-- | /See:/ 'newDeletePrefetchScheduleResponse' smart constructor.
data DeletePrefetchScheduleResponse = DeletePrefetchScheduleResponse'
  { -- | The response's http status code.
    DeletePrefetchScheduleResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeletePrefetchScheduleResponse
-> DeletePrefetchScheduleResponse -> Bool
(DeletePrefetchScheduleResponse
 -> DeletePrefetchScheduleResponse -> Bool)
-> (DeletePrefetchScheduleResponse
    -> DeletePrefetchScheduleResponse -> Bool)
-> Eq DeletePrefetchScheduleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePrefetchScheduleResponse
-> DeletePrefetchScheduleResponse -> Bool
$c/= :: DeletePrefetchScheduleResponse
-> DeletePrefetchScheduleResponse -> Bool
== :: DeletePrefetchScheduleResponse
-> DeletePrefetchScheduleResponse -> Bool
$c== :: DeletePrefetchScheduleResponse
-> DeletePrefetchScheduleResponse -> Bool
Prelude.Eq, ReadPrec [DeletePrefetchScheduleResponse]
ReadPrec DeletePrefetchScheduleResponse
Int -> ReadS DeletePrefetchScheduleResponse
ReadS [DeletePrefetchScheduleResponse]
(Int -> ReadS DeletePrefetchScheduleResponse)
-> ReadS [DeletePrefetchScheduleResponse]
-> ReadPrec DeletePrefetchScheduleResponse
-> ReadPrec [DeletePrefetchScheduleResponse]
-> Read DeletePrefetchScheduleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePrefetchScheduleResponse]
$creadListPrec :: ReadPrec [DeletePrefetchScheduleResponse]
readPrec :: ReadPrec DeletePrefetchScheduleResponse
$creadPrec :: ReadPrec DeletePrefetchScheduleResponse
readList :: ReadS [DeletePrefetchScheduleResponse]
$creadList :: ReadS [DeletePrefetchScheduleResponse]
readsPrec :: Int -> ReadS DeletePrefetchScheduleResponse
$creadsPrec :: Int -> ReadS DeletePrefetchScheduleResponse
Prelude.Read, Int -> DeletePrefetchScheduleResponse -> ShowS
[DeletePrefetchScheduleResponse] -> ShowS
DeletePrefetchScheduleResponse -> String
(Int -> DeletePrefetchScheduleResponse -> ShowS)
-> (DeletePrefetchScheduleResponse -> String)
-> ([DeletePrefetchScheduleResponse] -> ShowS)
-> Show DeletePrefetchScheduleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePrefetchScheduleResponse] -> ShowS
$cshowList :: [DeletePrefetchScheduleResponse] -> ShowS
show :: DeletePrefetchScheduleResponse -> String
$cshow :: DeletePrefetchScheduleResponse -> String
showsPrec :: Int -> DeletePrefetchScheduleResponse -> ShowS
$cshowsPrec :: Int -> DeletePrefetchScheduleResponse -> ShowS
Prelude.Show, (forall x.
 DeletePrefetchScheduleResponse
 -> Rep DeletePrefetchScheduleResponse x)
-> (forall x.
    Rep DeletePrefetchScheduleResponse x
    -> DeletePrefetchScheduleResponse)
-> Generic DeletePrefetchScheduleResponse
forall x.
Rep DeletePrefetchScheduleResponse x
-> DeletePrefetchScheduleResponse
forall x.
DeletePrefetchScheduleResponse
-> Rep DeletePrefetchScheduleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeletePrefetchScheduleResponse x
-> DeletePrefetchScheduleResponse
$cfrom :: forall x.
DeletePrefetchScheduleResponse
-> Rep DeletePrefetchScheduleResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeletePrefetchScheduleResponse' 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:
--
-- 'httpStatus', 'deletePrefetchScheduleResponse_httpStatus' - The response's http status code.
newDeletePrefetchScheduleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeletePrefetchScheduleResponse
newDeletePrefetchScheduleResponse :: Int -> DeletePrefetchScheduleResponse
newDeletePrefetchScheduleResponse Int
pHttpStatus_ =
  DeletePrefetchScheduleResponse' :: Int -> DeletePrefetchScheduleResponse
DeletePrefetchScheduleResponse'
    { $sel:httpStatus:DeletePrefetchScheduleResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeletePrefetchScheduleResponse