{-# 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-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 specific program on a specific channel.
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.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:/ 'newDeleteProgram' smart constructor.
data DeleteProgram = DeleteProgram'
  { -- | The identifier for the channel you are working on.
    DeleteProgram -> Text
channelName :: Prelude.Text,
    -- | The identifier for the program you are working on.
    DeleteProgram -> Text
programName :: Prelude.Text
  }
  deriving (DeleteProgram -> DeleteProgram -> Bool
(DeleteProgram -> DeleteProgram -> Bool)
-> (DeleteProgram -> DeleteProgram -> Bool) -> Eq DeleteProgram
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]
(Int -> ReadS DeleteProgram)
-> ReadS [DeleteProgram]
-> ReadPrec DeleteProgram
-> ReadPrec [DeleteProgram]
-> Read 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
(Int -> DeleteProgram -> ShowS)
-> (DeleteProgram -> String)
-> ([DeleteProgram] -> ShowS)
-> Show DeleteProgram
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. DeleteProgram -> Rep DeleteProgram x)
-> (forall x. Rep DeleteProgram x -> DeleteProgram)
-> Generic DeleteProgram
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 identifier for the channel you are working on.
--
-- 'programName', 'deleteProgram_programName' - The identifier for the program you are working on.
newDeleteProgram ::
  -- | 'channelName'
  Prelude.Text ->
  -- | 'programName'
  Prelude.Text ->
  DeleteProgram
newDeleteProgram :: Text -> Text -> DeleteProgram
newDeleteProgram Text
pChannelName_ Text
pProgramName_ =
  DeleteProgram' :: Text -> Text -> DeleteProgram
DeleteProgram'
    { $sel:channelName:DeleteProgram' :: Text
channelName = Text
pChannelName_,
      $sel:programName:DeleteProgram' :: Text
programName = Text
pProgramName_
    }

-- | The identifier for the channel you are working on.
deleteProgram_channelName :: Lens.Lens' DeleteProgram Prelude.Text
deleteProgram_channelName :: (Text -> f Text) -> DeleteProgram -> f DeleteProgram
deleteProgram_channelName = (DeleteProgram -> Text)
-> (DeleteProgram -> Text -> DeleteProgram)
-> Lens DeleteProgram DeleteProgram Text Text
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 identifier for the program you are working on.
deleteProgram_programName :: Lens.Lens' DeleteProgram Prelude.Text
deleteProgram_programName :: (Text -> f Text) -> DeleteProgram -> f DeleteProgram
deleteProgram_programName = (DeleteProgram -> Text)
-> (DeleteProgram -> Text -> DeleteProgram)
-> Lens DeleteProgram DeleteProgram Text Text
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 :: DeleteProgram -> Request DeleteProgram
request = Service -> DeleteProgram -> Request DeleteProgram
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteProgram
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteProgram)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteProgram))
-> Logger
-> Service
-> Proxy DeleteProgram
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteProgram)))
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 -> DeleteProgramResponse
DeleteProgramResponse'
            (Int -> DeleteProgramResponse)
-> Either String Int -> Either String DeleteProgramResponse
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 DeleteProgram

instance Prelude.NFData DeleteProgram

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

instance Core.ToQuery DeleteProgram where
  toQuery :: DeleteProgram -> QueryString
toQuery = QueryString -> DeleteProgram -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteProgramResponse -> DeleteProgramResponse -> Bool)
-> (DeleteProgramResponse -> DeleteProgramResponse -> Bool)
-> Eq DeleteProgramResponse
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]
(Int -> ReadS DeleteProgramResponse)
-> ReadS [DeleteProgramResponse]
-> ReadPrec DeleteProgramResponse
-> ReadPrec [DeleteProgramResponse]
-> Read 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
(Int -> DeleteProgramResponse -> ShowS)
-> (DeleteProgramResponse -> String)
-> ([DeleteProgramResponse] -> ShowS)
-> Show DeleteProgramResponse
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. DeleteProgramResponse -> Rep DeleteProgramResponse x)
-> (forall x. Rep DeleteProgramResponse x -> DeleteProgramResponse)
-> Generic DeleteProgramResponse
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' :: Int -> DeleteProgramResponse
DeleteProgramResponse' {$sel:httpStatus:DeleteProgramResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
deleteProgramResponse_httpStatus :: Lens.Lens' DeleteProgramResponse Prelude.Int
deleteProgramResponse_httpStatus :: (Int -> f Int) -> DeleteProgramResponse -> f DeleteProgramResponse
deleteProgramResponse_httpStatus = (DeleteProgramResponse -> Int)
-> (DeleteProgramResponse -> Int -> DeleteProgramResponse)
-> Lens DeleteProgramResponse DeleteProgramResponse Int Int
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