{-# 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.MonitoringNetworkConfig
-- 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.MonitoringNetworkConfig where

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

-- | The networking configuration for the monitoring job.
--
-- /See:/ 'newMonitoringNetworkConfig' smart constructor.
data MonitoringNetworkConfig = MonitoringNetworkConfig'
  { -- | Whether to allow inbound and outbound network calls to and from the
    -- containers used for the monitoring job.
    MonitoringNetworkConfig -> Maybe Bool
enableNetworkIsolation :: Prelude.Maybe Prelude.Bool,
    MonitoringNetworkConfig -> Maybe VpcConfig
vpcConfig :: Prelude.Maybe VpcConfig,
    -- | Whether to encrypt all communications between the instances used for the
    -- monitoring jobs. Choose @True@ to encrypt communications. Encryption
    -- provides greater security for distributed jobs, but the processing might
    -- take longer.
    MonitoringNetworkConfig -> Maybe Bool
enableInterContainerTrafficEncryption :: Prelude.Maybe Prelude.Bool
  }
  deriving (MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool
(MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool)
-> (MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool)
-> Eq MonitoringNetworkConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool
$c/= :: MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool
== :: MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool
$c== :: MonitoringNetworkConfig -> MonitoringNetworkConfig -> Bool
Prelude.Eq, ReadPrec [MonitoringNetworkConfig]
ReadPrec MonitoringNetworkConfig
Int -> ReadS MonitoringNetworkConfig
ReadS [MonitoringNetworkConfig]
(Int -> ReadS MonitoringNetworkConfig)
-> ReadS [MonitoringNetworkConfig]
-> ReadPrec MonitoringNetworkConfig
-> ReadPrec [MonitoringNetworkConfig]
-> Read MonitoringNetworkConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringNetworkConfig]
$creadListPrec :: ReadPrec [MonitoringNetworkConfig]
readPrec :: ReadPrec MonitoringNetworkConfig
$creadPrec :: ReadPrec MonitoringNetworkConfig
readList :: ReadS [MonitoringNetworkConfig]
$creadList :: ReadS [MonitoringNetworkConfig]
readsPrec :: Int -> ReadS MonitoringNetworkConfig
$creadsPrec :: Int -> ReadS MonitoringNetworkConfig
Prelude.Read, Int -> MonitoringNetworkConfig -> ShowS
[MonitoringNetworkConfig] -> ShowS
MonitoringNetworkConfig -> String
(Int -> MonitoringNetworkConfig -> ShowS)
-> (MonitoringNetworkConfig -> String)
-> ([MonitoringNetworkConfig] -> ShowS)
-> Show MonitoringNetworkConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringNetworkConfig] -> ShowS
$cshowList :: [MonitoringNetworkConfig] -> ShowS
show :: MonitoringNetworkConfig -> String
$cshow :: MonitoringNetworkConfig -> String
showsPrec :: Int -> MonitoringNetworkConfig -> ShowS
$cshowsPrec :: Int -> MonitoringNetworkConfig -> ShowS
Prelude.Show, (forall x.
 MonitoringNetworkConfig -> Rep MonitoringNetworkConfig x)
-> (forall x.
    Rep MonitoringNetworkConfig x -> MonitoringNetworkConfig)
-> Generic MonitoringNetworkConfig
forall x. Rep MonitoringNetworkConfig x -> MonitoringNetworkConfig
forall x. MonitoringNetworkConfig -> Rep MonitoringNetworkConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonitoringNetworkConfig x -> MonitoringNetworkConfig
$cfrom :: forall x. MonitoringNetworkConfig -> Rep MonitoringNetworkConfig x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringNetworkConfig' 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:
--
-- 'enableNetworkIsolation', 'monitoringNetworkConfig_enableNetworkIsolation' - Whether to allow inbound and outbound network calls to and from the
-- containers used for the monitoring job.
--
-- 'vpcConfig', 'monitoringNetworkConfig_vpcConfig' - Undocumented member.
--
-- 'enableInterContainerTrafficEncryption', 'monitoringNetworkConfig_enableInterContainerTrafficEncryption' - Whether to encrypt all communications between the instances used for the
-- monitoring jobs. Choose @True@ to encrypt communications. Encryption
-- provides greater security for distributed jobs, but the processing might
-- take longer.
newMonitoringNetworkConfig ::
  MonitoringNetworkConfig
newMonitoringNetworkConfig :: MonitoringNetworkConfig
newMonitoringNetworkConfig =
  MonitoringNetworkConfig' :: Maybe Bool
-> Maybe VpcConfig -> Maybe Bool -> MonitoringNetworkConfig
MonitoringNetworkConfig'
    { $sel:enableNetworkIsolation:MonitoringNetworkConfig' :: Maybe Bool
enableNetworkIsolation =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfig:MonitoringNetworkConfig' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:enableInterContainerTrafficEncryption:MonitoringNetworkConfig' :: Maybe Bool
enableInterContainerTrafficEncryption =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | Whether to allow inbound and outbound network calls to and from the
-- containers used for the monitoring job.
monitoringNetworkConfig_enableNetworkIsolation :: Lens.Lens' MonitoringNetworkConfig (Prelude.Maybe Prelude.Bool)
monitoringNetworkConfig_enableNetworkIsolation :: (Maybe Bool -> f (Maybe Bool))
-> MonitoringNetworkConfig -> f MonitoringNetworkConfig
monitoringNetworkConfig_enableNetworkIsolation = (MonitoringNetworkConfig -> Maybe Bool)
-> (MonitoringNetworkConfig
    -> Maybe Bool -> MonitoringNetworkConfig)
-> Lens
     MonitoringNetworkConfig
     MonitoringNetworkConfig
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringNetworkConfig' {Maybe Bool
enableNetworkIsolation :: Maybe Bool
$sel:enableNetworkIsolation:MonitoringNetworkConfig' :: MonitoringNetworkConfig -> Maybe Bool
enableNetworkIsolation} -> Maybe Bool
enableNetworkIsolation) (\s :: MonitoringNetworkConfig
s@MonitoringNetworkConfig' {} Maybe Bool
a -> MonitoringNetworkConfig
s {$sel:enableNetworkIsolation:MonitoringNetworkConfig' :: Maybe Bool
enableNetworkIsolation = Maybe Bool
a} :: MonitoringNetworkConfig)

