{-# 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.DeleteLoadBalancer
-- 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 load balancer.
--
-- If you are attempting to recreate a load balancer, you must reconfigure
-- all settings. The DNS name associated with a deleted load balancer are
-- no longer usable. The name and associated DNS record of the deleted load
-- balancer no longer exist and traffic sent to any of its IP addresses is
-- no longer delivered to your instances.
--
-- If the load balancer does not exist or has already been deleted, the
-- call to @DeleteLoadBalancer@ still succeeds.
module Amazonka.ELB.DeleteLoadBalancer
  ( -- * Creating a Request
    DeleteLoadBalancer (..),
    newDeleteLoadBalancer,

    -- * Request Lenses
    deleteLoadBalancer_loadBalancerName,

    -- * Destructuring the Response
    DeleteLoadBalancerResponse (..),
    newDeleteLoadBalancerResponse,

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

-- |
-- Create a value of 'DeleteLoadBalancer' 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', 'deleteLoadBalancer_loadBalancerName' - The name of the load balancer.
newDeleteLoadBalancer ::
  -- | 'loadBalancerName'
  Prelude.Text ->
  DeleteLoadBalancer
newDeleteLoadBalancer :: Text -> DeleteLoadBalancer
newDeleteLoadBalancer Text
pLoadBalancerName_ =
  DeleteLoadBalancer' :: Text -> DeleteLoadBalancer
DeleteLoadBalancer'
    { $sel:loadBalancerName:DeleteLoadBalancer' :: Text
loadBalancerName =
        Text
pLoadBalancerName_
    }

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

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

instance Prelude.NFData DeleteLoadBalancer

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

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

instance Core.ToQuery DeleteLoadBalancer where
  toQuery :: DeleteLoadBalancer -> QueryString
toQuery DeleteLoadBalancer' {Text
loadBalancerName :: Text
$sel:loadBalancerName:DeleteLoadBalancer' :: DeleteLoadBalancer -> 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
"DeleteLoadBalancer" :: 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
      ]

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

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

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

instance Prelude.NFData DeleteLoadBalancerResponse