{-# 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.SageMakerA2IRuntime.StopHumanLoop
-- 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 the specified human loop.
module Amazonka.SageMakerA2IRuntime.StopHumanLoop
  ( -- * Creating a Request
    StopHumanLoop (..),
    newStopHumanLoop,

    -- * Request Lenses
    stopHumanLoop_humanLoopName,

    -- * Destructuring the Response
    StopHumanLoopResponse (..),
    newStopHumanLoopResponse,

    -- * Response Lenses
    stopHumanLoopResponse_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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMakerA2IRuntime.Types

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

-- |
-- Create a value of 'StopHumanLoop' 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:
--
-- 'humanLoopName', 'stopHumanLoop_humanLoopName' - The name of the human loop that you want to stop.
newStopHumanLoop ::
  -- | 'humanLoopName'
  Prelude.Text ->
  StopHumanLoop
newStopHumanLoop :: Text -> StopHumanLoop
newStopHumanLoop Text
pHumanLoopName_ =
  StopHumanLoop' {$sel:humanLoopName:StopHumanLoop' :: Text
humanLoopName = Text
pHumanLoopName_}

-- | The name of the human loop that you want to stop.
stopHumanLoop_humanLoopName :: Lens.Lens' StopHumanLoop Prelude.Text
stopHumanLoop_humanLoopName :: Lens' StopHumanLoop Text
stopHumanLoop_humanLoopName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopHumanLoop' {Text
humanLoopName :: Text
$sel:humanLoopName:StopHumanLoop' :: StopHumanLoop -> Text
humanLoopName} -> Text
humanLoopName) (\s :: StopHumanLoop
s@StopHumanLoop' {} Text
a -> StopHumanLoop
s {$sel:humanLoopName:StopHumanLoop' :: Text
humanLoopName = Text
a} :: StopHumanLoop)

instance Core.AWSRequest StopHumanLoop where
  type
    AWSResponse StopHumanLoop =
      StopHumanLoopResponse
  request :: (Service -> Service) -> StopHumanLoop -> Request StopHumanLoop
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 StopHumanLoop
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopHumanLoop)))
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 -> StopHumanLoopResponse
StopHumanLoopResponse'
            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 StopHumanLoop where
  hashWithSalt :: Int -> StopHumanLoop -> Int
hashWithSalt Int
_salt StopHumanLoop' {Text
humanLoopName :: Text
$sel:humanLoopName:StopHumanLoop' :: StopHumanLoop -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
humanLoopName

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

instance Data.ToHeaders StopHumanLoop where
  toHeaders :: StopHumanLoop -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToPath StopHumanLoop where
  toPath :: StopHumanLoop -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/human-loops/stop"

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

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

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

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

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