{-# 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.ClientProperties
-- 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.ClientProperties 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
import Amazonka.WorkSpaces.Types.LogUploadEnum
import Amazonka.WorkSpaces.Types.ReconnectEnum

-- | Describes an Amazon WorkSpaces client.
--
-- /See:/ 'newClientProperties' smart constructor.
data ClientProperties = ClientProperties'
  { -- | Specifies whether users can upload diagnostic log files of Amazon
    -- WorkSpaces client directly to WorkSpaces to troubleshoot issues when
    -- using the WorkSpaces client. When enabled, the log files will be sent to
    -- WorkSpaces automatically and will be applied to all users in the
    -- specified directory.
    ClientProperties -> Maybe LogUploadEnum
logUploadEnabled :: Prelude.Maybe LogUploadEnum,
    -- | Specifies whether users can cache their credentials on the Amazon
    -- WorkSpaces client. When enabled, users can choose to reconnect to their
    -- WorkSpaces without re-entering their credentials.
    ClientProperties -> Maybe ReconnectEnum
reconnectEnabled :: Prelude.Maybe ReconnectEnum
  }
  deriving (ClientProperties -> ClientProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClientProperties -> ClientProperties -> Bool
$c/= :: ClientProperties -> ClientProperties -> Bool
== :: ClientProperties -> ClientProperties -> Bool
$c== :: ClientProperties -> ClientProperties -> Bool
Prelude.Eq, ReadPrec [ClientProperties]
ReadPrec ClientProperties
Int -> ReadS ClientProperties
ReadS [ClientProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClientProperties]
$creadListPrec :: ReadPrec [ClientProperties]
readPrec :: ReadPrec ClientProperties
$creadPrec :: ReadPrec ClientProperties
readList :: ReadS [ClientProperties]
$creadList :: ReadS [ClientProperties]
readsPrec :: Int -> ReadS ClientProperties
$creadsPrec :: Int -> ReadS ClientProperties
Prelude.Read, Int -> ClientProperties -> ShowS
[ClientProperties] -> ShowS
ClientProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClientProperties] -> ShowS
$cshowList :: [ClientProperties] -> ShowS
show :: ClientProperties -> String
$cshow :: ClientProperties -> String
showsPrec :: Int -> ClientProperties -> ShowS
$cshowsPrec :: Int -> ClientProperties -> ShowS
Prelude.Show, forall x. Rep ClientProperties x -> ClientProperties
forall x. ClientProperties -> Rep ClientProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClientProperties x -> ClientProperties
$cfrom :: forall x. ClientProperties -> Rep ClientProperties x
Prelude.Generic)

-- |
-- Create a value of 'ClientProperties' 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:
--
-- 'logUploadEnabled', 'clientProperties_logUploadEnabled' - Specifies whether users can upload diagnostic log files of Amazon
-- WorkSpaces client directly to WorkSpaces to troubleshoot issues when
-- using the WorkSpaces client. When enabled, the log files will be sent to
-- WorkSpaces automatically and will be applied to all users in the
-- specified directory.
--
-- 'reconnectEnabled', 'clientProperties_reconnectEnabled' - Specifies whether users can cache their credentials on the Amazon
-- WorkSpaces client. When enabled, users can choose to reconnect to their
-- WorkSpaces without re-entering their credentials.
newClientProperties ::
  ClientProperties
