{-# 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.Rekognition.DeleteStreamProcessor
-- 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 processor identified by @Name@. You assign the value
-- for @Name@ when you create the stream processor with
-- CreateStreamProcessor. You might not be able to use the same name for a
-- stream processor for a few seconds after calling
-- @DeleteStreamProcessor@.
module Amazonka.Rekognition.DeleteStreamProcessor
  ( -- * Creating a Request
    DeleteStreamProcessor (..),
    newDeleteStreamProcessor,

    -- * Request Lenses
    deleteStreamProcessor_name,

    -- * Destructuring the Response
    DeleteStreamProcessorResponse (..),
    newDeleteStreamProcessorResponse,

    -- * Response Lenses
    deleteStreamProcessorResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteStreamProcessor' smart constructor.
data DeleteStreamProcessor = DeleteStreamProcessor'
  { -- | The name of the stream processor you want to delete.
    DeleteStreamProcessor -> Text
name :: Prelude.Text
  }
  deriving (DeleteStreamProcessor -> DeleteStreamProcessor -> Bool
(DeleteStreamProcessor -> DeleteStreamProcessor -> Bool)
-> (DeleteStreamProcessor -> DeleteStreamProcessor -> Bool)
-> Eq DeleteStreamProcessor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStreamProcessor -> DeleteStreamProcessor -> Bool
$c/= :: DeleteStreamProcessor -> DeleteStreamProcessor -> Bool
== :: DeleteStreamProcessor -> DeleteStreamProcessor -> Bool
$c== :: DeleteStreamProcessor -> DeleteStreamProcessor -> Bool
Prelude.Eq, ReadPrec [DeleteStreamProcessor]
ReadPrec DeleteStreamProcessor
Int -> ReadS DeleteStreamProcessor
ReadS [DeleteStreamProcessor]
(Int -> ReadS DeleteStreamProcessor)
-> ReadS [DeleteStreamProcessor]
-> ReadPrec DeleteStreamProcessor
-> ReadPrec [DeleteStreamProcessor]
-> Read DeleteStreamProcessor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStreamProcessor]
$creadListPrec :: ReadPrec [DeleteStreamProcessor]
readPrec :: ReadPrec DeleteStreamProcessor
$creadPrec :: ReadPrec DeleteStreamProcessor
readList :: ReadS [DeleteStreamProcessor]
$creadList :: ReadS [DeleteStreamProcessor]
readsPrec :: Int -> ReadS DeleteStreamProcessor
$creadsPrec :: Int -> ReadS DeleteStreamProcessor
Prelude.Read, Int -> DeleteStreamProcessor -> ShowS
[DeleteStreamProcessor] -> ShowS
DeleteStreamProcessor -> String
(Int -> DeleteStreamProcessor -> ShowS)
-> (DeleteStreamProcessor -> String)
-> ([DeleteStreamProcessor] -> ShowS)
-> Show DeleteStreamProcessor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStreamProcessor] -> ShowS
$cshowList :: [DeleteStreamProcessor] -> ShowS
show :: DeleteStreamProcessor -> String
$cshow :: DeleteStreamProcessor -> String
showsPrec :: Int -> DeleteStreamProcessor -> ShowS
$cshowsPrec :: Int -> DeleteStreamProcessor -> ShowS
Prelude.Show, (forall x. DeleteStreamProcessor -> Rep DeleteStreamProcessor x)
-> (forall x. Rep DeleteStreamProcessor x -> DeleteStreamProcessor)
-> Generic DeleteStreamProcessor
forall x. Rep DeleteStreamProcessor x -> DeleteStreamProcessor
forall x. DeleteStreamProcessor -> Rep DeleteStreamProcessor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStreamProcessor x -> DeleteStreamProcessor
$cfrom :: forall x. DeleteStreamProcessor -> Rep DeleteStreamProcessor x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStreamProcessor' 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:
--
-- 'name', 'deleteStreamProcessor_name' - The name of the stream processor you want to delete.
newDeleteStreamProcessor ::
  -- | 'name'
  Prelude.Text ->
  DeleteStreamProcessor
newDeleteStreamProcessor :: Text -> DeleteStreamProcessor
newDeleteStreamProcessor Text
pName_ =
  DeleteStreamProcessor' :: Text -> DeleteStreamProcessor
DeleteStreamProcessor' {$sel:name:DeleteStreamProcessor' :: Text
name = Text
pName_}

-- | The name of the stream processor you want to delete.
deleteStreamProcessor_name :: Lens.Lens' DeleteStreamProcessor Prelude.Text
deleteStreamProcessor_name :: (Text -> f Text)
-> DeleteStreamProcessor -> f DeleteStreamProcessor
deleteStreamProcessor_name = (DeleteStreamProcessor -> Text)
-> (DeleteStreamProcessor -> Text -> DeleteStreamProcessor)
-> Lens DeleteStreamProcessor DeleteStreamProcessor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamProcessor' {Text
name :: Text
$sel:name:DeleteStreamProcessor' :: DeleteStreamProcessor -> Text
name} -> Text
name) (\s :: DeleteStreamProcessor
s@DeleteStreamProcessor' {} Text
a -> DeleteStreamProcessor
s {$sel:name:DeleteStreamProcessor' :: Text
name = Text
a} :: DeleteStreamProcessor)

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

instance Prelude.NFData DeleteStreamProcessor

instance Core.ToHeaders DeleteStreamProcessor where
  toHeaders :: DeleteStreamProcessor -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteStreamProcessor -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"RekognitionService.DeleteStreamProcessor" ::
                          Prelude.ByteString
                      ),
            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 DeleteStreamProcessor where
  toJSON :: DeleteStreamProcessor -> Value
toJSON DeleteStreamProcessor' {Text
name :: Text
$sel:name:DeleteStreamProcessor' :: DeleteStreamProcessor -> 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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

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

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

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

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

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

instance Prelude.NFData DeleteStreamProcessorResponse