{-# 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.OSUpdateSettings
-- 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.OSUpdateSettings 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.OSVersion
import qualified Amazonka.Prelude as Prelude

-- | OS version that the directory needs to be updated to.
--
-- /See:/ 'newOSUpdateSettings' smart constructor.
data OSUpdateSettings = OSUpdateSettings'
  { -- | OS version that the directory needs to be updated to.
    OSUpdateSettings -> Maybe OSVersion
oSVersion :: Prelude.Maybe OSVersion
  }
  deriving (OSUpdateSettings -> OSUpdateSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OSUpdateSettings -> OSUpdateSettings -> Bool
$c/= :: OSUpdateSettings -> OSUpdateSettings -> Bool
== :: OSUpdateSettings -> OSUpdateSettings -> Bool
$c== :: OSUpdateSettings -> OSUpdateSettings -> Bool
Prelude.Eq, ReadPrec [OSUpdateSettings]
ReadPrec OSUpdateSettings
Int -> ReadS OSUpdateSettings
ReadS [OSUpdateSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OSUpdateSettings]
$creadListPrec :: ReadPrec [OSUpdateSettings]
readPrec :: ReadPrec OSUpdateSettings
$creadPrec :: ReadPrec OSUpdateSettings
readList :: ReadS [OSUpdateSettings]
$creadList :: ReadS [OSUpdateSettings]
readsPrec :: Int -> ReadS OSUpdateSettings
$creadsPrec :: Int -> ReadS OSUpdateSettings
Prelude.Read, Int -> OSUpdateSettings -> ShowS
[OSUpdateSettings] -> ShowS
OSUpdateSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OSUpdateSettings] -> ShowS
$cshowList :: [OSUpdateSettings] -> ShowS
show :: OSUpdateSettings -> String
$cshow :: OSUpdateSettings -> String
showsPrec :: Int -> OSUpdateSettings -> ShowS
$cshowsPrec :: Int -> OSUpdateSettings -> ShowS
Prelude.Show, forall x. Rep OSUpdateSettings x -> OSUpdateSettings
forall x. OSUpdateSettings -> Rep OSUpdateSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OSUpdateSettings x -> OSUpdateSettings
$cfrom :: forall x. OSUpdateSettings -> Rep OSUpdateSettings x
Prelude.Generic)

-- |
-- Create a value of 'OSUpdateSettings' 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:
--
-- 'oSVersion', 'oSUpdateSettings_oSVersion' - OS version that the directory needs to be updated to.
newOSUpdateSettings ::
  OSUpdateSettings
newOSUpdateSettings :: OSUpdateSettings
newOSUpdateSettings =
  OSUpdateSettings' {$sel:oSVersion:OSUpdateSettings' :: Maybe OSVersion
oSVersion = forall a. Maybe a
Prelude.Nothing}

-- | OS version that the directory needs to be updated to.
oSUpdateSettings_oSVersion :: Lens.Lens' OSUpdateSettings (Prelude.Maybe OSVersion)
oSUpdateSettings_oSVersion :: Lens' OSUpdateSettings (Maybe OSVersion)
oSUpdateSettings_oSVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OSUpdateSettings' {Maybe OSVersion
oSVersion :: Maybe OSVersion
$sel:oSVersion:OSUpdateSettings' :: OSUpdateSettings -> Maybe OSVersion
oSVersion} -> Maybe OSVersion
oSVersion) (\s :: OSUpdateSettings
s@OSUpdateSettings' {} Maybe OSVersion
a -> OSUpdateSettings
s {$sel:oSVersion:OSUpdateSettings' :: Maybe OSVersion
oSVersion = Maybe OSVersion
a} :: OSUpdateSettings)

instance Data.FromJSON OSUpdateSettings where
  parseJSON :: Value -> Parser OSUpdateSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OSUpdateSettings"
      ( \Object
x ->
          Maybe OSVersion -> OSUpdateSettings
OSUpdateSettings'
            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
"OSVersion")
      )

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

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

instance Data.ToJSON OSUpdateSettings where
  toJSON :: OSUpdateSettings -> Value
toJSON OSUpdateSettings' {Maybe OSVersion
oSVersion :: Maybe OSVersion
$sel:oSVersion:OSUpdateSettings' :: OSUpdateSettings -> Maybe OSVersion
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"OSVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OSVersion
oSVersion]
      )