{-# 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.DeleteRegistrationCode
-- 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)
--
-- Deletes a CA certificate registration code.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteRegistrationCode>
-- action.
module Amazonka.IoT.DeleteRegistrationCode
  ( -- * Creating a Request
    DeleteRegistrationCode (..),
    newDeleteRegistrationCode,

    -- * Destructuring the Response
    DeleteRegistrationCodeResponse (..),
    newDeleteRegistrationCodeResponse,

    -- * Response Lenses
    deleteRegistrationCodeResponse_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

-- | The input for the DeleteRegistrationCode operation.
--
-- /See:/ 'newDeleteRegistrationCode' smart constructor.
data DeleteRegistrationCode = DeleteRegistrationCode'
  {
  }
  deriving (DeleteRegistrationCode -> DeleteRegistrationCode -> Bool
(DeleteRegistrationCode -> DeleteRegistrationCode -> Bool)
-> (DeleteRegistrationCode -> DeleteRegistrationCode -> Bool)
-> Eq DeleteRegistrationCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRegistrationCode -> DeleteRegistrationCode -> Bool
$c/= :: DeleteRegistrationCode -> DeleteRegistrationCode -> Bool
== :: DeleteRegistrationCode -> DeleteRegistrationCode -> Bool
$c== :: DeleteRegistrationCode -> DeleteRegistrationCode -> Bool
Prelude.Eq, ReadPrec [DeleteRegistrationCode]
ReadPrec DeleteRegistrationCode
Int -> ReadS DeleteRegistrationCode
ReadS [DeleteRegistrationCode]
(Int -> ReadS DeleteRegistrationCode)
-> ReadS [DeleteRegistrationCode]
-> ReadPrec DeleteRegistrationCode
-> ReadPrec [DeleteRegistrationCode]
-> Read DeleteRegistrationCode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRegistrationCode]
$creadListPrec :: ReadPrec [DeleteRegistrationCode]
readPrec :: ReadPrec DeleteRegistrationCode
$creadPrec :: ReadPrec DeleteRegistrationCode
readList :: ReadS [DeleteRegistrationCode]
$creadList :: ReadS [DeleteRegistrationCode]
readsPrec :: Int -> ReadS DeleteRegistrationCode
$creadsPrec :: Int -> ReadS DeleteRegistrationCode
Prelude.Read, Int -> DeleteRegistrationCode -> ShowS
[DeleteRegistrationCode] -> ShowS
DeleteRegistrationCode -> String
(Int -> DeleteRegistrationCode -> ShowS)
-> (DeleteRegistrationCode -> String)
-> ([DeleteRegistrationCode] -> ShowS)
-> Show DeleteRegistrationCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRegistrationCode] -> ShowS
$cshowList :: [DeleteRegistrationCode] -> ShowS
show :: DeleteRegistrationCode -> String
$cshow :: DeleteRegistrationCode -> String
showsPrec :: Int -> DeleteRegistrationCode -> ShowS
$cshowsPrec :: Int -> DeleteRegistrationCode -> ShowS
Prelude.Show, (forall x. DeleteRegistrationCode -> Rep DeleteRegistrationCode x)
-> (forall x.
    Rep DeleteRegistrationCode x -> DeleteRegistrationCode)
-> Generic DeleteRegistrationCode
forall x. Rep DeleteRegistrationCode x -> DeleteRegistrationCode
forall x. DeleteRegistrationCode -> Rep DeleteRegistrationCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRegistrationCode x -> DeleteRegistrationCode
$cfrom :: forall x. DeleteRegistrationCode -> Rep DeleteRegistrationCode x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRegistrationCode' 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.
newDeleteRegistrationCode ::
  DeleteRegistrationCode
newDeleteRegistrationCode :: DeleteRegistrationCode
newDeleteRegistrationCode = DeleteRegistrationCode
DeleteRegistrationCode'

instance Core.AWSRequest DeleteRegistrationCode where
  type
    AWSResponse DeleteRegistrationCode =
      DeleteRegistrationCodeResponse
  request :: DeleteRegistrationCode -> Request DeleteRegistrationCode
request = Service -> DeleteRegistrationCode -> Request DeleteRegistrationCode
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRegistrationCode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRegistrationCode)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteRegistrationCode))
-> Logger
-> Service
-> Proxy DeleteRegistrationCode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRegistrationCode)))
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 -> DeleteRegistrationCodeResponse
DeleteRegistrationCodeResponse'
            (Int -> DeleteRegistrationCodeResponse)
-> Either String Int
-> Either String DeleteRegistrationCodeResponse
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 DeleteRegistrationCode

instance Prelude.NFData DeleteRegistrationCode

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

instance Core.ToPath DeleteRegistrationCode where
  toPath :: DeleteRegistrationCode -> ByteString
toPath = ByteString -> DeleteRegistrationCode -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/registrationcode"

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

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

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

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

instance
  Prelude.NFData
    DeleteRegistrationCodeResponse