{-# 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.GlobalAccelerator.DeleteListener
-- 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 a listener from an accelerator.
module Amazonka.GlobalAccelerator.DeleteListener
  ( -- * Creating a Request
    DeleteListener (..),
    newDeleteListener,

    -- * Request Lenses
    deleteListener_listenerArn,

    -- * Destructuring the Response
    DeleteListenerResponse (..),
    newDeleteListenerResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.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:/ 'newDeleteListener' smart constructor.
data DeleteListener = DeleteListener'
  { -- | The Amazon Resource Name (ARN) of the listener.
    DeleteListener -> Text
listenerArn :: Prelude.Text
  }
  deriving (DeleteListener -> DeleteListener -> Bool
(DeleteListener -> DeleteListener -> Bool)
-> (DeleteListener -> DeleteListener -> Bool) -> Eq DeleteListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteListener -> DeleteListener -> Bool
$c/= :: DeleteListener -> DeleteListener -> Bool
== :: DeleteListener -> DeleteListener -> Bool
$c== :: DeleteListener -> DeleteListener -> Bool
Prelude.Eq, ReadPrec [DeleteListener]
ReadPrec DeleteListener
Int -> ReadS DeleteListener
ReadS [DeleteListener]
(Int -> ReadS DeleteListener)
-> ReadS [DeleteListener]
-> ReadPrec DeleteListener
-> ReadPrec [DeleteListener]
-> Read DeleteListener
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteListener]
$creadListPrec :: ReadPrec [DeleteListener]
readPrec :: ReadPrec DeleteListener
$creadPrec :: ReadPrec DeleteListener
readList :: ReadS [DeleteListener]
$creadList :: ReadS [DeleteListener]
readsPrec :: Int -> ReadS DeleteListener
$creadsPrec :: Int -> ReadS DeleteListener
Prelude.Read, Int -> DeleteListener -> ShowS
[DeleteListener] -> ShowS
DeleteListener -> String
(Int -> DeleteListener -> ShowS)
-> (DeleteListener -> String)
-> ([DeleteListener] -> ShowS)
-> Show DeleteListener
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteListener] -> ShowS
$cshowList :: [DeleteListener] -> ShowS
show :: DeleteListener -> String
$cshow :: DeleteListener -> String
showsPrec :: Int -> DeleteListener -> ShowS
$cshowsPrec :: Int -> DeleteListener -> ShowS
Prelude.Show, (forall x. DeleteListener -> Rep DeleteListener x)
-> (forall x. Rep DeleteListener x -> DeleteListener)
-> Generic DeleteListener
forall x. Rep DeleteListener x -> DeleteListener
forall x. DeleteListener -> Rep DeleteListener x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteListener x -> DeleteListener
$cfrom :: forall x. DeleteListener -> Rep DeleteListener x
Prelude.Generic)

-- |
-- Create a value of 'DeleteListener' 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:
--
-- 'listenerArn', 'deleteListener_listenerArn' - The Amazon Resource Name (ARN) of the listener.
newDeleteListener ::
  -- | 'listenerArn'
  Prelude.Text ->
  DeleteListener
newDeleteListener :: Text -> DeleteListener
newDeleteListener Text
pListenerArn_ =
  DeleteListener' :: Text -> DeleteListener
DeleteListener' {$sel:listenerArn:DeleteListener' :: Text
listenerArn = Text
pListenerArn_}

-- | The Amazon Resource Name (ARN) of the listener.
deleteListener_listenerArn :: Lens.Lens' DeleteListener Prelude.Text
deleteListener_listenerArn :: (Text -> f Text) -> DeleteListener -> f DeleteListener
deleteListener_listenerArn = (DeleteListener -> Text)
-> (DeleteListener -> Text -> DeleteListener)
-> Lens DeleteListener DeleteListener Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteListener' {Text
listenerArn :: Text
$sel:listenerArn:DeleteListener' :: DeleteListener -> Text
listenerArn} -> Text
listenerArn) (\s :: DeleteListener
s@DeleteListener' {} Text
a -> DeleteListener
s {$sel:listenerArn:DeleteListener' :: Text
listenerArn = Text
a} :: DeleteListener)

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

instance Prelude.Hashable DeleteListener

instance Prelude.NFData DeleteListener

instance Core.ToHeaders DeleteListener where
  toHeaders :: DeleteListener -> [Header]
toHeaders =
    [Header] -> DeleteListener -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"GlobalAccelerator_V20180706.DeleteListener" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DeleteListener where
  toJSON :: DeleteListener -> Value
toJSON DeleteListener' {Text
listenerArn :: Text
$sel:listenerArn:DeleteListener' :: DeleteListener -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ListenerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
listenerArn)]
      )

instance Core.ToPath DeleteListener where
  toPath :: DeleteListener -> ByteString
toPath = ByteString -> DeleteListener -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

instance Prelude.NFData DeleteListenerResponse