{-# 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.AppStream.Types.ApplicationSettings
-- 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.AppStream.Types.ApplicationSettings where

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

-- | The persistent application settings for users of a stack.
--
-- /See:/ 'newApplicationSettings' smart constructor.
data ApplicationSettings = ApplicationSettings'
  { -- | The path prefix for the S3 bucket where users’ persistent application
    -- settings are stored. You can allow the same persistent application
    -- settings to be used across multiple stacks by specifying the same
    -- settings group for each stack.
    ApplicationSettings -> Maybe Text
settingsGroup :: Prelude.Maybe Prelude.Text,
    -- | Enables or disables persistent application settings for users during
    -- their streaming sessions.
    ApplicationSettings -> Bool
enabled :: Prelude.Bool
  }
  deriving (ApplicationSettings -> ApplicationSettings -> Bool
(ApplicationSettings -> ApplicationSettings -> Bool)
-> (ApplicationSettings -> ApplicationSettings -> Bool)
-> Eq ApplicationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationSettings -> ApplicationSettings -> Bool
$c/= :: ApplicationSettings -> ApplicationSettings -> Bool
== :: ApplicationSettings -> ApplicationSettings -> Bool
$c== :: ApplicationSettings -> ApplicationSettings -> Bool
Prelude.Eq, ReadPrec [ApplicationSettings]
ReadPrec ApplicationSettings
Int -> ReadS ApplicationSettings
ReadS [ApplicationSettings]
(Int -> ReadS ApplicationSettings)
-> ReadS [ApplicationSettings]
-> ReadPrec ApplicationSettings
-> ReadPrec [ApplicationSettings]
-> Read ApplicationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationSettings]
$creadListPrec :: ReadPrec [ApplicationSettings]
readPrec :: ReadPrec ApplicationSettings
$creadPrec :: ReadPrec ApplicationSettings
readList :: ReadS [ApplicationSettings]
$creadList :: ReadS [ApplicationSettings]
readsPrec :: Int -> ReadS ApplicationSettings
$creadsPrec :: Int -> ReadS ApplicationSettings
Prelude.Read, Int -> ApplicationSettings -> ShowS
[ApplicationSettings] -> ShowS
ApplicationSettings -> String
(Int -> ApplicationSettings -> ShowS)
-> (ApplicationSettings -> String)
-> ([ApplicationSettings] -> ShowS)
-> Show ApplicationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationSettings] -> ShowS
$cshowList :: [ApplicationSettings] -> ShowS
show :: ApplicationSettings -> String
$cshow :: ApplicationSettings -> String
showsPrec :: Int -> ApplicationSettings -> ShowS
$cshowsPrec :: Int -> ApplicationSettings -> ShowS
Prelude.Show, (forall x. ApplicationSettings -> Rep ApplicationSettings x)
-> (forall x. Rep ApplicationSettings x -> ApplicationSettings)
-> Generic ApplicationSettings
forall x. Rep ApplicationSettings x -> ApplicationSettings
forall x. ApplicationSettings -> Rep ApplicationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationSettings x -> ApplicationSettings
$cfrom :: forall x. ApplicationSettings -> Rep ApplicationSettings x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationSettings' 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:
--
-- 'settingsGroup', 'applicationSettings_settingsGroup' - The path prefix for the S3 bucket where users’ persistent application
-- settings are stored. You can allow the same persistent application
-- settings to be used across multiple stacks by specifying the same
-- settings group for each stack.
--
-- 'enabled', 'applicationSettings_enabled' - Enables or disables persistent application settings for users during
-- their streaming sessions.
newApplicationSettings ::
  -- | 'enabled'
  Prelude.Bool ->
  ApplicationSettings
newApplicationSettings :: Bool -> ApplicationSettings
newApplicationSettings Bool
pEnabled_ =
  ApplicationSettings' :: Maybe Text -> Bool -> ApplicationSettings
ApplicationSettings'
    { $sel:settingsGroup:ApplicationSettings' :: Maybe Text
settingsGroup =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:ApplicationSettings' :: Bool
enabled = Bool
pEnabled_
    }

-- | The path prefix for the S3 bucket where users’ persistent application
-- settings are stored. You can allow the same persistent application
-- settings to be used across multiple stacks by specifying the same
-- settings group for each stack.
applicationSettings_settingsGroup :: Lens.Lens' ApplicationSettings (Prelude.Maybe Prelude.Text)
applicationSettings_settingsGroup :: (Maybe Text -> f (Maybe Text))
-> ApplicationSettings -> f ApplicationSettings
applicationSettings_settingsGroup = (ApplicationSettings -> Maybe Text)
-> (ApplicationSettings -> Maybe Text -> ApplicationSettings)
-> Lens
     ApplicationSettings ApplicationSettings (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSettings' {Maybe Text
settingsGroup :: Maybe Text
$sel:settingsGroup:ApplicationSettings' :: ApplicationSettings -> Maybe Text
settingsGroup} -> Maybe Text
settingsGroup) (\s :: ApplicationSettings
s@ApplicationSettings' {} Maybe Text
a -> ApplicationSettings
s {$sel:settingsGroup:ApplicationSettings' :: Maybe Text
settingsGroup = Maybe Text
a} :: ApplicationSettings)

-- | Enables or disables persistent application settings for users during
-- their streaming sessions.
applicationSettings_enabled :: Lens.Lens' ApplicationSettings Prelude.Bool
applicationSettings_enabled :: (Bool -> f Bool) -> ApplicationSettings -> f ApplicationSettings
applicationSettings_enabled = (ApplicationSettings -> Bool)
-> (ApplicationSettings -> Bool -> ApplicationSettings)
-> Lens ApplicationSettings ApplicationSettings Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationSettings' {Bool
enabled :: Bool
$sel:enabled:ApplicationSettings' :: ApplicationSettings -> Bool
enabled} -> Bool
enabled) (\s :: ApplicationSettings
s@ApplicationSettings' {} Bool
a -> ApplicationSettings
s {$sel:enabled:ApplicationSettings' :: Bool
enabled = Bool
a} :: ApplicationSettings)

instance Prelude.Hashable ApplicationSettings

instance Prelude.NFData ApplicationSettings

instance Core.ToJSON ApplicationSettings where
  toJSON :: ApplicationSettings -> Value
toJSON ApplicationSettings' {Bool
Maybe Text
enabled :: Bool
settingsGroup :: Maybe Text
$sel:enabled:ApplicationSettings' :: ApplicationSettings -> Bool
$sel:settingsGroup:ApplicationSettings' :: ApplicationSettings -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SettingsGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
settingsGroup,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enabled)
          ]
      )