{-# 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.HyperParameterTuningResourceConfig
-- 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.HyperParameterTuningResourceConfig 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.HyperParameterTuningAllocationStrategy
import Amazonka.SageMaker.Types.HyperParameterTuningInstanceConfig
import Amazonka.SageMaker.Types.TrainingInstanceType

-- | The configuration of resources, including compute instances and storage
-- volumes for use in training jobs launched by hyperparameter tuning jobs.
-- @HyperParameterTuningResourceConfig@ is similar to @ResourceConfig@, but
-- has the additional @InstanceConfigs@ and @AllocationStrategy@ fields to
-- allow for flexible instance management. Specify one or more instance
-- types, count, and the allocation strategy for instance selection.
--
-- @HyperParameterTuningResourceConfig@ supports the capabilities of
-- @ResourceConfig@ with the exception of @KeepAlivePeriodInSeconds@.
-- Hyperparameter tuning jobs use warm pools by default, which reuse
-- clusters between training jobs.
--
-- /See:/ 'newHyperParameterTuningResourceConfig' smart constructor.
data HyperParameterTuningResourceConfig = HyperParameterTuningResourceConfig'
  { -- | The strategy that determines the order of preference for resources
    -- specified in @InstanceConfigs@ used in hyperparameter optimization.
    HyperParameterTuningResourceConfig
-> Maybe HyperParameterTuningAllocationStrategy
allocationStrategy :: Prelude.Maybe HyperParameterTuningAllocationStrategy,
    -- | A list containing the configuration(s) for one or more resources for
    -- processing hyperparameter jobs. These resources include compute
    -- instances and storage volumes to use in model training jobs launched by
    -- hyperparameter tuning jobs. The @AllocationStrategy@ controls the order
    -- in which multiple configurations provided in @InstanceConfigs@ are used.
    --
    -- If you only want to use a single instance configuration inside the
    -- @HyperParameterTuningResourceConfig@ API, do not provide a value for
    -- @InstanceConfigs@. Instead, use @InstanceType@, @VolumeSizeInGB@ and
    -- @InstanceCount@. If you use @InstanceConfigs@, do not provide values for
    -- @InstanceType@, @VolumeSizeInGB@ or @InstanceCount@.
    HyperParameterTuningResourceConfig
-> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs :: Prelude.Maybe (Prelude.NonEmpty HyperParameterTuningInstanceConfig),
    -- | The number of compute instances of type @InstanceType@ to use. For
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/data-parallel-use-api.html distributed training>,
    -- select a value greater than 1.
    HyperParameterTuningResourceConfig -> Maybe Natural
instanceCount :: Prelude.Maybe Prelude.Natural,
    -- | The instance type used to run hyperparameter optimization tuning jobs.
    -- See
    -- <https://docs.aws.amazon.com/notebooks-available-instance-types.html descriptions of instance types>
    -- for more information.
    HyperParameterTuningResourceConfig -> Maybe TrainingInstanceType
instanceType :: Prelude.Maybe TrainingInstanceType,
    -- | A key used by Amazon Web Services Key Management Service to encrypt data
    -- on the storage volume attached to the compute instances used to run the
    -- training job. You can use either of the following formats to specify a
    -- key.
    --
    -- KMS Key ID:
    --
    -- @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
    --
    -- Amazon Resource Name (ARN) of a KMS key:
    --
    -- @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
    --
    -- Some instances use local storage, which use a
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html hardware module to encrypt>
    -- storage volumes. If you choose one of these instance types, you cannot
    -- request a @VolumeKmsKeyId@. For a list of instance types that use local
    -- storage, see
    -- <http://aws.amazon.com/releasenotes/host-instance-storage-volumes-table/ instance store volumes>.
    -- For more information about Amazon Web Services Key Management Service,
    -- see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security-kms-permissions.html KMS encryption>
    -- for more information.
    HyperParameterTuningResourceConfig -> Maybe Text
volumeKmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The volume size in GB for the storage volume to be used in processing
    -- hyperparameter optimization jobs (optional). These volumes store model
    -- artifacts, incremental states and optionally, scratch space for training
    -- algorithms. Do not provide a value for this parameter if a value for
    -- @InstanceConfigs@ is also specified.
    --
    -- Some instance types have a fixed total local storage size. If you select
    -- one of these instances for training, @VolumeSizeInGB@ cannot be greater
    -- than this total size. For a list of instance types with local instance
    -- storage and their sizes, see
    -- <http://aws.amazon.com/releasenotes/host-instance-storage-volumes-table/ instance store volumes>.
    --
    -- SageMaker supports only the
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html General Purpose SSD (gp2)>
    -- storage volume type.
    HyperParameterTuningResourceConfig -> Maybe Natural
volumeSizeInGB :: Prelude.Maybe Prelude.Natural
  }
  deriving (HyperParameterTuningResourceConfig
-> HyperParameterTuningResourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HyperParameterTuningResourceConfig
-> HyperParameterTuningResourceConfig -> Bool
$c/= :: HyperParameterTuningResourceConfig
-> HyperParameterTuningResourceConfig -> Bool
== :: HyperParameterTuningResourceConfig
-> HyperParameterTuningResourceConfig -> Bool
$c== :: HyperParameterTuningResourceConfig
-> HyperParameterTuningResourceConfig -> Bool
Prelude.Eq, ReadPrec [HyperParameterTuningResourceConfig]
ReadPrec HyperParameterTuningResourceConfig
Int -> ReadS HyperParameterTuningResourceConfig
ReadS [HyperParameterTuningResourceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HyperParameterTuningResourceConfig]
$creadListPrec :: ReadPrec [HyperParameterTuningResourceConfig]
readPrec :: ReadPrec HyperParameterTuningResourceConfig
$creadPrec :: ReadPrec HyperParameterTuningResourceConfig
readList :: ReadS [HyperParameterTuningResourceConfig]
$creadList :: ReadS [HyperParameterTuningResourceConfig]
readsPrec :: Int -> ReadS HyperParameterTuningResourceConfig
$creadsPrec :: Int -> ReadS HyperParameterTuningResourceConfig
Prelude.Read, Int -> HyperParameterTuningResourceConfig -> ShowS
[HyperParameterTuningResourceConfig] -> ShowS
HyperParameterTuningResourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HyperParameterTuningResourceConfig] -> ShowS
$cshowList :: [HyperParameterTuningResourceConfig] -> ShowS
show :: HyperParameterTuningResourceConfig -> String
$cshow :: HyperParameterTuningResourceConfig -> String
showsPrec :: Int -> HyperParameterTuningResourceConfig -> ShowS
$cshowsPrec :: Int -> HyperParameterTuningResourceConfig -> ShowS
Prelude.Show, forall x.
Rep HyperParameterTuningResourceConfig x
-> HyperParameterTuningResourceConfig
forall x.
HyperParameterTuningResourceConfig
-> Rep HyperParameterTuningResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HyperParameterTuningResourceConfig x
-> HyperParameterTuningResourceConfig
$cfrom :: forall x.
HyperParameterTuningResourceConfig
-> Rep HyperParameterTuningResourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'HyperParameterTuningResourceConfig' 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:
--
-- 'allocationStrategy', 'hyperParameterTuningResourceConfig_allocationStrategy' - The strategy that determines the order of preference for resources
-- specified in @InstanceConfigs@ used in hyperparameter optimization.
--
-- 'instanceConfigs', 'hyperParameterTuningResourceConfig_instanceConfigs' - A list containing the configuration(s) for one or more resources for
-- processing hyperparameter jobs. These resources include compute
-- instances and storage volumes to use in model training jobs launched by
-- hyperparameter tuning jobs. The @AllocationStrategy@ controls the order
-- in which multiple configurations provided in @InstanceConfigs@ are used.
--
-- If you only want to use a single instance configuration inside the
-- @HyperParameterTuningResourceConfig@ API, do not provide a value for
-- @InstanceConfigs@. Instead, use @InstanceType@, @VolumeSizeInGB@ and
-- @InstanceCount@. If you use @InstanceConfigs@, do not provide values for
-- @InstanceType@, @VolumeSizeInGB@ or @InstanceCount@.
--
-- 'instanceCount', 'hyperParameterTuningResourceConfig_instanceCount' - The number of compute instances of type @InstanceType@ to use. For
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/data-parallel-use-api.html distributed training>,
-- select a value greater than 1.
--
-- 'instanceType', 'hyperParameterTuningResourceConfig_instanceType' - The instance type used to run hyperparameter optimization tuning jobs.
-- See
-- <https://docs.aws.amazon.com/notebooks-available-instance-types.html descriptions of instance types>
-- for more information.
--
-- 'volumeKmsKeyId', 'hyperParameterTuningResourceConfig_volumeKmsKeyId' - A key used by Amazon Web Services Key Management Service to encrypt data
-- on the storage volume attached to the compute instances used to run the
-- training job. You can use either of the following formats to specify a
-- key.
--
-- KMS Key ID:
--
-- @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- Amazon Resource Name (ARN) of a KMS key:
--
-- @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- Some instances use local storage, which use a
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html hardware module to encrypt>
-- storage volumes. If you choose one of these instance types, you cannot
-- request a @VolumeKmsKeyId@. For a list of instance types that use local
-- storage, see
-- <http://aws.amazon.com/releasenotes/host-instance-storage-volumes-table/ instance store volumes>.
-- For more information about Amazon Web Services Key Management Service,
-- see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security-kms-permissions.html KMS encryption>
-- for more information.
--
-- 'volumeSizeInGB', 'hyperParameterTuningResourceConfig_volumeSizeInGB' - The volume size in GB for the storage volume to be used in processing
-- hyperparameter optimization jobs (optional). These volumes store model
-- artifacts, incremental states and optionally, scratch space for training
-- algorithms. Do not provide a value for this parameter if a value for
-- @InstanceConfigs@ is also specified.
--
-- Some instance types have a fixed total local storage size. If you select
-- one of these instances for training, @VolumeSizeInGB@ cannot be greater
-- than this total size. For a list of instance types with local instance
-- storage and their sizes, see
-- <http://aws.amazon.com/releasenotes/host-instance-storage-volumes-table/ instance store volumes>.
--
-- SageMaker supports only the
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html General Purpose SSD (gp2)>
-- storage volume type.
newHyperParameterTuningResourceConfig ::
  HyperParameterTuningResourceConfig
newHyperParameterTuningResourceConfig :: HyperParameterTuningResourceConfig
newHyperParameterTuningResourceConfig =
  HyperParameterTuningResourceConfig'
    { $sel:allocationStrategy:HyperParameterTuningResourceConfig' :: Maybe HyperParameterTuningAllocationStrategy
allocationStrategy =
        forall a. Maybe a
Prelude.Nothing,
      $sel:instanceConfigs:HyperParameterTuningResourceConfig' :: Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceCount:HyperParameterTuningResourceConfig' :: Maybe Natural
instanceCount = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceType:HyperParameterTuningResourceConfig' :: Maybe TrainingInstanceType
instanceType = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeKmsKeyId:HyperParameterTuningResourceConfig' :: Maybe Text
volumeKmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:volumeSizeInGB:HyperParameterTuningResourceConfig' :: Maybe Natural
volumeSizeInGB = forall a. Maybe a
Prelude.Nothing
    }

-- | The strategy that determines the order of preference for resources
-- specified in @InstanceConfigs@ used in hyperparameter optimization.
hyperParameterTuningResourceConfig_allocationStrategy :: Lens.Lens' HyperParameterTuningResourceConfig (Prelude.Maybe HyperParameterTuningAllocationStrategy)
hyperParameterTuningResourceConfig_allocationStrategy :: Lens'
  HyperParameterTuningResourceConfig
  (Maybe HyperParameterTuningAllocationStrategy)
hyperParameterTuningResourceConfig_allocationStrategy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningResourceConfig' {Maybe HyperParameterTuningAllocationStrategy
allocationStrategy :: Maybe HyperParameterTuningAllocationStrategy
$sel:allocationStrategy:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe HyperParameterTuningAllocationStrategy
allocationStrategy} -> Maybe HyperParameterTuningAllocationStrategy
allocationStrategy) (\s :: HyperParameterTuningResourceConfig
s@HyperParameterTuningResourceConfig' {} Maybe HyperParameterTuningAllocationStrategy
a -> HyperParameterTuningResourceConfig
s {$sel:allocationStrategy:HyperParameterTuningResourceConfig' :: Maybe HyperParameterTuningAllocationStrategy
allocationStrategy = Maybe HyperParameterTuningAllocationStrategy
a} :: HyperParameterTuningResourceConfig)

