{-# 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.StopChannel
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops a channel. For information about MediaTailor channels, see
-- <https://docs.aws.amazon.com/mediatailor/latest/ug/channel-assembly-channels.html Working with channels>
-- in the /MediaTailor User Guide/.
module Amazonka.MediaTailor.StopChannel
  ( -- * Creating a Request
    StopChannel (..),
    newStopChannel,

    -- * Request Lenses
    stopChannel_channelName,

    -- * Destructuring the Response
    StopChannelResponse (..),
    newStopChannelResponse,

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

-- |
-- Create a value of 'StopChannel' 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', 'stopChannel_channelName' - The name of the channel.
newStopChannel ::
  -- | 'channelName'
  Prelude.Text ->
  StopChannel
newStopChannel :: Text -> StopChannel
newStopChannel Text
pChannelName_ =
  StopChannel' {$sel:channelName:StopChannel' :: Text
channelName = Text
pChannelName_}

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

instance Core.AWSRequest StopChannel where
  type AWSResponse StopChannel = StopChannelResponse
  request :: (Service -> Service) -> StopChannel -> Request StopChannel
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StopChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopChannel)))
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 -> StopChannelResponse
StopChannelResponse'
            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 StopChannel where
  hashWithSalt :: Int -> StopChannel -> Int
hashWithSalt Int
_salt StopChannel' {Text
channelName :: Text
$sel:channelName:StopChannel' :: StopChannel -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelName

instance Prelude.NFData StopChannel where
  rnf :: StopChannel -> ()
rnf StopChannel' {Text
channelName :: Text
$sel:channelName:StopChannel' :: StopChannel -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
channelName

instance Data.ToHeaders StopChannel where
  toHeaders :: StopChannel -> 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.ToJSON StopChannel where
  toJSON :: StopChannel -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath StopChannel where
  toPath :: StopChannel -> ByteString
toPath StopChannel' {Text
channelName :: Text
$sel:channelName:StopChannel' :: StopChannel -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/channel/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
channelName, ByteString
"/stop"]

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

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

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

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

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