{-# 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.EKS.UpdateNodegroupConfig
-- 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 Amazon EKS managed node group configuration. Your node group
-- continues to function during the update. The response output includes an
-- update ID that you can use to track the status of your node group update
-- with the DescribeUpdate API operation. Currently you can update the
-- Kubernetes labels for a node group or the scaling configuration.
module Amazonka.EKS.UpdateNodegroupConfig
  ( -- * Creating a Request
    UpdateNodegroupConfig (..),
    newUpdateNodegroupConfig,

    -- * Request Lenses
    updateNodegroupConfig_taints,
    updateNodegroupConfig_scalingConfig,
    updateNodegroupConfig_labels,
    updateNodegroupConfig_clientRequestToken,
    updateNodegroupConfig_updateConfig,
    updateNodegroupConfig_clusterName,
    updateNodegroupConfig_nodegroupName,

    -- * Destructuring the Response
    UpdateNodegroupConfigResponse (..),
    newUpdateNodegroupConfigResponse,

    -- * Response Lenses
    updateNodegroupConfigResponse_update,
    updateNodegroupConfigResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EKS.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

-- | /See:/ 'newUpdateNodegroupConfig' smart constructor.
data UpdateNodegroupConfig = UpdateNodegroupConfig'
  { -- | The Kubernetes taints to be applied to the nodes in the node group after
    -- the update.
    UpdateNodegroupConfig -> Maybe UpdateTaintsPayload
taints :: Prelude.Maybe UpdateTaintsPayload,
    -- | The scaling configuration details for the Auto Scaling group after the
    -- update.
    UpdateNodegroupConfig -> Maybe NodegroupScalingConfig
scalingConfig :: Prelude.Maybe NodegroupScalingConfig,
    -- | The Kubernetes labels to be applied to the nodes in the node group after
    -- the update.
    UpdateNodegroupConfig -> Maybe UpdateLabelsPayload
labels :: Prelude.Maybe UpdateLabelsPayload,
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    UpdateNodegroupConfig -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The node group update configuration.
    UpdateNodegroupConfig -> Maybe NodegroupUpdateConfig
updateConfig :: Prelude.Maybe NodegroupUpdateConfig,
    -- | The name of the Amazon EKS cluster that the managed node group resides
    -- in.
    UpdateNodegroupConfig -> Text
clusterName :: Prelude.Text,
    -- | The name of the managed node group to update.
    UpdateNodegroupConfig -> Text
nodegroupName :: Prelude.Text
  }
  deriving (UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool
(UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool)
-> (UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool)
-> Eq UpdateNodegroupConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool
$c/= :: UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool
== :: UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool
$c== :: UpdateNodegroupConfig -> UpdateNodegroupConfig -> Bool
Prelude.Eq, ReadPrec [UpdateNodegroupConfig]
ReadPrec UpdateNodegroupConfig
Int -> ReadS UpdateNodegroupConfig
ReadS [UpdateNodegroupConfig]
(Int -> ReadS UpdateNodegroupConfig)
-> ReadS [UpdateNodegroupConfig]
-> ReadPrec UpdateNodegroupConfig
-> ReadPrec [UpdateNodegroupConfig]
-> Read UpdateNodegroupConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNodegroupConfig]
$creadListPrec :: ReadPrec [UpdateNodegroupConfig]
readPrec :: ReadPrec UpdateNodegroupConfig
$creadPrec :: ReadPrec UpdateNodegroupConfig
readList :: ReadS [UpdateNodegroupConfig]
$creadList :: ReadS [UpdateNodegroupConfig]
readsPrec :: Int -> ReadS UpdateNodegroupConfig
$creadsPrec :: Int -> ReadS UpdateNodegroupConfig
Prelude.Read, Int -> UpdateNodegroupConfig -> ShowS
[UpdateNodegroupConfig] -> ShowS
UpdateNodegroupConfig -> String
(Int -> UpdateNodegroupConfig -> ShowS)
-> (UpdateNodegroupConfig -> String)
-> ([UpdateNodegroupConfig] -> ShowS)
-> Show UpdateNodegroupConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNodegroupConfig] -> ShowS
$cshowList :: [UpdateNodegroupConfig] -> ShowS
show :: UpdateNodegroupConfig -> String
$cshow :: UpdateNodegroupConfig -> String
showsPrec :: Int -> UpdateNodegroupConfig -> ShowS
$cshowsPrec :: Int -> UpdateNodegroupConfig -> ShowS
Prelude.Show, (forall x. UpdateNodegroupConfig -> Rep UpdateNodegroupConfig x)
-> (forall x. Rep UpdateNodegroupConfig x -> UpdateNodegroupConfig)
-> Generic UpdateNodegroupConfig
forall x. Rep UpdateNodegroupConfig x -> UpdateNodegroupConfig
forall x. UpdateNodegroupConfig -> Rep UpdateNodegroupConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateNodegroupConfig x -> UpdateNodegroupConfig
$cfrom :: forall x. UpdateNodegroupConfig -> Rep UpdateNodegroupConfig x
Prelude.Generic)

