{-# 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-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.SageMaker.Types.AutoMLSecurityConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.VpcConfig

-- | Security options.
--
-- /See:/ 'newAutoMLSecurityConfig' smart constructor.
data AutoMLSecurityConfig = AutoMLSecurityConfig'
  { -- | The VPC configuration.
    AutoMLSecurityConfig -> Maybe VpcConfig
vpcConfig :: Prelude.Maybe VpcConfig,
    -- | The key used to encrypt stored data.
    AutoMLSecurityConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Whether to use traffic encryption between the container layers.
    AutoMLSecurityConfig -> Maybe Bool
enableInterContainerTrafficEncryption :: Prelude.Maybe Prelude.Bool
  }
  deriving (AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool
(AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool)
-> (AutoMLSecurityConfig -> AutoMLSecurityConfig -> Bool)
-> Eq AutoMLSecurityConfig
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]
(Int -> ReadS AutoMLSecurityConfig)
-> ReadS [AutoMLSecurityConfig]
-> ReadPrec AutoMLSecurityConfig
-> ReadPrec [AutoMLSecurityConfig]
-> Read 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
(Int -> AutoMLSecurityConfig -> ShowS)
-> (AutoMLSecurityConfig -> String)
-> ([AutoMLSecurityConfig] -> ShowS)
-> Show AutoMLSecurityConfig
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. AutoMLSecurityConfig -> Rep AutoMLSecurityConfig x)
-> (forall x. Rep AutoMLSecurityConfig x -> AutoMLSecurityConfig)
-> Generic AutoMLSecurityConfig
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:
--
-- 'vpcConfig', 'autoMLSecurityConfig_vpcConfig' - The VPC configuration.
--
-- 'volumeKmsKeyId', 'autoMLSecurityConfig_volumeKmsKeyId' - The key used to encrypt stored data.
--
-- 'enableInterContainerTrafficEncryption', 'autoMLSecurityConfig_enableInterContainerTrafficEncryption' - Whether to use traffic encryption between the container layers.
newAutoMLSecurityConfig ::
  AutoMLSecurityConfig
newAutoMLSecurityConfig :: AutoMLSecurityConfig
newAutoMLSecurityConfig =
  AutoMLSecurityConfig' :: Maybe VpcConfig -> Maybe Text -> Maybe Bool -> AutoMLSecurityConfig
AutoMLSecurityConfig'
    { $sel:vpcConfig:AutoMLSecurityConfig' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:volumeKmsKeyId:AutoMLSecurityConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enableInterContainerTrafficEncryption:AutoMLSecurityConfig' :: Maybe Bool
enableInterContainerTrafficEncryption =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The VPC configuration.
autoMLSecurityConfig_vpcConfig :: Lens.Lens' AutoMLSecurityConfig (Prelude.Maybe VpcConfig)
autoMLSecurityConfig_vpcConfig :: (Maybe VpcConfig -> f (Maybe VpcConfig))
-> AutoMLSecurityConfig -> f AutoMLSecurityConfig
autoMLSecurityConfig_vpcConfig = (AutoMLSecurityConfig -> Maybe VpcConfig)
-> (AutoMLSecurityConfig
    -> Maybe VpcConfig -> AutoMLSecurityConfig)
-> Lens
     AutoMLSecurityConfig
     AutoMLSecurityConfig
     (Maybe VpcConfig)
     (Maybe 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)

-- | The key used to encrypt stored data.
autoMLSecurityConfig_volumeKmsKeyId :: Lens.Lens' AutoMLSecurityConfig (Prelude.Maybe Prelude.Text)
autoMLSecurityConfig_volumeKmsKeyId :: (Maybe Text -> f (Maybe Text))
-> AutoMLSecurityConfig -> f AutoMLSecurityConfig
autoMLSecurityConfig_volumeKmsKeyId = (AutoMLSecurityConfig -> Maybe Text)
-> (AutoMLSecurityConfig -> Maybe Text -> AutoMLSecurityConfig)
-> Lens
     AutoMLSecurityConfig AutoMLSecurityConfig (Maybe Text) (Maybe Text)
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)

-- | Whether to use traffic encryption between the container layers.
autoMLSecurityConfig_enableInterContainerTrafficEncryption :: Lens.Lens' AutoMLSecurityConfig (Prelude.Maybe Prelude.Bool)
autoMLSecurityConfig_enableInterContainerTrafficEncryption :: (Maybe Bool -> f (Maybe Bool))
-> AutoMLSecurityConfig -> f AutoMLSecurityConfig
autoMLSecurityConfig_enableInterContainerTrafficEncryption = (AutoMLSecurityConfig -> Maybe Bool)
-> (AutoMLSecurityConfig -> Maybe Bool -> AutoMLSecurityConfig)
-> Lens
     AutoMLSecurityConfig AutoMLSecurityConfig (Maybe Bool) (Maybe Bool)
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)

instance Core.FromJSON AutoMLSecurityConfig where
  parseJSON :: Value -> Parser AutoMLSecurityConfig
parseJSON =
    String
-> (Object -> Parser AutoMLSecurityConfig)
-> Value
-> Parser AutoMLSecurityConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoMLSecurityConfig"
      ( \Object
x ->
          Maybe VpcConfig -> Maybe Text -> Maybe Bool -> AutoMLSecurityConfig
AutoMLSecurityConfig'
            (Maybe VpcConfig
 -> Maybe Text -> Maybe Bool -> AutoMLSecurityConfig)
-> Parser (Maybe VpcConfig)
-> Parser (Maybe Text -> Maybe Bool -> AutoMLSecurityConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VpcConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VpcConfig")
            Parser (Maybe Text -> Maybe Bool -> AutoMLSecurityConfig)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> AutoMLSecurityConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VolumeKmsKeyId")
            Parser (Maybe Bool -> AutoMLSecurityConfig)
-> Parser (Maybe Bool) -> Parser AutoMLSecurityConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EnableInterContainerTrafficEncryption")
      )

instance Prelude.Hashable AutoMLSecurityConfig

instance Prelude.NFData AutoMLSecurityConfig

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