{-# 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.ElasticBeanstalk.DeleteEnvironmentConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the draft configuration associated with the running environment.
--
-- Updating a running environment with any configuration changes creates a
-- draft configuration set. You can get the draft configuration using
-- DescribeConfigurationSettings while the update is in progress or if the
-- update fails. The @DeploymentStatus@ for the draft configuration
-- indicates whether the deployment is in process or has failed. The draft
-- configuration remains in existence until it is deleted with this action.
module Amazonka.ElasticBeanstalk.DeleteEnvironmentConfiguration
  ( -- * Creating a Request
    DeleteEnvironmentConfiguration (..),
    newDeleteEnvironmentConfiguration,

    -- * Request Lenses
    deleteEnvironmentConfiguration_applicationName,
    deleteEnvironmentConfiguration_environmentName,

    -- * Destructuring the Response
    DeleteEnvironmentConfigurationResponse (..),
    newDeleteEnvironmentConfigurationResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticBeanstalk.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Request to delete a draft environment configuration.
--
-- /See:/ 'newDeleteEnvironmentConfiguration' smart constructor.
data DeleteEnvironmentConfiguration = DeleteEnvironmentConfiguration'
  { -- | The name of the application the environment is associated with.
    DeleteEnvironmentConfiguration -> Text
applicationName :: Prelude.Text,
    -- | The name of the environment to delete the draft configuration from.
    DeleteEnvironmentConfiguration -> Text
environmentName :: Prelude.Text
  }
  deriving (DeleteEnvironmentConfiguration
-> DeleteEnvironmentConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEnvironmentConfiguration
-> DeleteEnvironmentConfiguration -> Bool
$c/= :: DeleteEnvironmentConfiguration
-> DeleteEnvironmentConfiguration -> Bool
== :: DeleteEnvironmentConfiguration
-> DeleteEnvironmentConfiguration -> Bool
$c== :: DeleteEnvironmentConfiguration
-> DeleteEnvironmentConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteEnvironmentConfiguration]
ReadPrec DeleteEnvironmentConfiguration
Int -> ReadS DeleteEnvironmentConfiguration
ReadS [DeleteEnvironmentConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEnvironmentConfiguration]
$creadListPrec :: ReadPrec [DeleteEnvironmentConfiguration]
readPrec :: ReadPrec DeleteEnvironmentConfiguration
$creadPrec :: ReadPrec DeleteEnvironmentConfiguration
readList :: ReadS [DeleteEnvironmentConfiguration]
$creadList :: ReadS [DeleteEnvironmentConfiguration]
readsPrec :: Int -> ReadS DeleteEnvironmentConfiguration
$creadsPrec :: Int -> ReadS DeleteEnvironmentConfiguration
Prelude.Read, Int -> DeleteEnvironmentConfiguration -> ShowS
[DeleteEnvironmentConfiguration] -> ShowS
DeleteEnvironmentConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEnvironmentConfiguration] -> ShowS
$cshowList :: [DeleteEnvironmentConfiguration] -> ShowS
show :: DeleteEnvironmentConfiguration -> String
$cshow :: DeleteEnvironmentConfiguration -> String
showsPrec :: Int -> DeleteEnvironmentConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteEnvironmentConfiguration -> ShowS
Prelude.Show, forall x.
Rep DeleteEnvironmentConfiguration x
-> DeleteEnvironmentConfiguration
forall x.
DeleteEnvironmentConfiguration
-> Rep DeleteEnvironmentConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEnvironmentConfiguration x
-> DeleteEnvironmentConfiguration
$cfrom :: forall x.
DeleteEnvironmentConfiguration
-> Rep DeleteEnvironmentConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEnvironmentConfiguration' 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:
--
-- 'applicationName', 'deleteEnvironmentConfiguration_applicationName' - The name of the application the environment is associated with.
--
-- 'environmentName', 'deleteEnvironmentConfiguration_environmentName' - The name of the environment to delete the draft configuration from.
newDeleteEnvironmentConfiguration ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'environmentName'
  Prelude.Text ->
  DeleteEnvironmentConfiguration
newDeleteEnvironmentConfiguration :: Text -> Text -> DeleteEnvironmentConfiguration
newDeleteEnvironmentConfiguration
  Text
pApplicationName_
  Text
pEnvironmentName_ =
    DeleteEnvironmentConfiguration'
      { $sel:applicationName:DeleteEnvironmentConfiguration' :: Text
applicationName =
          Text
pApplicationName_,
        $sel:environmentName:DeleteEnvironmentConfiguration' :: Text
environmentName = Text
pEnvironmentName_
      }

-- | The name of the application the environment is associated with.
deleteEnvironmentConfiguration_applicationName :: Lens.Lens' DeleteEnvironmentConfiguration Prelude.Text
deleteEnvironmentConfiguration_applicationName :: Lens' DeleteEnvironmentConfiguration Text
deleteEnvironmentConfiguration_applicationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEnvironmentConfiguration' {Text
applicationName :: Text
$sel:applicationName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
applicationName} -> Text
applicationName) (\s :: DeleteEnvironmentConfiguration
s@DeleteEnvironmentConfiguration' {} Text
a -> DeleteEnvironmentConfiguration
s {$sel:applicationName:DeleteEnvironmentConfiguration' :: Text
applicationName = Text
a} :: DeleteEnvironmentConfiguration)

