{-# 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.Proton.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)
--
-- Update an environment.
--
-- If the environment is associated with an environment account connection,
-- /don\'t/ update or include the @protonServiceRoleArn@ parameter to
-- update or connect to an environment account connection.
--
-- You can only update to a new environment account connection if it was
-- created in the same environment account that the current environment
-- account connection was created in and is associated with the current
-- environment.
--
-- If the environment /isn\'t/ associated with an environment account
-- connection, /don\'t/ update or include the
-- @environmentAccountConnectionId@ parameter to update or connect to an
-- environment account connection.
--
-- You can update either the @environmentAccountConnectionId@ or
-- @protonServiceRoleArn@ parameter and value. You can’t update both.
--
-- There are four modes for updating an environment as described in the
-- following. The @deploymentType@ field defines the mode.
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the environment is deployed and updated with the new
--     spec that you provide. Only requested parameters are updated.
--     /Don’t/ include minor or major version parameters when you use this
--     @deployment-type@.
--
-- []
--     @MINOR_VERSION@
--
--     In this mode, the environment is deployed and updated with the
--     published, recommended (latest) minor version of the current major
--     version in use, by default. You can also specify a different minor
--     version of the current major version in use.
--
-- []
--     @MAJOR_VERSION@
--
--     In this mode, the environment is deployed and updated with the
--     published, recommended (latest) major and minor version of the
--     current template, by default. You can also specify a different major
--     version that\'s higher than the major version in use and a minor
--     version (optional).
module Amazonka.Proton.UpdateEnvironment
  ( -- * Creating a Request
    UpdateEnvironment (..),
    newUpdateEnvironment,

    -- * Request Lenses
    updateEnvironment_protonServiceRoleArn,
    updateEnvironment_environmentAccountConnectionId,
    updateEnvironment_spec,
    updateEnvironment_templateMinorVersion,
    updateEnvironment_description,
    updateEnvironment_templateMajorVersion,
    updateEnvironment_deploymentType,
    updateEnvironment_name,

    -- * Destructuring the Response
    UpdateEnvironmentResponse (..),
    newUpdateEnvironmentResponse,

    -- * Response Lenses
    updateEnvironmentResponse_httpStatus,
    updateEnvironmentResponse_environment,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateEnvironment' smart constructor.
data UpdateEnvironment = UpdateEnvironment'
  { -- | The Amazon Resource Name (ARN) of the AWS Proton service role that
    -- allows AWS Proton to make API calls to other services your behalf.
    UpdateEnvironment -> Maybe Text
protonServiceRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the environment account connection.
    --
    -- You can only update to a new environment account connection if it was
    -- created in the same environment account that the current environment
    -- account connection was created in and is associated with the current
    -- environment.
    UpdateEnvironment -> Maybe Text
environmentAccountConnectionId :: Prelude.Maybe Prelude.Text,
    -- | The formatted specification that defines the update.
    UpdateEnvironment -> Maybe (Sensitive Text)
spec :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the minor version of the environment to update.
    UpdateEnvironment -> Maybe Text
templateMinorVersion :: Prelude.Maybe Prelude.Text,
    -- | A description of the environment update.
    UpdateEnvironment -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the major version of the environment to update.
    UpdateEnvironment -> Maybe Text
templateMajorVersion :: Prelude.Maybe Prelude.Text,
    -- | There are four modes for updating an environment as described in the
    -- following. The @deploymentType@ field defines the mode.
    --
    -- []
    --     @NONE@
    --
    --     In this mode, a deployment /doesn\'t/ occur. Only the requested
    --     metadata parameters are updated.
    --
    -- []
    --     @CURRENT_VERSION@
    --
    --     In this mode, the environment is deployed and updated with the new
    --     spec that you provide. Only requested parameters are updated.
    --     /Don’t/ include minor or major version parameters when you use this
    --     @deployment-type@.
    --
    -- []
    --     @MINOR_VERSION@
    --
    --     In this mode, the environment is deployed and updated with the
    --     published, recommended (latest) minor version of the current major
    --     version in use, by default. You can also specify a different minor
    --     version of the current major version in use.
    --
    -- []
    --     @MAJOR_VERSION@
    --
    --     In this mode, the environment is deployed and updated with the
    --     published, recommended (latest) major and minor version of the
    --     current template, by default. You can also specify a different major
    --     version that is higher than the major version in use and a minor
    --     version (optional).
    UpdateEnvironment -> DeploymentUpdateType
deploymentType :: DeploymentUpdateType,
    -- | The name of the environment to update.
    UpdateEnvironment -> Text
name :: 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, 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:
--
-- 'protonServiceRoleArn', 'updateEnvironment_protonServiceRoleArn' - The Amazon Resource Name (ARN) of the AWS Proton service role that
-- allows AWS Proton to make API calls to other services your behalf.
--
-- 'environmentAccountConnectionId', 'updateEnvironment_environmentAccountConnectionId' - The ID of the environment account connection.
--
-- You can only update to a new environment account connection if it was
-- created in the same environment account that the current environment
-- account connection was created in and is associated with the current
-- environment.
--
-- 'spec', 'updateEnvironment_spec' - The formatted specification that defines the update.
--
-- 'templateMinorVersion', 'updateEnvironment_templateMinorVersion' - The ID of the minor version of the environment to update.
--
-- 'description', 'updateEnvironment_description' - A description of the environment update.
--
-- 'templateMajorVersion', 'updateEnvironment_templateMajorVersion' - The ID of the major version of the environment to update.
--
-- 'deploymentType', 'updateEnvironment_deploymentType' - There are four modes for updating an environment as described in the
-- following. The @deploymentType@ field defines the mode.
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the environment is deployed and updated with the new
--     spec that you provide. Only requested parameters are updated.
--     /Don’t/ include minor or major version parameters when you use this
--     @deployment-type@.
--
-- []
--     @MINOR_VERSION@
--
--     In this mode, the environment is deployed and updated with the
--     published, recommended (latest) minor version of the current major
--     version in use, by default. You can also specify a different minor
--     version of the current major version in use.
--
-- []
--     @MAJOR_VERSION@
--
--     In this mode, the environment is deployed and updated with the
--     published, recommended (latest) major and minor version of the
--     current template, by default. You can also specify a different major
--     version that is higher than the major version in use and a minor
--     version (optional).
--
-- 'name', 'updateEnvironment_name' - The name of the environment to update.
newUpdateEnvironment ::
  -- | 'deploymentType'
  DeploymentUpdateType ->
  -- | 'name'
  Prelude.Text ->
  UpdateEnvironment
newUpdateEnvironment :: DeploymentUpdateType -> Text -> UpdateEnvironment
newUpdateEnvironment DeploymentUpdateType
pDeploymentType_ Text
pName_ =
  UpdateEnvironment' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> DeploymentUpdateType
-> Text
-> UpdateEnvironment
UpdateEnvironment'
    { $sel:protonServiceRoleArn:UpdateEnvironment' :: Maybe Text
protonServiceRoleArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentAccountConnectionId:UpdateEnvironment' :: Maybe Text
environmentAccountConnectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:spec:UpdateEnvironment' :: Maybe (Sensitive Text)
spec = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:templateMinorVersion:UpdateEnvironment' :: Maybe Text
templateMinorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateEnvironment' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:templateMajorVersion:UpdateEnvironment' :: Maybe Text
templateMajorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentType:UpdateEnvironment' :: DeploymentUpdateType
deploymentType = DeploymentUpdateType
pDeploymentType_,
      $sel:name:UpdateEnvironment' :: Text
name = Text
pName_
    }

-- | The Amazon Resource Name (ARN) of the AWS Proton service role that
-- allows AWS Proton to make API calls to other services your behalf.
updateEnvironment_protonServiceRoleArn :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_protonServiceRoleArn :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_protonServiceRoleArn = (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
protonServiceRoleArn :: Maybe Text
$sel:protonServiceRoleArn:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
protonServiceRoleArn} -> Maybe Text
protonServiceRoleArn) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:protonServiceRoleArn:UpdateEnvironment' :: Maybe Text
protonServiceRoleArn = Maybe Text
a} :: UpdateEnvironment)

-- | The ID of the environment account connection.
--
-- You can only update to a new environment account connection if it was
-- created in the same environment account that the current environment
-- account connection was created in and is associated with the current
-- environment.
updateEnvironment_environmentAccountConnectionId :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_environmentAccountConnectionId :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_environmentAccountConnectionId = (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
environmentAccountConnectionId :: Maybe Text
$sel:environmentAccountConnectionId:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
environmentAccountConnectionId} -> Maybe Text
environmentAccountConnectionId) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:environmentAccountConnectionId:UpdateEnvironment' :: Maybe Text
environmentAccountConnectionId = Maybe Text
a} :: UpdateEnvironment)

-- | The formatted specification that defines the update.
updateEnvironment_spec :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_spec :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_spec = (UpdateEnvironment -> Maybe (Sensitive Text))
-> (UpdateEnvironment
    -> Maybe (Sensitive Text) -> UpdateEnvironment)
-> Lens
     UpdateEnvironment
     UpdateEnvironment
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe (Sensitive Text)
spec :: Maybe (Sensitive Text)
$sel:spec:UpdateEnvironment' :: UpdateEnvironment -> Maybe (Sensitive Text)
spec} -> Maybe (Sensitive Text)
spec) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe (Sensitive Text)
a -> UpdateEnvironment
s {$sel:spec:UpdateEnvironment' :: Maybe (Sensitive Text)
spec = Maybe (Sensitive Text)
a} :: UpdateEnvironment) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UpdateEnvironment -> f UpdateEnvironment)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment
-> f UpdateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the minor version of the environment to update.
updateEnvironment_templateMinorVersion :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_templateMinorVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_templateMinorVersion = (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
templateMinorVersion :: Maybe Text
$sel:templateMinorVersion:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
templateMinorVersion} -> Maybe Text
templateMinorVersion) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:templateMinorVersion:UpdateEnvironment' :: Maybe Text
templateMinorVersion = Maybe Text
a} :: UpdateEnvironment)