-- | Undocumented member.
monitoringNetworkConfig_vpcConfig :: Lens.Lens' MonitoringNetworkConfig (Prelude.Maybe VpcConfig)
monitoringNetworkConfig_vpcConfig :: (Maybe VpcConfig -> f (Maybe VpcConfig))
-> MonitoringNetworkConfig -> f MonitoringNetworkConfig
monitoringNetworkConfig_vpcConfig = (MonitoringNetworkConfig -> Maybe VpcConfig)
-> (MonitoringNetworkConfig
    -> Maybe VpcConfig -> MonitoringNetworkConfig)
-> Lens
     MonitoringNetworkConfig
     MonitoringNetworkConfig
     (Maybe VpcConfig)
     (Maybe VpcConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringNetworkConfig' {Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
$sel:vpcConfig:MonitoringNetworkConfig' :: MonitoringNetworkConfig -> Maybe VpcConfig
vpcConfig} -> Maybe VpcConfig
vpcConfig) (\s :: MonitoringNetworkConfig
s@MonitoringNetworkConfig' {} Maybe VpcConfig
a -> MonitoringNetworkConfig
s {$sel:vpcConfig:MonitoringNetworkConfig' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
a} :: MonitoringNetworkConfig)

-- | Whether to encrypt all communications between the instances used for the
-- monitoring jobs. Choose @True@ to encrypt communications. Encryption
-- provides greater security for distributed jobs, but the processing might
-- take longer.
monitoringNetworkConfig_enableInterContainerTrafficEncryption :: Lens.Lens' MonitoringNetworkConfig (Prelude.Maybe Prelude.Bool)
monitoringNetworkConfig_enableInterContainerTrafficEncryption :: (Maybe Bool -> f (Maybe Bool))
-> MonitoringNetworkConfig -> f MonitoringNetworkConfig
monitoringNetworkConfig_enableInterContainerTrafficEncryption = (MonitoringNetworkConfig -> Maybe Bool)
-> (MonitoringNetworkConfig
    -> Maybe Bool -> MonitoringNetworkConfig)
-> Lens
     MonitoringNetworkConfig
     MonitoringNetworkConfig
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringNetworkConfig' {Maybe Bool
enableInterContainerTrafficEncryption :: Maybe Bool
$sel:enableInterContainerTrafficEncryption:MonitoringNetworkConfig' :: MonitoringNetworkConfig -> Maybe Bool
enableInterContainerTrafficEncryption} -> Maybe Bool
enableInterContainerTrafficEncryption) (\s :: MonitoringNetworkConfig
s@MonitoringNetworkConfig' {} Maybe Bool
a -> MonitoringNetworkConfig
s {$sel:enableInterContainerTrafficEncryption:MonitoringNetworkConfig' :: Maybe Bool
enableInterContainerTrafficEncryption = Maybe Bool
a} :: MonitoringNetworkConfig)

instance Core.FromJSON MonitoringNetworkConfig where
  parseJSON :: Value -> Parser MonitoringNetworkConfig
parseJSON =
    String
-> (Object -> Parser MonitoringNetworkConfig)
-> Value
-> Parser MonitoringNetworkConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringNetworkConfig"
      ( \Object
x ->
          Maybe Bool
-> Maybe VpcConfig -> Maybe Bool -> MonitoringNetworkConfig
MonitoringNetworkConfig'
            (Maybe Bool
 -> Maybe VpcConfig -> Maybe Bool -> MonitoringNetworkConfig)
-> Parser (Maybe Bool)
-> Parser
     (Maybe VpcConfig -> Maybe Bool -> MonitoringNetworkConfig)
forall (f :: * -> *) a b. Functor 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
"EnableNetworkIsolation")
            Parser (Maybe VpcConfig -> Maybe Bool -> MonitoringNetworkConfig)
-> Parser (Maybe VpcConfig)
-> Parser (Maybe Bool -> MonitoringNetworkConfig)
forall (f :: * -> *) a b. Applicative f => 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 Bool -> MonitoringNetworkConfig)
-> Parser (Maybe Bool) -> Parser MonitoringNetworkConfig
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 MonitoringNetworkConfig

instance Prelude.NFData MonitoringNetworkConfig

instance Core.ToJSON MonitoringNetworkConfig where
  toJSON :: MonitoringNetworkConfig -> Value
toJSON MonitoringNetworkConfig' {Maybe Bool
Maybe VpcConfig
enableInterContainerTrafficEncryption :: Maybe Bool
vpcConfig :: Maybe VpcConfig
enableNetworkIsolation :: Maybe Bool
$sel:enableInterContainerTrafficEncryption:MonitoringNetworkConfig' :: MonitoringNetworkConfig -> Maybe Bool
$sel:vpcConfig:MonitoringNetworkConfig' :: MonitoringNetworkConfig -> Maybe VpcConfig
$sel:enableNetworkIsolation:MonitoringNetworkConfig' :: MonitoringNetworkConfig -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EnableNetworkIsolation" 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
enableNetworkIsolation,
            (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
"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
          ]
      )