{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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. 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.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.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:/ 'newDeletePrefetchSchedule' smart constructor.
data DeletePrefetchSchedule = DeletePrefetchSchedule'
  { -- | The name of the prefetch schedule. If the action is successful, the
    -- service sends back an HTTP 204 response with an empty HTTP body.
    DeletePrefetchSchedule -> Text
name :: Prelude.Text,
    -- | The name of the playback configuration for this prefetch schedule.
    DeletePrefetchSchedule -> Text
playbackConfigurationName :: Prelude.Text
  }
  deriving (DeletePrefetchSchedule -> DeletePrefetchSchedule -> Bool
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]
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
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. 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 name of the prefetch schedule. If the action is successful, the
-- service sends back an HTTP 204 response with an empty HTTP body.
--
-- 'playbackConfigurationName', 'deletePrefetchSchedule_playbackConfigurationName' - The name of the playback configuration for this prefetch schedule.
newDeletePrefetchSchedule ::
  -- | 'name'
  Prelude.Text ->
  -- | 'playbackConfigurationName'
  Prelude.Text ->
  DeletePrefetchSchedule
newDeletePrefetchSchedule :: Text -> Text -> DeletePrefetchSchedule
newDeletePrefetchSchedule
  Text
pName_
  Text
pPlaybackConfigurationName_ =
    DeletePrefetchSchedule'
      { $sel:name:DeletePrefetchSchedule' :: Text
name = Text
pName_,
        $sel:playbackConfigurationName:DeletePrefetchSchedule' :: Text
playbackConfigurationName =
          Text
pPlaybackConfigurationName_
      }

-- | The name of the prefetch schedule. If the action is successful, the
-- service sends back an HTTP 204 response with an empty HTTP body.
deletePrefetchSchedule_name :: Lens.Lens' DeletePrefetchSchedule Prelude.Text
deletePrefetchSchedule_name :: Lens' DeletePrefetchSchedule Text
deletePrefetchSchedule_name = 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 for this prefetch schedule.
deletePrefetchSchedule_playbackConfigurationName :: Lens.Lens' DeletePrefetchSchedule Prelude.Text
deletePrefetchSchedule_playbackConfigurationName :: Lens' DeletePrefetchSchedule Text
deletePrefetchSchedule_playbackConfigurationName = 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 :: (Service -> Service)
-> DeletePrefetchSchedule -> Request DeletePrefetchSchedule
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeletePrefetchSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePrefetchSchedule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeletePrefetchScheduleResponse
DeletePrefetchScheduleResponse'
            forall (f :: * -> *) a b. Functor 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 DeletePrefetchSchedule where
  hashWithSalt :: Int -> DeletePrefetchSchedule -> Int
hashWithSalt Int
_salt DeletePrefetchSchedule' {Text
playbackConfigurationName :: Text
name :: Text
$sel:playbackConfigurationName:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
$sel:name:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
playbackConfigurationName

instance Prelude.NFData DeletePrefetchSchedule where
  rnf :: DeletePrefetchSchedule -> ()
rnf DeletePrefetchSchedule' {Text
playbackConfigurationName :: Text
name :: Text
$sel:playbackConfigurationName:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
$sel:name:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
..} =
    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

instance Data.ToHeaders DeletePrefetchSchedule where
  toHeaders :: DeletePrefetchSchedule -> 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.ToPath DeletePrefetchSchedule where
  toPath :: DeletePrefetchSchedule -> ByteString
toPath DeletePrefetchSchedule' {Text
playbackConfigurationName :: Text
name :: Text
$sel:playbackConfigurationName:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> Text
$sel:name:DeletePrefetchSchedule' :: DeletePrefetchSchedule -> 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 DeletePrefetchSchedule where
  toQuery :: DeletePrefetchSchedule -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DeletePrefetchScheduleResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deletePrefetchScheduleResponse_httpStatus :: Lens.Lens' DeletePrefetchScheduleResponse Prelude.Int
deletePrefetchScheduleResponse_httpStatus :: Lens' DeletePrefetchScheduleResponse Int
deletePrefetchScheduleResponse_httpStatus = 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
  where
  rnf :: DeletePrefetchScheduleResponse -> ()
rnf DeletePrefetchScheduleResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeletePrefetchScheduleResponse' :: DeletePrefetchScheduleResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus