{-# 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-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)
--
-- 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 Amazonka.IoT.Types
import qualified Amazonka.Lens as Lens
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
(StopThingRegistrationTask -> StopThingRegistrationTask -> Bool)
-> (StopThingRegistrationTask -> StopThingRegistrationTask -> Bool)
-> Eq StopThingRegistrationTask
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]
(Int -> ReadS StopThingRegistrationTask)
-> ReadS [StopThingRegistrationTask]
-> ReadPrec StopThingRegistrationTask
-> ReadPrec [StopThingRegistrationTask]
-> Read 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
(Int -> StopThingRegistrationTask -> ShowS)
-> (StopThingRegistrationTask -> String)
-> ([StopThingRegistrationTask] -> ShowS)
-> Show StopThingRegistrationTask
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.
 StopThingRegistrationTask -> Rep StopThingRegistrationTask x)
-> (forall x.
    Rep StopThingRegistrationTask x -> StopThingRegistrationTask)
-> Generic StopThingRegistrationTask
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' :: Text -> StopThingRegistrationTask
StopThingRegistrationTask' {$sel:taskId:StopThingRegistrationTask' :: Text
taskId = Text
pTaskId_}

-- | The bulk thing provisioning task ID.
stopThingRegistrationTask_taskId :: Lens.Lens' StopThingRegistrationTask Prelude.Text
stopThingRegistrationTask_taskId :: (Text -> f Text)
-> StopThingRegistrationTask -> f StopThingRegistrationTask
stopThingRegistrationTask_taskId = (StopThingRegistrationTask -> Text)
-> (StopThingRegistrationTask -> Text -> StopThingRegistrationTask)
-> Lens
     StopThingRegistrationTask StopThingRegistrationTask Text Text
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 :: StopThingRegistrationTask -> Request StopThingRegistrationTask
request = Service
-> StopThingRegistrationTask -> Request StopThingRegistrationTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopThingRegistrationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopThingRegistrationTask)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse StopThingRegistrationTask))
-> Logger
-> Service
-> Proxy StopThingRegistrationTask
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopThingRegistrationTask)))
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 -> StopThingRegistrationTaskResponse
StopThingRegistrationTaskResponse'
            (Int -> StopThingRegistrationTaskResponse)
-> Either String Int
-> Either String StopThingRegistrationTaskResponse
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 StopThingRegistrationTask

instance Prelude.NFData StopThingRegistrationTask

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

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

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

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

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