-- |
-- Create a value of 'UpdateNodegroupConfig' 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:
--
-- 'taints', 'updateNodegroupConfig_taints' - The Kubernetes taints to be applied to the nodes in the node group after
-- the update.
--
-- 'scalingConfig', 'updateNodegroupConfig_scalingConfig' - The scaling configuration details for the Auto Scaling group after the
-- update.
--
-- 'labels', 'updateNodegroupConfig_labels' - The Kubernetes labels to be applied to the nodes in the node group after
-- the update.
--
-- 'clientRequestToken', 'updateNodegroupConfig_clientRequestToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'updateConfig', 'updateNodegroupConfig_updateConfig' - The node group update configuration.
--
-- 'clusterName', 'updateNodegroupConfig_clusterName' - The name of the Amazon EKS cluster that the managed node group resides
-- in.
--
-- 'nodegroupName', 'updateNodegroupConfig_nodegroupName' - The name of the managed node group to update.
newUpdateNodegroupConfig ::
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'nodegroupName'
  Prelude.Text ->
  UpdateNodegroupConfig
newUpdateNodegroupConfig :: Text -> Text -> UpdateNodegroupConfig
newUpdateNodegroupConfig
  Text
pClusterName_
  Text
pNodegroupName_ =
    UpdateNodegroupConfig' :: Maybe UpdateTaintsPayload
-> Maybe NodegroupScalingConfig
-> Maybe UpdateLabelsPayload
-> Maybe Text
-> Maybe NodegroupUpdateConfig
-> Text
-> Text
-> UpdateNodegroupConfig
UpdateNodegroupConfig'
      { $sel:taints:UpdateNodegroupConfig' :: Maybe UpdateTaintsPayload
taints = Maybe UpdateTaintsPayload
forall a. Maybe a
Prelude.Nothing,
        $sel:scalingConfig:UpdateNodegroupConfig' :: Maybe NodegroupScalingConfig
scalingConfig = Maybe NodegroupScalingConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:labels:UpdateNodegroupConfig' :: Maybe UpdateLabelsPayload
labels = Maybe UpdateLabelsPayload
forall a. Maybe a
Prelude.Nothing,
        $sel:clientRequestToken:UpdateNodegroupConfig' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:updateConfig:UpdateNodegroupConfig' :: Maybe NodegroupUpdateConfig
updateConfig = Maybe NodegroupUpdateConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:clusterName:UpdateNodegroupConfig' :: Text
clusterName = Text
pClusterName_,
        $sel:nodegroupName:UpdateNodegroupConfig' :: Text
nodegroupName = Text
pNodegroupName_
      }

-- | The Kubernetes taints to be applied to the nodes in the node group after
-- the update.
updateNodegroupConfig_taints :: Lens.Lens' UpdateNodegroupConfig (Prelude.Maybe UpdateTaintsPayload)
updateNodegroupConfig_taints :: (Maybe UpdateTaintsPayload -> f (Maybe UpdateTaintsPayload))
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_taints = (UpdateNodegroupConfig -> Maybe UpdateTaintsPayload)
-> (UpdateNodegroupConfig
    -> Maybe UpdateTaintsPayload -> UpdateNodegroupConfig)
