{-# 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.SpaceSettings
-- 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.SpaceSettings 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.JupyterServerAppSettings
import Amazonka.SageMaker.Types.KernelGatewayAppSettings

-- | A collection of space settings.
--
-- /See:/ 'newSpaceSettings' smart constructor.
data SpaceSettings = SpaceSettings'
  { SpaceSettings -> Maybe JupyterServerAppSettings
jupyterServerAppSettings :: Prelude.Maybe JupyterServerAppSettings,
    SpaceSettings -> Maybe KernelGatewayAppSettings
kernelGatewayAppSettings :: Prelude.Maybe KernelGatewayAppSettings
  }
  deriving (SpaceSettings -> SpaceSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpaceSettings -> SpaceSettings -> Bool
$c/= :: SpaceSettings -> SpaceSettings -> Bool
== :: SpaceSettings -> SpaceSettings -> Bool
$c== :: SpaceSettings -> SpaceSettings -> Bool
Prelude.Eq, ReadPrec [SpaceSettings]
ReadPrec SpaceSettings
Int -> ReadS SpaceSettings
ReadS [SpaceSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SpaceSettings]
$creadListPrec :: ReadPrec [SpaceSettings]
readPrec :: ReadPrec SpaceSettings
$creadPrec :: ReadPrec SpaceSettings
readList :: ReadS [SpaceSettings]
$creadList :: ReadS [SpaceSettings]
readsPrec :: Int -> ReadS SpaceSettings
$creadsPrec :: Int -> ReadS SpaceSettings
Prelude.Read, Int -> SpaceSettings -> ShowS
[SpaceSettings] -> ShowS
SpaceSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpaceSettings] -> ShowS
$cshowList :: [SpaceSettings] -> ShowS
show :: SpaceSettings -> String
$cshow :: SpaceSettings -> String
showsPrec :: Int -> SpaceSettings -> ShowS
$cshowsPrec :: Int -> SpaceSettings -> ShowS
Prelude.Show, forall x. Rep SpaceSettings x -> SpaceSettings
forall x. SpaceSettings -> Rep SpaceSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SpaceSettings x -> SpaceSettings
$cfrom :: forall x. SpaceSettings -> Rep SpaceSettings x
Prelude.Generic)

-- |
-- Create a value of 'SpaceSettings' 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:
--
-- 'jupyterServerAppSettings', 'spaceSettings_jupyterServerAppSettings' - Undocumented member.
--
-- 'kernelGatewayAppSettings', 'spaceSettings_kernelGatewayAppSettings' - Undocumented member.
newSpaceSettings ::
  SpaceSettings
newSpaceSettings :: SpaceSettings
newSpaceSettings =
  SpaceSettings'
    { $sel:jupyterServerAppSettings:SpaceSettings' :: Maybe JupyterServerAppSettings
jupyterServerAppSettings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:kernelGatewayAppSettings:SpaceSettings' :: Maybe KernelGatewayAppSettings
kernelGatewayAppSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
spaceSettings_jupyterServerAppSettings :: Lens.Lens' SpaceSettings (Prelude.Maybe JupyterServerAppSettings)
spaceSettings_jupyterServerAppSettings :: Lens' SpaceSettings (Maybe JupyterServerAppSettings)
spaceSettings_jupyterServerAppSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpaceSettings' {Maybe JupyterServerAppSettings
jupyterServerAppSettings :: Maybe JupyterServerAppSettings
$sel:jupyterServerAppSettings:SpaceSettings' :: SpaceSettings -> Maybe JupyterServerAppSettings
jupyterServerAppSettings} -> Maybe JupyterServerAppSettings
jupyterServerAppSettings) (\s :: SpaceSettings
s@SpaceSettings' {} Maybe JupyterServerAppSettings
a -> SpaceSettings
s {$sel:jupyterServerAppSettings:SpaceSettings' :: Maybe JupyterServerAppSettings
jupyterServerAppSettings = Maybe JupyterServerAppSettings
a} :: SpaceSettings)

