{-# 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.Batch.UpdateComputeEnvironment
-- 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 an Batch compute environment.
module Amazonka.Batch.UpdateComputeEnvironment
  ( -- * Creating a Request
    UpdateComputeEnvironment (..),
    newUpdateComputeEnvironment,

    -- * Request Lenses
    updateComputeEnvironment_state,
    updateComputeEnvironment_computeResources,
    updateComputeEnvironment_serviceRole,
    updateComputeEnvironment_computeEnvironment,

    -- * Destructuring the Response
    UpdateComputeEnvironmentResponse (..),
    newUpdateComputeEnvironmentResponse,

    -- * Response Lenses
    updateComputeEnvironmentResponse_computeEnvironmentName,
    updateComputeEnvironmentResponse_computeEnvironmentArn,
    updateComputeEnvironmentResponse_httpStatus,
  )
where

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

-- | Contains the parameters for @UpdateComputeEnvironment@.
--
-- /See:/ 'newUpdateComputeEnvironment' smart constructor.
data UpdateComputeEnvironment = UpdateComputeEnvironment'
  { -- | The state of the compute environment. Compute environments in the
    -- @ENABLED@ state can accept jobs from a queue and scale in or out
    -- automatically based on the workload demand of its associated queues.
    --
    -- If the state is @ENABLED@, then the Batch scheduler can attempt to place
    -- jobs from an associated job queue on the compute resources within the
    -- environment. If the compute environment is managed, then it can scale
    -- its instances out or in automatically, based on the job queue demand.
    --
    -- If the state is @DISABLED@, then the Batch scheduler doesn\'t attempt to
    -- place jobs within the environment. Jobs in a @STARTING@ or @RUNNING@
    -- state continue to progress normally. Managed compute environments in the
    -- @DISABLED@ state don\'t scale out. However, they scale in to @minvCpus@
    -- value after instances become idle.
    UpdateComputeEnvironment -> Maybe CEState
state :: Prelude.Maybe CEState,
    -- | Details of the compute resources managed by the compute environment.
    -- Required for a managed compute environment. For more information, see
    -- <https://docs.aws.amazon.com/batch/latest/userguide/compute_environments.html Compute Environments>
    -- in the /Batch User Guide/.
    UpdateComputeEnvironment -> Maybe ComputeResourceUpdate
computeResources :: Prelude.Maybe ComputeResourceUpdate,
    -- | The full Amazon Resource Name (ARN) of the IAM role that allows Batch to
    -- make calls to other Amazon Web Services services on your behalf. For
    -- more information, see
    -- <https://docs.aws.amazon.com/batch/latest/userguide/service_IAM_role.html Batch service IAM role>
    -- in the /Batch User Guide/.
    --
    -- If the compute environment has a service-linked role, it can\'t be
    -- changed to use a regular IAM role. Likewise, if the compute environment
    -- has a regular IAM role, it can\'t be changed to use a service-linked
    -- role.
    --
    -- If your specified role has a path other than @\/@, then you must either
    -- specify the full role ARN (this is recommended) or prefix the role name
    -- with the path.
    --
    -- Depending on how you created your Batch service role, its ARN might
    -- contain the @service-role@ path prefix. When you only specify the name
    -- of the service role, Batch assumes that your ARN doesn\'t use the
    -- @service-role@ path prefix. Because of this, we recommend that you
    -- specify the full ARN of your service role when you create compute
    -- environments.
    UpdateComputeEnvironment -> Maybe Text
serviceRole :: Prelude.Maybe Prelude.Text,
    -- | The name or full Amazon Resource Name (ARN) of the compute environment
    -- to update.
    UpdateComputeEnvironment -> Text
computeEnvironment :: Prelude.Text
  }
  deriving (UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool
(UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool)
-> (UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool)
-> Eq UpdateComputeEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool
$c/= :: UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool
== :: UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool
$c== :: UpdateComputeEnvironment -> UpdateComputeEnvironment -> Bool
Prelude.Eq, ReadPrec [UpdateComputeEnvironment]
ReadPrec UpdateComputeEnvironment
Int -> ReadS UpdateComputeEnvironment
ReadS [UpdateComputeEnvironment]
(Int -> ReadS UpdateComputeEnvironment)
-> ReadS [UpdateComputeEnvironment]
-> ReadPrec UpdateComputeEnvironment
-> ReadPrec [UpdateComputeEnvironment]
-> Read UpdateComputeEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateComputeEnvironment]
$creadListPrec :: ReadPrec [UpdateComputeEnvironment]
readPrec :: ReadPrec UpdateComputeEnvironment
$creadPrec :: ReadPrec UpdateComputeEnvironment
readList :: ReadS [UpdateComputeEnvironment]
$creadList :: ReadS [UpdateComputeEnvironment]
readsPrec :: Int -> ReadS UpdateComputeEnvironment
$creadsPrec :: Int -> ReadS UpdateComputeEnvironment
Prelude.Read, Int -> UpdateComputeEnvironment -> ShowS
[UpdateComputeEnvironment] -> ShowS
UpdateComputeEnvironment -> String
(Int -> UpdateComputeEnvironment -> ShowS)
-> (UpdateComputeEnvironment -> String)
-> ([UpdateComputeEnvironment] -> ShowS)
-> Show UpdateComputeEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateComputeEnvironment] -> ShowS
$cshowList :: [UpdateComputeEnvironment] -> ShowS
show :: UpdateComputeEnvironment -> String
$cshow :: UpdateComputeEnvironment -> String
showsPrec :: Int -> UpdateComputeEnvironment -> ShowS
$cshowsPrec :: Int -> UpdateComputeEnvironment -> ShowS
Prelude.Show, (forall x.
 UpdateComputeEnvironment -> Rep UpdateComputeEnvironment x)
-> (forall x.
    Rep UpdateComputeEnvironment x -> UpdateComputeEnvironment)
-> Generic UpdateComputeEnvironment
forall x.
Rep UpdateComputeEnvironment x -> UpdateComputeEnvironment
forall x.
UpdateComputeEnvironment -> Rep UpdateComputeEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateComputeEnvironment x -> UpdateComputeEnvironment
$cfrom :: forall x.
UpdateComputeEnvironment -> Rep UpdateComputeEnvironment x
Prelude.Generic)

-- |
-- Create a value of 'UpdateComputeEnvironment' 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:
--
-- 'state', 'updateComputeEnvironment_state' - The state of the compute environment. Compute environments in the
-- @ENABLED@ state can accept jobs from a queue and scale in or out
-- automatically based on the workload demand of its associated queues.
--
-- If the state is @ENABLED@, then the Batch scheduler can attempt to place
-- jobs from an associated job queue on the compute resources within the
-- environment. If the compute environment is managed, then it can scale
-- its instances out or in automatically, based on the job queue demand.
--
-- If the state is @DISABLED@, then the Batch scheduler doesn\'t attempt to
-- place jobs within the environment. Jobs in a @STARTING@ or @RUNNING@
-- state continue to progress normally. Managed compute environments in the
-- @DISABLED@ state don\'t scale out. However, they scale in to @minvCpus@
-- value after instances become idle.
--
-- 'computeResources', 'updateComputeEnvironment_computeResources' - Details of the compute resources managed by the compute environment.
-- Required for a managed compute environment. For more information, see
-- <https://docs.aws.amazon.com/batch/latest/userguide/compute_environments.html Compute Environments>
-- in the /Batch User Guide/.
--
-- 'serviceRole', 'updateComputeEnvironment_serviceRole' - The full Amazon Resource Name (ARN) of the IAM role that allows Batch to
-- make calls to other Amazon Web Services services on your behalf. For
-- more information, see
-- <https://docs.aws.amazon.com/batch/latest/userguide/service_IAM_role.html Batch service IAM role>
-- in the /Batch User Guide/.
--
-- If the compute environment has a service-linked role, it can\'t be
-- changed to use a regular IAM role. Likewise, if the compute environment
-- has a regular IAM role, it can\'t be changed to use a service-linked
-- role.
--
-- If your specified role has a path other than @\/@, then you must either
-- specify the full role ARN (this is recommended) or prefix the role name
-- with the path.
--
-- Depending on how you created your Batch service role, its ARN might
-- contain the @service-role@ path prefix. When you only specify the name
-- of the service role, Batch assumes that your ARN doesn\'t use the
-- @service-role@ path prefix. Because of this, we recommend that you
-- specify the full ARN of your service role when you create compute
-- environments.
--
-- 'computeEnvironment', 'updateComputeEnvironment_computeEnvironment' - The name or full Amazon Resource Name (ARN) of the compute environment
-- to update.
newUpdateComputeEnvironment ::
  -- | 'computeEnvironment'
  Prelude.Text ->
  UpdateComputeEnvironment
newUpdateComputeEnvironment :: Text -> UpdateComputeEnvironment
newUpdateComputeEnvironment Text
pComputeEnvironment_ =
  UpdateComputeEnvironment' :: Maybe CEState
-> Maybe ComputeResourceUpdate
-> Maybe Text
-> Text
-> UpdateComputeEnvironment
UpdateComputeEnvironment'
    { $sel:state:UpdateComputeEnvironment' :: Maybe CEState
state = Maybe CEState
forall a. Maybe a
Prelude.Nothing,
      $sel:computeResources:UpdateComputeEnvironment' :: Maybe ComputeResourceUpdate
computeResources = Maybe ComputeResourceUpdate
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceRole:UpdateComputeEnvironment' :: Maybe Text
serviceRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:computeEnvironment:UpdateComputeEnvironment' :: Text
computeEnvironment = Text
pComputeEnvironment_
    }

-- | The state of the compute environment. Compute environments in the
-- @ENABLED@ state can accept jobs from a queue and scale in or out
-- automatically based on the workload demand of its associated queues.
--
-- If the state is @ENABLED@, then the Batch scheduler can attempt to place
-- jobs from an associated job queue on the compute resources within the
-- environment. If the compute environment is managed, then it can scale
-- its instances out or in automatically, based on the job queue demand.
--
-- If the state is @DISABLED@, then the Batch scheduler doesn\'t attempt to
-- place jobs within the environment. Jobs in a @STARTING@ or @RUNNING@
-- state continue to progress normally. Managed compute environments in the
-- @DISABLED@ state don\'t scale out. However, they scale in to @minvCpus@
-- value after instances become idle.
updateComputeEnvironment_state :: Lens.Lens' UpdateComputeEnvironment (Prelude.Maybe CEState)
updateComputeEnvironment_state :: (Maybe CEState -> f (Maybe CEState))
-> UpdateComputeEnvironment -> f UpdateComputeEnvironment
updateComputeEnvironment_state = (UpdateComputeEnvironment -> Maybe CEState)
-> (UpdateComputeEnvironment
    -> Maybe CEState -> UpdateComputeEnvironment)
-> Lens
     UpdateComputeEnvironment
     UpdateComputeEnvironment
     (Maybe CEState)
     (Maybe CEState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComputeEnvironment' {Maybe CEState
state :: Maybe CEState
$sel:state:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Maybe CEState
state} -> Maybe CEState
state) (\s :: UpdateComputeEnvironment
s@UpdateComputeEnvironment' {} Maybe CEState
a -> UpdateComputeEnvironment
s {$sel:state:UpdateComputeEnvironment' :: Maybe CEState
state = Maybe CEState
a} :: UpdateComputeEnvironment)

-- | Details of the compute resources managed by the compute environment.
-- Required for a managed compute environment. For more information, see
-- <https://docs.aws.amazon.com/batch/latest/userguide/compute_environments.html Compute Environments>
-- in the /Batch User Guide/.
updateComputeEnvironment_computeResources :: Lens.Lens' UpdateComputeEnvironment (Prelude.Maybe ComputeResourceUpdate)
updateComputeEnvironment_computeResources :: (Maybe ComputeResourceUpdate -> f (Maybe ComputeResourceUpdate))
-> UpdateComputeEnvironment -> f UpdateComputeEnvironment
updateComputeEnvironment_computeResources = (UpdateComputeEnvironment -> Maybe ComputeResourceUpdate)
-> (UpdateComputeEnvironment
    -> Maybe ComputeResourceUpdate -> UpdateComputeEnvironment)
-> Lens
     UpdateComputeEnvironment
     UpdateComputeEnvironment
     (Maybe ComputeResourceUpdate)
     (Maybe ComputeResourceUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComputeEnvironment' {Maybe ComputeResourceUpdate
computeResources :: Maybe ComputeResourceUpdate
$sel:computeResources:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Maybe ComputeResourceUpdate
computeResources} -> Maybe ComputeResourceUpdate
computeResources) (\s :: UpdateComputeEnvironment
s@UpdateComputeEnvironment' {} Maybe ComputeResourceUpdate
a -> UpdateComputeEnvironment
s {$sel:computeResources:UpdateComputeEnvironment' :: Maybe ComputeResourceUpdate
computeResources = Maybe ComputeResourceUpdate
a} :: UpdateComputeEnvironment)

-- | The full Amazon Resource Name (ARN) of the IAM role that allows Batch to
-- make calls to other Amazon Web Services services on your behalf. For
-- more information, see
-- <https://docs.aws.amazon.com/batch/latest/userguide/service_IAM_role.html Batch service IAM role>
-- in the /Batch User Guide/.
--
-- If the compute environment has a service-linked role, it can\'t be
-- changed to use a regular IAM role. Likewise, if the compute environment
-- has a regular IAM role, it can\'t be changed to use a service-linked
-- role.
--
-- If your specified role has a path other than @\/@, then you must either
-- specify the full role ARN (this is recommended) or prefix the role name
-- with the path.
--
-- Depending on how you created your Batch service role, its ARN might
-- contain the @service-role@ path prefix. When you only specify the name
-- of the service role, Batch assumes that your ARN doesn\'t use the
-- @service-role@ path prefix. Because of this, we recommend that you
-- specify the full ARN of your service role when you create compute
-- environments.
updateComputeEnvironment_serviceRole :: Lens.Lens' UpdateComputeEnvironment (Prelude.Maybe Prelude.Text)
updateComputeEnvironment_serviceRole :: (Maybe Text -> f (Maybe Text))
-> UpdateComputeEnvironment -> f UpdateComputeEnvironment
updateComputeEnvironment_serviceRole = (UpdateComputeEnvironment -> Maybe Text)
-> (UpdateComputeEnvironment
    -> Maybe Text -> UpdateComputeEnvironment)
-> Lens
     UpdateComputeEnvironment
     UpdateComputeEnvironment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComputeEnvironment' {Maybe Text
serviceRole :: Maybe Text
$sel:serviceRole:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Maybe Text
serviceRole} -> Maybe Text
serviceRole) (\s :: UpdateComputeEnvironment
s@UpdateComputeEnvironment' {} Maybe Text
a -> UpdateComputeEnvironment
s {$sel:serviceRole:UpdateComputeEnvironment' :: Maybe Text
serviceRole = Maybe Text
a} :: UpdateComputeEnvironment)

-- | The name or full Amazon Resource Name (ARN) of the compute environment
-- to update.
updateComputeEnvironment_computeEnvironment :: Lens.Lens' UpdateComputeEnvironment Prelude.Text
updateComputeEnvironment_computeEnvironment :: (Text -> f Text)
-> UpdateComputeEnvironment -> f UpdateComputeEnvironment
updateComputeEnvironment_computeEnvironment = (UpdateComputeEnvironment -> Text)
-> (UpdateComputeEnvironment -> Text -> UpdateComputeEnvironment)
-> Lens UpdateComputeEnvironment UpdateComputeEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComputeEnvironment' {Text
computeEnvironment :: Text
$sel:computeEnvironment:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Text
computeEnvironment} -> Text
computeEnvironment) (\s :: UpdateComputeEnvironment
s@UpdateComputeEnvironment' {} Text
a -> UpdateComputeEnvironment
s {$sel:computeEnvironment:UpdateComputeEnvironment' :: Text
computeEnvironment = Text
a} :: UpdateComputeEnvironment)

instance Core.AWSRequest UpdateComputeEnvironment where
  type
    AWSResponse UpdateComputeEnvironment =
      UpdateComputeEnvironmentResponse
  request :: UpdateComputeEnvironment -> Request UpdateComputeEnvironment
request = Service
-> UpdateComputeEnvironment -> Request UpdateComputeEnvironment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateComputeEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateComputeEnvironment)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateComputeEnvironment))
-> Logger
-> Service
-> Proxy UpdateComputeEnvironment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateComputeEnvironment)))
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 ->
          Maybe Text -> Maybe Text -> Int -> UpdateComputeEnvironmentResponse
UpdateComputeEnvironmentResponse'
            (Maybe Text
 -> Maybe Text -> Int -> UpdateComputeEnvironmentResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> UpdateComputeEnvironmentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"computeEnvironmentName")
            Either
  String (Maybe Text -> Int -> UpdateComputeEnvironmentResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateComputeEnvironmentResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"computeEnvironmentArn")
            Either String (Int -> UpdateComputeEnvironmentResponse)
-> Either String Int
-> Either String UpdateComputeEnvironmentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateComputeEnvironment

instance Prelude.NFData UpdateComputeEnvironment

instance Core.ToHeaders UpdateComputeEnvironment where
  toHeaders :: UpdateComputeEnvironment -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateComputeEnvironment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateComputeEnvironment where
  toJSON :: UpdateComputeEnvironment -> Value
toJSON UpdateComputeEnvironment' {Maybe Text
Maybe CEState
Maybe ComputeResourceUpdate
Text
computeEnvironment :: Text
serviceRole :: Maybe Text
computeResources :: Maybe ComputeResourceUpdate
state :: Maybe CEState
$sel:computeEnvironment:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Text
$sel:serviceRole:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Maybe Text
$sel:computeResources:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Maybe ComputeResourceUpdate
$sel:state:UpdateComputeEnvironment' :: UpdateComputeEnvironment -> Maybe CEState
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"state" Text -> CEState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CEState -> Pair) -> Maybe CEState -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CEState
state,
            (Text
"computeResources" Text -> ComputeResourceUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ComputeResourceUpdate -> Pair)
-> Maybe ComputeResourceUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ComputeResourceUpdate
computeResources,
            (Text
"serviceRole" 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
serviceRole,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"computeEnvironment" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
computeEnvironment)
          ]
      )

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

instance Core.ToQuery UpdateComputeEnvironment where
  toQuery :: UpdateComputeEnvironment -> QueryString
toQuery = QueryString -> UpdateComputeEnvironment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateComputeEnvironmentResponse' smart constructor.
data UpdateComputeEnvironmentResponse = UpdateComputeEnvironmentResponse'
  { -- | The name of the compute environment. Up to 128 letters (uppercase and
    -- lowercase), numbers, hyphens, and underscores are allowed.
    UpdateComputeEnvironmentResponse -> Maybe Text
computeEnvironmentName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the compute environment.
    UpdateComputeEnvironmentResponse -> Maybe Text
computeEnvironmentArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateComputeEnvironmentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateComputeEnvironmentResponse
-> UpdateComputeEnvironmentResponse -> Bool
(UpdateComputeEnvironmentResponse
 -> UpdateComputeEnvironmentResponse -> Bool)
-> (UpdateComputeEnvironmentResponse
    -> UpdateComputeEnvironmentResponse -> Bool)
-> Eq UpdateComputeEnvironmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateComputeEnvironmentResponse
-> UpdateComputeEnvironmentResponse -> Bool
$c/= :: UpdateComputeEnvironmentResponse
-> UpdateComputeEnvironmentResponse -> Bool
== :: UpdateComputeEnvironmentResponse
-> UpdateComputeEnvironmentResponse -> Bool
$c== :: UpdateComputeEnvironmentResponse
-> UpdateComputeEnvironmentResponse -> Bool
Prelude.Eq, ReadPrec [UpdateComputeEnvironmentResponse]
ReadPrec UpdateComputeEnvironmentResponse
Int -> ReadS UpdateComputeEnvironmentResponse
ReadS [UpdateComputeEnvironmentResponse]
(Int -> ReadS UpdateComputeEnvironmentResponse)
-> ReadS [UpdateComputeEnvironmentResponse]
-> ReadPrec UpdateComputeEnvironmentResponse
-> ReadPrec [UpdateComputeEnvironmentResponse]
-> Read UpdateComputeEnvironmentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateComputeEnvironmentResponse]
$creadListPrec :: ReadPrec [UpdateComputeEnvironmentResponse]
readPrec :: ReadPrec UpdateComputeEnvironmentResponse
$creadPrec :: ReadPrec UpdateComputeEnvironmentResponse
readList :: ReadS [UpdateComputeEnvironmentResponse]
$creadList :: ReadS [UpdateComputeEnvironmentResponse]
readsPrec :: Int -> ReadS UpdateComputeEnvironmentResponse
$creadsPrec :: Int -> ReadS UpdateComputeEnvironmentResponse
Prelude.Read, Int -> UpdateComputeEnvironmentResponse -> ShowS
[UpdateComputeEnvironmentResponse] -> ShowS
UpdateComputeEnvironmentResponse -> String
(Int -> UpdateComputeEnvironmentResponse -> ShowS)
-> (UpdateComputeEnvironmentResponse -> String)
-> ([UpdateComputeEnvironmentResponse] -> ShowS)
-> Show UpdateComputeEnvironmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateComputeEnvironmentResponse] -> ShowS
$cshowList :: [UpdateComputeEnvironmentResponse] -> ShowS
show :: UpdateComputeEnvironmentResponse -> String
$cshow :: UpdateComputeEnvironmentResponse -> String
showsPrec :: Int -> UpdateComputeEnvironmentResponse -> ShowS
$cshowsPrec :: Int -> UpdateComputeEnvironmentResponse -> ShowS
Prelude.Show, (forall x.
 UpdateComputeEnvironmentResponse
 -> Rep UpdateComputeEnvironmentResponse x)
-> (forall x.
    Rep UpdateComputeEnvironmentResponse x
    -> UpdateComputeEnvironmentResponse)
-> Generic UpdateComputeEnvironmentResponse
forall x.
Rep UpdateComputeEnvironmentResponse x
-> UpdateComputeEnvironmentResponse
forall x.
UpdateComputeEnvironmentResponse
-> Rep UpdateComputeEnvironmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateComputeEnvironmentResponse x
-> UpdateComputeEnvironmentResponse
$cfrom :: forall x.
UpdateComputeEnvironmentResponse
-> Rep UpdateComputeEnvironmentResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateComputeEnvironmentResponse' 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:
--
-- 'computeEnvironmentName', 'updateComputeEnvironmentResponse_computeEnvironmentName' - The name of the compute environment. Up to 128 letters (uppercase and
-- lowercase), numbers, hyphens, and underscores are allowed.
--
-- 'computeEnvironmentArn', 'updateComputeEnvironmentResponse_computeEnvironmentArn' - The Amazon Resource Name (ARN) of the compute environment.
--
-- 'httpStatus', 'updateComputeEnvironmentResponse_httpStatus' - The response's http status code.
newUpdateComputeEnvironmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateComputeEnvironmentResponse
newUpdateComputeEnvironmentResponse :: Int -> UpdateComputeEnvironmentResponse
newUpdateComputeEnvironmentResponse Int
pHttpStatus_ =
  UpdateComputeEnvironmentResponse' :: Maybe Text -> Maybe Text -> Int -> UpdateComputeEnvironmentResponse
UpdateComputeEnvironmentResponse'
    { $sel:computeEnvironmentName:UpdateComputeEnvironmentResponse' :: Maybe Text
computeEnvironmentName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:computeEnvironmentArn:UpdateComputeEnvironmentResponse' :: Maybe Text
computeEnvironmentArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateComputeEnvironmentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The name of the compute environment. Up to 128 letters (uppercase and
-- lowercase), numbers, hyphens, and underscores are allowed.
updateComputeEnvironmentResponse_computeEnvironmentName :: Lens.Lens' UpdateComputeEnvironmentResponse (Prelude.Maybe Prelude.Text)
updateComputeEnvironmentResponse_computeEnvironmentName :: (Maybe Text -> f (Maybe Text))
-> UpdateComputeEnvironmentResponse
-> f UpdateComputeEnvironmentResponse
updateComputeEnvironmentResponse_computeEnvironmentName = (UpdateComputeEnvironmentResponse -> Maybe Text)
-> (UpdateComputeEnvironmentResponse
    -> Maybe Text -> UpdateComputeEnvironmentResponse)
-> Lens
     UpdateComputeEnvironmentResponse
     UpdateComputeEnvironmentResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComputeEnvironmentResponse' {Maybe Text
computeEnvironmentName :: Maybe Text
$sel:computeEnvironmentName:UpdateComputeEnvironmentResponse' :: UpdateComputeEnvironmentResponse -> Maybe Text
computeEnvironmentName} -> Maybe Text
computeEnvironmentName) (\s :: UpdateComputeEnvironmentResponse
s@UpdateComputeEnvironmentResponse' {} Maybe Text
a -> UpdateComputeEnvironmentResponse
s {$sel:computeEnvironmentName:UpdateComputeEnvironmentResponse' :: Maybe Text
computeEnvironmentName = Maybe Text
a} :: UpdateComputeEnvironmentResponse)

-- | The Amazon Resource Name (ARN) of the compute environment.
updateComputeEnvironmentResponse_computeEnvironmentArn :: Lens.Lens' UpdateComputeEnvironmentResponse (Prelude.Maybe Prelude.Text)
updateComputeEnvironmentResponse_computeEnvironmentArn :: (Maybe Text -> f (Maybe Text))
-> UpdateComputeEnvironmentResponse
-> f UpdateComputeEnvironmentResponse
updateComputeEnvironmentResponse_computeEnvironmentArn = (UpdateComputeEnvironmentResponse -> Maybe Text)
-> (UpdateComputeEnvironmentResponse
    -> Maybe Text -> UpdateComputeEnvironmentResponse)
-> Lens
     UpdateComputeEnvironmentResponse
     UpdateComputeEnvironmentResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateComputeEnvironmentResponse' {Maybe Text
computeEnvironmentArn :: Maybe Text
$sel:computeEnvironmentArn:UpdateComputeEnvironmentResponse' :: UpdateComputeEnvironmentResponse -> Maybe Text
computeEnvironmentArn} -> Maybe Text
computeEnvironmentArn) (\s :: UpdateComputeEnvironmentResponse
s@UpdateComputeEnvironmentResponse' {} Maybe Text
a -> UpdateComputeEnvironmentResponse
s {$sel:computeEnvironmentArn:UpdateComputeEnvironmentResponse' :: Maybe Text
computeEnvironmentArn = Maybe Text
a} :: UpdateComputeEnvironmentResponse)

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

instance
  Prelude.NFData
    UpdateComputeEnvironmentResponse