{-# 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.DeleteProgram
-- 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 program within a channel. For information about programs, see
-- <https://docs.aws.amazon.com/mediatailor/latest/ug/channel-assembly-programs.html Working with programs>
-- in the /MediaTailor User Guide/.
module Amazonka.MediaTailor.DeleteProgram
  ( -- * Creating a Request
    DeleteProgram (..),
    newDeleteProgram,

    -- * Request Lenses
    deleteProgram_channelName,
    deleteProgram_programName,

    -- * Destructuring the Response
    DeleteProgramResponse (..),
    newDeleteProgramResponse,

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

-- |
-- Create a value of 'DeleteProgram' 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:
--
-- 'channelName', 'deleteProgram_channelName' - The name of the channel.
--
-- 'programName', 'deleteProgram_programName' - The name of the program.
newDeleteProgram ::
  -- | 'channelName'
  Prelude.Text ->
  -- | 'programName'
  Prelude.Text ->
  DeleteProgram
newDeleteProgram :: Text -> Text -> DeleteProgram
newDeleteProgram Text
pChannelName_ Text
pProgramName_ =
  DeleteProgram'
    { $sel:channelName:DeleteProgram' :: Text
channelName = Text
pChannelName_,
      $sel:programName:DeleteProgram' :: Text
programName = Text
pProgramName_
    }

-- | The name of the channel.
deleteProgram_channelName :: Lens.Lens' DeleteProgram Prelude.Text
deleteProgram_channelName :: Lens' DeleteProgram Text
deleteProgram_channelName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProgram' {Text
channelName :: Text
$sel:channelName:DeleteProgram' :: DeleteProgram -> Text
channelName} -> Text
channelName) (\s :: DeleteProgram
s@DeleteProgram' {} Text
a -> DeleteProgram
s {$sel:channelName:DeleteProgram' :: Text
channelName = Text
a} :: DeleteProgram)

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

instance Core.AWSRequest DeleteProgram where
  type
    AWSResponse DeleteProgram =
      DeleteProgramResponse
  request :: (Service -> Service) -> DeleteProgram -> Request DeleteProgram
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 DeleteProgram
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteProgram)))
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 -> DeleteProgramResponse
DeleteProgramResponse'
            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 DeleteProgram where
  hashWithSalt :: Int -> DeleteProgram -> Int
hashWithSalt Int
_salt DeleteProgram' {Text
programName :: Text
channelName :: Text
$sel:programName:DeleteProgram' :: DeleteProgram -> Text
$sel:channelName:DeleteProgram' :: DeleteProgram -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
programName

instance Prelude.NFData DeleteProgram where
  rnf :: DeleteProgram -> ()
rnf DeleteProgram' {Text
programName :: Text
channelName :: Text
$sel:programName:DeleteProgram' :: DeleteProgram -> Text
$sel:channelName:DeleteProgram' :: DeleteProgram -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
channelName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
programName

instance Data.ToHeaders DeleteProgram where
  toHeaders :: DeleteProgram -> 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 DeleteProgram where
  toPath :: DeleteProgram -> ByteString
toPath DeleteProgram' {Text
programName :: Text
channelName :: Text
$sel:programName:DeleteProgram' :: DeleteProgram -> Text
$sel:channelName:DeleteProgram' :: DeleteProgram -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/channel/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
channelName,
        ByteString
"/program/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
programName
      ]

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

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

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

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

instance Prelude.NFData DeleteProgramResponse where
  rnf :: DeleteProgramResponse -> ()
rnf DeleteProgramResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteProgramResponse' :: DeleteProgramResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus