{-# 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.UpdateEnvironment
-- 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)
--
-- Updates the environment description, deploys a new application version,
-- updates the configuration settings to an entirely new configuration
-- template, or updates select configuration option values in the running
-- environment.
--
-- Attempting to update both the release and configuration is not allowed
-- and AWS Elastic Beanstalk returns an @InvalidParameterCombination@
-- error.
--
-- When updating the configuration settings to a new template or individual
-- settings, a draft configuration is created and
-- DescribeConfigurationSettings for this environment returns two setting
-- descriptions with different @DeploymentStatus@ values.
module Amazonka.ElasticBeanstalk.UpdateEnvironment
  ( -- * Creating a Request
    UpdateEnvironment (..),
    newUpdateEnvironment,

    -- * Request Lenses
    updateEnvironment_templateName,
    updateEnvironment_optionsToRemove,
    updateEnvironment_optionSettings,
    updateEnvironment_versionLabel,
    updateEnvironment_platformArn,
    updateEnvironment_tier,
    updateEnvironment_environmentName,
    updateEnvironment_applicationName,
    updateEnvironment_solutionStackName,
    updateEnvironment_environmentId,
    updateEnvironment_groupName,
    updateEnvironment_description,

    -- * Destructuring the Response
    EnvironmentDescription (..),
    newEnvironmentDescription,

    -- * Response Lenses
    environmentDescription_status,
    environmentDescription_cname,
    environmentDescription_templateName,
    environmentDescription_abortableOperationInProgress,
    environmentDescription_endpointURL,
    environmentDescription_resources,
    environmentDescription_dateUpdated,
    environmentDescription_dateCreated,
    environmentDescription_health,
    environmentDescription_versionLabel,
    environmentDescription_operationsRole,
    environmentDescription_platformArn,
    environmentDescription_tier,
    environmentDescription_environmentName,
    environmentDescription_applicationName,
    environmentDescription_environmentArn,
    environmentDescription_solutionStackName,
    environmentDescription_environmentId,
    environmentDescription_healthStatus,
    environmentDescription_environmentLinks,
    environmentDescription_description,
  )
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 update an environment.
--
-- /See:/ 'newUpdateEnvironment' smart constructor.
data UpdateEnvironment = UpdateEnvironment'
  { -- | If this parameter is specified, AWS Elastic Beanstalk deploys this
    -- configuration template to the environment. If no such configuration
    -- template is found, AWS Elastic Beanstalk returns an
    -- @InvalidParameterValue@ error.
    UpdateEnvironment -> Maybe Text
templateName :: Prelude.Maybe Prelude.Text,
    -- | A list of custom user-defined configuration options to remove from the
    -- configuration set for this environment.
    UpdateEnvironment -> Maybe [OptionSpecification]
optionsToRemove :: Prelude.Maybe [OptionSpecification],
    -- | If specified, AWS Elastic Beanstalk updates the configuration set
    -- associated with the running environment and sets the specified
    -- configuration options to the requested value.
    UpdateEnvironment -> Maybe [ConfigurationOptionSetting]
optionSettings :: Prelude.Maybe [ConfigurationOptionSetting],
    -- | If this parameter is specified, AWS Elastic Beanstalk deploys the named
    -- application version to the environment. If no such application version
    -- is found, returns an @InvalidParameterValue@ error.
    UpdateEnvironment -> Maybe Text
versionLabel :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the platform, if used.
    UpdateEnvironment -> Maybe Text
platformArn :: Prelude.Maybe Prelude.Text,
    -- | This specifies the tier to use to update the environment.
    --
    -- Condition: At this time, if you change the tier version, name, or type,
    -- AWS Elastic Beanstalk returns @InvalidParameterValue@ error.
    UpdateEnvironment -> Maybe EnvironmentTier
tier :: Prelude.Maybe EnvironmentTier,
    -- | The name of the environment to update. If no environment with this name
    -- exists, AWS Elastic Beanstalk returns an @InvalidParameterValue@ error.
    --
    -- Condition: You must specify either this or an EnvironmentId, or both. If
    -- you do not specify either, AWS Elastic Beanstalk returns
    -- @MissingRequiredParameter@ error.
    UpdateEnvironment -> Maybe Text
environmentName :: Prelude.Maybe Prelude.Text,
    -- | The name of the application with which the environment is associated.
    UpdateEnvironment -> Maybe Text
applicationName :: Prelude.Maybe Prelude.Text,
    -- | This specifies the platform version that the environment will run after
    -- the environment is updated.
    UpdateEnvironment -> Maybe Text
solutionStackName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the environment to update.
    --
    -- If no environment with this ID exists, AWS Elastic Beanstalk returns an
    -- @InvalidParameterValue@ error.
    --
    -- Condition: You must specify either this or an EnvironmentName, or both.
    -- If you do not specify either, AWS Elastic Beanstalk returns
    -- @MissingRequiredParameter@ error.
    UpdateEnvironment -> Maybe Text
environmentId :: Prelude.Maybe Prelude.Text,
    -- | The name of the group to which the target environment belongs. Specify a
    -- group name only if the environment\'s name is specified in an
    -- environment manifest and not with the environment name or environment ID
    -- parameters. See
    -- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-cfg-manifest.html Environment Manifest (env.yaml)>
    -- for details.
    UpdateEnvironment -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | If this parameter is specified, AWS Elastic Beanstalk updates the
    -- description of this environment.
    UpdateEnvironment -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateEnvironment -> UpdateEnvironment -> Bool
(UpdateEnvironment -> UpdateEnvironment -> Bool)
-> (UpdateEnvironment -> UpdateEnvironment -> Bool)
-> Eq UpdateEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEnvironment -> UpdateEnvironment -> Bool
$c/= :: UpdateEnvironment -> UpdateEnvironment -> Bool
== :: UpdateEnvironment -> UpdateEnvironment -> Bool
$c== :: UpdateEnvironment -> UpdateEnvironment -> Bool
Prelude.Eq, ReadPrec [UpdateEnvironment]
ReadPrec UpdateEnvironment
Int -> ReadS UpdateEnvironment
ReadS [UpdateEnvironment]
(Int -> ReadS UpdateEnvironment)
-> ReadS [UpdateEnvironment]
-> ReadPrec UpdateEnvironment
-> ReadPrec [UpdateEnvironment]
-> Read UpdateEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEnvironment]
$creadListPrec :: ReadPrec [UpdateEnvironment]
readPrec :: ReadPrec UpdateEnvironment
$creadPrec :: ReadPrec UpdateEnvironment
readList :: ReadS [UpdateEnvironment]
$creadList :: ReadS [UpdateEnvironment]
readsPrec :: Int -> ReadS UpdateEnvironment
$creadsPrec :: Int -> ReadS UpdateEnvironment
Prelude.Read, Int -> UpdateEnvironment -> ShowS
[UpdateEnvironment] -> ShowS
UpdateEnvironment -> String
(Int -> UpdateEnvironment -> ShowS)
-> (UpdateEnvironment -> String)
-> ([UpdateEnvironment] -> ShowS)
-> Show UpdateEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEnvironment] -> ShowS
$cshowList :: [UpdateEnvironment] -> ShowS
show :: UpdateEnvironment -> String
$cshow :: UpdateEnvironment -> String
showsPrec :: Int -> UpdateEnvironment -> ShowS
$cshowsPrec :: Int -> UpdateEnvironment -> ShowS
Prelude.Show, (forall x. UpdateEnvironment -> Rep UpdateEnvironment x)
-> (forall x. Rep UpdateEnvironment x -> UpdateEnvironment)
-> Generic UpdateEnvironment
forall x. Rep UpdateEnvironment x -> UpdateEnvironment
forall x. UpdateEnvironment -> Rep UpdateEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEnvironment x -> UpdateEnvironment
$cfrom :: forall x. UpdateEnvironment -> Rep UpdateEnvironment x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEnvironment' 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:
--
-- 'templateName', 'updateEnvironment_templateName' - If this parameter is specified, AWS Elastic Beanstalk deploys this
-- configuration template to the environment. If no such configuration
-- template is found, AWS Elastic Beanstalk returns an
-- @InvalidParameterValue@ error.
--
-- 'optionsToRemove', 'updateEnvironment_optionsToRemove' - A list of custom user-defined configuration options to remove from the
-- configuration set for this environment.
--
-- 'optionSettings', 'updateEnvironment_optionSettings' - If specified, AWS Elastic Beanstalk updates the configuration set
-- associated with the running environment and sets the specified
-- configuration options to the requested value.
--
-- 'versionLabel', 'updateEnvironment_versionLabel' - If this parameter is specified, AWS Elastic Beanstalk deploys the named
-- application version to the environment. If no such application version
-- is found, returns an @InvalidParameterValue@ error.
--
-- 'platformArn', 'updateEnvironment_platformArn' - The ARN of the platform, if used.
--
-- 'tier', 'updateEnvironment_tier' - This specifies the tier to use to update the environment.
--
-- Condition: At this time, if you change the tier version, name, or type,
-- AWS Elastic Beanstalk returns @InvalidParameterValue@ error.
--
-- 'environmentName', 'updateEnvironment_environmentName' - The name of the environment to update. If no environment with this name
-- exists, AWS Elastic Beanstalk returns an @InvalidParameterValue@ error.
--
-- Condition: You must specify either this or an EnvironmentId, or both. If
-- you do not specify either, AWS Elastic Beanstalk returns
-- @MissingRequiredParameter@ error.
--
-- 'applicationName', 'updateEnvironment_applicationName' - The name of the application with which the environment is associated.
--
-- 'solutionStackName', 'updateEnvironment_solutionStackName' - This specifies the platform version that the environment will run after
-- the environment is updated.
--
-- 'environmentId', 'updateEnvironment_environmentId' - The ID of the environment to update.
--
-- If no environment with this ID exists, AWS Elastic Beanstalk returns an
-- @InvalidParameterValue@ error.
--
-- Condition: You must specify either this or an EnvironmentName, or both.
-- If you do not specify either, AWS Elastic Beanstalk returns
-- @MissingRequiredParameter@ error.
--
-- 'groupName', 'updateEnvironment_groupName' - The name of the group to which the target environment belongs. Specify a
-- group name only if the environment\'s name is specified in an
-- environment manifest and not with the environment name or environment ID
-- parameters. See
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-cfg-manifest.html Environment Manifest (env.yaml)>
-- for details.
--
-- 'description', 'updateEnvironment_description' - If this parameter is specified, AWS Elastic Beanstalk updates the
-- description of this environment.
newUpdateEnvironment ::
  UpdateEnvironment
newUpdateEnvironment :: UpdateEnvironment
newUpdateEnvironment =
  UpdateEnvironment' :: Maybe Text
-> Maybe [OptionSpecification]
-> Maybe [ConfigurationOptionSetting]
-> Maybe Text
-> Maybe Text
-> Maybe EnvironmentTier
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> UpdateEnvironment
UpdateEnvironment'
    { $sel:templateName:UpdateEnvironment' :: Maybe Text
templateName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:optionsToRemove:UpdateEnvironment' :: Maybe [OptionSpecification]
optionsToRemove = Maybe [OptionSpecification]
forall a. Maybe a
Prelude.Nothing,
      $sel:optionSettings:UpdateEnvironment' :: Maybe [ConfigurationOptionSetting]
optionSettings = Maybe [ConfigurationOptionSetting]
forall a. Maybe a
Prelude.Nothing,
      $sel:versionLabel:UpdateEnvironment' :: Maybe Text
versionLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:platformArn:UpdateEnvironment' :: Maybe Text
platformArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tier:UpdateEnvironment' :: Maybe EnvironmentTier
tier = Maybe EnvironmentTier
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentName:UpdateEnvironment' :: Maybe Text
environmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:UpdateEnvironment' :: Maybe Text
applicationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:solutionStackName:UpdateEnvironment' :: Maybe Text
solutionStackName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentId:UpdateEnvironment' :: Maybe Text
environmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:UpdateEnvironment' :: Maybe Text
groupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateEnvironment' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If this parameter is specified, AWS Elastic Beanstalk deploys this
-- configuration template to the environment. If no such configuration
-- template is found, AWS Elastic Beanstalk returns an
-- @InvalidParameterValue@ error.
updateEnvironment_templateName :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_templateName :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_templateName = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
templateName :: Maybe Text
$sel:templateName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
templateName} -> Maybe Text
templateName) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:templateName:UpdateEnvironment' :: Maybe Text
templateName = Maybe Text
a} :: UpdateEnvironment)