-- | A list containing the configuration(s) for one or more resources for
-- processing hyperparameter jobs. These resources include compute
-- instances and storage volumes to use in model training jobs launched by
-- hyperparameter tuning jobs. The @AllocationStrategy@ controls the order
-- in which multiple configurations provided in @InstanceConfigs@ are used.
--
-- If you only want to use a single instance configuration inside the
-- @HyperParameterTuningResourceConfig@ API, do not provide a value for
-- @InstanceConfigs@. Instead, use @InstanceType@, @VolumeSizeInGB@ and
-- @InstanceCount@. If you use @InstanceConfigs@, do not provide values for
-- @InstanceType@, @VolumeSizeInGB@ or @InstanceCount@.
hyperParameterTuningResourceConfig_instanceConfigs :: Lens.Lens' HyperParameterTuningResourceConfig (Prelude.Maybe (Prelude.NonEmpty HyperParameterTuningInstanceConfig))
hyperParameterTuningResourceConfig_instanceConfigs :: Lens'
  HyperParameterTuningResourceConfig
  (Maybe (NonEmpty HyperParameterTuningInstanceConfig))
hyperParameterTuningResourceConfig_instanceConfigs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningResourceConfig' {Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs :: Maybe (NonEmpty HyperParameterTuningInstanceConfig)
$sel:instanceConfigs:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs} -> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs) (\s :: HyperParameterTuningResourceConfig
s@HyperParameterTuningResourceConfig' {} Maybe (NonEmpty HyperParameterTuningInstanceConfig)
a -> HyperParameterTuningResourceConfig
s {$sel:instanceConfigs:HyperParameterTuningResourceConfig' :: Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs = Maybe (NonEmpty HyperParameterTuningInstanceConfig)
a} :: HyperParameterTuningResourceConfig) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of compute instances of type @InstanceType@ to use. For
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/data-parallel-use-api.html distributed training>,
-- select a value greater than 1.
hyperParameterTuningResourceConfig_instanceCount :: Lens.Lens' HyperParameterTuningResourceConfig (Prelude.Maybe Prelude.Natural)
hyperParameterTuningResourceConfig_instanceCount :: Lens' HyperParameterTuningResourceConfig (Maybe Natural)
hyperParameterTuningResourceConfig_instanceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningResourceConfig' {Maybe Natural
instanceCount :: Maybe Natural
$sel:instanceCount:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
instanceCount} -> Maybe Natural
instanceCount) (\s :: HyperParameterTuningResourceConfig
s@HyperParameterTuningResourceConfig' {} Maybe Natural
a -> HyperParameterTuningResourceConfig
s {$sel:instanceCount:HyperParameterTuningResourceConfig' :: Maybe Natural
instanceCount = Maybe Natural
a} :: HyperParameterTuningResourceConfig)

-- | The instance type used to run hyperparameter optimization tuning jobs.
-- See
-- <https://docs.aws.amazon.com/notebooks-available-instance-types.html descriptions of instance types>
-- for more information.
hyperParameterTuningResourceConfig_instanceType :: Lens.Lens' HyperParameterTuningResourceConfig (Prelude.Maybe TrainingInstanceType)
hyperParameterTuningResourceConfig_instanceType :: Lens'
  HyperParameterTuningResourceConfig (Maybe TrainingInstanceType)
hyperParameterTuningResourceConfig_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningResourceConfig' {Maybe TrainingInstanceType
instanceType :: Maybe TrainingInstanceType
$sel:instanceType:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe TrainingInstanceType
instanceType} -> Maybe TrainingInstanceType
instanceType) (\s :: HyperParameterTuningResourceConfig
s@HyperParameterTuningResourceConfig' {} Maybe TrainingInstanceType
a -> HyperParameterTuningResourceConfig
s {$sel:instanceType:HyperParameterTuningResourceConfig' :: Maybe TrainingInstanceType
instanceType = Maybe TrainingInstanceType
a} :: HyperParameterTuningResourceConfig)

-- | A key used by Amazon Web Services Key Management Service to encrypt data
-- on the storage volume attached to the compute instances used to run the
-- training job. You can use either of the following formats to specify a
-- key.
--
-- KMS Key ID:
--
-- @\"1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- Amazon Resource Name (ARN) of a KMS key:
--
-- @\"arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab\"@
--
-- Some instances use local storage, which use a
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html hardware module to encrypt>
-- storage volumes. If you choose one of these instance types, you cannot
-- request a @VolumeKmsKeyId@. For a list of instance types that use local
-- storage, see
-- <http://aws.amazon.com/releasenotes/host-instance-storage-volumes-table/ instance store volumes>.
-- For more information about Amazon Web Services Key Management Service,
-- see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-security-kms-permissions.html KMS encryption>
-- for more information.
hyperParameterTuningResourceConfig_volumeKmsKeyId :: Lens.Lens' HyperParameterTuningResourceConfig (Prelude.Maybe Prelude.Text)
hyperParameterTuningResourceConfig_volumeKmsKeyId :: Lens' HyperParameterTuningResourceConfig (Maybe Text)
hyperParameterTuningResourceConfig_volumeKmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningResourceConfig' {Maybe Text
volumeKmsKeyId :: Maybe Text
$sel:volumeKmsKeyId:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Text
volumeKmsKeyId} -> Maybe Text
volumeKmsKeyId) (\s :: HyperParameterTuningResourceConfig
s@HyperParameterTuningResourceConfig' {} Maybe Text
a -> HyperParameterTuningResourceConfig
s {$sel:volumeKmsKeyId:HyperParameterTuningResourceConfig' :: Maybe Text
volumeKmsKeyId = Maybe Text
a} :: HyperParameterTuningResourceConfig)

