{-# 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.DeleteCoreDefinition
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a core definition.
module Amazonka.Greengrass.DeleteCoreDefinition
  ( -- * Creating a Request
    DeleteCoreDefinition (..),
    newDeleteCoreDefinition,

    -- * Request Lenses
    deleteCoreDefinition_coreDefinitionId,

    -- * Destructuring the Response
    DeleteCoreDefinitionResponse (..),
    newDeleteCoreDefinitionResponse,

    -- * Response Lenses
    deleteCoreDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Greengrass.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteCoreDefinition' 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:
--
-- 'coreDefinitionId', 'deleteCoreDefinition_coreDefinitionId' - The ID of the core definition.
newDeleteCoreDefinition ::
  -- | 'coreDefinitionId'
  Prelude.Text ->
  DeleteCoreDefinition
newDeleteCoreDefinition :: Text -> DeleteCoreDefinition
newDeleteCoreDefinition Text
pCoreDefinitionId_ =
  DeleteCoreDefinition'
    { $sel:coreDefinitionId:DeleteCoreDefinition' :: Text
coreDefinitionId =
        Text
pCoreDefinitionId_
    }

-- | The ID of the core definition.
deleteCoreDefinition_coreDefinitionId :: Lens.Lens' DeleteCoreDefinition Prelude.Text
deleteCoreDefinition_coreDefinitionId :: Lens' DeleteCoreDefinition Text
deleteCoreDefinition_coreDefinitionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCoreDefinition' {Text
coreDefinitionId :: Text
$sel:coreDefinitionId:DeleteCoreDefinition' :: DeleteCoreDefinition -> Text
coreDefinitionId} -> Text
coreDefinitionId) (\s :: DeleteCoreDefinition
s@DeleteCoreDefinition' {} Text
a -> DeleteCoreDefinition
s {$sel:coreDefinitionId:DeleteCoreDefinition' :: Text
coreDefinitionId = Text
a} :: DeleteCoreDefinition)

instance Core.AWSRequest DeleteCoreDefinition where
  type
    AWSResponse DeleteCoreDefinition =
      DeleteCoreDefinitionResponse
  request :: (Service -> Service)
-> DeleteCoreDefinition -> Request DeleteCoreDefinition
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteCoreDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCoreDefinition)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteCoreDefinitionResponse
DeleteCoreDefinitionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteCoreDefinition where
  hashWithSalt :: Int -> DeleteCoreDefinition -> Int
hashWithSalt Int
_salt DeleteCoreDefinition' {Text
coreDefinitionId :: Text
$sel:coreDefinitionId:DeleteCoreDefinition' :: DeleteCoreDefinition -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
coreDefinitionId

instance Prelude.NFData DeleteCoreDefinition where
  rnf :: DeleteCoreDefinition -> ()
rnf DeleteCoreDefinition' {Text
coreDefinitionId :: Text
$sel:coreDefinitionId:DeleteCoreDefinition' :: DeleteCoreDefinition -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
coreDefinitionId

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

instance Data.ToPath DeleteCoreDefinition where
  toPath :: DeleteCoreDefinition -> ByteString
toPath DeleteCoreDefinition' {Text
coreDefinitionId :: Text
$sel:coreDefinitionId:DeleteCoreDefinition' :: DeleteCoreDefinition -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/definition/cores/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
coreDefinitionId
      ]

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

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

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

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

instance Prelude.NFData DeleteCoreDefinitionResponse where
  rnf :: DeleteCoreDefinitionResponse -> ()
rnf DeleteCoreDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteCoreDefinitionResponse' :: DeleteCoreDefinitionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus