{-# 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.AutoMLSecurityConfig
-- 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.AutoMLSecurityConfig 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.VpcConfig

-- | Security options.
--
-- /See:/ 'newAutoMLSecurityConfig' smart constructor.
data AutoMLSecurityConfig = AutoMLSecurityConfig'
  { -- | Whether to use traffic encryption between the container layers.
    AutoMLSecurityConfig -> Maybe Bool
enableInterContainerTrafficEncryption :: Prelude.Maybe Prelude.Bool,
    -- | The key used to encrypt stored data.
    AutoMLSecurityConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The VPC configuration.
    AutoMLSecurityConfig -> Maybe VpcConfig
vpcConfig :: Prelude.Maybe VpcConfig
  }
  deriving (AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool
$c/= :: AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool
== :: AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool
$c== :: AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool
Prelude.Eq, ReadPrec [AutoMLSecurityConfig]
ReadPrec AutoMLSecurityConfig
Int -> ReadS AutoMLSecurityConfig
ReadS [AutoMLSecurityConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLSecurityConfig]
$creadListPrec :: ReadPrec [AutoMLSecurityConfig]
readPrec :: ReadPrec AutoMLSecurityConfig
$creadPrec :: ReadPrec AutoMLSecurityConfig
readList :: ReadS [AutoMLSecurityConfig]
$creadList :: ReadS [AutoMLSecurityConfig]
readsPrec :: Int -> ReadS AutoMLSecurityConfig
$creadsPrec :: Int -> ReadS AutoMLSecurityConfig
Prelude.Read, Int -> AutoMLSecurityConfig -> ShowS
[AutoMLSecurityConfig] -> ShowS
AutoMLSecurityConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLSecurityConfig] -> ShowS
$cshowList :: [AutoMLSecurityConfig] -> ShowS
show :: AutoMLSecurityConfig -> String
$cshow :: AutoMLSecurityConfig -> String
showsPrec :: Int -> AutoMLSecurityConfig -> ShowS
$cshowsPrec :: Int -> AutoMLSecurityConfig -> ShowS
Prelude.Show, forall x. Rep AutoMLSecurityConfig x -> AutoMLSecurityConfig
forall x. AutoMLSecurityConfig -> Rep AutoMLSecurityConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLSecurityConfig x -> AutoMLSecurityConfig
$cfrom :: forall x. AutoMLSecurityConfig -> Rep AutoMLSecurityConfig x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLSecurityConfig' 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:
--
-- 'enableInterContainerTrafficEncryption', 'autoMLSecurityConfig_enableInterContainerTrafficEncryption' - Whether to use traffic encryption between the container layers.
--
-- 'volumeKmsKeyId', 'autoMLSecurityConfig_volumeKmsKeyId' - The key used to encrypt stored data.
--
-- 'vpcConfig', 'autoMLSecurityConfig_vpcConfig' - The VPC configuration.
newAutoMLSecurityConfig ::
  AutoMLSecurityConfig
newAutoMLSecurityConfig :: AutoMLSecurityConfig
newAutoMLSecurityConfig =
  AutoMLSecurityConfig'
    { $sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: Maybe Bool
enableInterContainerTrafficEncryption =
        forall a. Maybe a
Prelude.Nothing,
      $sel:volumeKmsKeyId:AutoMLSecurityConfig' :: Maybe Text
volumeKmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfig:AutoMLSecurityConfig' :: Maybe VpcConfig
vpcConfig = forall a. Maybe a
Prelude.Nothing
    }

-- | Whether to use traffic encryption between the container layers.
autoMLSecurityConfig_enableInterContainerTrafficEncryption :: Lens.Lens' AutoMLSecurityConfig (Prelude.Maybe Prelude.Bool)
autoMLSecurityConfig_enableInterContainerTrafficEncryption :: Lens' AutoMLSecurityConfig (Maybe Bool)
autoMLSecurityConfig_enableInterContainerTrafficEncryption = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLSecurityConfig' {Maybe Bool
enableInterContainerTrafficEncryption :: Maybe Bool
$sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Bool
enableInterContainerTrafficEncryption} -> Maybe Bool
enableInterContainerTrafficEncryption) (\s :: AutoMLSecurityConfig
s@AutoMLSecurityConfig' {} Maybe Bool
a -> AutoMLSecurityConfig
s {$sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: Maybe Bool
enableInterContainerTrafficEncryption = Maybe Bool
a} :: AutoMLSecurityConfig)

