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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(CandidateProperties -> CandidateProperties -> Bool)
-> (CandidateProperties -> CandidateProperties -> Bool)
-> Eq CandidateProperties
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]
(Int -> ReadS CandidateProperties)
-> ReadS [CandidateProperties]
-> ReadPrec CandidateProperties
-> ReadPrec [CandidateProperties]
-> Read 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
(Int -> CandidateProperties -> ShowS)
-> (CandidateProperties -> String)
-> ([CandidateProperties] -> ShowS)
-> Show CandidateProperties
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. CandidateProperties -> Rep CandidateProperties x)
-> (forall x. Rep CandidateProperties x -> CandidateProperties)
-> Generic CandidateProperties
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' :: Maybe CandidateArtifactLocations
-> Maybe [MetricDatum] -> CandidateProperties
CandidateProperties'
    { $sel:candidateArtifactLocations:CandidateProperties' :: Maybe CandidateArtifactLocations
candidateArtifactLocations =
        Maybe CandidateArtifactLocations
forall a. Maybe a
Prelude.Nothing,
      $sel:candidateMetrics:CandidateProperties' :: Maybe [MetricDatum]
candidateMetrics = Maybe [MetricDatum]
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 :: (Maybe CandidateArtifactLocations
 -> f (Maybe CandidateArtifactLocations))
-> CandidateProperties -> f CandidateProperties
candidateProperties_candidateArtifactLocations = (CandidateProperties -> Maybe CandidateArtifactLocations)
-> (CandidateProperties
    -> Maybe CandidateArtifactLocations -> CandidateProperties)
-> Lens
     CandidateProperties
     CandidateProperties
     (Maybe CandidateArtifactLocations)
     (Maybe 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 :: (Maybe [MetricDatum] -> f (Maybe [MetricDatum]))
-> CandidateProperties -> f CandidateProperties
candidateProperties_candidateMetrics = (CandidateProperties -> Maybe [MetricDatum])
-> (CandidateProperties
    -> Maybe [MetricDatum] -> CandidateProperties)
-> Lens
     CandidateProperties
     CandidateProperties
     (Maybe [MetricDatum])
     (Maybe [MetricDatum])
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) ((Maybe [MetricDatum] -> f (Maybe [MetricDatum]))
 -> CandidateProperties -> f CandidateProperties)
-> ((Maybe [MetricDatum] -> f (Maybe [MetricDatum]))
    -> Maybe [MetricDatum] -> f (Maybe [MetricDatum]))
-> (Maybe [MetricDatum] -> f (Maybe [MetricDatum]))
-> CandidateProperties
-> f CandidateProperties
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MetricDatum] [MetricDatum] [MetricDatum] [MetricDatum]
-> Iso
     (Maybe [MetricDatum])
     (Maybe [MetricDatum])
     (Maybe [MetricDatum])
     (Maybe [MetricDatum])
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 AnIso [MetricDatum] [MetricDatum] [MetricDatum] [MetricDatum]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CandidateProperties where
  parseJSON :: Value -> Parser CandidateProperties
parseJSON =
    String
-> (Object -> Parser CandidateProperties)
-> Value
-> Parser CandidateProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CandidateProperties"
      ( \Object
x ->
          Maybe CandidateArtifactLocations
-> Maybe [MetricDatum] -> CandidateProperties
CandidateProperties'
            (Maybe CandidateArtifactLocations
 -> Maybe [MetricDatum] -> CandidateProperties)
-> Parser (Maybe CandidateArtifactLocations)
-> Parser (Maybe [MetricDatum] -> CandidateProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe CandidateArtifactLocations)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CandidateArtifactLocations")
            Parser (Maybe [MetricDatum] -> CandidateProperties)
-> Parser (Maybe [MetricDatum]) -> Parser CandidateProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [MetricDatum]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CandidateMetrics"
                            Parser (Maybe (Maybe [MetricDatum]))
-> Maybe [MetricDatum] -> Parser (Maybe [MetricDatum])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [MetricDatum]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable CandidateProperties

instance Prelude.NFData CandidateProperties