newClientProperties :: ClientProperties
newClientProperties =
  ClientProperties'
    { $sel:logUploadEnabled:ClientProperties' :: Maybe LogUploadEnum
logUploadEnabled =
        forall a. Maybe a
Prelude.Nothing,
      $sel:reconnectEnabled:ClientProperties' :: Maybe ReconnectEnum
reconnectEnabled = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether users can upload diagnostic log files of Amazon
-- WorkSpaces client directly to WorkSpaces to troubleshoot issues when
-- using the WorkSpaces client. When enabled, the log files will be sent to
-- WorkSpaces automatically and will be applied to all users in the
-- specified directory.
clientProperties_logUploadEnabled :: Lens.Lens' ClientProperties (Prelude.Maybe LogUploadEnum)
clientProperties_logUploadEnabled :: Lens' ClientProperties (Maybe LogUploadEnum)
clientProperties_logUploadEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientProperties' {Maybe LogUploadEnum
logUploadEnabled :: Maybe LogUploadEnum
$sel:logUploadEnabled:ClientProperties' :: ClientProperties -> Maybe LogUploadEnum
logUploadEnabled} -> Maybe LogUploadEnum
logUploadEnabled) (\s :: ClientProperties
s@ClientProperties' {} Maybe LogUploadEnum
a -> ClientProperties
s {$sel:logUploadEnabled:ClientProperties' :: Maybe LogUploadEnum
logUploadEnabled = Maybe LogUploadEnum
a} :: ClientProperties)

-- | Specifies whether users can cache their credentials on the Amazon
-- WorkSpaces client. When enabled, users can choose to reconnect to their
-- WorkSpaces without re-entering their credentials.
clientProperties_reconnectEnabled :: Lens.Lens' ClientProperties (Prelude.Maybe ReconnectEnum)
clientProperties_reconnectEnabled :: Lens' ClientProperties (Maybe ReconnectEnum)
clientProperties_reconnectEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClientProperties' {Maybe ReconnectEnum
reconnectEnabled :: Maybe ReconnectEnum
$sel:reconnectEnabled:ClientProperties' :: ClientProperties -> Maybe ReconnectEnum
reconnectEnabled} -> Maybe ReconnectEnum
reconnectEnabled) (\s :: ClientProperties
s@ClientProperties' {} Maybe ReconnectEnum
a -> ClientProperties
s {$sel:reconnectEnabled:ClientProperties' :: Maybe ReconnectEnum
reconnectEnabled = Maybe ReconnectEnum
a} :: ClientProperties)

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

instance Prelude.Hashable ClientProperties where
  hashWithSalt :: Int -> ClientProperties -> Int
hashWithSalt Int
_salt ClientProperties' {Maybe LogUploadEnum
Maybe ReconnectEnum
reconnectEnabled :: Maybe ReconnectEnum
logUploadEnabled :: Maybe LogUploadEnum
$sel:reconnectEnabled:ClientProperties' :: ClientProperties -> Maybe ReconnectEnum
$sel:logUploadEnabled:ClientProperties' :: ClientProperties -> Maybe LogUploadEnum
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LogUploadEnum
logUploadEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReconnectEnum
reconnectEnabled

instance Prelude.NFData ClientProperties where
  rnf :: ClientProperties -> ()
rnf ClientProperties' {Maybe LogUploadEnum
Maybe ReconnectEnum
reconnectEnabled :: Maybe ReconnectEnum
logUploadEnabled :: Maybe LogUploadEnum
$sel:reconnectEnabled:ClientProperties' :: ClientProperties -> Maybe ReconnectEnum
$sel:logUploadEnabled:ClientProperties' :: ClientProperties -> Maybe LogUploadEnum
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe LogUploadEnum
logUploadEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReconnectEnum
reconnectEnabled

instance Data.ToJSON ClientProperties where
  toJSON :: ClientProperties -> Value
toJSON ClientProperties' {Maybe LogUploadEnum
Maybe ReconnectEnum
reconnectEnabled :: Maybe ReconnectEnum
logUploadEnabled :: Maybe LogUploadEnum
$sel:reconnectEnabled:ClientProperties' :: ClientProperties -> Maybe ReconnectEnum
$sel:logUploadEnabled:ClientProperties' :: ClientProperties -> Maybe LogUploadEnum
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"LogUploadEnabled" 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 LogUploadEnum
logUploadEnabled,
            (Key
"ReconnectEnabled" 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 ReconnectEnum
reconnectEnabled
          ]
      )