{-# 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-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)
--
-- 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.Lens as Lens
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
(StopHumanLoop -> StopHumanLoop -> Bool)
-> (StopHumanLoop -> StopHumanLoop -> Bool) -> Eq StopHumanLoop
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]
(Int -> ReadS StopHumanLoop)
-> ReadS [StopHumanLoop]
-> ReadPrec StopHumanLoop
-> ReadPrec [StopHumanLoop]
-> Read 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
(Int -> StopHumanLoop -> ShowS)
-> (StopHumanLoop -> String)
-> ([StopHumanLoop] -> ShowS)
-> Show StopHumanLoop
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. StopHumanLoop -> Rep StopHumanLoop x)
-> (forall x. Rep StopHumanLoop x -> StopHumanLoop)
-> Generic StopHumanLoop
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' :: Text -> StopHumanLoop
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 :: (Text -> f Text) -> StopHumanLoop -> f StopHumanLoop
stopHumanLoop_humanLoopName = (StopHumanLoop -> Text)
-> (StopHumanLoop -> Text -> StopHumanLoop)
-> Lens StopHumanLoop StopHumanLoop Text Text
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 :: StopHumanLoop -> Request StopHumanLoop
request = Service -> StopHumanLoop -> Request StopHumanLoop
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopHumanLoop
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopHumanLoop)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse StopHumanLoop))
-> Logger
-> Service
-> Proxy StopHumanLoop
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopHumanLoop)))
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 -> StopHumanLoopResponse
StopHumanLoopResponse'
            (Int -> StopHumanLoopResponse)
-> Either String Int -> Either String StopHumanLoopResponse
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 StopHumanLoop

instance Prelude.NFData StopHumanLoop

instance Core.ToHeaders StopHumanLoop where
  toHeaders :: StopHumanLoop -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopHumanLoop -> 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 StopHumanLoop where
  toJSON :: StopHumanLoop -> Value
toJSON StopHumanLoop' {Text
humanLoopName :: Text
$sel:humanLoopName:StopHumanLoop' :: StopHumanLoop -> 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
"HumanLoopName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
humanLoopName)
          ]
      )

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

instance Core.ToQuery StopHumanLoop where
  toQuery :: StopHumanLoop -> QueryString
toQuery = QueryString -> StopHumanLoop -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(StopHumanLoopResponse -> StopHumanLoopResponse -> Bool)
-> (StopHumanLoopResponse -> StopHumanLoopResponse -> Bool)
-> Eq StopHumanLoopResponse
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]
(Int -> ReadS StopHumanLoopResponse)
-> ReadS [StopHumanLoopResponse]
-> ReadPrec StopHumanLoopResponse
-> ReadPrec [StopHumanLoopResponse]
-> Read 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
(Int -> StopHumanLoopResponse -> ShowS)
-> (StopHumanLoopResponse -> String)
-> ([StopHumanLoopResponse] -> ShowS)
-> Show StopHumanLoopResponse
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. StopHumanLoopResponse -> Rep StopHumanLoopResponse x)
-> (forall x. Rep StopHumanLoopResponse x -> StopHumanLoopResponse)
-> Generic StopHumanLoopResponse
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' :: Int -> StopHumanLoopResponse
StopHumanLoopResponse' {$sel:httpStatus:StopHumanLoopResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
stopHumanLoopResponse_httpStatus :: Lens.Lens' StopHumanLoopResponse Prelude.Int
stopHumanLoopResponse_httpStatus :: (Int -> f Int) -> StopHumanLoopResponse -> f StopHumanLoopResponse
stopHumanLoopResponse_httpStatus = (StopHumanLoopResponse -> Int)
-> (StopHumanLoopResponse -> Int -> StopHumanLoopResponse)
-> Lens StopHumanLoopResponse StopHumanLoopResponse Int Int
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