-- | The volume size in GB for the storage volume to be used in processing
-- hyperparameter optimization jobs (optional). These volumes store model
-- artifacts, incremental states and optionally, scratch space for training
-- algorithms. Do not provide a value for this parameter if a value for
-- @InstanceConfigs@ is also specified.
--
-- Some instance types have a fixed total local storage size. If you select
-- one of these instances for training, @VolumeSizeInGB@ cannot be greater
-- than this total size. For a list of instance types with local instance
-- storage and their sizes, see
-- <http://aws.amazon.com/releasenotes/host-instance-storage-volumes-table/ instance store volumes>.
--
-- SageMaker supports only the
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html General Purpose SSD (gp2)>
-- storage volume type.
hyperParameterTuningResourceConfig_volumeSizeInGB :: Lens.Lens' HyperParameterTuningResourceConfig (Prelude.Maybe Prelude.Natural)
hyperParameterTuningResourceConfig_volumeSizeInGB :: Lens' HyperParameterTuningResourceConfig (Maybe Natural)
hyperParameterTuningResourceConfig_volumeSizeInGB = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HyperParameterTuningResourceConfig' {Maybe Natural
volumeSizeInGB :: Maybe Natural
$sel:volumeSizeInGB:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
volumeSizeInGB} -> Maybe Natural
volumeSizeInGB) (\s :: HyperParameterTuningResourceConfig
s@HyperParameterTuningResourceConfig' {} Maybe Natural
a -> HyperParameterTuningResourceConfig
s {$sel:volumeSizeInGB:HyperParameterTuningResourceConfig' :: Maybe Natural
volumeSizeInGB = Maybe Natural
a} :: HyperParameterTuningResourceConfig)