-- | A list of custom user-defined configuration options to remove from the
-- configuration set for this environment.
updateEnvironment_optionsToRemove :: Lens.Lens' UpdateEnvironment (Prelude.Maybe [OptionSpecification])
updateEnvironment_optionsToRemove :: (Maybe [OptionSpecification] -> f (Maybe [OptionSpecification]))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_optionsToRemove = (UpdateEnvironment -> Maybe [OptionSpecification])
-> (UpdateEnvironment
    -> Maybe [OptionSpecification] -> UpdateEnvironment)
-> Lens
     UpdateEnvironment
     UpdateEnvironment
     (Maybe [OptionSpecification])
     (Maybe [OptionSpecification])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe [OptionSpecification]
optionsToRemove :: Maybe [OptionSpecification]
$sel:optionsToRemove:UpdateEnvironment' :: UpdateEnvironment -> Maybe [OptionSpecification]
optionsToRemove} -> Maybe [OptionSpecification]
optionsToRemove) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe [OptionSpecification]
a -> UpdateEnvironment
s {$sel:optionsToRemove:UpdateEnvironment' :: Maybe [OptionSpecification]
optionsToRemove = Maybe [OptionSpecification]
a} :: UpdateEnvironment) ((Maybe [OptionSpecification] -> f (Maybe [OptionSpecification]))
 -> UpdateEnvironment -> f UpdateEnvironment)
