{-# 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.IoT.StopThingRegistrationTask
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Cancels a bulk thing provisioning task.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions StopThingRegistrationTask>
-- action.
module Amazonka.IoT.StopThingRegistrationTask
  ( -- * Creating a Request
    StopThingRegistrationTask (..),
    newStopThingRegistrationTask,

    -- * Request Lenses
    stopThingRegistrationTask_taskId,

    -- * Destructuring the Response
    StopThingRegistrationTaskResponse (..),
    newStopThingRegistrationTaskResponse,

    -- * Response Lenses
    stopThingRegistrationTaskResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'StopThingRegistrationTask' 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:
--
-- 'taskId', 'stopThingRegistrationTask_taskId' - The bulk thing provisioning task ID.
newStopThingRegistrationTask ::
  -- | 'taskId'
  Prelude.Text ->
  StopThingRegistrationTask
newStopThingRegistrationTask :: Text -> StopThingRegistrationTask
newStopThingRegistrationTask Text
pTaskId_ =
  StopThingRegistrationTask' {$sel:taskId:StopThingRegistrationTask' :: Text
taskId = Text
pTaskId_}

-- | The bulk thing provisioning task ID.
stopThingRegistrationTask_taskId :: Lens.Lens' StopThingRegistrationTask Prelude.Text
stopThingRegistrationTask_taskId :: Lens' StopThingRegistrationTask Text
stopThingRegistrationTask_taskId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopThingRegistrationTask' {Text
taskId :: Text
$sel:taskId:StopThingRegistrationTask' :: StopThingRegistrationTask -> Text
taskId} -> Text
taskId) (\s :: StopThingRegistrationTask
s@StopThingRegistrationTask' {} Text
a -> StopThingRegistrationTask
s {$sel:taskId:StopThingRegistrationTask' :: Text
taskId = Text
a} :: StopThingRegistrationTask)

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

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

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

instance Data.ToJSON StopThingRegistrationTask where
  toJSON :: StopThingRegistrationTask -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath StopThingRegistrationTask where
  toPath :: StopThingRegistrationTask -> ByteString
toPath StopThingRegistrationTask' {Text
taskId :: Text
$sel:taskId:StopThingRegistrationTask' :: StopThingRegistrationTask -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/thing-registration-tasks/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
taskId,
        ByteString
"/cancel"
      ]

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

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

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

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

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