-> Lens
     UpdateNodegroupConfig
     UpdateNodegroupConfig
     (Maybe UpdateTaintsPayload)
     (Maybe UpdateTaintsPayload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Maybe UpdateTaintsPayload
taints :: Maybe UpdateTaintsPayload
$sel:taints:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe UpdateTaintsPayload
taints} -> Maybe UpdateTaintsPayload
taints) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Maybe UpdateTaintsPayload
a -> UpdateNodegroupConfig
s {$sel:taints:UpdateNodegroupConfig' :: Maybe UpdateTaintsPayload
taints = Maybe UpdateTaintsPayload
a} :: UpdateNodegroupConfig)

-- | The scaling configuration details for the Auto Scaling group after the
-- update.
updateNodegroupConfig_scalingConfig :: Lens.Lens' UpdateNodegroupConfig (Prelude.Maybe NodegroupScalingConfig)
updateNodegroupConfig_scalingConfig :: (Maybe NodegroupScalingConfig -> f (Maybe NodegroupScalingConfig))
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_scalingConfig = (UpdateNodegroupConfig -> Maybe NodegroupScalingConfig)
-> (UpdateNodegroupConfig
    -> Maybe NodegroupScalingConfig -> UpdateNodegroupConfig)
-> Lens
     UpdateNodegroupConfig
     UpdateNodegroupConfig
     (Maybe NodegroupScalingConfig)
     (Maybe NodegroupScalingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Maybe NodegroupScalingConfig
scalingConfig :: Maybe NodegroupScalingConfig
$sel:scalingConfig:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe NodegroupScalingConfig
scalingConfig} -> Maybe NodegroupScalingConfig
scalingConfig) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Maybe NodegroupScalingConfig
a -> UpdateNodegroupConfig
s {$sel:scalingConfig:UpdateNodegroupConfig' :: Maybe NodegroupScalingConfig
scalingConfig = Maybe NodegroupScalingConfig
a} :: UpdateNodegroupConfig)

-- | The Kubernetes labels to be applied to the nodes in the node group after
-- the update.
updateNodegroupConfig_labels :: Lens.Lens' UpdateNodegroupConfig (Prelude.Maybe UpdateLabelsPayload)
updateNodegroupConfig_labels :: (Maybe UpdateLabelsPayload -> f (Maybe UpdateLabelsPayload))
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_labels = (UpdateNodegroupConfig -> Maybe UpdateLabelsPayload)
-> (UpdateNodegroupConfig
    -> Maybe UpdateLabelsPayload -> UpdateNodegroupConfig)
-> Lens
     UpdateNodegroupConfig
     UpdateNodegroupConfig
     (Maybe UpdateLabelsPayload)
     (Maybe UpdateLabelsPayload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Maybe UpdateLabelsPayload
labels :: Maybe UpdateLabelsPayload
$sel:labels:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe UpdateLabelsPayload
labels} -> Maybe UpdateLabelsPayload
labels) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Maybe UpdateLabelsPayload
a -> UpdateNodegroupConfig
s {$sel:labels:UpdateNodegroupConfig' :: Maybe UpdateLabelsPayload
labels = Maybe UpdateLabelsPayload
a} :: UpdateNodegroupConfig)

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
updateNodegroupConfig_clientRequestToken :: Lens.Lens' UpdateNodegroupConfig (Prelude.Maybe Prelude.Text)
updateNodegroupConfig_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_clientRequestToken = (UpdateNodegroupConfig -> Maybe Text)
-> (UpdateNodegroupConfig -> Maybe Text -> UpdateNodegroupConfig)
-> Lens
     UpdateNodegroupConfig
     UpdateNodegroupConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Maybe Text
a -> UpdateNodegroupConfig
s {$sel:clientRequestToken:UpdateNodegroupConfig' :: Maybe Text
clientRequestToken = Maybe Text
a} :: UpdateNodegroupConfig)