-> ((Maybe [OptionSpecification]
     -> f (Maybe [OptionSpecification]))
    -> Maybe [OptionSpecification] -> f (Maybe [OptionSpecification]))
-> (Maybe [OptionSpecification] -> f (Maybe [OptionSpecification]))
-> UpdateEnvironment
-> f UpdateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OptionSpecification]
  [OptionSpecification]
  [OptionSpecification]
  [OptionSpecification]
-> Iso
     (Maybe [OptionSpecification])
     (Maybe [OptionSpecification])
     (Maybe [OptionSpecification])
     (Maybe [OptionSpecification])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [OptionSpecification]
  [OptionSpecification]
  [OptionSpecification]
  [OptionSpecification]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If specified, AWS Elastic Beanstalk updates the configuration set
-- associated with the running environment and sets the specified
-- configuration options to the requested value.
updateEnvironment_optionSettings :: Lens.Lens' UpdateEnvironment (Prelude.Maybe [ConfigurationOptionSetting])
updateEnvironment_optionSettings :: (Maybe [ConfigurationOptionSetting]
 -> f (Maybe [ConfigurationOptionSetting]))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_optionSettings = (UpdateEnvironment -> Maybe [ConfigurationOptionSetting])
-> (UpdateEnvironment
    -> Maybe [ConfigurationOptionSetting] -> UpdateEnvironment)
-> Lens
     UpdateEnvironment
     UpdateEnvironment
     (Maybe [ConfigurationOptionSetting])
     (Maybe [ConfigurationOptionSetting])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe [ConfigurationOptionSetting]
optionSettings :: Maybe [ConfigurationOptionSetting]
$sel:optionSettings:UpdateEnvironment' :: UpdateEnvironment -> Maybe [ConfigurationOptionSetting]
optionSettings} -> Maybe [ConfigurationOptionSetting]
optionSettings) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe [ConfigurationOptionSetting]
a -> UpdateEnvironment
s {$sel:optionSettings:UpdateEnvironment' :: Maybe [ConfigurationOptionSetting]
optionSettings = Maybe [ConfigurationOptionSetting]
a} :: UpdateEnvironment) ((Maybe [ConfigurationOptionSetting]
  -> f (Maybe [ConfigurationOptionSetting]))
 -> UpdateEnvironment -> f UpdateEnvironment)