-- | Undocumented member.
spaceSettings_kernelGatewayAppSettings :: Lens.Lens' SpaceSettings (Prelude.Maybe KernelGatewayAppSettings)
spaceSettings_kernelGatewayAppSettings :: Lens' SpaceSettings (Maybe KernelGatewayAppSettings)
spaceSettings_kernelGatewayAppSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SpaceSettings' {Maybe KernelGatewayAppSettings
kernelGatewayAppSettings :: Maybe KernelGatewayAppSettings
$sel:kernelGatewayAppSettings:SpaceSettings' :: SpaceSettings -> Maybe KernelGatewayAppSettings
kernelGatewayAppSettings} -> Maybe KernelGatewayAppSettings
kernelGatewayAppSettings) (\s :: SpaceSettings
s@SpaceSettings' {} Maybe KernelGatewayAppSettings
a -> SpaceSettings
s {$sel:kernelGatewayAppSettings:SpaceSettings' :: Maybe KernelGatewayAppSettings
kernelGatewayAppSettings = Maybe KernelGatewayAppSettings
a} :: SpaceSettings)

instance Data.FromJSON SpaceSettings where
  parseJSON :: Value -> Parser SpaceSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SpaceSettings"
      ( \Object
x ->
          Maybe JupyterServerAppSettings
-> Maybe KernelGatewayAppSettings -> SpaceSettings
SpaceSettings'
            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
"JupyterServerAppSettings")
            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
"KernelGatewayAppSettings")
      )

instance Prelude.Hashable SpaceSettings where
  hashWithSalt :: Int -> SpaceSettings -> Int
hashWithSalt Int
_salt SpaceSettings' {Maybe KernelGatewayAppSettings
Maybe JupyterServerAppSettings
kernelGatewayAppSettings :: Maybe KernelGatewayAppSettings
jupyterServerAppSettings :: Maybe JupyterServerAppSettings
$sel:kernelGatewayAppSettings:SpaceSettings' :: SpaceSettings -> Maybe KernelGatewayAppSettings
$sel:jupyterServerAppSettings:SpaceSettings' :: SpaceSettings -> Maybe JupyterServerAppSettings
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JupyterServerAppSettings
jupyterServerAppSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KernelGatewayAppSettings
kernelGatewayAppSettings

instance Prelude.NFData SpaceSettings where
  rnf :: SpaceSettings -> ()
rnf SpaceSettings' {Maybe KernelGatewayAppSettings
Maybe JupyterServerAppSettings
kernelGatewayAppSettings :: Maybe KernelGatewayAppSettings
jupyterServerAppSettings :: Maybe JupyterServerAppSettings
$sel:kernelGatewayAppSettings:SpaceSettings' :: SpaceSettings -> Maybe KernelGatewayAppSettings
$sel:jupyterServerAppSettings:SpaceSettings' :: SpaceSettings -> Maybe JupyterServerAppSettings
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe JupyterServerAppSettings
jupyterServerAppSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KernelGatewayAppSettings
kernelGatewayAppSettings

instance Data.ToJSON SpaceSettings where
  toJSON :: SpaceSettings -> Value
toJSON SpaceSettings' {Maybe KernelGatewayAppSettings
Maybe JupyterServerAppSettings
kernelGatewayAppSettings :: Maybe KernelGatewayAppSettings
jupyterServerAppSettings :: Maybe JupyterServerAppSettings
$sel:kernelGatewayAppSettings:SpaceSettings' :: SpaceSettings -> Maybe KernelGatewayAppSettings
$sel:jupyterServerAppSettings:SpaceSettings' :: SpaceSettings -> Maybe JupyterServerAppSettings
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"JupyterServerAppSettings" 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 JupyterServerAppSettings
jupyterServerAppSettings,
            (Key
"KernelGatewayAppSettings" 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 KernelGatewayAppSettings
kernelGatewayAppSettings
          ]
      )