{-# 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.StopStreamProcessor
-- 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 running stream processor that was created by
-- CreateStreamProcessor.
module Amazonka.Rekognition.StopStreamProcessor
  ( -- * Creating a Request
    StopStreamProcessor (..),
    newStopStreamProcessor,

    -- * Request Lenses
    stopStreamProcessor_name,

    -- * Destructuring the Response
    StopStreamProcessorResponse (..),
    newStopStreamProcessorResponse,

    -- * Response Lenses
    stopStreamProcessorResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'StopStreamProcessor' 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', 'stopStreamProcessor_name' - The name of a stream processor created by CreateStreamProcessor.
newStopStreamProcessor ::
  -- | 'name'
  Prelude.Text ->
  StopStreamProcessor
newStopStreamProcessor :: Text -> StopStreamProcessor
newStopStreamProcessor Text
pName_ =
  StopStreamProcessor' {$sel:name:StopStreamProcessor' :: Text
name = Text
pName_}

-- | The name of a stream processor created by CreateStreamProcessor.
stopStreamProcessor_name :: Lens.Lens' StopStreamProcessor Prelude.Text
stopStreamProcessor_name :: Lens' StopStreamProcessor Text
stopStreamProcessor_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopStreamProcessor' {Text
name :: Text
$sel:name:StopStreamProcessor' :: StopStreamProcessor -> Text
name} -> Text
name) (\s :: StopStreamProcessor
s@StopStreamProcessor' {} Text
a -> StopStreamProcessor
s {$sel:name:StopStreamProcessor' :: Text
name = Text
a} :: StopStreamProcessor)

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

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

instance Data.ToHeaders StopStreamProcessor where
  toHeaders :: StopStreamProcessor -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"RekognitionService.StopStreamProcessor" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StopStreamProcessor where
  toJSON :: StopStreamProcessor -> Value
toJSON StopStreamProcessor' {Text
name :: Text
$sel:name:StopStreamProcessor' :: StopStreamProcessor -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

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

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

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

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

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

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