-> ((Maybe [ConfigurationOptionSetting]
     -> f (Maybe [ConfigurationOptionSetting]))
    -> Maybe [ConfigurationOptionSetting]
    -> f (Maybe [ConfigurationOptionSetting]))
-> (Maybe [ConfigurationOptionSetting]
    -> f (Maybe [ConfigurationOptionSetting]))
-> UpdateEnvironment
-> f UpdateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConfigurationOptionSetting]
  [ConfigurationOptionSetting]
  [ConfigurationOptionSetting]
  [ConfigurationOptionSetting]
-> Iso
     (Maybe [ConfigurationOptionSetting])
     (Maybe [ConfigurationOptionSetting])
     (Maybe [ConfigurationOptionSetting])
     (Maybe [ConfigurationOptionSetting])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [ConfigurationOptionSetting]
  [ConfigurationOptionSetting]
  [ConfigurationOptionSetting]
  [ConfigurationOptionSetting]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If this parameter is specified, AWS Elastic Beanstalk deploys the named
-- application version to the environment. If no such application version
-- is found, returns an @InvalidParameterValue@ error.
updateEnvironment_versionLabel :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_versionLabel :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_versionLabel = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
versionLabel :: Maybe Text
$sel:versionLabel:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
versionLabel} -> Maybe Text
versionLabel) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:versionLabel:UpdateEnvironment' :: Maybe Text
versionLabel = Maybe Text
a} :: UpdateEnvironment)

-- | The ARN of the platform, if used.
updateEnvironment_platformArn :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_platformArn :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_platformArn = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
platformArn :: Maybe Text
$sel:platformArn:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
platformArn} -> Maybe Text
platformArn) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:platformArn:UpdateEnvironment' :: Maybe Text
platformArn = Maybe Text
a} :: UpdateEnvironment)

-- | This specifies the tier to use to update the environment.
--
-- Condition: At this time, if you change the tier version, name, or type,
-- AWS Elastic Beanstalk returns @InvalidParameterValue@ error.
updateEnvironment_tier :: Lens.Lens' UpdateEnvironment (Prelude.Maybe EnvironmentTier)
updateEnvironment_tier :: (Maybe EnvironmentTier -> f (Maybe EnvironmentTier))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_tier = (UpdateEnvironment -> Maybe EnvironmentTier)
-> (UpdateEnvironment
    -> Maybe EnvironmentTier -> UpdateEnvironment)
-> Lens
     UpdateEnvironment
     UpdateEnvironment
     (Maybe EnvironmentTier)
     (Maybe EnvironmentTier)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe EnvironmentTier
tier :: Maybe EnvironmentTier
$sel:tier:UpdateEnvironment' :: UpdateEnvironment -> Maybe EnvironmentTier
tier} -> Maybe EnvironmentTier
tier) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe EnvironmentTier
a -> UpdateEnvironment
s {$sel:tier:UpdateEnvironment' :: Maybe EnvironmentTier
tier = Maybe EnvironmentTier
a} :: UpdateEnvironment)

-- | The name of the environment to update. If no environment with this name
-- exists, AWS Elastic Beanstalk returns an @InvalidParameterValue@ error.
--
-- Condition: You must specify either this or an EnvironmentId, or both. If
-- you do not specify either, AWS Elastic Beanstalk returns
-- @MissingRequiredParameter@ error.
updateEnvironment_environmentName :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_environmentName :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_environmentName = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
environmentName :: Maybe Text
$sel:environmentName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
environmentName} -> Maybe Text
environmentName) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:environmentName:UpdateEnvironment' :: Maybe Text
environmentName = Maybe Text
a} :: UpdateEnvironment)

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

-- | This specifies the platform version that the environment will run after
-- the environment is updated.
updateEnvironment_solutionStackName :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_solutionStackName :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_solutionStackName = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
solutionStackName :: Maybe Text
$sel:solutionStackName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
solutionStackName} -> Maybe Text
solutionStackName) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:solutionStackName:UpdateEnvironment' :: Maybe Text
solutionStackName = Maybe Text
a} :: UpdateEnvironment)

