{-# 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.CandidateProperties
-- 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.CandidateProperties 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.CandidateArtifactLocations
import Amazonka.SageMaker.Types.MetricDatum

-- | The properties of an AutoML candidate job.
--
-- /See:/ 'newCandidateProperties' smart constructor.
data CandidateProperties = CandidateProperties'
  { -- | The Amazon S3 prefix to the artifacts generated for an AutoML candidate.
    CandidateProperties -> Maybe CandidateArtifactLocations
candidateArtifactLocations :: Prelude.Maybe CandidateArtifactLocations,
    -- | Information about the candidate metrics for an AutoML job.
    CandidateProperties -> Maybe [MetricDatum]
candidateMetrics :: Prelude.Maybe [MetricDatum]
  }
  deriving (CandidateProperties -> CandidateProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CandidateProperties -> CandidateProperties -> Bool
$c/= :: CandidateProperties -> CandidateProperties -> Bool
== :: CandidateProperties -> CandidateProperties -> Bool
$c== :: CandidateProperties -> CandidateProperties -> Bool
Prelude.Eq, ReadPrec [CandidateProperties]
ReadPrec CandidateProperties
Int -> ReadS CandidateProperties
ReadS [CandidateProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CandidateProperties]
$creadListPrec :: ReadPrec [CandidateProperties]
readPrec :: ReadPrec CandidateProperties
$creadPrec :: ReadPrec CandidateProperties
readList :: ReadS [CandidateProperties]
$creadList :: ReadS [CandidateProperties]
readsPrec :: Int -> ReadS CandidateProperties
$creadsPrec :: Int -> ReadS CandidateProperties
Prelude.Read, Int -> CandidateProperties -> ShowS
[CandidateProperties] -> ShowS
CandidateProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CandidateProperties] -> ShowS
$cshowList :: [CandidateProperties] -> ShowS
show :: CandidateProperties -> String
$cshow :: CandidateProperties -> String
showsPrec :: Int -> CandidateProperties -> ShowS
$cshowsPrec :: Int -> CandidateProperties -> ShowS
Prelude.Show, forall x. Rep CandidateProperties x -> CandidateProperties
forall x. CandidateProperties -> Rep CandidateProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CandidateProperties x -> CandidateProperties
$cfrom :: forall x. CandidateProperties -> Rep CandidateProperties x
Prelude.Generic)

-- |
-- Create a value of 'CandidateProperties' 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:
--
-- 'candidateArtifactLocations', 'candidateProperties_candidateArtifactLocations' - The Amazon S3 prefix to the artifacts generated for an AutoML candidate.
--
-- 'candidateMetrics', 'candidateProperties_candidateMetrics' - Information about the candidate metrics for an AutoML job.
newCandidateProperties ::
  CandidateProperties
newCandidateProperties :: CandidateProperties
newCandidateProperties =
  CandidateProperties'
    { $sel:candidateArtifactLocations:CandidateProperties' :: Maybe CandidateArtifactLocations
candidateArtifactLocations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:candidateMetrics:CandidateProperties' :: Maybe [MetricDatum]
candidateMetrics = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon S3 prefix to the artifacts generated for an AutoML candidate.
candidateProperties_candidateArtifactLocations :: Lens.Lens' CandidateProperties (Prelude.Maybe CandidateArtifactLocations)
candidateProperties_candidateArtifactLocations :: Lens' CandidateProperties (Maybe CandidateArtifactLocations)
candidateProperties_candidateArtifactLocations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CandidateProperties' {Maybe CandidateArtifactLocations
candidateArtifactLocations :: Maybe CandidateArtifactLocations
$sel:candidateArtifactLocations:CandidateProperties' :: CandidateProperties -> Maybe CandidateArtifactLocations
candidateArtifactLocations} -> Maybe CandidateArtifactLocations
candidateArtifactLocations) (\s :: CandidateProperties
s@CandidateProperties' {} Maybe CandidateArtifactLocations
a -> CandidateProperties
s {$sel:candidateArtifactLocations:CandidateProperties' :: Maybe CandidateArtifactLocations
candidateArtifactLocations = Maybe CandidateArtifactLocations
a} :: CandidateProperties)

-- | Information about the candidate metrics for an AutoML job.
candidateProperties_candidateMetrics :: Lens.Lens' CandidateProperties (Prelude.Maybe [MetricDatum])
candidateProperties_candidateMetrics :: Lens' CandidateProperties (Maybe [MetricDatum])
candidateProperties_candidateMetrics = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CandidateProperties' {Maybe [MetricDatum]
candidateMetrics :: Maybe [MetricDatum]
$sel:candidateMetrics:CandidateProperties' :: CandidateProperties -> Maybe [MetricDatum]
candidateMetrics} -> Maybe [MetricDatum]
candidateMetrics) (\s :: CandidateProperties
s@CandidateProperties' {} Maybe [MetricDatum]
a -> CandidateProperties
s {$sel:candidateMetrics:CandidateProperties' :: Maybe [MetricDatum]
candidateMetrics = Maybe [MetricDatum]
a} :: CandidateProperties) 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

instance Data.FromJSON CandidateProperties where
  parseJSON :: Value -> Parser CandidateProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CandidateProperties"
      ( \Object
x ->
          Maybe CandidateArtifactLocations
-> Maybe [MetricDatum] -> CandidateProperties
CandidateProperties'
            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
"CandidateArtifactLocations")
            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
"CandidateMetrics"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable CandidateProperties where
  hashWithSalt :: Int -> CandidateProperties -> Int
hashWithSalt Int
_salt CandidateProperties' {Maybe [MetricDatum]
Maybe CandidateArtifactLocations
candidateMetrics :: Maybe [MetricDatum]
candidateArtifactLocations :: Maybe CandidateArtifactLocations
$sel:candidateMetrics:CandidateProperties' :: CandidateProperties -> Maybe [MetricDatum]
$sel:candidateArtifactLocations:CandidateProperties' :: CandidateProperties -> Maybe CandidateArtifactLocations
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CandidateArtifactLocations
candidateArtifactLocations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MetricDatum]
candidateMetrics

instance Prelude.NFData CandidateProperties where
  rnf :: CandidateProperties -> ()
rnf CandidateProperties' {Maybe [MetricDatum]
Maybe CandidateArtifactLocations
candidateMetrics :: Maybe [MetricDatum]
candidateArtifactLocations :: Maybe CandidateArtifactLocations
$sel:candidateMetrics:CandidateProperties' :: CandidateProperties -> Maybe [MetricDatum]
$sel:candidateArtifactLocations:CandidateProperties' :: CandidateProperties -> Maybe CandidateArtifactLocations
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CandidateArtifactLocations
candidateArtifactLocations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MetricDatum]
candidateMetrics