-- | A description of the environment update.
updateEnvironment_description :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_description :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_description = (UpdateEnvironment -> Maybe (Sensitive Text))
-> (UpdateEnvironment
    -> Maybe (Sensitive Text) -> UpdateEnvironment)
-> Lens
     UpdateEnvironment
     UpdateEnvironment
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:UpdateEnvironment' :: UpdateEnvironment -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe (Sensitive Text)
a -> UpdateEnvironment
s {$sel:description:UpdateEnvironment' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: UpdateEnvironment) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> UpdateEnvironment -> f UpdateEnvironment)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment
-> f UpdateEnvironment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the major version of the environment to update.
updateEnvironment_templateMajorVersion :: Lens.Lens' UpdateEnvironment (Prelude.Maybe Prelude.Text)
updateEnvironment_templateMajorVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_templateMajorVersion = (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
templateMajorVersion :: Maybe Text
$sel:templateMajorVersion:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
templateMajorVersion} -> Maybe Text
templateMajorVersion) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Maybe Text
a -> UpdateEnvironment
s {$sel:templateMajorVersion:UpdateEnvironment' :: Maybe Text
templateMajorVersion = Maybe Text
a} :: UpdateEnvironment)

-- | There are four modes for updating an environment as described in the
-- following. The @deploymentType@ field defines the mode.
--
-- []
--     @NONE@
--
--     In this mode, a deployment /doesn\'t/ occur. Only the requested
--     metadata parameters are updated.
--
-- []
--     @CURRENT_VERSION@
--
--     In this mode, the environment is deployed and updated with the new
--     spec that you provide. Only requested parameters are updated.
--     /Don’t/ include minor or major version parameters when you use this
--     @deployment-type@.
--
-- []
--     @MINOR_VERSION@
--
--     In this mode, the environment is deployed and updated with the
--     published, recommended (latest) minor version of the current major
--     version in use, by default. You can also specify a different minor
--     version of the current major version in use.
--
-- []
--     @MAJOR_VERSION@
--
--     In this mode, the environment is deployed and updated with the
--     published, recommended (latest) major and minor version of the
--     current template, by default. You can also specify a different major
--     version that is higher than the major version in use and a minor
--     version (optional).
updateEnvironment_deploymentType :: Lens.Lens' UpdateEnvironment DeploymentUpdateType
updateEnvironment_deploymentType :: (DeploymentUpdateType -> f DeploymentUpdateType)
-> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_deploymentType = (UpdateEnvironment -> DeploymentUpdateType)
-> (UpdateEnvironment -> DeploymentUpdateType -> UpdateEnvironment)
-> Lens
     UpdateEnvironment
     UpdateEnvironment
     DeploymentUpdateType
     DeploymentUpdateType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {DeploymentUpdateType
deploymentType :: DeploymentUpdateType
$sel:deploymentType:UpdateEnvironment' :: UpdateEnvironment -> DeploymentUpdateType
deploymentType} -> DeploymentUpdateType
deploymentType) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} DeploymentUpdateType
a -> UpdateEnvironment
s {$sel:deploymentType:UpdateEnvironment' :: DeploymentUpdateType
deploymentType = DeploymentUpdateType
a} :: UpdateEnvironment)