-- | The ID of the environment to update.
--
-- If no environment with this ID exists, AWS Elastic Beanstalk returns an
-- @InvalidParameterValue@ error.
--
-- Condition: You must specify either this or an EnvironmentName, or both.
-- If you do not specify either, AWS Elastic Beanstalk returns
-- @MissingRequiredParameter@ error.
updateEnvironment_environmentId :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_environmentId :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_environmentId = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
environmentId :: Maybe Text
$sel:environmentId:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
environmentId} -> Maybe Text
environmentId) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:environmentId:UpdateEnvironment' :: Maybe Text
environmentId = Maybe Text
a} :: UpdateEnvironment)

-- | The name of the group to which the target environment belongs. Specify a
-- group name only if the environment\'s name is specified in an
-- environment manifest and not with the environment name or environment ID
-- parameters. See
-- <https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-cfg-manifest.html Environment Manifest (env.yaml)>
-- for details.
updateEnvironment_groupName :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_groupName :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_groupName = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
groupName :: Maybe Text
$sel:groupName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:groupName:UpdateEnvironment' :: Maybe Text
groupName = Maybe Text
a} :: UpdateEnvironment)

-- | If this parameter is specified, AWS Elastic Beanstalk updates the
-- description of this environment.
updateEnvironment_description :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_description :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_description = (UpdateEnvironment -> Maybe Text)
-> (UpdateEnvironment -> Maybe Text -> UpdateEnvironment)
-> Lens
     UpdateEnvironment UpdateEnvironment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe Text
description :: Maybe Text
$sel:description:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:description:UpdateEnvironment' :: Maybe Text
description = Maybe Text
a} :: UpdateEnvironment)

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

instance Prelude.Hashable UpdateEnvironment

instance Prelude.NFData UpdateEnvironment

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

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

instance Core.ToQuery UpdateEnvironment where
  toQuery :: UpdateEnvironment -> QueryString
toQuery UpdateEnvironment' {Maybe [ConfigurationOptionSetting]
Maybe [OptionSpecification]
Maybe Text
Maybe EnvironmentTier
description :: Maybe Text
groupName :: Maybe Text
environmentId :: Maybe Text
solutionStackName :: Maybe Text
applicationName :: Maybe Text
environmentName :: Maybe Text
tier :: Maybe EnvironmentTier
platformArn :: Maybe Text
versionLabel :: Maybe Text
optionSettings :: Maybe [ConfigurationOptionSetting]
optionsToRemove :: Maybe [OptionSpecification]
templateName :: Maybe Text
$sel:description:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:groupName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:environmentId:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:solutionStackName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:applicationName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:environmentName:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:tier:UpdateEnvironment' :: UpdateEnvironment -> Maybe EnvironmentTier
$sel:platformArn:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:versionLabel:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:optionSettings:UpdateEnvironment' :: UpdateEnvironment -> Maybe [ConfigurationOptionSetting]
$sel:optionsToRemove:UpdateEnvironment' :: UpdateEnvironment -> Maybe [OptionSpecification]
$sel:templateName:UpdateEnvironment' :: UpdateEnvironment -> Maybe 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
"UpdateEnvironment" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"TemplateName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
templateName,
        ByteString
"OptionsToRemove"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [OptionSpecification] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([OptionSpecification] -> QueryString)
-> Maybe [OptionSpecification] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OptionSpecification]
optionsToRemove
            ),
        ByteString
"OptionSettings"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [ConfigurationOptionSetting] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([ConfigurationOptionSetting] -> QueryString)
-> Maybe [ConfigurationOptionSetting] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ConfigurationOptionSetting]
optionSettings
            ),
        ByteString
"VersionLabel" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
versionLabel,
        ByteString
"PlatformArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
platformArn,
        ByteString
"Tier" ByteString -> Maybe EnvironmentTier -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe EnvironmentTier
tier,
        ByteString
"EnvironmentName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
environmentName,
        ByteString
"ApplicationName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
applicationName,
        ByteString
"SolutionStackName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
solutionStackName,
        ByteString
"EnvironmentId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
environmentId,
        ByteString
"GroupName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
groupName,
        ByteString
"Description" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
description
      ]