-- | The node group update configuration.
updateNodegroupConfig_updateConfig :: Lens.Lens' UpdateNodegroupConfig (Prelude.Maybe NodegroupUpdateConfig)
updateNodegroupConfig_updateConfig :: (Maybe NodegroupUpdateConfig -> f (Maybe NodegroupUpdateConfig))
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_updateConfig = (UpdateNodegroupConfig -> Maybe NodegroupUpdateConfig)
-> (UpdateNodegroupConfig
    -> Maybe NodegroupUpdateConfig -> UpdateNodegroupConfig)
-> Lens
     UpdateNodegroupConfig
     UpdateNodegroupConfig
     (Maybe NodegroupUpdateConfig)
     (Maybe NodegroupUpdateConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Maybe NodegroupUpdateConfig
updateConfig :: Maybe NodegroupUpdateConfig
$sel:updateConfig:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe NodegroupUpdateConfig
updateConfig} -> Maybe NodegroupUpdateConfig
updateConfig) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Maybe NodegroupUpdateConfig
a -> UpdateNodegroupConfig
s {$sel:updateConfig:UpdateNodegroupConfig' :: Maybe NodegroupUpdateConfig
updateConfig = Maybe NodegroupUpdateConfig
a} :: UpdateNodegroupConfig)

-- | The name of the Amazon EKS cluster that the managed node group resides
-- in.
updateNodegroupConfig_clusterName :: Lens.Lens' UpdateNodegroupConfig Prelude.Text
updateNodegroupConfig_clusterName :: (Text -> f Text)
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_clusterName = (UpdateNodegroupConfig -> Text)
-> (UpdateNodegroupConfig -> Text -> UpdateNodegroupConfig)
-> Lens UpdateNodegroupConfig UpdateNodegroupConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Text
clusterName :: Text
$sel:clusterName:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Text
clusterName} -> Text
clusterName) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Text
a -> UpdateNodegroupConfig
s {$sel:clusterName:UpdateNodegroupConfig' :: Text
clusterName = Text
a} :: UpdateNodegroupConfig)

-- | The name of the managed node group to update.
updateNodegroupConfig_nodegroupName :: Lens.Lens' UpdateNodegroupConfig Prelude.Text
updateNodegroupConfig_nodegroupName :: (Text -> f Text)
-> UpdateNodegroupConfig -> f UpdateNodegroupConfig
updateNodegroupConfig_nodegroupName = (UpdateNodegroupConfig -> Text)
-> (UpdateNodegroupConfig -> Text -> UpdateNodegroupConfig)
-> Lens UpdateNodegroupConfig UpdateNodegroupConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfig' {Text
nodegroupName :: Text
$sel:nodegroupName:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Text
nodegroupName} -> Text
nodegroupName) (\s :: UpdateNodegroupConfig
s@UpdateNodegroupConfig' {} Text
a -> UpdateNodegroupConfig
s {$sel:nodegroupName:UpdateNodegroupConfig' :: Text
nodegroupName = Text
a} :: UpdateNodegroupConfig)

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

instance Prelude.NFData UpdateNodegroupConfig

instance Core.ToHeaders UpdateNodegroupConfig where
  toHeaders :: UpdateNodegroupConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateNodegroupConfig -> 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 UpdateNodegroupConfig where
  toJSON :: UpdateNodegroupConfig -> Value