-- | The name of the environment to delete the draft configuration from.
deleteEnvironmentConfiguration_environmentName :: Lens.Lens' DeleteEnvironmentConfiguration Prelude.Text
deleteEnvironmentConfiguration_environmentName :: Lens' DeleteEnvironmentConfiguration Text
deleteEnvironmentConfiguration_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEnvironmentConfiguration' {Text
environmentName :: Text
$sel:environmentName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
environmentName} -> Text
environmentName) (\s :: DeleteEnvironmentConfiguration
s@DeleteEnvironmentConfiguration' {} Text
a -> DeleteEnvironmentConfiguration
s {$sel:environmentName:DeleteEnvironmentConfiguration' :: Text
environmentName = Text
a} :: DeleteEnvironmentConfiguration)

instance
  Core.AWSRequest
    DeleteEnvironmentConfiguration
  where
  type
    AWSResponse DeleteEnvironmentConfiguration =
      DeleteEnvironmentConfigurationResponse
  request :: (Service -> Service)
-> DeleteEnvironmentConfiguration
-> Request DeleteEnvironmentConfiguration
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteEnvironmentConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteEnvironmentConfiguration)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteEnvironmentConfigurationResponse
DeleteEnvironmentConfigurationResponse'

instance
  Prelude.Hashable
    DeleteEnvironmentConfiguration
  where
  hashWithSalt :: Int -> DeleteEnvironmentConfiguration -> Int
hashWithSalt
    Int
_salt
    DeleteEnvironmentConfiguration' {Text
environmentName :: Text
applicationName :: Text
$sel:environmentName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
$sel:applicationName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentName

instance
  Prelude.NFData
    DeleteEnvironmentConfiguration
  where
  rnf :: DeleteEnvironmentConfiguration -> ()
rnf DeleteEnvironmentConfiguration' {Text
environmentName :: Text
applicationName :: Text
$sel:environmentName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
$sel:applicationName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
environmentName

instance
  Data.ToHeaders
    DeleteEnvironmentConfiguration
  where
  toHeaders :: DeleteEnvironmentConfiguration -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DeleteEnvironmentConfiguration where
  toQuery :: DeleteEnvironmentConfiguration -> QueryString
toQuery DeleteEnvironmentConfiguration' {Text
environmentName :: Text
applicationName :: Text
$sel:environmentName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
$sel:applicationName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"DeleteEnvironmentConfiguration" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"ApplicationName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
applicationName,
        ByteString
"EnvironmentName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
environmentName
      ]

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

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

instance
  Prelude.NFData
    DeleteEnvironmentConfigurationResponse
  where
  rnf :: DeleteEnvironmentConfigurationResponse -> ()
rnf DeleteEnvironmentConfigurationResponse
_ = ()