{-# 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.ELB.DeleteLoadBalancerListeners
-- 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 listeners from the specified load balancer.
module Amazonka.ELB.DeleteLoadBalancerListeners
  ( -- * Creating a Request
    DeleteLoadBalancerListeners (..),
    newDeleteLoadBalancerListeners,

    -- * Request Lenses
    deleteLoadBalancerListeners_loadBalancerName,
    deleteLoadBalancerListeners_loadBalancerPorts,

    -- * Destructuring the Response
    DeleteLoadBalancerListenersResponse (..),
    newDeleteLoadBalancerListenersResponse,

    -- * Response Lenses
    deleteLoadBalancerListenersResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ELB.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

-- | Contains the parameters for DeleteLoadBalancerListeners.
--
-- /See:/ 'newDeleteLoadBalancerListeners' smart constructor.
data DeleteLoadBalancerListeners = DeleteLoadBalancerListeners'
  { -- | The name of the load balancer.
    DeleteLoadBalancerListeners -> Text
loadBalancerName :: Prelude.Text,
    -- | The client port numbers of the listeners.
    DeleteLoadBalancerListeners -> [Int]
loadBalancerPorts :: [Prelude.Int]
  }
  deriving (DeleteLoadBalancerListeners -> DeleteLoadBalancerListeners -> Bool
(DeleteLoadBalancerListeners
 -> DeleteLoadBalancerListeners -> Bool)
-> (DeleteLoadBalancerListeners
    -> DeleteLoadBalancerListeners -> Bool)
-> Eq DeleteLoadBalancerListeners
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteLoadBalancerListeners -> DeleteLoadBalancerListeners -> Bool
$c/= :: DeleteLoadBalancerListeners -> DeleteLoadBalancerListeners -> Bool
== :: DeleteLoadBalancerListeners -> DeleteLoadBalancerListeners -> Bool
$c== :: DeleteLoadBalancerListeners -> DeleteLoadBalancerListeners -> Bool
Prelude.Eq, ReadPrec [DeleteLoadBalancerListeners]
ReadPrec DeleteLoadBalancerListeners
Int -> ReadS DeleteLoadBalancerListeners
ReadS [DeleteLoadBalancerListeners]
(Int -> ReadS DeleteLoadBalancerListeners)
-> ReadS [DeleteLoadBalancerListeners]
-> ReadPrec DeleteLoadBalancerListeners
-> ReadPrec [DeleteLoadBalancerListeners]
-> Read DeleteLoadBalancerListeners
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteLoadBalancerListeners]
$creadListPrec :: ReadPrec [DeleteLoadBalancerListeners]
readPrec :: ReadPrec DeleteLoadBalancerListeners
$creadPrec :: ReadPrec DeleteLoadBalancerListeners
readList :: ReadS [DeleteLoadBalancerListeners]
$creadList :: ReadS [DeleteLoadBalancerListeners]
readsPrec :: Int -> ReadS DeleteLoadBalancerListeners
$creadsPrec :: Int -> ReadS DeleteLoadBalancerListeners
Prelude.Read, Int -> DeleteLoadBalancerListeners -> ShowS
[DeleteLoadBalancerListeners] -> ShowS
DeleteLoadBalancerListeners -> String
(Int -> DeleteLoadBalancerListeners -> ShowS)
-> (DeleteLoadBalancerListeners -> String)
-> ([DeleteLoadBalancerListeners] -> ShowS)
-> Show DeleteLoadBalancerListeners
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteLoadBalancerListeners] -> ShowS
$cshowList :: [DeleteLoadBalancerListeners] -> ShowS
show :: DeleteLoadBalancerListeners -> String
$cshow :: DeleteLoadBalancerListeners -> String
showsPrec :: Int -> DeleteLoadBalancerListeners -> ShowS
$cshowsPrec :: Int -> DeleteLoadBalancerListeners -> ShowS
Prelude.Show, (forall x.
 DeleteLoadBalancerListeners -> Rep DeleteLoadBalancerListeners x)
-> (forall x.
    Rep DeleteLoadBalancerListeners x -> DeleteLoadBalancerListeners)
-> Generic DeleteLoadBalancerListeners
forall x.
Rep DeleteLoadBalancerListeners x -> DeleteLoadBalancerListeners
forall x.
DeleteLoadBalancerListeners -> Rep DeleteLoadBalancerListeners x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteLoadBalancerListeners x -> DeleteLoadBalancerListeners
$cfrom :: forall x.
DeleteLoadBalancerListeners -> Rep DeleteLoadBalancerListeners x
Prelude.Generic)

-- |
-- Create a value of 'DeleteLoadBalancerListeners' 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:
--
-- 'loadBalancerName', 'deleteLoadBalancerListeners_loadBalancerName' - The name of the load balancer.
--
-- 'loadBalancerPorts', 'deleteLoadBalancerListeners_loadBalancerPorts' - The client port numbers of the listeners.
newDeleteLoadBalancerListeners ::
  -- | 'loadBalancerName'
  Prelude.Text ->
  DeleteLoadBalancerListeners
