{-# 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.WorkSpacesWeb.Types.BrowserSettings
-- 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.WorkSpacesWeb.Types.BrowserSettings 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

-- | The browser settings resource that can be associated with a web portal.
-- Once associated with a web portal, browser settings control how the
-- browser will behave once a user starts a streaming session for the web
-- portal.
--
-- /See:/ 'newBrowserSettings' smart constructor.
data BrowserSettings = BrowserSettings'
  { -- | A list of web portal ARNs that this browser settings is associated with.
    BrowserSettings -> Maybe [Text]
associatedPortalArns :: Prelude.Maybe [Prelude.Text],
    -- | A JSON string containing Chrome Enterprise policies that will be applied
    -- to all streaming sessions.
    BrowserSettings -> Maybe (Sensitive Text)
browserPolicy :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The ARN of the browser settings.
    BrowserSettings -> Text
browserSettingsArn :: Prelude.Text
  }
  deriving (BrowserSettings -> BrowserSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BrowserSettings -> BrowserSettings -> Bool
$c/= :: BrowserSettings -> BrowserSettings -> Bool
== :: BrowserSettings -> BrowserSettings -> Bool
$c== :: BrowserSettings -> BrowserSettings -> Bool
Prelude.Eq, Int -> BrowserSettings -> ShowS
[BrowserSettings] -> ShowS
BrowserSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BrowserSettings] -> ShowS
$cshowList :: [BrowserSettings] -> ShowS
show :: BrowserSettings -> String
$cshow :: BrowserSettings -> String
showsPrec :: Int -> BrowserSettings -> ShowS
$cshowsPrec :: Int -> BrowserSettings -> ShowS
Prelude.Show, forall x. Rep BrowserSettings x -> BrowserSettings
forall x. BrowserSettings -> Rep BrowserSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BrowserSettings x -> BrowserSettings
$cfrom :: forall x. BrowserSettings -> Rep BrowserSettings x
Prelude.Generic)

-- |
-- Create a value of 'BrowserSettings' 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:
--
-- 'associatedPortalArns', 'browserSettings_associatedPortalArns' - A list of web portal ARNs that this browser settings is associated with.
--
-- 'browserPolicy', 'browserSettings_browserPolicy' - A JSON string containing Chrome Enterprise policies that will be applied
-- to all streaming sessions.
--
-- 'browserSettingsArn', 'browserSettings_browserSettingsArn' - The ARN of the browser settings.
newBrowserSettings ::
  -- | 'browserSettingsArn'
  Prelude.Text ->
  BrowserSettings
newBrowserSettings :: Text -> BrowserSettings
newBrowserSettings Text
pBrowserSettingsArn_ =
  BrowserSettings'
    { $sel:associatedPortalArns:BrowserSettings' :: Maybe [Text]
associatedPortalArns =
        forall a. Maybe a
Prelude.Nothing,
      $sel:browserPolicy:BrowserSettings' :: Maybe (Sensitive Text)
browserPolicy = forall a. Maybe a
Prelude.Nothing,
      $sel:browserSettingsArn:BrowserSettings' :: Text
browserSettingsArn = Text
pBrowserSettingsArn_
    }

-- | A list of web portal ARNs that this browser settings is associated with.
browserSettings_associatedPortalArns :: Lens.Lens' BrowserSettings (Prelude.Maybe [Prelude.Text])
browserSettings_associatedPortalArns :: Lens' BrowserSettings (Maybe [Text])
browserSettings_associatedPortalArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrowserSettings' {Maybe [Text]
associatedPortalArns :: Maybe [Text]
$sel:associatedPortalArns:BrowserSettings' :: BrowserSettings -> Maybe [Text]
associatedPortalArns} -> Maybe [Text]
associatedPortalArns) (\s :: BrowserSettings
s@BrowserSettings' {} Maybe [Text]
a -> BrowserSettings
s {$sel:associatedPortalArns:BrowserSettings' :: Maybe [Text]
associatedPortalArns = Maybe [Text]
a} :: BrowserSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A JSON string containing Chrome Enterprise policies that will be applied
-- to all streaming sessions.
browserSettings_browserPolicy :: Lens.Lens' BrowserSettings (Prelude.Maybe Prelude.Text)
browserSettings_browserPolicy :: Lens' BrowserSettings (Maybe Text)
browserSettings_browserPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrowserSettings' {Maybe (Sensitive Text)
browserPolicy :: Maybe (Sensitive Text)
$sel:browserPolicy:BrowserSettings' :: BrowserSettings -> Maybe (Sensitive Text)
browserPolicy} -> Maybe (Sensitive Text)
browserPolicy) (\s :: BrowserSettings
s@BrowserSettings' {} Maybe (Sensitive Text)
a -> BrowserSettings
s {$sel:browserPolicy:BrowserSettings' :: Maybe (Sensitive Text)
browserPolicy = Maybe (Sensitive Text)
a} :: BrowserSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The ARN of the browser settings.
browserSettings_browserSettingsArn :: Lens.Lens' BrowserSettings Prelude.Text
browserSettings_browserSettingsArn :: Lens' BrowserSettings Text
browserSettings_browserSettingsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BrowserSettings' {Text
browserSettingsArn :: Text
$sel:browserSettingsArn:BrowserSettings' :: BrowserSettings -> Text
browserSettingsArn} -> Text
browserSettingsArn) (\s :: BrowserSettings
s@BrowserSettings' {} Text
a -> BrowserSettings
s {$sel:browserSettingsArn:BrowserSettings' :: Text
browserSettingsArn = Text
a} :: BrowserSettings)

instance Data.FromJSON BrowserSettings where
  parseJSON :: Value -> Parser BrowserSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"BrowserSettings"
      ( \Object
x ->
          Maybe [Text] -> Maybe (Sensitive Text) -> Text -> BrowserSettings
BrowserSettings'
            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
"associatedPortalArns"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"browserPolicy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"browserSettingsArn")
      )

instance Prelude.Hashable BrowserSettings where
  hashWithSalt :: Int -> BrowserSettings -> Int
hashWithSalt Int
_salt BrowserSettings' {Maybe [Text]
Maybe (Sensitive Text)
Text
browserSettingsArn :: Text
browserPolicy :: Maybe (Sensitive Text)
associatedPortalArns :: Maybe [Text]
$sel:browserSettingsArn:BrowserSettings' :: BrowserSettings -> Text
$sel:browserPolicy:BrowserSettings' :: BrowserSettings -> Maybe (Sensitive Text)
$sel:associatedPortalArns:BrowserSettings' :: BrowserSettings -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
associatedPortalArns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
browserPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
browserSettingsArn

instance Prelude.NFData BrowserSettings where
  rnf :: BrowserSettings -> ()
rnf BrowserSettings' {Maybe [Text]
Maybe (Sensitive Text)
Text
browserSettingsArn :: Text
browserPolicy :: Maybe (Sensitive Text)
associatedPortalArns :: Maybe [Text]
$sel:browserSettingsArn:BrowserSettings' :: BrowserSettings -> Text
$sel:browserPolicy:BrowserSettings' :: BrowserSettings -> Maybe (Sensitive Text)
$sel:associatedPortalArns:BrowserSettings' :: BrowserSettings -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
associatedPortalArns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
browserPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
browserSettingsArn