{-# 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.ELBV2.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)
--
-- Deletes the specified listener.
--
-- Alternatively, your listener is deleted when you delete the load
-- balancer to which it is attached.
module Amazonka.ELBV2.DeleteListener
  ( -- * Creating a Request
    DeleteListener (..),
    newDeleteListener,

    -- * Request Lenses
    deleteListener_listenerArn,

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

    -- * Response Lenses
    deleteListenerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.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 => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteListener)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteListener))
-> Logger
-> Service
-> Proxy DeleteListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteListener)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteListenerResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteListenerResponse
DeleteListenerResponse'
            (Int -> DeleteListenerResponse)
-> Either String Int -> Either String DeleteListenerResponse
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 DeleteListener

instance Prelude.NFData DeleteListener

instance Core.ToHeaders DeleteListener where
  toHeaders :: DeleteListener -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteListener -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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 DeleteListener' {Text
listenerArn :: Text
$sel:listenerArn:DeleteListener' :: DeleteListener -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteListener" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"ListenerArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
listenerArn
      ]

-- | /See:/ 'newDeleteListenerResponse' smart constructor.
data DeleteListenerResponse = DeleteListenerResponse'
  { -- | The response's http status code.
    DeleteListenerResponse -> Int
httpStatus :: Prelude.Int
  }
  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.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'deleteListenerResponse_httpStatus' - The response's http status code.
newDeleteListenerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteListenerResponse
newDeleteListenerResponse :: Int -> DeleteListenerResponse
newDeleteListenerResponse Int
pHttpStatus_ =
  DeleteListenerResponse' :: Int -> DeleteListenerResponse
DeleteListenerResponse' {$sel:httpStatus:DeleteListenerResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteListenerResponse