{-# 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.DeleteConnectorDefinition
-- 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 connector definition.
module Amazonka.Greengrass.DeleteConnectorDefinition
  ( -- * Creating a Request
    DeleteConnectorDefinition (..),
    newDeleteConnectorDefinition,

    -- * Request Lenses
    deleteConnectorDefinition_connectorDefinitionId,

    -- * Destructuring the Response
    DeleteConnectorDefinitionResponse (..),
    newDeleteConnectorDefinitionResponse,

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

-- |
-- Create a value of 'DeleteConnectorDefinition' 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:
--
-- 'connectorDefinitionId', 'deleteConnectorDefinition_connectorDefinitionId' - The ID of the connector definition.
newDeleteConnectorDefinition ::
  -- | 'connectorDefinitionId'
  Prelude.Text ->
  DeleteConnectorDefinition
newDeleteConnectorDefinition :: Text -> DeleteConnectorDefinition
newDeleteConnectorDefinition Text
pConnectorDefinitionId_ =
  DeleteConnectorDefinition' :: Text -> DeleteConnectorDefinition
DeleteConnectorDefinition'
    { $sel:connectorDefinitionId:DeleteConnectorDefinition' :: Text
connectorDefinitionId =
        Text
pConnectorDefinitionId_
    }

-- | The ID of the connector definition.
deleteConnectorDefinition_connectorDefinitionId :: Lens.Lens' DeleteConnectorDefinition Prelude.Text
deleteConnectorDefinition_connectorDefinitionId :: (Text -> f Text)
-> DeleteConnectorDefinition -> f DeleteConnectorDefinition
deleteConnectorDefinition_connectorDefinitionId = (DeleteConnectorDefinition -> Text)
-> (DeleteConnectorDefinition -> Text -> DeleteConnectorDefinition)
-> Lens
     DeleteConnectorDefinition DeleteConnectorDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnectorDefinition' {Text
connectorDefinitionId :: Text
$sel:connectorDefinitionId:DeleteConnectorDefinition' :: DeleteConnectorDefinition -> Text
connectorDefinitionId} -> Text
connectorDefinitionId) (\s :: DeleteConnectorDefinition
s@DeleteConnectorDefinition' {} Text
a -> DeleteConnectorDefinition
s {$sel:connectorDefinitionId:DeleteConnectorDefinition' :: Text
connectorDefinitionId = Text
a} :: DeleteConnectorDefinition)

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

instance Prelude.NFData DeleteConnectorDefinition

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

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

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

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

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

instance
  Prelude.NFData
    DeleteConnectorDefinitionResponse