-- | The key used to encrypt stored data.
autoMLSecurityConfig_volumeKmsKeyId :: Lens.Lens' AutoMLSecurityConfig (Prelude.Maybe Prelude.Text)
autoMLSecurityConfig_volumeKmsKeyId :: Lens' AutoMLSecurityConfig (Maybe Text)
autoMLSecurityConfig_volumeKmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLSecurityConfig' {Maybe Text
volumeKmsKeyId :: Maybe Text
$sel:volumeKmsKeyId:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Text
volumeKmsKeyId} -> Maybe Text
volumeKmsKeyId) (\s :: AutoMLSecurityConfig
s@AutoMLSecurityConfig' {} Maybe Text
a -> AutoMLSecurityConfig
s {$sel:volumeKmsKeyId:AutoMLSecurityConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
a} :: AutoMLSecurityConfig)

-- | The VPC configuration.
autoMLSecurityConfig_vpcConfig :: Lens.Lens' AutoMLSecurityConfig (Prelude.Maybe VpcConfig)
autoMLSecurityConfig_vpcConfig :: Lens' AutoMLSecurityConfig (Maybe VpcConfig)
autoMLSecurityConfig_vpcConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLSecurityConfig' {Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
$sel:vpcConfig:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe VpcConfig
vpcConfig} -> Maybe VpcConfig
vpcConfig) (\s :: AutoMLSecurityConfig
s@AutoMLSecurityConfig' {} Maybe VpcConfig
a -> AutoMLSecurityConfig
s {$sel:vpcConfig:AutoMLSecurityConfig' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
a} :: AutoMLSecurityConfig)

instance Data.FromJSON AutoMLSecurityConfig where
  parseJSON :: Value -> Parser AutoMLSecurityConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AutoMLSecurityConfig"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Maybe VpcConfig -> AutoMLSecurityConfig
AutoMLSecurityConfig'
            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
"EnableInterContainerTrafficEncryption")
            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
"VolumeKmsKeyId")
            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
"VpcConfig")
      )

instance Prelude.Hashable AutoMLSecurityConfig where
  hashWithSalt :: Int -> AutoMLSecurityConfig -> Int
hashWithSalt Int
_salt AutoMLSecurityConfig' {Maybe Bool
Maybe Text
Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
volumeKmsKeyId :: Maybe Text
enableInterContainerTrafficEncryption :: Maybe Bool
$sel:vpcConfig:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe VpcConfig
$sel:volumeKmsKeyId:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Text
$sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableInterContainerTrafficEncryption
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
volumeKmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcConfig
vpcConfig

instance Prelude.NFData AutoMLSecurityConfig where
  rnf :: AutoMLSecurityConfig -> ()
rnf AutoMLSecurityConfig' {Maybe Bool
Maybe Text
Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
volumeKmsKeyId :: Maybe Text
enableInterContainerTrafficEncryption :: Maybe Bool
$sel:vpcConfig:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe VpcConfig
$sel:volumeKmsKeyId:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Text
$sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableInterContainerTrafficEncryption
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
volumeKmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcConfig
vpcConfig

instance Data.ToJSON AutoMLSecurityConfig where
  toJSON :: AutoMLSecurityConfig -> Value
toJSON AutoMLSecurityConfig' {Maybe Bool
Maybe Text
Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
volumeKmsKeyId :: Maybe Text
enableInterContainerTrafficEncryption :: Maybe Bool
$sel:vpcConfig:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe VpcConfig
$sel:volumeKmsKeyId:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Text
$sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: AutoMLSecurityConfig -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EnableInterContainerTrafficEncryption" 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 Bool
enableInterContainerTrafficEncryption,
            (Key
"VolumeKmsKeyId" 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 Text
volumeKmsKeyId,
            (Key
"VpcConfig" 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 VpcConfig
vpcConfig
          ]
      )