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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Defines the possible values for a continuous hyperparameter.
--
-- /See:/ 'newContinuousParameterRangeSpecification' smart constructor.
data ContinuousParameterRangeSpecification = ContinuousParameterRangeSpecification'
  { -- | The minimum floating-point value allowed.
    ContinuousParameterRangeSpecification -> Text
minValue :: Prelude.Text,
    -- | The maximum floating-point value allowed.
    ContinuousParameterRangeSpecification -> Text
maxValue :: Prelude.Text
  }
  deriving (ContinuousParameterRangeSpecification
-> ContinuousParameterRangeSpecification -> Bool
(ContinuousParameterRangeSpecification
 -> ContinuousParameterRangeSpecification -> Bool)
-> (ContinuousParameterRangeSpecification
    -> ContinuousParameterRangeSpecification -> Bool)
-> Eq ContinuousParameterRangeSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContinuousParameterRangeSpecification
-> ContinuousParameterRangeSpecification -> Bool
$c/= :: ContinuousParameterRangeSpecification
-> ContinuousParameterRangeSpecification -> Bool
== :: ContinuousParameterRangeSpecification
-> ContinuousParameterRangeSpecification -> Bool
$c== :: ContinuousParameterRangeSpecification
-> ContinuousParameterRangeSpecification -> Bool
Prelude.Eq, ReadPrec [ContinuousParameterRangeSpecification]
ReadPrec ContinuousParameterRangeSpecification
Int -> ReadS ContinuousParameterRangeSpecification
ReadS [ContinuousParameterRangeSpecification]
(Int -> ReadS ContinuousParameterRangeSpecification)
-> ReadS [ContinuousParameterRangeSpecification]
-> ReadPrec ContinuousParameterRangeSpecification
-> ReadPrec [ContinuousParameterRangeSpecification]
-> Read ContinuousParameterRangeSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContinuousParameterRangeSpecification]
$creadListPrec :: ReadPrec [ContinuousParameterRangeSpecification]
readPrec :: ReadPrec ContinuousParameterRangeSpecification
$creadPrec :: ReadPrec ContinuousParameterRangeSpecification
readList :: ReadS [ContinuousParameterRangeSpecification]
$creadList :: ReadS [ContinuousParameterRangeSpecification]
readsPrec :: Int -> ReadS ContinuousParameterRangeSpecification
$creadsPrec :: Int -> ReadS ContinuousParameterRangeSpecification
Prelude.Read, Int -> ContinuousParameterRangeSpecification -> ShowS
[ContinuousParameterRangeSpecification] -> ShowS
ContinuousParameterRangeSpecification -> String
(Int -> ContinuousParameterRangeSpecification -> ShowS)
-> (ContinuousParameterRangeSpecification -> String)
-> ([ContinuousParameterRangeSpecification] -> ShowS)
-> Show ContinuousParameterRangeSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContinuousParameterRangeSpecification] -> ShowS
$cshowList :: [ContinuousParameterRangeSpecification] -> ShowS
show :: ContinuousParameterRangeSpecification -> String
$cshow :: ContinuousParameterRangeSpecification -> String
showsPrec :: Int -> ContinuousParameterRangeSpecification -> ShowS
$cshowsPrec :: Int -> ContinuousParameterRangeSpecification -> ShowS
Prelude.Show, (forall x.
 ContinuousParameterRangeSpecification
 -> Rep ContinuousParameterRangeSpecification x)
-> (forall x.
    Rep ContinuousParameterRangeSpecification x
    -> ContinuousParameterRangeSpecification)
-> Generic ContinuousParameterRangeSpecification
forall x.
Rep ContinuousParameterRangeSpecification x
-> ContinuousParameterRangeSpecification
forall x.
ContinuousParameterRangeSpecification
-> Rep ContinuousParameterRangeSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContinuousParameterRangeSpecification x
-> ContinuousParameterRangeSpecification
$cfrom :: forall x.
ContinuousParameterRangeSpecification
-> Rep ContinuousParameterRangeSpecification x
Prelude.Generic)

-- |
-- Create a value of 'ContinuousParameterRangeSpecification' 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:
--
-- 'minValue', 'continuousParameterRangeSpecification_minValue' - The minimum floating-point value allowed.
--
-- 'maxValue', 'continuousParameterRangeSpecification_maxValue' - The maximum floating-point value allowed.
newContinuousParameterRangeSpecification ::
  -- | 'minValue'
  Prelude.Text ->
  -- | 'maxValue'
  Prelude.Text ->
  ContinuousParameterRangeSpecification
