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

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

-- | Configuration for the cluster used to run model monitoring jobs.
--
-- /See:/ 'newMonitoringClusterConfig' smart constructor.
data MonitoringClusterConfig = MonitoringClusterConfig'
  { -- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
    -- key that Amazon SageMaker uses to encrypt data on the storage volume
    -- attached to the ML compute instance(s) that run the model monitoring
    -- job.
    MonitoringClusterConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The number of ML compute instances to use in the model monitoring job.
    -- For distributed processing jobs, specify a value greater than 1. The
    -- default value is 1.
    MonitoringClusterConfig -> Natural
instanceCount :: Prelude.Natural,
    -- | The ML compute instance type for the processing job.
    MonitoringClusterConfig -> ProcessingInstanceType
instanceType :: ProcessingInstanceType,
    -- | The size of the ML storage volume, in gigabytes, that you want to
    -- provision. You must specify sufficient ML storage for your scenario.
    MonitoringClusterConfig -> Natural
volumeSizeInGB :: Prelude.Natural
  }
  deriving (MonitoringClusterConfig -> MonitoringClusterConfig -> Bool
(MonitoringClusterConfig -> MonitoringClusterConfig -> Bool)
-> (MonitoringClusterConfig -> MonitoringClusterConfig -> Bool)
-> Eq MonitoringClusterConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringClusterConfig -> MonitoringClusterConfig -> Bool
$c/= :: MonitoringClusterConfig -> MonitoringClusterConfig -> Bool
== :: MonitoringClusterConfig -> MonitoringClusterConfig -> Bool
$c== :: MonitoringClusterConfig -> MonitoringClusterConfig -> Bool
Prelude.Eq, ReadPrec [MonitoringClusterConfig]
ReadPrec MonitoringClusterConfig
Int -> ReadS MonitoringClusterConfig
ReadS [MonitoringClusterConfig]
(Int -> ReadS MonitoringClusterConfig)
-> ReadS [MonitoringClusterConfig]
-> ReadPrec MonitoringClusterConfig
-> ReadPrec [MonitoringClusterConfig]
-> Read MonitoringClusterConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringClusterConfig]
$creadListPrec :: ReadPrec [MonitoringClusterConfig]
readPrec :: ReadPrec MonitoringClusterConfig
$creadPrec :: ReadPrec MonitoringClusterConfig
readList :: ReadS [MonitoringClusterConfig]
$creadList :: ReadS [MonitoringClusterConfig]
readsPrec :: Int -> ReadS MonitoringClusterConfig
$creadsPrec :: Int -> ReadS MonitoringClusterConfig
Prelude.Read, Int -> MonitoringClusterConfig -> ShowS
[MonitoringClusterConfig] -> ShowS
MonitoringClusterConfig -> String
(Int -> MonitoringClusterConfig -> ShowS)
-> (MonitoringClusterConfig -> String)
-> ([MonitoringClusterConfig] -> ShowS)
-> Show MonitoringClusterConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringClusterConfig] -> ShowS
$cshowList :: [MonitoringClusterConfig] -> ShowS
show :: MonitoringClusterConfig -> String
$cshow :: MonitoringClusterConfig -> String
showsPrec :: Int -> MonitoringClusterConfig -> ShowS
$cshowsPrec :: Int -> MonitoringClusterConfig -> ShowS
Prelude.Show, (forall x.
 MonitoringClusterConfig -> Rep MonitoringClusterConfig x)
-> (forall x.
    Rep MonitoringClusterConfig x -> MonitoringClusterConfig)
-> Generic MonitoringClusterConfig
forall x. Rep MonitoringClusterConfig x -> MonitoringClusterConfig
forall x. MonitoringClusterConfig -> Rep MonitoringClusterConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonitoringClusterConfig x -> MonitoringClusterConfig
$cfrom :: forall x. MonitoringClusterConfig -> Rep MonitoringClusterConfig x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringClusterConfig' 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:
--
-- 'volumeKmsKeyId', 'monitoringClusterConfig_volumeKmsKeyId' - The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt data on the storage volume
-- attached to the ML compute instance(s) that run the model monitoring
-- job.
--
-- 'instanceCount', 'monitoringClusterConfig_instanceCount' - The number of ML compute instances to use in the model monitoring job.
-- For distributed processing jobs, specify a value greater than 1. The
-- default value is 1.
--
-- 'instanceType', 'monitoringClusterConfig_instanceType' - The ML compute instance type for the processing job.
--
-- 'volumeSizeInGB', 'monitoringClusterConfig_volumeSizeInGB' - The size of the ML storage volume, in gigabytes, that you want to
-- provision. You must specify sufficient ML storage for your scenario.
newMonitoringClusterConfig ::
  -- | 'instanceCount'
  Prelude.Natural ->
  -- | 'instanceType'
  ProcessingInstanceType ->
  -- | 'volumeSizeInGB'
  Prelude.Natural ->
  MonitoringClusterConfig
