{-# 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.APIGatewayManagementAPI.DeleteConnection
-- 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)
--
-- Delete the connection with the provided id.
module Amazonka.APIGatewayManagementAPI.DeleteConnection
  ( -- * Creating a Request
    DeleteConnection (..),
    newDeleteConnection,

    -- * Request Lenses
    deleteConnection_connectionId,

    -- * Destructuring the Response
    DeleteConnectionResponse (..),
    newDeleteConnectionResponse,
  )
where

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

-- |
-- Create a value of 'DeleteConnection' 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:
--
-- 'connectionId', 'deleteConnection_connectionId' - Undocumented member.
newDeleteConnection ::
  -- | 'connectionId'
  Prelude.Text ->
  DeleteConnection
newDeleteConnection :: Text -> DeleteConnection
newDeleteConnection Text
pConnectionId_ =
  DeleteConnection' :: Text -> DeleteConnection
DeleteConnection' {$sel:connectionId:DeleteConnection' :: Text
connectionId = Text
pConnectionId_}

-- | Undocumented member.
deleteConnection_connectionId :: Lens.Lens' DeleteConnection Prelude.Text
deleteConnection_connectionId :: (Text -> f Text) -> DeleteConnection -> f DeleteConnection
deleteConnection_connectionId = (DeleteConnection -> Text)
-> (DeleteConnection -> Text -> DeleteConnection)
-> Lens DeleteConnection DeleteConnection Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnection' {Text
connectionId :: Text
$sel:connectionId:DeleteConnection' :: DeleteConnection -> Text
connectionId} -> Text
connectionId) (\s :: DeleteConnection
s@DeleteConnection' {} Text
a -> DeleteConnection
s {$sel:connectionId:DeleteConnection' :: Text
connectionId = Text
a} :: DeleteConnection)

instance Core.AWSRequest DeleteConnection where
  type
    AWSResponse DeleteConnection =
      DeleteConnectionResponse
  request :: DeleteConnection -> Request DeleteConnection
request = Service -> DeleteConnection -> Request DeleteConnection
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnection)))
response =
    AWSResponse DeleteConnection
-> Logger
-> Service
-> Proxy DeleteConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConnection)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteConnection
DeleteConnectionResponse
DeleteConnectionResponse'

instance Prelude.Hashable DeleteConnection

instance Prelude.NFData DeleteConnection

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

instance Core.ToPath DeleteConnection where
  toPath :: DeleteConnection -> ByteString
toPath DeleteConnection' {Text
connectionId :: Text
$sel:connectionId:DeleteConnection' :: DeleteConnection -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/@connections/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
connectionId]

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

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

-- |
-- Create a value of 'DeleteConnectionResponse' 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.
newDeleteConnectionResponse ::
  DeleteConnectionResponse
newDeleteConnectionResponse :: DeleteConnectionResponse
newDeleteConnectionResponse =
  DeleteConnectionResponse
DeleteConnectionResponse'

instance Prelude.NFData DeleteConnectionResponse