{-# 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.DeleteChannelPolicy
-- 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 channel\'s IAM policy.
module Amazonka.MediaTailor.DeleteChannelPolicy
  ( -- * Creating a Request
    DeleteChannelPolicy (..),
    newDeleteChannelPolicy,

    -- * Request Lenses
    deleteChannelPolicy_channelName,

    -- * Destructuring the Response
    DeleteChannelPolicyResponse (..),
    newDeleteChannelPolicyResponse,

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

-- |
-- Create a value of 'DeleteChannelPolicy' 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', 'deleteChannelPolicy_channelName' - The identifier for the channel you are working on.
newDeleteChannelPolicy ::
  -- | 'channelName'
  Prelude.Text ->
  DeleteChannelPolicy
newDeleteChannelPolicy :: Text -> DeleteChannelPolicy
newDeleteChannelPolicy Text
pChannelName_ =
  DeleteChannelPolicy' :: Text -> DeleteChannelPolicy
DeleteChannelPolicy' {$sel:channelName:DeleteChannelPolicy' :: Text
channelName = Text
pChannelName_}

-- | The identifier for the channel you are working on.
deleteChannelPolicy_channelName :: Lens.Lens' DeleteChannelPolicy Prelude.Text
deleteChannelPolicy_channelName :: (Text -> f Text) -> DeleteChannelPolicy -> f DeleteChannelPolicy
deleteChannelPolicy_channelName = (DeleteChannelPolicy -> Text)
-> (DeleteChannelPolicy -> Text -> DeleteChannelPolicy)
-> Lens DeleteChannelPolicy DeleteChannelPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteChannelPolicy' {Text
channelName :: Text
$sel:channelName:DeleteChannelPolicy' :: DeleteChannelPolicy -> Text
channelName} -> Text
channelName) (\s :: DeleteChannelPolicy
s@DeleteChannelPolicy' {} Text
a -> DeleteChannelPolicy
s {$sel:channelName:DeleteChannelPolicy' :: Text
channelName = Text
a} :: DeleteChannelPolicy)

instance Core.AWSRequest DeleteChannelPolicy where
  type
    AWSResponse DeleteChannelPolicy =
      DeleteChannelPolicyResponse
  request :: DeleteChannelPolicy -> Request DeleteChannelPolicy
request = Service -> DeleteChannelPolicy -> Request DeleteChannelPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteChannelPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteChannelPolicy)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteChannelPolicy))
-> Logger
-> Service
-> Proxy DeleteChannelPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteChannelPolicy)))
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 -> DeleteChannelPolicyResponse
DeleteChannelPolicyResponse'
            (Int -> DeleteChannelPolicyResponse)
-> Either String Int -> Either String DeleteChannelPolicyResponse
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 DeleteChannelPolicy

instance Prelude.NFData DeleteChannelPolicy

instance Core.ToHeaders DeleteChannelPolicy where
  toHeaders :: DeleteChannelPolicy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteChannelPolicy -> 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 DeleteChannelPolicy where
  toPath :: DeleteChannelPolicy -> ByteString
toPath DeleteChannelPolicy' {Text
channelName :: Text
$sel:channelName:DeleteChannelPolicy' :: DeleteChannelPolicy -> 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
"/policy"]

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

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

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

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

instance Prelude.NFData DeleteChannelPolicyResponse