{-# 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.IVS.DeletePlaybackKeyPair
-- 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 specified authorization key pair. This invalidates future
-- viewer tokens generated using the key pair’s @privateKey@. For more
-- information, see
-- <https://docs.aws.amazon.com/ivs/latest/userguide/private-channels.html Setting Up Private Channels>
-- in the /Amazon IVS User Guide/.
module Amazonka.IVS.DeletePlaybackKeyPair
  ( -- * Creating a Request
    DeletePlaybackKeyPair (..),
    newDeletePlaybackKeyPair,

    -- * Request Lenses
    deletePlaybackKeyPair_arn,

    -- * Destructuring the Response
    DeletePlaybackKeyPairResponse (..),
    newDeletePlaybackKeyPairResponse,

    -- * Response Lenses
    deletePlaybackKeyPairResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IVS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeletePlaybackKeyPair' smart constructor.
data DeletePlaybackKeyPair = DeletePlaybackKeyPair'
  { -- | ARN of the key pair to be deleted.
    DeletePlaybackKeyPair -> Text
arn :: Prelude.Text
  }
  deriving (DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool
(DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool)
-> (DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool)
-> Eq DeletePlaybackKeyPair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool
$c/= :: DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool
== :: DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool
$c== :: DeletePlaybackKeyPair -> DeletePlaybackKeyPair -> Bool
Prelude.Eq, ReadPrec [DeletePlaybackKeyPair]
ReadPrec DeletePlaybackKeyPair
Int -> ReadS DeletePlaybackKeyPair
ReadS [DeletePlaybackKeyPair]
(Int -> ReadS DeletePlaybackKeyPair)
-> ReadS [DeletePlaybackKeyPair]
-> ReadPrec DeletePlaybackKeyPair
-> ReadPrec [DeletePlaybackKeyPair]
-> Read DeletePlaybackKeyPair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePlaybackKeyPair]
$creadListPrec :: ReadPrec [DeletePlaybackKeyPair]
readPrec :: ReadPrec DeletePlaybackKeyPair
$creadPrec :: ReadPrec DeletePlaybackKeyPair
readList :: ReadS [DeletePlaybackKeyPair]
$creadList :: ReadS [DeletePlaybackKeyPair]
readsPrec :: Int -> ReadS DeletePlaybackKeyPair
$creadsPrec :: Int -> ReadS DeletePlaybackKeyPair
Prelude.Read, Int -> DeletePlaybackKeyPair -> ShowS
[DeletePlaybackKeyPair] -> ShowS
DeletePlaybackKeyPair -> String
(Int -> DeletePlaybackKeyPair -> ShowS)
-> (DeletePlaybackKeyPair -> String)
-> ([DeletePlaybackKeyPair] -> ShowS)
-> Show DeletePlaybackKeyPair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePlaybackKeyPair] -> ShowS
$cshowList :: [DeletePlaybackKeyPair] -> ShowS
show :: DeletePlaybackKeyPair -> String
$cshow :: DeletePlaybackKeyPair -> String
showsPrec :: Int -> DeletePlaybackKeyPair -> ShowS
$cshowsPrec :: Int -> DeletePlaybackKeyPair -> ShowS
Prelude.Show, (forall x. DeletePlaybackKeyPair -> Rep DeletePlaybackKeyPair x)
-> (forall x. Rep DeletePlaybackKeyPair x -> DeletePlaybackKeyPair)
-> Generic DeletePlaybackKeyPair
forall x. Rep DeletePlaybackKeyPair x -> DeletePlaybackKeyPair
forall x. DeletePlaybackKeyPair -> Rep DeletePlaybackKeyPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePlaybackKeyPair x -> DeletePlaybackKeyPair
$cfrom :: forall x. DeletePlaybackKeyPair -> Rep DeletePlaybackKeyPair x
Prelude.Generic)

-- |
-- Create a value of 'DeletePlaybackKeyPair' 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:
--
-- 'arn', 'deletePlaybackKeyPair_arn' - ARN of the key pair to be deleted.
newDeletePlaybackKeyPair ::
  -- | 'arn'
  Prelude.Text ->
  DeletePlaybackKeyPair
newDeletePlaybackKeyPair :: Text -> DeletePlaybackKeyPair
newDeletePlaybackKeyPair Text
pArn_ =
  DeletePlaybackKeyPair' :: Text -> DeletePlaybackKeyPair
DeletePlaybackKeyPair' {$sel:arn:DeletePlaybackKeyPair' :: Text
arn = Text
pArn_}

-- | ARN of the key pair to be deleted.
deletePlaybackKeyPair_arn :: Lens.Lens' DeletePlaybackKeyPair Prelude.Text
deletePlaybackKeyPair_arn :: (Text -> f Text)
-> DeletePlaybackKeyPair -> f DeletePlaybackKeyPair
deletePlaybackKeyPair_arn = (DeletePlaybackKeyPair -> Text)
-> (DeletePlaybackKeyPair -> Text -> DeletePlaybackKeyPair)
-> Lens DeletePlaybackKeyPair DeletePlaybackKeyPair Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePlaybackKeyPair' {Text
arn :: Text
$sel:arn:DeletePlaybackKeyPair' :: DeletePlaybackKeyPair -> Text
arn} -> Text
arn) (\s :: DeletePlaybackKeyPair
s@DeletePlaybackKeyPair' {} Text
a -> DeletePlaybackKeyPair
s {$sel:arn:DeletePlaybackKeyPair' :: Text
arn = Text
a} :: DeletePlaybackKeyPair)

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

instance Prelude.NFData DeletePlaybackKeyPair

instance Core.ToHeaders DeletePlaybackKeyPair where
  toHeaders :: DeletePlaybackKeyPair -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeletePlaybackKeyPair -> 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.ToJSON DeletePlaybackKeyPair where
  toJSON :: DeletePlaybackKeyPair -> Value
toJSON DeletePlaybackKeyPair' {Text
arn :: Text
$sel:arn:DeletePlaybackKeyPair' :: DeletePlaybackKeyPair -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
      )

instance Core.ToPath DeletePlaybackKeyPair where
  toPath :: DeletePlaybackKeyPair -> ByteString
toPath = ByteString -> DeletePlaybackKeyPair -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/DeletePlaybackKeyPair"

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

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

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

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

instance Prelude.NFData DeletePlaybackKeyPairResponse