newMonitoringClusterConfig :: Natural
-> ProcessingInstanceType -> Natural -> MonitoringClusterConfig
newMonitoringClusterConfig
  Natural
pInstanceCount_
  ProcessingInstanceType
pInstanceType_
  Natural
pVolumeSizeInGB_ =
    MonitoringClusterConfig' :: Maybe Text
-> Natural
-> ProcessingInstanceType
-> Natural
-> MonitoringClusterConfig
MonitoringClusterConfig'
      { $sel:volumeKmsKeyId:MonitoringClusterConfig' :: Maybe Text
volumeKmsKeyId =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceCount:MonitoringClusterConfig' :: Natural
instanceCount = Natural
pInstanceCount_,
        $sel:instanceType:MonitoringClusterConfig' :: ProcessingInstanceType
instanceType = ProcessingInstanceType
pInstanceType_,
        $sel:volumeSizeInGB:MonitoringClusterConfig' :: Natural
volumeSizeInGB = Natural
pVolumeSizeInGB_
      }

-- | The Amazon Web Services Key Management Service (Amazon Web Services KMS)
-- key that Amazon SageMaker uses to encrypt data on the storage volume
-- attached to the ML compute instance(s) that run the model monitoring
-- job.
monitoringClusterConfig_volumeKmsKeyId :: Lens.Lens' MonitoringClusterConfig (Prelude.Maybe Prelude.Text)
monitoringClusterConfig_volumeKmsKeyId :: (Maybe Text -> f (Maybe Text))
-> MonitoringClusterConfig -> f MonitoringClusterConfig
monitoringClusterConfig_volumeKmsKeyId = (MonitoringClusterConfig -> Maybe Text)
-> (MonitoringClusterConfig
    -> Maybe Text -> MonitoringClusterConfig)
-> Lens
     MonitoringClusterConfig
     MonitoringClusterConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringClusterConfig' {Maybe Text
volumeKmsKeyId :: Maybe Text
$sel:volumeKmsKeyId:MonitoringClusterConfig' :: MonitoringClusterConfig -> Maybe Text
volumeKmsKeyId} -> Maybe Text
volumeKmsKeyId) (\s :: MonitoringClusterConfig
s@MonitoringClusterConfig' {} Maybe Text
a -> MonitoringClusterConfig
s {$sel:volumeKmsKeyId:MonitoringClusterConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
a} :: MonitoringClusterConfig)

-- | The number of ML compute instances to use in the model monitoring job.
-- For distributed processing jobs, specify a value greater than 1. The
-- default value is 1.
monitoringClusterConfig_instanceCount :: Lens.Lens' MonitoringClusterConfig Prelude.Natural
monitoringClusterConfig_instanceCount :: (Natural -> f Natural)
-> MonitoringClusterConfig -> f MonitoringClusterConfig
monitoringClusterConfig_instanceCount = (MonitoringClusterConfig -> Natural)
-> (MonitoringClusterConfig -> Natural -> MonitoringClusterConfig)
-> Lens
     MonitoringClusterConfig MonitoringClusterConfig Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringClusterConfig' {Natural
instanceCount :: Natural
$sel:instanceCount:MonitoringClusterConfig' :: MonitoringClusterConfig -> Natural
instanceCount} -> Natural
instanceCount) (\s :: MonitoringClusterConfig
s@MonitoringClusterConfig' {} Natural
a -> MonitoringClusterConfig
s {$sel:instanceCount:MonitoringClusterConfig' :: Natural
instanceCount = Natural
a} :: MonitoringClusterConfig)

-- | The ML compute instance type for the processing job.
monitoringClusterConfig_instanceType :: Lens.Lens' MonitoringClusterConfig ProcessingInstanceType
monitoringClusterConfig_instanceType :: (ProcessingInstanceType -> f ProcessingInstanceType)
-> MonitoringClusterConfig -> f MonitoringClusterConfig
monitoringClusterConfig_instanceType = (MonitoringClusterConfig -> ProcessingInstanceType)
-> (MonitoringClusterConfig
    -> ProcessingInstanceType -> MonitoringClusterConfig)