instance
  Data.FromJSON
    HyperParameterTuningResourceConfig
  where
  parseJSON :: Value -> Parser HyperParameterTuningResourceConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HyperParameterTuningResourceConfig"
      ( \Object
x ->
          Maybe HyperParameterTuningAllocationStrategy
-> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
-> Maybe Natural
-> Maybe TrainingInstanceType
-> Maybe Text
-> Maybe Natural
-> HyperParameterTuningResourceConfig
HyperParameterTuningResourceConfig'
            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
"AllocationStrategy")
            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
"InstanceConfigs")
            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
"InstanceCount")
            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
"InstanceType")
            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
"VolumeSizeInGB")
      )

instance
  Prelude.Hashable
    HyperParameterTuningResourceConfig
  where
  hashWithSalt :: Int -> HyperParameterTuningResourceConfig -> Int
hashWithSalt
    Int
_salt
    HyperParameterTuningResourceConfig' {Maybe Natural
Maybe (NonEmpty HyperParameterTuningInstanceConfig)
Maybe Text
Maybe HyperParameterTuningAllocationStrategy
Maybe TrainingInstanceType
volumeSizeInGB :: Maybe Natural
volumeKmsKeyId :: Maybe Text
instanceType :: Maybe TrainingInstanceType
instanceCount :: Maybe Natural
instanceConfigs :: Maybe (NonEmpty HyperParameterTuningInstanceConfig)
allocationStrategy :: Maybe HyperParameterTuningAllocationStrategy
$sel:volumeSizeInGB:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
$sel:volumeKmsKeyId:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Text
$sel:instanceType:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe TrainingInstanceType
$sel:instanceCount:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
$sel:instanceConfigs:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
$sel:allocationStrategy:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe HyperParameterTuningAllocationStrategy
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HyperParameterTuningAllocationStrategy
allocationStrategy
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
instanceCount
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TrainingInstanceType
instanceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
volumeKmsKeyId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
volumeSizeInGB

