{-# 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.SageMaker.Types.RStudioServerProAppSettings
-- 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.SageMaker.Types.RStudioServerProAppSettings 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.SageMaker.Types.RStudioServerProAccessStatus
import Amazonka.SageMaker.Types.RStudioServerProUserGroup

-- | A collection of settings that configure user interaction with the
-- @RStudioServerPro@ app. @RStudioServerProAppSettings@ cannot be updated.
-- The @RStudioServerPro@ app must be deleted and a new one created to make
-- any changes.
--
-- /See:/ 'newRStudioServerProAppSettings' smart constructor.
data RStudioServerProAppSettings = RStudioServerProAppSettings'
  { -- | Indicates whether the current user has access to the @RStudioServerPro@
    -- app.
    RStudioServerProAppSettings -> Maybe RStudioServerProAccessStatus
accessStatus :: Prelude.Maybe RStudioServerProAccessStatus,
    -- | The level of permissions that the user has within the @RStudioServerPro@
    -- app. This value defaults to \`User\`. The \`Admin\` value allows the
    -- user access to the RStudio Administrative Dashboard.
    RStudioServerProAppSettings -> Maybe RStudioServerProUserGroup
userGroup :: Prelude.Maybe RStudioServerProUserGroup
  }
  deriving (RStudioServerProAppSettings -> RStudioServerProAppSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RStudioServerProAppSettings -> RStudioServerProAppSettings -> Bool
$c/= :: RStudioServerProAppSettings -> RStudioServerProAppSettings -> Bool
== :: RStudioServerProAppSettings -> RStudioServerProAppSettings -> Bool
$c== :: RStudioServerProAppSettings -> RStudioServerProAppSettings -> Bool
Prelude.Eq, ReadPrec [RStudioServerProAppSettings]
ReadPrec RStudioServerProAppSettings
Int -> ReadS RStudioServerProAppSettings
ReadS [RStudioServerProAppSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RStudioServerProAppSettings]
$creadListPrec :: ReadPrec [RStudioServerProAppSettings]
readPrec :: ReadPrec RStudioServerProAppSettings
$creadPrec :: ReadPrec RStudioServerProAppSettings
readList :: ReadS [RStudioServerProAppSettings]
$creadList :: ReadS [RStudioServerProAppSettings]
readsPrec :: Int -> ReadS RStudioServerProAppSettings
$creadsPrec :: Int -> ReadS RStudioServerProAppSettings
Prelude.Read, Int -> RStudioServerProAppSettings -> ShowS
[RStudioServerProAppSettings] -> ShowS
RStudioServerProAppSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RStudioServerProAppSettings] -> ShowS
$cshowList :: [RStudioServerProAppSettings] -> ShowS
show :: RStudioServerProAppSettings -> String
$cshow :: RStudioServerProAppSettings -> String
showsPrec :: Int -> RStudioServerProAppSettings -> ShowS
$cshowsPrec :: Int -> RStudioServerProAppSettings -> ShowS
Prelude.Show, forall x.
Rep RStudioServerProAppSettings x -> RStudioServerProAppSettings
forall x.
RStudioServerProAppSettings -> Rep RStudioServerProAppSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RStudioServerProAppSettings x -> RStudioServerProAppSettings
$cfrom :: forall x.
RStudioServerProAppSettings -> Rep RStudioServerProAppSettings x
Prelude.Generic)

-- |
-- Create a value of 'RStudioServerProAppSettings' 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:
--
-- 'accessStatus', 'rStudioServerProAppSettings_accessStatus' - Indicates whether the current user has access to the @RStudioServerPro@
-- app.
--
-- 'userGroup', 'rStudioServerProAppSettings_userGroup' - The level of permissions that the user has within the @RStudioServerPro@
-- app. This value defaults to \`User\`. The \`Admin\` value allows the
-- user access to the RStudio Administrative Dashboard.
newRStudioServerProAppSettings ::
  RStudioServerProAppSettings
newRStudioServerProAppSettings :: RStudioServerProAppSettings
newRStudioServerProAppSettings =
  RStudioServerProAppSettings'
    { $sel:accessStatus:RStudioServerProAppSettings' :: Maybe RStudioServerProAccessStatus
accessStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:userGroup:RStudioServerProAppSettings' :: Maybe RStudioServerProUserGroup
userGroup = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the current user has access to the @RStudioServerPro@
-- app.
rStudioServerProAppSettings_accessStatus :: Lens.Lens' RStudioServerProAppSettings (Prelude.Maybe RStudioServerProAccessStatus)
rStudioServerProAppSettings_accessStatus :: Lens'
  RStudioServerProAppSettings (Maybe RStudioServerProAccessStatus)
rStudioServerProAppSettings_accessStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RStudioServerProAppSettings' {Maybe RStudioServerProAccessStatus
accessStatus :: Maybe RStudioServerProAccessStatus
$sel:accessStatus:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProAccessStatus
accessStatus} -> Maybe RStudioServerProAccessStatus
accessStatus) (\s :: RStudioServerProAppSettings
s@RStudioServerProAppSettings' {} Maybe RStudioServerProAccessStatus
a -> RStudioServerProAppSettings
s {$sel:accessStatus:RStudioServerProAppSettings' :: Maybe RStudioServerProAccessStatus
accessStatus = Maybe RStudioServerProAccessStatus
a} :: RStudioServerProAppSettings)

-- | The level of permissions that the user has within the @RStudioServerPro@
-- app. This value defaults to \`User\`. The \`Admin\` value allows the
-- user access to the RStudio Administrative Dashboard.
rStudioServerProAppSettings_userGroup :: Lens.Lens' RStudioServerProAppSettings (Prelude.Maybe RStudioServerProUserGroup)
rStudioServerProAppSettings_userGroup :: Lens' RStudioServerProAppSettings (Maybe RStudioServerProUserGroup)
rStudioServerProAppSettings_userGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RStudioServerProAppSettings' {Maybe RStudioServerProUserGroup
userGroup :: Maybe RStudioServerProUserGroup
$sel:userGroup:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProUserGroup
userGroup} -> Maybe RStudioServerProUserGroup
userGroup) (\s :: RStudioServerProAppSettings
s@RStudioServerProAppSettings' {} Maybe RStudioServerProUserGroup
a -> RStudioServerProAppSettings
s {$sel:userGroup:RStudioServerProAppSettings' :: Maybe RStudioServerProUserGroup
userGroup = Maybe RStudioServerProUserGroup
a} :: RStudioServerProAppSettings)

instance Data.FromJSON RStudioServerProAppSettings where
  parseJSON :: Value -> Parser RStudioServerProAppSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RStudioServerProAppSettings"
      ( \Object
x ->
          Maybe RStudioServerProAccessStatus
-> Maybe RStudioServerProUserGroup -> RStudioServerProAppSettings
RStudioServerProAppSettings'
            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
"AccessStatus")
            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
"UserGroup")
      )

instance Prelude.Hashable RStudioServerProAppSettings where
  hashWithSalt :: Int -> RStudioServerProAppSettings -> Int
hashWithSalt Int
_salt RStudioServerProAppSettings' {Maybe RStudioServerProAccessStatus
Maybe RStudioServerProUserGroup
userGroup :: Maybe RStudioServerProUserGroup
accessStatus :: Maybe RStudioServerProAccessStatus
$sel:userGroup:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProUserGroup
$sel:accessStatus:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProAccessStatus
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RStudioServerProAccessStatus
accessStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RStudioServerProUserGroup
userGroup

instance Prelude.NFData RStudioServerProAppSettings where
  rnf :: RStudioServerProAppSettings -> ()
rnf RStudioServerProAppSettings' {Maybe RStudioServerProAccessStatus
Maybe RStudioServerProUserGroup
userGroup :: Maybe RStudioServerProUserGroup
accessStatus :: Maybe RStudioServerProAccessStatus
$sel:userGroup:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProUserGroup
$sel:accessStatus:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProAccessStatus
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe RStudioServerProAccessStatus
accessStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RStudioServerProUserGroup
userGroup

instance Data.ToJSON RStudioServerProAppSettings where
  toJSON :: RStudioServerProAppSettings -> Value
toJSON RStudioServerProAppSettings' {Maybe RStudioServerProAccessStatus
Maybe RStudioServerProUserGroup
userGroup :: Maybe RStudioServerProUserGroup
accessStatus :: Maybe RStudioServerProAccessStatus
$sel:userGroup:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProUserGroup
$sel:accessStatus:RStudioServerProAppSettings' :: RStudioServerProAppSettings -> Maybe RStudioServerProAccessStatus
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AccessStatus" 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 RStudioServerProAccessStatus
accessStatus,
            (Key
"UserGroup" 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 RStudioServerProUserGroup
userGroup
          ]
      )