-> Lens
     MonitoringClusterConfig
     MonitoringClusterConfig
     ProcessingInstanceType
     ProcessingInstanceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringClusterConfig' {ProcessingInstanceType
instanceType :: ProcessingInstanceType
$sel:instanceType:MonitoringClusterConfig' :: MonitoringClusterConfig -> ProcessingInstanceType
instanceType} -> ProcessingInstanceType
instanceType) (\s :: MonitoringClusterConfig
s@MonitoringClusterConfig' {} ProcessingInstanceType
a -> MonitoringClusterConfig
s {$sel:instanceType:MonitoringClusterConfig' :: ProcessingInstanceType
instanceType = ProcessingInstanceType
a} :: MonitoringClusterConfig)

-- | The size of the ML storage volume, in gigabytes, that you want to
-- provision. You must specify sufficient ML storage for your scenario.
monitoringClusterConfig_volumeSizeInGB :: Lens.Lens' MonitoringClusterConfig Prelude.Natural
monitoringClusterConfig_volumeSizeInGB :: (Natural -> f Natural)
-> MonitoringClusterConfig -> f MonitoringClusterConfig
monitoringClusterConfig_volumeSizeInGB = (MonitoringClusterConfig -> Natural)
-> (MonitoringClusterConfig -> Natural -> MonitoringClusterConfig)
-> Lens
     MonitoringClusterConfig MonitoringClusterConfig Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringClusterConfig' {Natural
volumeSizeInGB :: Natural
$sel:volumeSizeInGB:MonitoringClusterConfig' :: MonitoringClusterConfig -> Natural
volumeSizeInGB} -> Natural
volumeSizeInGB) (\s :: MonitoringClusterConfig
s@MonitoringClusterConfig' {} Natural
a -> MonitoringClusterConfig
s {$sel:volumeSizeInGB:MonitoringClusterConfig' :: Natural
volumeSizeInGB = Natural
a} :: MonitoringClusterConfig)

instance Core.FromJSON MonitoringClusterConfig where
  parseJSON :: Value -> Parser MonitoringClusterConfig
parseJSON =
    String
-> (Object -> Parser MonitoringClusterConfig)
-> Value
-> Parser MonitoringClusterConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringClusterConfig"
      ( \Object
x ->
          Maybe Text
-> Natural
-> ProcessingInstanceType
-> Natural
-> MonitoringClusterConfig
MonitoringClusterConfig'
            (Maybe Text
 -> Natural
 -> ProcessingInstanceType
 -> Natural
 -> MonitoringClusterConfig)
-> Parser (Maybe Text)
-> Parser
     (Natural
      -> ProcessingInstanceType -> Natural -> MonitoringClusterConfig)
forall (f :: * -> *) a b. Functor 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
  (Natural
   -> ProcessingInstanceType -> Natural -> MonitoringClusterConfig)
-> Parser Natural
-> Parser
     (ProcessingInstanceType -> Natural -> MonitoringClusterConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InstanceCount")
            Parser
  (ProcessingInstanceType -> Natural -> MonitoringClusterConfig)
-> Parser ProcessingInstanceType
-> Parser (Natural -> MonitoringClusterConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ProcessingInstanceType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"InstanceType")
            Parser (Natural -> MonitoringClusterConfig)
-> Parser Natural -> Parser MonitoringClusterConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Natural
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"VolumeSizeInGB")
      )

instance Prelude.Hashable MonitoringClusterConfig

instance Prelude.NFData MonitoringClusterConfig

instance Core.ToJSON MonitoringClusterConfig where
  toJSON :: MonitoringClusterConfig -> Value
toJSON MonitoringClusterConfig' {Natural
Maybe Text
ProcessingInstanceType
volumeSizeInGB :: Natural
instanceType :: ProcessingInstanceType
instanceCount :: Natural
volumeKmsKeyId :: Maybe Text
$sel:volumeSizeInGB:MonitoringClusterConfig' :: MonitoringClusterConfig -> Natural
$sel:instanceType:MonitoringClusterConfig' :: MonitoringClusterConfig -> ProcessingInstanceType
$sel:instanceCount:MonitoringClusterConfig' :: MonitoringClusterConfig -> Natural
$sel:volumeKmsKeyId:MonitoringClusterConfig' :: MonitoringClusterConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceCount" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
instanceCount),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceType" Text -> ProcessingInstanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ProcessingInstanceType
instanceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"VolumeSizeInGB" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
volumeSizeInGB)
          ]
      )