instance
  Prelude.NFData
    HyperParameterTuningResourceConfig
  where
  rnf :: HyperParameterTuningResourceConfig -> ()
rnf HyperParameterTuningResourceConfig' {Maybe Natural
Maybe (NonEmpty HyperParameterTuningInstanceConfig)
Maybe Text
Maybe HyperParameterTuningAllocationStrategy
Maybe TrainingInstanceType
volumeSizeInGB :: Maybe Natural
volumeKmsKeyId :: Maybe Text
instanceType :: Maybe TrainingInstanceType
instanceCount :: Maybe Natural
instanceConfigs :: Maybe (NonEmpty HyperParameterTuningInstanceConfig)
allocationStrategy :: Maybe HyperParameterTuningAllocationStrategy
$sel:volumeSizeInGB:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
$sel:volumeKmsKeyId:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Text
$sel:instanceType:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe TrainingInstanceType
$sel:instanceCount:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
$sel:instanceConfigs:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
$sel:allocationStrategy:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe HyperParameterTuningAllocationStrategy
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HyperParameterTuningAllocationStrategy
allocationStrategy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
instanceCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TrainingInstanceType
instanceType
      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 Natural
volumeSizeInGB

instance
  Data.ToJSON
    HyperParameterTuningResourceConfig
  where
  toJSON :: HyperParameterTuningResourceConfig -> Value
toJSON HyperParameterTuningResourceConfig' {Maybe Natural
Maybe (NonEmpty HyperParameterTuningInstanceConfig)
Maybe Text
Maybe HyperParameterTuningAllocationStrategy
Maybe TrainingInstanceType
volumeSizeInGB :: Maybe Natural
volumeKmsKeyId :: Maybe Text
instanceType :: Maybe TrainingInstanceType
instanceCount :: Maybe Natural
instanceConfigs :: Maybe (NonEmpty HyperParameterTuningInstanceConfig)
allocationStrategy :: Maybe HyperParameterTuningAllocationStrategy
$sel:volumeSizeInGB:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
$sel:volumeKmsKeyId:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Text
$sel:instanceType:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe TrainingInstanceType
$sel:instanceCount:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig -> Maybe Natural
$sel:instanceConfigs:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe (NonEmpty HyperParameterTuningInstanceConfig)
$sel:allocationStrategy:HyperParameterTuningResourceConfig' :: HyperParameterTuningResourceConfig
-> Maybe HyperParameterTuningAllocationStrategy
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AllocationStrategy" 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 HyperParameterTuningAllocationStrategy
allocationStrategy,
            (Key
"InstanceConfigs" 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 (NonEmpty HyperParameterTuningInstanceConfig)
instanceConfigs,
            (Key
"InstanceCount" 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 Natural
instanceCount,
            (Key
"InstanceType" 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 TrainingInstanceType
instanceType,
            (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
"VolumeSizeInGB" 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 Natural
volumeSizeInGB
          ]
      )