{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.UpdateParam
-- 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)
module Amazonka.EKS.Types.UpdateParam where

import qualified Amazonka.Core as Core
import Amazonka.EKS.Types.UpdateParamType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing the details of an update request.
--
-- /See:/ 'newUpdateParam' smart constructor.
data UpdateParam = UpdateParam'
  { -- | The value of the keys submitted as part of an update request.
    UpdateParam -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
    -- | The keys associated with an update request.
    UpdateParam -> Maybe UpdateParamType
type' :: Prelude.Maybe UpdateParamType
  }
  deriving (UpdateParam -> UpdateParam -> Bool
(UpdateParam -> UpdateParam -> Bool)
-> (UpdateParam -> UpdateParam -> Bool) -> Eq UpdateParam
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateParam -> UpdateParam -> Bool
$c/= :: UpdateParam -> UpdateParam -> Bool
== :: UpdateParam -> UpdateParam -> Bool
$c== :: UpdateParam -> UpdateParam -> Bool
Prelude.Eq, ReadPrec [UpdateParam]
ReadPrec UpdateParam
Int -> ReadS UpdateParam
ReadS [UpdateParam]
(Int -> ReadS UpdateParam)
-> ReadS [UpdateParam]
-> ReadPrec UpdateParam
-> ReadPrec [UpdateParam]
-> Read UpdateParam
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateParam]
$creadListPrec :: ReadPrec [UpdateParam]
readPrec :: ReadPrec UpdateParam
$creadPrec :: ReadPrec UpdateParam
readList :: ReadS [UpdateParam]
$creadList :: ReadS [UpdateParam]
readsPrec :: Int -> ReadS UpdateParam
$creadsPrec :: Int -> ReadS UpdateParam
Prelude.Read, Int -> UpdateParam -> ShowS
[UpdateParam] -> ShowS
UpdateParam -> String
(Int -> UpdateParam -> ShowS)
-> (UpdateParam -> String)
-> ([UpdateParam] -> ShowS)
-> Show UpdateParam
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateParam] -> ShowS
$cshowList :: [UpdateParam] -> ShowS
show :: UpdateParam -> String
$cshow :: UpdateParam -> String
showsPrec :: Int -> UpdateParam -> ShowS
$cshowsPrec :: Int -> UpdateParam -> ShowS
Prelude.Show, (forall x. UpdateParam -> Rep UpdateParam x)
-> (forall x. Rep UpdateParam x -> UpdateParam)
-> Generic UpdateParam
forall x. Rep UpdateParam x -> UpdateParam
forall x. UpdateParam -> Rep UpdateParam x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateParam x -> UpdateParam
$cfrom :: forall x. UpdateParam -> Rep UpdateParam x
Prelude.Generic)

-- |
-- Create a value of 'UpdateParam' 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:
--
-- 'value', 'updateParam_value' - The value of the keys submitted as part of an update request.
--
-- 'type'', 'updateParam_type' - The keys associated with an update request.
newUpdateParam ::
  UpdateParam
newUpdateParam :: UpdateParam
newUpdateParam =
  UpdateParam' :: Maybe Text -> Maybe UpdateParamType -> UpdateParam
UpdateParam'
    { $sel:value:UpdateParam' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':UpdateParam' :: Maybe UpdateParamType
type' = Maybe UpdateParamType
forall a. Maybe a
Prelude.Nothing
    }

-- | The value of the keys submitted as part of an update request.
updateParam_value :: Lens.Lens' UpdateParam (Prelude.Maybe Prelude.Text)
updateParam_value :: (Maybe Text -> f (Maybe Text)) -> UpdateParam -> f UpdateParam
updateParam_value = (UpdateParam -> Maybe Text)
-> (UpdateParam -> Maybe Text -> UpdateParam)
-> Lens UpdateParam UpdateParam (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateParam' {Maybe Text
value :: Maybe Text
$sel:value:UpdateParam' :: UpdateParam -> Maybe Text
value} -> Maybe Text
value) (\s :: UpdateParam
s@UpdateParam' {} Maybe Text
a -> UpdateParam
s {$sel:value:UpdateParam' :: Maybe Text
value = Maybe Text
a} :: UpdateParam)

-- | The keys associated with an update request.
updateParam_type :: Lens.Lens' UpdateParam (Prelude.Maybe UpdateParamType)
updateParam_type :: (Maybe UpdateParamType -> f (Maybe UpdateParamType))
-> UpdateParam -> f UpdateParam
updateParam_type = (UpdateParam -> Maybe UpdateParamType)
-> (UpdateParam -> Maybe UpdateParamType -> UpdateParam)
-> Lens
     UpdateParam
     UpdateParam
     (Maybe UpdateParamType)
     (Maybe UpdateParamType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateParam' {Maybe UpdateParamType
type' :: Maybe UpdateParamType
$sel:type':UpdateParam' :: UpdateParam -> Maybe UpdateParamType
type'} -> Maybe UpdateParamType
type') (\s :: UpdateParam
s@UpdateParam' {} Maybe UpdateParamType
a -> UpdateParam
s {$sel:type':UpdateParam' :: Maybe UpdateParamType
type' = Maybe UpdateParamType
a} :: UpdateParam)

instance Core.FromJSON UpdateParam where
  parseJSON :: Value -> Parser UpdateParam
parseJSON =
    String
-> (Object -> Parser UpdateParam) -> Value -> Parser UpdateParam
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UpdateParam"
      ( \Object
x ->
          Maybe Text -> Maybe UpdateParamType -> UpdateParam
UpdateParam'
            (Maybe Text -> Maybe UpdateParamType -> UpdateParam)
-> Parser (Maybe Text)
-> Parser (Maybe UpdateParamType -> UpdateParam)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"value") Parser (Maybe UpdateParamType -> UpdateParam)
-> Parser (Maybe UpdateParamType) -> Parser UpdateParam
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UpdateParamType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
      )

instance Prelude.Hashable UpdateParam

instance Prelude.NFData UpdateParam