{-# 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-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 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 Amazonka.ElasticBeanstalk.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

-- | 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
(DeleteEnvironmentConfiguration
 -> DeleteEnvironmentConfiguration -> Bool)
-> (DeleteEnvironmentConfiguration
    -> DeleteEnvironmentConfiguration -> Bool)
-> Eq DeleteEnvironmentConfiguration
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]
(Int -> ReadS DeleteEnvironmentConfiguration)
-> ReadS [DeleteEnvironmentConfiguration]
-> ReadPrec DeleteEnvironmentConfiguration
-> ReadPrec [DeleteEnvironmentConfiguration]
-> Read 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
(Int -> DeleteEnvironmentConfiguration -> ShowS)
-> (DeleteEnvironmentConfiguration -> String)
-> ([DeleteEnvironmentConfiguration] -> ShowS)
-> Show DeleteEnvironmentConfiguration
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.
 DeleteEnvironmentConfiguration
 -> Rep DeleteEnvironmentConfiguration x)
-> (forall x.
    Rep DeleteEnvironmentConfiguration x
    -> DeleteEnvironmentConfiguration)
-> Generic DeleteEnvironmentConfiguration
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' :: Text -> Text -> DeleteEnvironmentConfiguration
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 :: (Text -> f Text)
-> DeleteEnvironmentConfiguration
-> f DeleteEnvironmentConfiguration
deleteEnvironmentConfiguration_applicationName = (DeleteEnvironmentConfiguration -> Text)
-> (DeleteEnvironmentConfiguration
    -> Text -> DeleteEnvironmentConfiguration)
-> Lens
     DeleteEnvironmentConfiguration
     DeleteEnvironmentConfiguration
     Text
     Text
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 :: (Text -> f Text)
-> DeleteEnvironmentConfiguration
-> f DeleteEnvironmentConfiguration
deleteEnvironmentConfiguration_environmentName = (DeleteEnvironmentConfiguration -> Text)
-> (DeleteEnvironmentConfiguration
    -> Text -> DeleteEnvironmentConfiguration)
-> Lens
     DeleteEnvironmentConfiguration
     DeleteEnvironmentConfiguration
     Text
     Text
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 :: DeleteEnvironmentConfiguration
-> Request DeleteEnvironmentConfiguration
request = Service
-> DeleteEnvironmentConfiguration
-> Request DeleteEnvironmentConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEnvironmentConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteEnvironmentConfiguration)))
response =
    AWSResponse DeleteEnvironmentConfiguration
-> Logger
-> Service
-> Proxy DeleteEnvironmentConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteEnvironmentConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteEnvironmentConfiguration
DeleteEnvironmentConfigurationResponse
DeleteEnvironmentConfigurationResponse'

instance
  Prelude.Hashable
    DeleteEnvironmentConfiguration

instance
  Prelude.NFData
    DeleteEnvironmentConfiguration

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

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

instance Core.ToQuery DeleteEnvironmentConfiguration where
  toQuery :: DeleteEnvironmentConfiguration -> QueryString
toQuery DeleteEnvironmentConfiguration' {Text
environmentName :: Text
applicationName :: Text
$sel:environmentName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> Text
$sel:applicationName:DeleteEnvironmentConfiguration' :: DeleteEnvironmentConfiguration -> 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
"DeleteEnvironmentConfiguration" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"ApplicationName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
applicationName,
        ByteString
"EnvironmentName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
environmentName
      ]

-- | /See:/ 'newDeleteEnvironmentConfigurationResponse' smart constructor.
data DeleteEnvironmentConfigurationResponse = DeleteEnvironmentConfigurationResponse'
  {
  }
  deriving (DeleteEnvironmentConfigurationResponse
-> DeleteEnvironmentConfigurationResponse -> Bool
(DeleteEnvironmentConfigurationResponse
 -> DeleteEnvironmentConfigurationResponse -> Bool)
-> (DeleteEnvironmentConfigurationResponse
    -> DeleteEnvironmentConfigurationResponse -> Bool)
-> Eq DeleteEnvironmentConfigurationResponse
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]
(Int -> ReadS DeleteEnvironmentConfigurationResponse)
-> ReadS [DeleteEnvironmentConfigurationResponse]
-> ReadPrec DeleteEnvironmentConfigurationResponse
-> ReadPrec [DeleteEnvironmentConfigurationResponse]
-> Read 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
(Int -> DeleteEnvironmentConfigurationResponse -> ShowS)
-> (DeleteEnvironmentConfigurationResponse -> String)
-> ([DeleteEnvironmentConfigurationResponse] -> ShowS)
-> Show DeleteEnvironmentConfigurationResponse
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.
 DeleteEnvironmentConfigurationResponse
 -> Rep DeleteEnvironmentConfigurationResponse x)
-> (forall x.
    Rep DeleteEnvironmentConfigurationResponse x
    -> DeleteEnvironmentConfigurationResponse)
-> Generic DeleteEnvironmentConfigurationResponse
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