toJSON UpdateNodegroupConfig' {Maybe Text
Maybe NodegroupScalingConfig
Maybe NodegroupUpdateConfig
Maybe UpdateLabelsPayload
Maybe UpdateTaintsPayload
Text
nodegroupName :: Text
clusterName :: Text
updateConfig :: Maybe NodegroupUpdateConfig
clientRequestToken :: Maybe Text
labels :: Maybe UpdateLabelsPayload
scalingConfig :: Maybe NodegroupScalingConfig
taints :: Maybe UpdateTaintsPayload
$sel:nodegroupName:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Text
$sel:clusterName:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Text
$sel:updateConfig:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe NodegroupUpdateConfig
$sel:clientRequestToken:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe Text
$sel:labels:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe UpdateLabelsPayload
$sel:scalingConfig:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe NodegroupScalingConfig
$sel:taints:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe UpdateTaintsPayload
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"taints" Text -> UpdateTaintsPayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (UpdateTaintsPayload -> Pair)
-> Maybe UpdateTaintsPayload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateTaintsPayload
taints,
            (Text
"scalingConfig" Text -> NodegroupScalingConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NodegroupScalingConfig -> Pair)
-> Maybe NodegroupScalingConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NodegroupScalingConfig
scalingConfig,
            (Text
"labels" Text -> UpdateLabelsPayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (UpdateLabelsPayload -> Pair)
-> Maybe UpdateLabelsPayload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateLabelsPayload
labels,
            (Text
"clientRequestToken" 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
clientRequestToken,
            (Text
"updateConfig" Text -> NodegroupUpdateConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NodegroupUpdateConfig -> Pair)
-> Maybe NodegroupUpdateConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NodegroupUpdateConfig
updateConfig
          ]
      )

instance Core.ToPath UpdateNodegroupConfig where
  toPath :: UpdateNodegroupConfig -> ByteString
toPath UpdateNodegroupConfig' {Maybe Text
Maybe NodegroupScalingConfig
Maybe NodegroupUpdateConfig
Maybe UpdateLabelsPayload
Maybe UpdateTaintsPayload
Text
nodegroupName :: Text
clusterName :: Text
updateConfig :: Maybe NodegroupUpdateConfig
clientRequestToken :: Maybe Text
labels :: Maybe UpdateLabelsPayload
scalingConfig :: Maybe NodegroupScalingConfig
taints :: Maybe UpdateTaintsPayload
$sel:nodegroupName:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Text
$sel:clusterName:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Text
$sel:updateConfig:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe NodegroupUpdateConfig
$sel:clientRequestToken:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe Text
$sel:labels:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe UpdateLabelsPayload
$sel:scalingConfig:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe NodegroupScalingConfig
$sel:taints:UpdateNodegroupConfig' :: UpdateNodegroupConfig -> Maybe UpdateTaintsPayload
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/clusters/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
clusterName,
        ByteString
"/node-groups/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
nodegroupName,
        ByteString
"/update-config"
      ]

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

-- | /See:/ 'newUpdateNodegroupConfigResponse' smart constructor.
data UpdateNodegroupConfigResponse = UpdateNodegroupConfigResponse'
  { UpdateNodegroupConfigResponse -> Maybe Update
update :: Prelude.Maybe Update,
    -- | The response's http status code.
    UpdateNodegroupConfigResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateNodegroupConfigResponse
-> UpdateNodegroupConfigResponse -> Bool
(UpdateNodegroupConfigResponse
 -> UpdateNodegroupConfigResponse -> Bool)
-> (UpdateNodegroupConfigResponse
    -> UpdateNodegroupConfigResponse -> Bool)
-> Eq UpdateNodegroupConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateNodegroupConfigResponse
-> UpdateNodegroupConfigResponse -> Bool
$c/= :: UpdateNodegroupConfigResponse
-> UpdateNodegroupConfigResponse -> Bool
== :: UpdateNodegroupConfigResponse
-> UpdateNodegroupConfigResponse -> Bool
$c== :: UpdateNodegroupConfigResponse
-> UpdateNodegroupConfigResponse -> Bool
Prelude.Eq, ReadPrec [UpdateNodegroupConfigResponse]
ReadPrec UpdateNodegroupConfigResponse
Int -> ReadS UpdateNodegroupConfigResponse
ReadS [UpdateNodegroupConfigResponse]
(Int -> ReadS UpdateNodegroupConfigResponse)
-> ReadS [UpdateNodegroupConfigResponse]
-> ReadPrec UpdateNodegroupConfigResponse
-> ReadPrec [UpdateNodegroupConfigResponse]
-> Read UpdateNodegroupConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateNodegroupConfigResponse]
$creadListPrec :: ReadPrec [UpdateNodegroupConfigResponse]
readPrec :: ReadPrec UpdateNodegroupConfigResponse
$creadPrec :: ReadPrec UpdateNodegroupConfigResponse
readList :: ReadS [UpdateNodegroupConfigResponse]
$creadList :: ReadS [UpdateNodegroupConfigResponse]
readsPrec :: Int -> ReadS UpdateNodegroupConfigResponse
$creadsPrec :: Int -> ReadS UpdateNodegroupConfigResponse
Prelude.Read, Int -> UpdateNodegroupConfigResponse -> ShowS
[UpdateNodegroupConfigResponse] -> ShowS
UpdateNodegroupConfigResponse -> String
(Int -> UpdateNodegroupConfigResponse -> ShowS)
-> (UpdateNodegroupConfigResponse -> String)
-> ([UpdateNodegroupConfigResponse] -> ShowS)
-> Show UpdateNodegroupConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateNodegroupConfigResponse] -> ShowS
$cshowList :: [UpdateNodegroupConfigResponse] -> ShowS
show :: UpdateNodegroupConfigResponse -> String
$cshow :: UpdateNodegroupConfigResponse -> String
showsPrec :: Int -> UpdateNodegroupConfigResponse -> ShowS
$cshowsPrec :: Int -> UpdateNodegroupConfigResponse -> ShowS
Prelude.Show, (forall x.
 UpdateNodegroupConfigResponse
 -> Rep UpdateNodegroupConfigResponse x)
