{-# 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.GreengrassV2.DeleteCoreDevice
-- 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 Greengrass core device, which is an IoT thing. This operation
-- removes the core device from the list of core devices. This operation
-- doesn\'t delete the IoT thing. For more information about how to delete
-- the IoT thing, see
-- <https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteThing.html DeleteThing>
-- in the /IoT API Reference/.
module Amazonka.GreengrassV2.DeleteCoreDevice
  ( -- * Creating a Request
    DeleteCoreDevice (..),
    newDeleteCoreDevice,

    -- * Request Lenses
    deleteCoreDevice_coreDeviceThingName,

    -- * Destructuring the Response
    DeleteCoreDeviceResponse (..),
    newDeleteCoreDeviceResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GreengrassV2.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:/ 'newDeleteCoreDevice' smart constructor.
data DeleteCoreDevice = DeleteCoreDevice'
  { -- | The name of the core device. This is also the name of the IoT thing.
    DeleteCoreDevice -> Text
coreDeviceThingName :: Prelude.Text
  }
  deriving (DeleteCoreDevice -> DeleteCoreDevice -> Bool
(DeleteCoreDevice -> DeleteCoreDevice -> Bool)
-> (DeleteCoreDevice -> DeleteCoreDevice -> Bool)
-> Eq DeleteCoreDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCoreDevice -> DeleteCoreDevice -> Bool
$c/= :: DeleteCoreDevice -> DeleteCoreDevice -> Bool
== :: DeleteCoreDevice -> DeleteCoreDevice -> Bool
$c== :: DeleteCoreDevice -> DeleteCoreDevice -> Bool
Prelude.Eq, ReadPrec [DeleteCoreDevice]
ReadPrec DeleteCoreDevice
Int -> ReadS DeleteCoreDevice
ReadS [DeleteCoreDevice]
(Int -> ReadS DeleteCoreDevice)
-> ReadS [DeleteCoreDevice]
-> ReadPrec DeleteCoreDevice
-> ReadPrec [DeleteCoreDevice]
-> Read DeleteCoreDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCoreDevice]
$creadListPrec :: ReadPrec [DeleteCoreDevice]
readPrec :: ReadPrec DeleteCoreDevice
$creadPrec :: ReadPrec DeleteCoreDevice
readList :: ReadS [DeleteCoreDevice]
$creadList :: ReadS [DeleteCoreDevice]
readsPrec :: Int -> ReadS DeleteCoreDevice
$creadsPrec :: Int -> ReadS DeleteCoreDevice
Prelude.Read, Int -> DeleteCoreDevice -> ShowS
[DeleteCoreDevice] -> ShowS
DeleteCoreDevice -> String
(Int -> DeleteCoreDevice -> ShowS)
-> (DeleteCoreDevice -> String)
-> ([DeleteCoreDevice] -> ShowS)
-> Show DeleteCoreDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCoreDevice] -> ShowS
$cshowList :: [DeleteCoreDevice] -> ShowS
show :: DeleteCoreDevice -> String
$cshow :: DeleteCoreDevice -> String
showsPrec :: Int -> DeleteCoreDevice -> ShowS
$cshowsPrec :: Int -> DeleteCoreDevice -> ShowS
Prelude.Show, (forall x. DeleteCoreDevice -> Rep DeleteCoreDevice x)
-> (forall x. Rep DeleteCoreDevice x -> DeleteCoreDevice)
-> Generic DeleteCoreDevice
forall x. Rep DeleteCoreDevice x -> DeleteCoreDevice
forall x. DeleteCoreDevice -> Rep DeleteCoreDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteCoreDevice x -> DeleteCoreDevice
$cfrom :: forall x. DeleteCoreDevice -> Rep DeleteCoreDevice x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCoreDevice' 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:
--
-- 'coreDeviceThingName', 'deleteCoreDevice_coreDeviceThingName' - The name of the core device. This is also the name of the IoT thing.
newDeleteCoreDevice ::
  -- | 'coreDeviceThingName'
  Prelude.Text ->
  DeleteCoreDevice
newDeleteCoreDevice :: Text -> DeleteCoreDevice
newDeleteCoreDevice Text
pCoreDeviceThingName_ =
  DeleteCoreDevice' :: Text -> DeleteCoreDevice
DeleteCoreDevice'
    { $sel:coreDeviceThingName:DeleteCoreDevice' :: Text
coreDeviceThingName =
        Text
pCoreDeviceThingName_
    }

-- | The name of the core device. This is also the name of the IoT thing.
deleteCoreDevice_coreDeviceThingName :: Lens.Lens' DeleteCoreDevice Prelude.Text
deleteCoreDevice_coreDeviceThingName :: (Text -> f Text) -> DeleteCoreDevice -> f DeleteCoreDevice
deleteCoreDevice_coreDeviceThingName = (DeleteCoreDevice -> Text)
-> (DeleteCoreDevice -> Text -> DeleteCoreDevice)
-> Lens DeleteCoreDevice DeleteCoreDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCoreDevice' {Text
coreDeviceThingName :: Text
$sel:coreDeviceThingName:DeleteCoreDevice' :: DeleteCoreDevice -> Text
coreDeviceThingName} -> Text
coreDeviceThingName) (\s :: DeleteCoreDevice
s@DeleteCoreDevice' {} Text
a -> DeleteCoreDevice
s {$sel:coreDeviceThingName:DeleteCoreDevice' :: Text
coreDeviceThingName = Text
a} :: DeleteCoreDevice)

instance Core.AWSRequest DeleteCoreDevice where
  type
    AWSResponse DeleteCoreDevice =
      DeleteCoreDeviceResponse
  request :: DeleteCoreDevice -> Request DeleteCoreDevice
request = Service -> DeleteCoreDevice -> Request DeleteCoreDevice
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCoreDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCoreDevice)))
response =
    AWSResponse DeleteCoreDevice
-> Logger
-> Service
-> Proxy DeleteCoreDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCoreDevice)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteCoreDevice
DeleteCoreDeviceResponse
DeleteCoreDeviceResponse'

instance Prelude.Hashable DeleteCoreDevice

instance Prelude.NFData DeleteCoreDevice

instance Core.ToHeaders DeleteCoreDevice where
  toHeaders :: DeleteCoreDevice -> [Header]
toHeaders =
    [Header] -> DeleteCoreDevice -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteCoreDevice where
  toPath :: DeleteCoreDevice -> ByteString
toPath DeleteCoreDevice' {Text
coreDeviceThingName :: Text
$sel:coreDeviceThingName:DeleteCoreDevice' :: DeleteCoreDevice -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/v2/coreDevices/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
coreDeviceThingName
      ]

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

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

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

instance Prelude.NFData DeleteCoreDeviceResponse