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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | Indicates whether updated drivers or other components are available for
    -- the specified WorkSpace image.
    UpdateResult -> Maybe Bool
updateAvailable :: Prelude.Maybe Prelude.Bool,
    -- | A description of whether updates for the WorkSpace image are pending or
    -- available.
    UpdateResult -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateResult -> UpdateResult -> Bool
(UpdateResult -> UpdateResult -> Bool)
-> (UpdateResult -> UpdateResult -> Bool) -> Eq UpdateResult
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]
(Int -> ReadS UpdateResult)
-> ReadS [UpdateResult]
-> ReadPrec UpdateResult
-> ReadPrec [UpdateResult]
-> Read 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
(Int -> UpdateResult -> ShowS)
-> (UpdateResult -> String)
-> ([UpdateResult] -> ShowS)
-> Show UpdateResult
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. UpdateResult -> Rep UpdateResult x)
-> (forall x. Rep UpdateResult x -> UpdateResult)
-> Generic UpdateResult
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:
--
-- 'updateAvailable', 'updateResult_updateAvailable' - Indicates whether updated drivers or other components are available for
-- the specified WorkSpace image.
--
-- 'description', 'updateResult_description' - A description of whether updates for the WorkSpace image are pending or
-- available.
newUpdateResult ::
  UpdateResult
newUpdateResult :: UpdateResult
newUpdateResult =
  UpdateResult' :: Maybe Bool -> Maybe Text -> UpdateResult
UpdateResult'
    { $sel:updateAvailable:UpdateResult' :: Maybe Bool
updateAvailable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateResult' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Bool -> f (Maybe Bool)) -> UpdateResult -> f UpdateResult
updateResult_updateAvailable = (UpdateResult -> Maybe Bool)
-> (UpdateResult -> Maybe Bool -> UpdateResult)
-> Lens UpdateResult UpdateResult (Maybe Bool) (Maybe Bool)
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)

-- | A description of whether updates for the WorkSpace image are pending or
-- available.
updateResult_description :: Lens.Lens' UpdateResult (Prelude.Maybe Prelude.Text)
updateResult_description :: (Maybe Text -> f (Maybe Text)) -> UpdateResult -> f UpdateResult
updateResult_description = (UpdateResult -> Maybe Text)
-> (UpdateResult -> Maybe Text -> UpdateResult)
-> Lens UpdateResult UpdateResult (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable UpdateResult

instance Prelude.NFData UpdateResult