-> (forall x.
    Rep UpdateNodegroupConfigResponse x
    -> UpdateNodegroupConfigResponse)
-> Generic UpdateNodegroupConfigResponse
forall x.
Rep UpdateNodegroupConfigResponse x
-> UpdateNodegroupConfigResponse
forall x.
UpdateNodegroupConfigResponse
-> Rep UpdateNodegroupConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateNodegroupConfigResponse x
-> UpdateNodegroupConfigResponse
$cfrom :: forall x.
UpdateNodegroupConfigResponse
-> Rep UpdateNodegroupConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateNodegroupConfigResponse' 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:
--
-- 'update', 'updateNodegroupConfigResponse_update' - Undocumented member.
--
-- 'httpStatus', 'updateNodegroupConfigResponse_httpStatus' - The response's http status code.
newUpdateNodegroupConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateNodegroupConfigResponse
newUpdateNodegroupConfigResponse :: Int -> UpdateNodegroupConfigResponse
newUpdateNodegroupConfigResponse Int
pHttpStatus_ =
  UpdateNodegroupConfigResponse' :: Maybe Update -> Int -> UpdateNodegroupConfigResponse
UpdateNodegroupConfigResponse'
    { $sel:update:UpdateNodegroupConfigResponse' :: Maybe Update
update =
        Maybe Update
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateNodegroupConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
updateNodegroupConfigResponse_update :: Lens.Lens' UpdateNodegroupConfigResponse (Prelude.Maybe Update)
updateNodegroupConfigResponse_update :: (Maybe Update -> f (Maybe Update))
-> UpdateNodegroupConfigResponse -> f UpdateNodegroupConfigResponse
updateNodegroupConfigResponse_update = (UpdateNodegroupConfigResponse -> Maybe Update)
-> (UpdateNodegroupConfigResponse
    -> Maybe Update -> UpdateNodegroupConfigResponse)
-> Lens
     UpdateNodegroupConfigResponse
     UpdateNodegroupConfigResponse
     (Maybe Update)
     (Maybe Update)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateNodegroupConfigResponse' {Maybe Update
update :: Maybe Update
$sel:update:UpdateNodegroupConfigResponse' :: UpdateNodegroupConfigResponse -> Maybe Update
update} -> Maybe Update
update) (\s :: UpdateNodegroupConfigResponse
s@UpdateNodegroupConfigResponse' {} Maybe Update
a -> UpdateNodegroupConfigResponse
s {$sel:update:UpdateNodegroupConfigResponse' :: Maybe Update
update = Maybe Update
a} :: UpdateNodegroupConfigResponse)

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

instance Prelude.NFData UpdateNodegroupConfigResponse