{-# 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.Greengrass.DeleteDeviceDefinition
-- 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 device definition.
module Amazonka.Greengrass.DeleteDeviceDefinition
  ( -- * Creating a Request
    DeleteDeviceDefinition (..),
    newDeleteDeviceDefinition,

    -- * Request Lenses
    deleteDeviceDefinition_deviceDefinitionId,

    -- * Destructuring the Response
    DeleteDeviceDefinitionResponse (..),
    newDeleteDeviceDefinitionResponse,

    -- * Response Lenses
    deleteDeviceDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.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:/ 'newDeleteDeviceDefinition' smart constructor.
data DeleteDeviceDefinition = DeleteDeviceDefinition'
  { -- | The ID of the device definition.
    DeleteDeviceDefinition -> Text
deviceDefinitionId :: Prelude.Text
  }
  deriving (DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool
(DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool)
-> (DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool)
-> Eq DeleteDeviceDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool
$c/= :: DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool
== :: DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool
$c== :: DeleteDeviceDefinition -> DeleteDeviceDefinition -> Bool
Prelude.Eq, ReadPrec [DeleteDeviceDefinition]
ReadPrec DeleteDeviceDefinition
Int -> ReadS DeleteDeviceDefinition
ReadS [DeleteDeviceDefinition]
(Int -> ReadS DeleteDeviceDefinition)
-> ReadS [DeleteDeviceDefinition]
-> ReadPrec DeleteDeviceDefinition
-> ReadPrec [DeleteDeviceDefinition]
-> Read DeleteDeviceDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDeviceDefinition]
$creadListPrec :: ReadPrec [DeleteDeviceDefinition]
readPrec :: ReadPrec DeleteDeviceDefinition
$creadPrec :: ReadPrec DeleteDeviceDefinition
readList :: ReadS [DeleteDeviceDefinition]
$creadList :: ReadS [DeleteDeviceDefinition]
readsPrec :: Int -> ReadS DeleteDeviceDefinition
$creadsPrec :: Int -> ReadS DeleteDeviceDefinition
Prelude.Read, Int -> DeleteDeviceDefinition -> ShowS
[DeleteDeviceDefinition] -> ShowS
DeleteDeviceDefinition -> String
(Int -> DeleteDeviceDefinition -> ShowS)
-> (DeleteDeviceDefinition -> String)
-> ([DeleteDeviceDefinition] -> ShowS)
-> Show DeleteDeviceDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDeviceDefinition] -> ShowS
$cshowList :: [DeleteDeviceDefinition] -> ShowS
show :: DeleteDeviceDefinition -> String
$cshow :: DeleteDeviceDefinition -> String
showsPrec :: Int -> DeleteDeviceDefinition -> ShowS
$cshowsPrec :: Int -> DeleteDeviceDefinition -> ShowS
Prelude.Show, (forall x. DeleteDeviceDefinition -> Rep DeleteDeviceDefinition x)
-> (forall x.
    Rep DeleteDeviceDefinition x -> DeleteDeviceDefinition)
-> Generic DeleteDeviceDefinition
forall x. Rep DeleteDeviceDefinition x -> DeleteDeviceDefinition
forall x. DeleteDeviceDefinition -> Rep DeleteDeviceDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDeviceDefinition x -> DeleteDeviceDefinition
$cfrom :: forall x. DeleteDeviceDefinition -> Rep DeleteDeviceDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDeviceDefinition' 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:
--
-- 'deviceDefinitionId', 'deleteDeviceDefinition_deviceDefinitionId' - The ID of the device definition.
newDeleteDeviceDefinition ::
  -- | 'deviceDefinitionId'
  Prelude.Text ->
  DeleteDeviceDefinition
newDeleteDeviceDefinition :: Text -> DeleteDeviceDefinition
newDeleteDeviceDefinition Text
pDeviceDefinitionId_ =
  DeleteDeviceDefinition' :: Text -> DeleteDeviceDefinition
DeleteDeviceDefinition'
    { $sel:deviceDefinitionId:DeleteDeviceDefinition' :: Text
deviceDefinitionId =
        Text
pDeviceDefinitionId_
    }

-- | The ID of the device definition.
deleteDeviceDefinition_deviceDefinitionId :: Lens.Lens' DeleteDeviceDefinition Prelude.Text
deleteDeviceDefinition_deviceDefinitionId :: (Text -> f Text)
-> DeleteDeviceDefinition -> f DeleteDeviceDefinition
deleteDeviceDefinition_deviceDefinitionId = (DeleteDeviceDefinition -> Text)
-> (DeleteDeviceDefinition -> Text -> DeleteDeviceDefinition)
-> Lens DeleteDeviceDefinition DeleteDeviceDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDeviceDefinition' {Text
deviceDefinitionId :: Text
$sel:deviceDefinitionId:DeleteDeviceDefinition' :: DeleteDeviceDefinition -> Text
deviceDefinitionId} -> Text
deviceDefinitionId) (\s :: DeleteDeviceDefinition
s@DeleteDeviceDefinition' {} Text
a -> DeleteDeviceDefinition
s {$sel:deviceDefinitionId:DeleteDeviceDefinition' :: Text
deviceDefinitionId = Text
a} :: DeleteDeviceDefinition)

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

instance Prelude.NFData DeleteDeviceDefinition

instance Core.ToHeaders DeleteDeviceDefinition where
  toHeaders :: DeleteDeviceDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDeviceDefinition -> 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.ToPath DeleteDeviceDefinition where
  toPath :: DeleteDeviceDefinition -> ByteString
toPath DeleteDeviceDefinition' {Text
deviceDefinitionId :: Text
$sel:deviceDefinitionId:DeleteDeviceDefinition' :: DeleteDeviceDefinition -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/definition/devices/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceDefinitionId
      ]

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

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

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

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

instance
  Prelude.NFData
    DeleteDeviceDefinitionResponse