{-# 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.WorkSpaces.Types.UpdateResult
-- 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.WorkSpaces.Types.UpdateResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Describes whether a WorkSpace image needs to be updated with the latest
-- drivers and other components required by Amazon WorkSpaces.
--
-- Only Windows 10 WorkSpace images can be programmatically updated at this
-- time.
--
-- /See:/ 'newUpdateResult' smart constructor.
data UpdateResult = UpdateResult'
  { -- | A description of whether updates for the WorkSpace image are pending or
    -- available.
    UpdateResult -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether updated drivers or other components are available for
    -- the specified WorkSpace image.
    UpdateResult -> Maybe Bool
updateAvailable :: Prelude.Maybe Prelude.Bool
  }
  deriving (UpdateResult -> UpdateResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResult -> UpdateResult -> Bool
$c/= :: UpdateResult -> UpdateResult -> Bool
== :: UpdateResult -> UpdateResult -> Bool
$c== :: UpdateResult -> UpdateResult -> Bool
Prelude.Eq, ReadPrec [UpdateResult]
ReadPrec UpdateResult
Int -> ReadS UpdateResult
ReadS [UpdateResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResult]
$creadListPrec :: ReadPrec [UpdateResult]
readPrec :: ReadPrec UpdateResult
$creadPrec :: ReadPrec UpdateResult
readList :: ReadS [UpdateResult]
$creadList :: ReadS [UpdateResult]
readsPrec :: Int -> ReadS UpdateResult
$creadsPrec :: Int -> ReadS UpdateResult
Prelude.Read, Int -> UpdateResult -> ShowS
[UpdateResult] -> ShowS
UpdateResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResult] -> ShowS
$cshowList :: [UpdateResult] -> ShowS
show :: UpdateResult -> String
$cshow :: UpdateResult -> String
showsPrec :: Int -> UpdateResult -> ShowS
$cshowsPrec :: Int -> UpdateResult -> ShowS
Prelude.Show, forall x. Rep UpdateResult x -> UpdateResult
forall x. UpdateResult -> Rep UpdateResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResult x -> UpdateResult
$cfrom :: forall x. UpdateResult -> Rep UpdateResult x
Prelude.Generic)

-- |
-- Create a value of 'UpdateResult' 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:
--
-- 'description', 'updateResult_description' - A description of whether updates for the WorkSpace image are pending or
-- available.
--
-- 'updateAvailable', 'updateResult_updateAvailable' - Indicates whether updated drivers or other components are available for
-- the specified WorkSpace image.
newUpdateResult ::
  UpdateResult
newUpdateResult :: UpdateResult
newUpdateResult =
  UpdateResult'
    { $sel:description:UpdateResult' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:updateAvailable:UpdateResult' :: Maybe Bool
updateAvailable = forall a. Maybe a
Prelude.Nothing
    }

-- | A description of whether updates for the WorkSpace image are pending or
-- available.
updateResult_description :: Lens.Lens' UpdateResult (Prelude.Maybe Prelude.Text)
updateResult_description :: Lens' UpdateResult (Maybe Text)
updateResult_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResult' {Maybe Text
description :: Maybe Text
$sel:description:UpdateResult' :: UpdateResult -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateResult
s@UpdateResult' {} Maybe Text
a -> UpdateResult
s {$sel:description:UpdateResult' :: Maybe Text
description = Maybe Text
a} :: UpdateResult)

-- | Indicates whether updated drivers or other components are available for
-- the specified WorkSpace image.
updateResult_updateAvailable :: Lens.Lens' UpdateResult (Prelude.Maybe Prelude.Bool)
updateResult_updateAvailable :: Lens' UpdateResult (Maybe Bool)
updateResult_updateAvailable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResult' {Maybe Bool
updateAvailable :: Maybe Bool
$sel:updateAvailable:UpdateResult' :: UpdateResult -> Maybe Bool
updateAvailable} -> Maybe Bool
updateAvailable) (\s :: UpdateResult
s@UpdateResult' {} Maybe Bool
a -> UpdateResult
s {$sel:updateAvailable:UpdateResult' :: Maybe Bool
updateAvailable = Maybe Bool
a} :: UpdateResult)

instance Data.FromJSON UpdateResult where
  parseJSON :: Value -> Parser UpdateResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpdateResult"
      ( \Object
x ->
          Maybe Text -> Maybe Bool -> UpdateResult
UpdateResult'
            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
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UpdateAvailable")
      )

instance Prelude.Hashable UpdateResult where
  hashWithSalt :: Int -> UpdateResult -> Int
hashWithSalt Int
_salt UpdateResult' {Maybe Bool
Maybe Text
updateAvailable :: Maybe Bool
description :: Maybe Text
$sel:updateAvailable:UpdateResult' :: UpdateResult -> Maybe Bool
$sel:description:UpdateResult' :: UpdateResult -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
updateAvailable

instance Prelude.NFData UpdateResult where
  rnf :: UpdateResult -> ()
rnf UpdateResult' {Maybe Bool
Maybe Text
updateAvailable :: Maybe Bool
description :: Maybe Text
$sel:updateAvailable:UpdateResult' :: UpdateResult -> Maybe Bool
$sel:description:UpdateResult' :: UpdateResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
updateAvailable