{-# 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.DeleteStreamKey
-- 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 the stream key for the specified ARN, so it can no longer be
-- used to stream.
module Amazonka.IVS.DeleteStreamKey
  ( -- * Creating a Request
    DeleteStreamKey (..),
    newDeleteStreamKey,

    -- * Request Lenses
    deleteStreamKey_arn,

    -- * Destructuring the Response
    DeleteStreamKeyResponse (..),
    newDeleteStreamKeyResponse,
  )
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:/ 'newDeleteStreamKey' smart constructor.
data DeleteStreamKey = DeleteStreamKey'
  { -- | ARN of the stream key to be deleted.
    DeleteStreamKey -> Text
arn :: Prelude.Text
  }
  deriving (DeleteStreamKey -> DeleteStreamKey -> Bool
(DeleteStreamKey -> DeleteStreamKey -> Bool)
-> (DeleteStreamKey -> DeleteStreamKey -> Bool)
-> Eq DeleteStreamKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStreamKey -> DeleteStreamKey -> Bool
$c/= :: DeleteStreamKey -> DeleteStreamKey -> Bool
== :: DeleteStreamKey -> DeleteStreamKey -> Bool
$c== :: DeleteStreamKey -> DeleteStreamKey -> Bool
Prelude.Eq, ReadPrec [DeleteStreamKey]
ReadPrec DeleteStreamKey
Int -> ReadS DeleteStreamKey
ReadS [DeleteStreamKey]
(Int -> ReadS DeleteStreamKey)
-> ReadS [DeleteStreamKey]
-> ReadPrec DeleteStreamKey
-> ReadPrec [DeleteStreamKey]
-> Read DeleteStreamKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStreamKey]
$creadListPrec :: ReadPrec [DeleteStreamKey]
readPrec :: ReadPrec DeleteStreamKey
$creadPrec :: ReadPrec DeleteStreamKey
readList :: ReadS [DeleteStreamKey]
$creadList :: ReadS [DeleteStreamKey]
readsPrec :: Int -> ReadS DeleteStreamKey
$creadsPrec :: Int -> ReadS DeleteStreamKey
Prelude.Read, Int -> DeleteStreamKey -> ShowS
[DeleteStreamKey] -> ShowS
DeleteStreamKey -> String
(Int -> DeleteStreamKey -> ShowS)
-> (DeleteStreamKey -> String)
-> ([DeleteStreamKey] -> ShowS)
-> Show DeleteStreamKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStreamKey] -> ShowS
$cshowList :: [DeleteStreamKey] -> ShowS
show :: DeleteStreamKey -> String
$cshow :: DeleteStreamKey -> String
showsPrec :: Int -> DeleteStreamKey -> ShowS
$cshowsPrec :: Int -> DeleteStreamKey -> ShowS
Prelude.Show, (forall x. DeleteStreamKey -> Rep DeleteStreamKey x)
-> (forall x. Rep DeleteStreamKey x -> DeleteStreamKey)
-> Generic DeleteStreamKey
forall x. Rep DeleteStreamKey x -> DeleteStreamKey
forall x. DeleteStreamKey -> Rep DeleteStreamKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStreamKey x -> DeleteStreamKey
$cfrom :: forall x. DeleteStreamKey -> Rep DeleteStreamKey x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStreamKey' 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', 'deleteStreamKey_arn' - ARN of the stream key to be deleted.
newDeleteStreamKey ::
  -- | 'arn'
  Prelude.Text ->
  DeleteStreamKey
newDeleteStreamKey :: Text -> DeleteStreamKey
newDeleteStreamKey Text
pArn_ =
  DeleteStreamKey' :: Text -> DeleteStreamKey
DeleteStreamKey' {$sel:arn:DeleteStreamKey' :: Text
arn = Text
pArn_}

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

instance Core.AWSRequest DeleteStreamKey where
  type
    AWSResponse DeleteStreamKey =
      DeleteStreamKeyResponse
  request :: DeleteStreamKey -> Request DeleteStreamKey
request = Service -> DeleteStreamKey -> Request DeleteStreamKey
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteStreamKey)))
response =
    AWSResponse DeleteStreamKey
-> Logger
-> Service
-> Proxy DeleteStreamKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteStreamKey)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteStreamKey
DeleteStreamKeyResponse
DeleteStreamKeyResponse'

instance Prelude.Hashable DeleteStreamKey

instance Prelude.NFData DeleteStreamKey

instance Core.ToHeaders DeleteStreamKey where
  toHeaders :: DeleteStreamKey -> [Header]
toHeaders =
    [Header] -> DeleteStreamKey -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteStreamKey where
  toJSON :: DeleteStreamKey -> Value
toJSON DeleteStreamKey' {Text
arn :: Text
$sel:arn:DeleteStreamKey' :: DeleteStreamKey -> 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 DeleteStreamKey where
  toPath :: DeleteStreamKey -> ByteString
toPath = ByteString -> DeleteStreamKey -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/DeleteStreamKey"

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

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

-- |
-- Create a value of 'DeleteStreamKeyResponse' 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.
newDeleteStreamKeyResponse ::
  DeleteStreamKeyResponse
newDeleteStreamKeyResponse :: DeleteStreamKeyResponse
newDeleteStreamKeyResponse = DeleteStreamKeyResponse
DeleteStreamKeyResponse'

instance Prelude.NFData DeleteStreamKeyResponse