newContinuousParameterRangeSpecification :: Text -> Text -> ContinuousParameterRangeSpecification
newContinuousParameterRangeSpecification
  Text
pMinValue_
  Text
pMaxValue_ =
    ContinuousParameterRangeSpecification' :: Text -> Text -> ContinuousParameterRangeSpecification
ContinuousParameterRangeSpecification'
      { $sel:minValue:ContinuousParameterRangeSpecification' :: Text
minValue =
          Text
pMinValue_,
        $sel:maxValue:ContinuousParameterRangeSpecification' :: Text
maxValue = Text
pMaxValue_
      }

-- | The minimum floating-point value allowed.
continuousParameterRangeSpecification_minValue :: Lens.Lens' ContinuousParameterRangeSpecification Prelude.Text
continuousParameterRangeSpecification_minValue :: (Text -> f Text)
-> ContinuousParameterRangeSpecification
-> f ContinuousParameterRangeSpecification
continuousParameterRangeSpecification_minValue = (ContinuousParameterRangeSpecification -> Text)
-> (ContinuousParameterRangeSpecification
    -> Text -> ContinuousParameterRangeSpecification)
-> Lens
     ContinuousParameterRangeSpecification
     ContinuousParameterRangeSpecification
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousParameterRangeSpecification' {Text
minValue :: Text
$sel:minValue:ContinuousParameterRangeSpecification' :: ContinuousParameterRangeSpecification -> Text
minValue} -> Text
minValue) (\s :: ContinuousParameterRangeSpecification
s@ContinuousParameterRangeSpecification' {} Text
a -> ContinuousParameterRangeSpecification
s {$sel:minValue:ContinuousParameterRangeSpecification' :: Text
minValue = Text
a} :: ContinuousParameterRangeSpecification)

-- | The maximum floating-point value allowed.
continuousParameterRangeSpecification_maxValue :: Lens.Lens' ContinuousParameterRangeSpecification Prelude.Text
continuousParameterRangeSpecification_maxValue :: (Text -> f Text)
-> ContinuousParameterRangeSpecification
-> f ContinuousParameterRangeSpecification
continuousParameterRangeSpecification_maxValue = (ContinuousParameterRangeSpecification -> Text)
-> (ContinuousParameterRangeSpecification
    -> Text -> ContinuousParameterRangeSpecification)
-> Lens
     ContinuousParameterRangeSpecification
     ContinuousParameterRangeSpecification
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContinuousParameterRangeSpecification' {Text
maxValue :: Text
$sel:maxValue:ContinuousParameterRangeSpecification' :: ContinuousParameterRangeSpecification -> Text
maxValue} -> Text
maxValue) (\s :: ContinuousParameterRangeSpecification
s@ContinuousParameterRangeSpecification' {} Text
a -> ContinuousParameterRangeSpecification
s {$sel:maxValue:ContinuousParameterRangeSpecification' :: Text
maxValue = Text
a} :: ContinuousParameterRangeSpecification)

instance
  Core.FromJSON
    ContinuousParameterRangeSpecification
  where
  parseJSON :: Value -> Parser ContinuousParameterRangeSpecification
parseJSON =
    String
-> (Object -> Parser ContinuousParameterRangeSpecification)
-> Value
-> Parser ContinuousParameterRangeSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ContinuousParameterRangeSpecification"
      ( \Object
x ->
          Text -> Text -> ContinuousParameterRangeSpecification
ContinuousParameterRangeSpecification'
            (Text -> Text -> ContinuousParameterRangeSpecification)
-> Parser Text
-> Parser (Text -> ContinuousParameterRangeSpecification)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MinValue")
            Parser (Text -> ContinuousParameterRangeSpecification)
-> Parser Text -> Parser ContinuousParameterRangeSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"MaxValue")
      )

instance
  Prelude.Hashable
    ContinuousParameterRangeSpecification

instance
  Prelude.NFData
    ContinuousParameterRangeSpecification

instance
  Core.ToJSON
    ContinuousParameterRangeSpecification
  where
  toJSON :: ContinuousParameterRangeSpecification -> Value
toJSON ContinuousParameterRangeSpecification' {Text
maxValue :: Text
minValue :: Text
$sel:maxValue:ContinuousParameterRangeSpecification' :: ContinuousParameterRangeSpecification -> Text
$sel:minValue:ContinuousParameterRangeSpecification' :: ContinuousParameterRangeSpecification -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MinValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
minValue),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MaxValue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
maxValue)
          ]
      )