-- | The name of the environment to update.
updateEnvironment_name :: Lens.Lens' UpdateEnvironment Prelude.Text
updateEnvironment_name :: (Text -> f Text) -> UpdateEnvironment -> f UpdateEnvironment
updateEnvironment_name = (UpdateEnvironment -> Text)
-> (UpdateEnvironment -> Text -> UpdateEnvironment)
-> Lens UpdateEnvironment UpdateEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironment' {Text
name :: Text
$sel:name:UpdateEnvironment' :: UpdateEnvironment -> Text
name} -> Text
name) (\s :: UpdateEnvironment
s@UpdateEnvironment' {} Text
a -> UpdateEnvironment
s {$sel:name:UpdateEnvironment' :: Text
name = Text
a} :: UpdateEnvironment)

instance Core.AWSRequest UpdateEnvironment where
  type
    AWSResponse UpdateEnvironment =
      UpdateEnvironmentResponse
  request :: UpdateEnvironment -> Request UpdateEnvironment
request = Service -> UpdateEnvironment -> Request UpdateEnvironment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEnvironment)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateEnvironment))
-> Logger
-> Service
-> Proxy UpdateEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEnvironment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Environment -> UpdateEnvironmentResponse
UpdateEnvironmentResponse'
            (Int -> Environment -> UpdateEnvironmentResponse)
-> Either String Int
-> Either String (Environment -> UpdateEnvironmentResponse)
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))
            Either String (Environment -> UpdateEnvironmentResponse)
-> Either String Environment
-> Either String UpdateEnvironmentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Environment
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"environment")
      )

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] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AwsProton20200720.UpdateEnvironment" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateEnvironment where
  toJSON :: UpdateEnvironment -> Value
