{-# 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.DeleteLoadBalancerPolicy
-- 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 policy from the specified load balancer. This
-- policy must not be enabled for any listeners.
module Amazonka.ELB.DeleteLoadBalancerPolicy
  ( -- * Creating a Request
    DeleteLoadBalancerPolicy (..),
    newDeleteLoadBalancerPolicy,

    -- * Request Lenses
    deleteLoadBalancerPolicy_loadBalancerName,
    deleteLoadBalancerPolicy_policyName,

    -- * Destructuring the Response
    DeleteLoadBalancerPolicyResponse (..),
    newDeleteLoadBalancerPolicyResponse,

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

-- |
-- Create a value of 'DeleteLoadBalancerPolicy' 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', 'deleteLoadBalancerPolicy_loadBalancerName' - The name of the load balancer.
--
-- 'policyName', 'deleteLoadBalancerPolicy_policyName' - The name of the policy.
newDeleteLoadBalancerPolicy ::
  -- | 'loadBalancerName'
  Prelude.Text ->
  -- | 'policyName'
  Prelude.Text ->
  DeleteLoadBalancerPolicy
newDeleteLoadBalancerPolicy :: Text -> Text -> DeleteLoadBalancerPolicy
newDeleteLoadBalancerPolicy
  Text
pLoadBalancerName_
  Text
pPolicyName_ =
    DeleteLoadBalancerPolicy' :: Text -> Text -> DeleteLoadBalancerPolicy
DeleteLoadBalancerPolicy'
      { $sel:loadBalancerName:DeleteLoadBalancerPolicy' :: Text
loadBalancerName =
          Text
pLoadBalancerName_,
        $sel:policyName:DeleteLoadBalancerPolicy' :: Text
policyName = Text
pPolicyName_
      }

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

-- | The name of the policy.
deleteLoadBalancerPolicy_policyName :: Lens.Lens' DeleteLoadBalancerPolicy Prelude.Text
deleteLoadBalancerPolicy_policyName :: (Text -> f Text)
-> DeleteLoadBalancerPolicy -> f DeleteLoadBalancerPolicy
deleteLoadBalancerPolicy_policyName = (DeleteLoadBalancerPolicy -> Text)
-> (DeleteLoadBalancerPolicy -> Text -> DeleteLoadBalancerPolicy)
-> Lens DeleteLoadBalancerPolicy DeleteLoadBalancerPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteLoadBalancerPolicy' {Text
policyName :: Text
$sel:policyName:DeleteLoadBalancerPolicy' :: DeleteLoadBalancerPolicy -> Text
policyName} -> Text
policyName) (\s :: DeleteLoadBalancerPolicy
s@DeleteLoadBalancerPolicy' {} Text
a -> DeleteLoadBalancerPolicy
s {$sel:policyName:DeleteLoadBalancerPolicy' :: Text
policyName = Text
a} :: DeleteLoadBalancerPolicy)

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

instance Prelude.NFData DeleteLoadBalancerPolicy

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

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

instance Core.ToQuery DeleteLoadBalancerPolicy where
  toQuery :: DeleteLoadBalancerPolicy -> QueryString
toQuery DeleteLoadBalancerPolicy' {Text
policyName :: Text
loadBalancerName :: Text
$sel:policyName:DeleteLoadBalancerPolicy' :: DeleteLoadBalancerPolicy -> Text
$sel:loadBalancerName:DeleteLoadBalancerPolicy' :: DeleteLoadBalancerPolicy -> 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
"DeleteLoadBalancerPolicy" :: 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
"PolicyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
policyName
      ]

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

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

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

instance
  Prelude.NFData
    DeleteLoadBalancerPolicyResponse