newDeleteLoadBalancerListeners :: Text -> DeleteLoadBalancerListeners
newDeleteLoadBalancerListeners Text
pLoadBalancerName_ =
  DeleteLoadBalancerListeners' :: Text -> [Int] -> DeleteLoadBalancerListeners
DeleteLoadBalancerListeners'
    { $sel:loadBalancerName:DeleteLoadBalancerListeners' :: Text
loadBalancerName =
        Text
pLoadBalancerName_,
      $sel:loadBalancerPorts:DeleteLoadBalancerListeners' :: [Int]
loadBalancerPorts = [Int]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the load balancer.
deleteLoadBalancerListeners_loadBalancerName :: Lens.Lens' DeleteLoadBalancerListeners Prelude.Text
deleteLoadBalancerListeners_loadBalancerName :: (Text -> f Text)
-> DeleteLoadBalancerListeners -> f DeleteLoadBalancerListeners
deleteLoadBalancerListeners_loadBalancerName = (DeleteLoadBalancerListeners -> Text)
-> (DeleteLoadBalancerListeners
    -> Text -> DeleteLoadBalancerListeners)
-> Lens
     DeleteLoadBalancerListeners DeleteLoadBalancerListeners Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLoadBalancerListeners' {Text
loadBalancerName :: Text
$sel:loadBalancerName:DeleteLoadBalancerListeners' :: DeleteLoadBalancerListeners -> Text
loadBalancerName} -> Text
loadBalancerName) (\s :: DeleteLoadBalancerListeners
s@DeleteLoadBalancerListeners' {} Text
a -> DeleteLoadBalancerListeners
s {$sel:loadBalancerName:DeleteLoadBalancerListeners' :: Text
loadBalancerName = Text
a} :: DeleteLoadBalancerListeners)

-- | The client port numbers of the listeners.
deleteLoadBalancerListeners_loadBalancerPorts :: Lens.Lens' DeleteLoadBalancerListeners [Prelude.Int]
deleteLoadBalancerListeners_loadBalancerPorts :: ([Int] -> f [Int])
-> DeleteLoadBalancerListeners -> f DeleteLoadBalancerListeners
deleteLoadBalancerListeners_loadBalancerPorts = (DeleteLoadBalancerListeners -> [Int])
-> (DeleteLoadBalancerListeners
    -> [Int] -> DeleteLoadBalancerListeners)
-> Lens
     DeleteLoadBalancerListeners DeleteLoadBalancerListeners [Int] [Int]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLoadBalancerListeners' {[Int]
loadBalancerPorts :: [Int]
$sel:loadBalancerPorts:DeleteLoadBalancerListeners' :: DeleteLoadBalancerListeners -> [Int]
loadBalancerPorts} -> [Int]
loadBalancerPorts) (\s :: DeleteLoadBalancerListeners
s@DeleteLoadBalancerListeners' {} [Int]
a -> DeleteLoadBalancerListeners
s {$sel:loadBalancerPorts:DeleteLoadBalancerListeners' :: [Int]
loadBalancerPorts = [Int]
a} :: DeleteLoadBalancerListeners) (([Int] -> f [Int])
 -> DeleteLoadBalancerListeners -> f DeleteLoadBalancerListeners)
-> (([Int] -> f [Int]) -> [Int] -> f [Int])
-> ([Int] -> f [Int])
-> DeleteLoadBalancerListeners
-> f DeleteLoadBalancerListeners
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Int] -> f [Int]) -> [Int] -> f [Int]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest DeleteLoadBalancerListeners where
  type
    AWSResponse DeleteLoadBalancerListeners =
      DeleteLoadBalancerListenersResponse
  request :: DeleteLoadBalancerListeners -> Request DeleteLoadBalancerListeners
request = Service
-> DeleteLoadBalancerListeners
-> Request DeleteLoadBalancerListeners
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteLoadBalancerListeners
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteLoadBalancerListeners)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteLoadBalancerListeners))
-> Logger
-> Service
-> Proxy DeleteLoadBalancerListeners
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteLoadBalancerListeners)))
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
"DeleteLoadBalancerListenersResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteLoadBalancerListenersResponse
DeleteLoadBalancerListenersResponse'
            (Int -> DeleteLoadBalancerListenersResponse)
-> Either String Int
-> Either String DeleteLoadBalancerListenersResponse
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 DeleteLoadBalancerListeners

instance Prelude.NFData DeleteLoadBalancerListeners

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

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

instance Core.ToQuery DeleteLoadBalancerListeners where
  toQuery :: DeleteLoadBalancerListeners -> QueryString
toQuery DeleteLoadBalancerListeners' {[Int]
Text
loadBalancerPorts :: [Int]
loadBalancerName :: Text
$sel:loadBalancerPorts:DeleteLoadBalancerListeners' :: DeleteLoadBalancerListeners -> [Int]
$sel:loadBalancerName:DeleteLoadBalancerListeners' :: DeleteLoadBalancerListeners -> 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
"DeleteLoadBalancerListeners" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-06-01" :: Prelude.ByteString),
        ByteString
"LoadBalancerName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
loadBalancerName,
        ByteString
"LoadBalancerPorts"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Int] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Int]
loadBalancerPorts
      ]

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

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

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

instance
  Prelude.NFData
    DeleteLoadBalancerListenersResponse