toJSON UpdateEnvironment' {Maybe Text
Maybe (Sensitive Text)
Text
DeploymentUpdateType
name :: Text
deploymentType :: DeploymentUpdateType
templateMajorVersion :: Maybe Text
description :: Maybe (Sensitive Text)
templateMinorVersion :: Maybe Text
spec :: Maybe (Sensitive Text)
environmentAccountConnectionId :: Maybe Text
protonServiceRoleArn :: Maybe Text
$sel:name:UpdateEnvironment' :: UpdateEnvironment -> Text
$sel:deploymentType:UpdateEnvironment' :: UpdateEnvironment -> DeploymentUpdateType
$sel:templateMajorVersion:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:description:UpdateEnvironment' :: UpdateEnvironment -> Maybe (Sensitive Text)
$sel:templateMinorVersion:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:spec:UpdateEnvironment' :: UpdateEnvironment -> Maybe (Sensitive Text)
$sel:environmentAccountConnectionId:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
$sel:protonServiceRoleArn:UpdateEnvironment' :: UpdateEnvironment -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"protonServiceRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
protonServiceRoleArn,
            (Text
"environmentAccountConnectionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
environmentAccountConnectionId,
            (Text
"spec" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
spec,
            (Text
"templateMinorVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateMinorVersion,
            (Text
"description" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
description,
            (Text
"templateMajorVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateMajorVersion,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"deploymentType" Text -> DeploymentUpdateType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeploymentUpdateType
deploymentType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

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 = QueryString -> UpdateEnvironment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateEnvironmentResponse' smart constructor.
data UpdateEnvironmentResponse = UpdateEnvironmentResponse'
  { -- | The response's http status code.
    UpdateEnvironmentResponse -> Int
httpStatus :: Prelude.Int,
    -- | The environment detail data that\'s returned by AWS Proton.
    UpdateEnvironmentResponse -> Environment
environment :: Environment
  }
  deriving (UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool
(UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool)
-> (UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool)
-> Eq UpdateEnvironmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool
$c/= :: UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool
== :: UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool
$c== :: UpdateEnvironmentResponse -> UpdateEnvironmentResponse -> Bool
Prelude.Eq, Int -> UpdateEnvironmentResponse -> ShowS
[UpdateEnvironmentResponse] -> ShowS
UpdateEnvironmentResponse -> String
(Int -> UpdateEnvironmentResponse -> ShowS)
-> (UpdateEnvironmentResponse -> String)
-> ([UpdateEnvironmentResponse] -> ShowS)
-> Show UpdateEnvironmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEnvironmentResponse] -> ShowS
$cshowList :: [UpdateEnvironmentResponse] -> ShowS
show :: UpdateEnvironmentResponse -> String
$cshow :: UpdateEnvironmentResponse -> String
showsPrec :: Int -> UpdateEnvironmentResponse -> ShowS
$cshowsPrec :: Int -> UpdateEnvironmentResponse -> ShowS
Prelude.Show, (forall x.
 UpdateEnvironmentResponse -> Rep UpdateEnvironmentResponse x)
-> (forall x.
    Rep UpdateEnvironmentResponse x -> UpdateEnvironmentResponse)
-> Generic UpdateEnvironmentResponse
forall x.
Rep UpdateEnvironmentResponse x -> UpdateEnvironmentResponse
forall x.
UpdateEnvironmentResponse -> Rep UpdateEnvironmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEnvironmentResponse x -> UpdateEnvironmentResponse
$cfrom :: forall x.
UpdateEnvironmentResponse -> Rep UpdateEnvironmentResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEnvironmentResponse' 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', 'updateEnvironmentResponse_httpStatus' - The response's http status code.
--
-- 'environment', 'updateEnvironmentResponse_environment' - The environment detail data that\'s returned by AWS Proton.
newUpdateEnvironmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'environment'
  Environment ->
  UpdateEnvironmentResponse
newUpdateEnvironmentResponse :: Int -> Environment -> UpdateEnvironmentResponse
newUpdateEnvironmentResponse
  Int
pHttpStatus_
  Environment
pEnvironment_ =
    UpdateEnvironmentResponse' :: Int -> Environment -> UpdateEnvironmentResponse
UpdateEnvironmentResponse'
      { $sel:httpStatus:UpdateEnvironmentResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:environment:UpdateEnvironmentResponse' :: Environment
environment = Environment
pEnvironment_
      }

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

-- | The environment detail data that\'s returned by AWS Proton.
updateEnvironmentResponse_environment :: Lens.Lens' UpdateEnvironmentResponse Environment
updateEnvironmentResponse_environment :: (Environment -> f Environment)
-> UpdateEnvironmentResponse -> f UpdateEnvironmentResponse
updateEnvironmentResponse_environment = (UpdateEnvironmentResponse -> Environment)
-> (UpdateEnvironmentResponse
    -> Environment -> UpdateEnvironmentResponse)
-> Lens
     UpdateEnvironmentResponse
     UpdateEnvironmentResponse
     Environment
     Environment
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEnvironmentResponse' {Environment
environment :: Environment
$sel:environment:UpdateEnvironmentResponse' :: UpdateEnvironmentResponse -> Environment
environment} -> Environment
environment) (\s :: UpdateEnvironmentResponse
s@UpdateEnvironmentResponse' {} Environment
a -> UpdateEnvironmentResponse
s {$sel:environment:UpdateEnvironmentResponse' :: Environment
environment = Environment
a} :: UpdateEnvironmentResponse)

instance Prelude.NFData UpdateEnvironmentResponse