{-# 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.DeleteLoggerDefinition
-- 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 logger definition.
module Amazonka.Greengrass.DeleteLoggerDefinition
  ( -- * Creating a Request
    DeleteLoggerDefinition (..),
    newDeleteLoggerDefinition,

    -- * Request Lenses
    deleteLoggerDefinition_loggerDefinitionId,

    -- * Destructuring the Response
    DeleteLoggerDefinitionResponse (..),
    newDeleteLoggerDefinitionResponse,

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

-- |
-- Create a value of 'DeleteLoggerDefinition' 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:
--
-- 'loggerDefinitionId', 'deleteLoggerDefinition_loggerDefinitionId' - The ID of the logger definition.
newDeleteLoggerDefinition ::
  -- | 'loggerDefinitionId'
  Prelude.Text ->
  DeleteLoggerDefinition
newDeleteLoggerDefinition :: Text -> DeleteLoggerDefinition
newDeleteLoggerDefinition Text
pLoggerDefinitionId_ =
  DeleteLoggerDefinition' :: Text -> DeleteLoggerDefinition
DeleteLoggerDefinition'
    { $sel:loggerDefinitionId:DeleteLoggerDefinition' :: Text
loggerDefinitionId =
        Text
pLoggerDefinitionId_
    }

-- | The ID of the logger definition.
deleteLoggerDefinition_loggerDefinitionId :: Lens.Lens' DeleteLoggerDefinition Prelude.Text
deleteLoggerDefinition_loggerDefinitionId :: (Text -> f Text)
-> DeleteLoggerDefinition -> f DeleteLoggerDefinition
deleteLoggerDefinition_loggerDefinitionId = (DeleteLoggerDefinition -> Text)
-> (DeleteLoggerDefinition -> Text -> DeleteLoggerDefinition)
-> Lens DeleteLoggerDefinition DeleteLoggerDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLoggerDefinition' {Text
loggerDefinitionId :: Text
$sel:loggerDefinitionId:DeleteLoggerDefinition' :: DeleteLoggerDefinition -> Text
loggerDefinitionId} -> Text
loggerDefinitionId) (\s :: DeleteLoggerDefinition
s@DeleteLoggerDefinition' {} Text
a -> DeleteLoggerDefinition
s {$sel:loggerDefinitionId:DeleteLoggerDefinition' :: Text
loggerDefinitionId = Text
a} :: DeleteLoggerDefinition)

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

instance Prelude.NFData DeleteLoggerDefinition

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

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

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

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

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

instance
  Prelude.NFData
    DeleteLoggerDefinitionResponse