{-# 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.DeleteResourceDefinition
-- 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 resource definition.
module Amazonka.Greengrass.DeleteResourceDefinition
  ( -- * Creating a Request
    DeleteResourceDefinition (..),
    newDeleteResourceDefinition,

    -- * Request Lenses
    deleteResourceDefinition_resourceDefinitionId,

    -- * Destructuring the Response
    DeleteResourceDefinitionResponse (..),
    newDeleteResourceDefinitionResponse,

    -- * Response Lenses
    deleteResourceDefinitionResponse_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:/ 'newDeleteResourceDefinition' smart constructor.
data DeleteResourceDefinition = DeleteResourceDefinition'
  { -- | The ID of the resource definition.
    DeleteResourceDefinition -> Text
resourceDefinitionId :: Prelude.Text
  }
  deriving (DeleteResourceDefinition -> DeleteResourceDefinition -> Bool
(DeleteResourceDefinition -> DeleteResourceDefinition -> Bool)
-> (DeleteResourceDefinition -> DeleteResourceDefinition -> Bool)
-> Eq DeleteResourceDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceDefinition -> DeleteResourceDefinition -> Bool
$c/= :: DeleteResourceDefinition -> DeleteResourceDefinition -> Bool
== :: DeleteResourceDefinition -> DeleteResourceDefinition -> Bool
$c== :: DeleteResourceDefinition -> DeleteResourceDefinition -> Bool
Prelude.Eq, ReadPrec [DeleteResourceDefinition]
ReadPrec DeleteResourceDefinition
Int -> ReadS DeleteResourceDefinition
ReadS [DeleteResourceDefinition]
(Int -> ReadS DeleteResourceDefinition)
-> ReadS [DeleteResourceDefinition]
-> ReadPrec DeleteResourceDefinition
-> ReadPrec [DeleteResourceDefinition]
-> Read DeleteResourceDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceDefinition]
$creadListPrec :: ReadPrec [DeleteResourceDefinition]
readPrec :: ReadPrec DeleteResourceDefinition
$creadPrec :: ReadPrec DeleteResourceDefinition
readList :: ReadS [DeleteResourceDefinition]
$creadList :: ReadS [DeleteResourceDefinition]
readsPrec :: Int -> ReadS DeleteResourceDefinition
$creadsPrec :: Int -> ReadS DeleteResourceDefinition
Prelude.Read, Int -> DeleteResourceDefinition -> ShowS
[DeleteResourceDefinition] -> ShowS
DeleteResourceDefinition -> String
(Int -> DeleteResourceDefinition -> ShowS)
-> (DeleteResourceDefinition -> String)
-> ([DeleteResourceDefinition] -> ShowS)
-> Show DeleteResourceDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceDefinition] -> ShowS
$cshowList :: [DeleteResourceDefinition] -> ShowS
show :: DeleteResourceDefinition -> String
$cshow :: DeleteResourceDefinition -> String
showsPrec :: Int -> DeleteResourceDefinition -> ShowS
$cshowsPrec :: Int -> DeleteResourceDefinition -> ShowS
Prelude.Show, (forall x.
 DeleteResourceDefinition -> Rep DeleteResourceDefinition x)
-> (forall x.
    Rep DeleteResourceDefinition x -> DeleteResourceDefinition)
-> Generic DeleteResourceDefinition
forall x.
Rep DeleteResourceDefinition x -> DeleteResourceDefinition
forall x.
DeleteResourceDefinition -> Rep DeleteResourceDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteResourceDefinition x -> DeleteResourceDefinition
$cfrom :: forall x.
DeleteResourceDefinition -> Rep DeleteResourceDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourceDefinition' 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:
--
-- 'resourceDefinitionId', 'deleteResourceDefinition_resourceDefinitionId' - The ID of the resource definition.
newDeleteResourceDefinition ::
  -- | 'resourceDefinitionId'
  Prelude.Text ->
  DeleteResourceDefinition
newDeleteResourceDefinition :: Text -> DeleteResourceDefinition
newDeleteResourceDefinition Text
pResourceDefinitionId_ =
  DeleteResourceDefinition' :: Text -> DeleteResourceDefinition
DeleteResourceDefinition'
    { $sel:resourceDefinitionId:DeleteResourceDefinition' :: Text
resourceDefinitionId =
        Text
pResourceDefinitionId_
    }

-- | The ID of the resource definition.
deleteResourceDefinition_resourceDefinitionId :: Lens.Lens' DeleteResourceDefinition Prelude.Text
deleteResourceDefinition_resourceDefinitionId :: (Text -> f Text)
-> DeleteResourceDefinition -> f DeleteResourceDefinition
deleteResourceDefinition_resourceDefinitionId = (DeleteResourceDefinition -> Text)
-> (DeleteResourceDefinition -> Text -> DeleteResourceDefinition)
-> Lens DeleteResourceDefinition DeleteResourceDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceDefinition' {Text
resourceDefinitionId :: Text
$sel:resourceDefinitionId:DeleteResourceDefinition' :: DeleteResourceDefinition -> Text
resourceDefinitionId} -> Text
resourceDefinitionId) (\s :: DeleteResourceDefinition
s@DeleteResourceDefinition' {} Text
a -> DeleteResourceDefinition
s {$sel:resourceDefinitionId:DeleteResourceDefinition' :: Text
resourceDefinitionId = Text
a} :: DeleteResourceDefinition)

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

instance Prelude.NFData DeleteResourceDefinition

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

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

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

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

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

instance
  Prelude.NFData
    DeleteResourceDefinitionResponse