{-# 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.DirectoryService.Types.UpdateValue
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DirectoryService.Types.UpdateValue where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectoryService.Types.OSUpdateSettings
import qualified Amazonka.Prelude as Prelude

-- | The value for a given type of @UpdateSettings@.
--
-- /See:/ 'newUpdateValue' smart constructor.
data UpdateValue = UpdateValue'
  { -- | The OS update related settings.
    UpdateValue -> Maybe OSUpdateSettings
oSUpdateSettings :: Prelude.Maybe OSUpdateSettings
  }
  deriving (UpdateValue -> UpdateValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateValue -> UpdateValue -> Bool
$c/= :: UpdateValue -> UpdateValue -> Bool
== :: UpdateValue -> UpdateValue -> Bool
$c== :: UpdateValue -> UpdateValue -> Bool
Prelude.Eq, ReadPrec [UpdateValue]
ReadPrec UpdateValue
Int -> ReadS UpdateValue
ReadS [UpdateValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateValue]
$creadListPrec :: ReadPrec [UpdateValue]
readPrec :: ReadPrec UpdateValue
$creadPrec :: ReadPrec UpdateValue
readList :: ReadS [UpdateValue]
$creadList :: ReadS [UpdateValue]
readsPrec :: Int -> ReadS UpdateValue
$creadsPrec :: Int -> ReadS UpdateValue
Prelude.Read, Int -> UpdateValue -> ShowS
[UpdateValue] -> ShowS
UpdateValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateValue] -> ShowS
$cshowList :: [UpdateValue] -> ShowS
show :: UpdateValue -> String
$cshow :: UpdateValue -> String
showsPrec :: Int -> UpdateValue -> ShowS
$cshowsPrec :: Int -> UpdateValue -> ShowS
Prelude.Show, forall x. Rep UpdateValue x -> UpdateValue
forall x. UpdateValue -> Rep UpdateValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateValue x -> UpdateValue
$cfrom :: forall x. UpdateValue -> Rep UpdateValue x
Prelude.Generic)

-- |
-- Create a value of 'UpdateValue' 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:
--
-- 'oSUpdateSettings', 'updateValue_oSUpdateSettings' - The OS update related settings.
newUpdateValue ::
  UpdateValue
newUpdateValue :: UpdateValue
newUpdateValue =
  UpdateValue' {$sel:oSUpdateSettings:UpdateValue' :: Maybe OSUpdateSettings
oSUpdateSettings = forall a. Maybe a
Prelude.Nothing}

-- | The OS update related settings.
updateValue_oSUpdateSettings :: Lens.Lens' UpdateValue (Prelude.Maybe OSUpdateSettings)
updateValue_oSUpdateSettings :: Lens' UpdateValue (Maybe OSUpdateSettings)
updateValue_oSUpdateSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateValue' {Maybe OSUpdateSettings
oSUpdateSettings :: Maybe OSUpdateSettings
$sel:oSUpdateSettings:UpdateValue' :: UpdateValue -> Maybe OSUpdateSettings
oSUpdateSettings} -> Maybe OSUpdateSettings
oSUpdateSettings) (\s :: UpdateValue
s@UpdateValue' {} Maybe OSUpdateSettings
a -> UpdateValue
s {$sel:oSUpdateSettings:UpdateValue' :: Maybe OSUpdateSettings
oSUpdateSettings = Maybe OSUpdateSettings
a} :: UpdateValue)

instance Data.FromJSON UpdateValue where
  parseJSON :: Value -> Parser UpdateValue
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpdateValue"
      ( \Object
x ->
          Maybe OSUpdateSettings -> UpdateValue
UpdateValue'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"OSUpdateSettings")
      )

instance Prelude.Hashable UpdateValue where
  hashWithSalt :: Int -> UpdateValue -> Int
hashWithSalt Int
_salt UpdateValue' {Maybe OSUpdateSettings
oSUpdateSettings :: Maybe OSUpdateSettings
$sel:oSUpdateSettings:UpdateValue' :: UpdateValue -> Maybe OSUpdateSettings
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OSUpdateSettings
oSUpdateSettings

instance Prelude.NFData UpdateValue where
  rnf :: UpdateValue -> ()
rnf UpdateValue' {Maybe OSUpdateSettings
oSUpdateSettings :: Maybe OSUpdateSettings
$sel:oSUpdateSettings:UpdateValue' :: UpdateValue -> Maybe OSUpdateSettings
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe OSUpdateSettings
oSUpdateSettings