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

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

-- | Specifies batch transform jobs that Amazon SageMaker runs to validate
-- your model package.
--
-- /See:/ 'newModelPackageValidationSpecification' smart constructor.
data ModelPackageValidationSpecification = ModelPackageValidationSpecification'
  { -- | The IAM roles to be used for the validation of the model package.
    ModelPackageValidationSpecification -> Text
validationRole :: Prelude.Text,
    -- | An array of @ModelPackageValidationProfile@ objects, each of which
    -- specifies a batch transform job that Amazon SageMaker runs to validate
    -- your model package.
    ModelPackageValidationSpecification
-> NonEmpty ModelPackageValidationProfile
validationProfiles :: Prelude.NonEmpty ModelPackageValidationProfile
  }
  deriving (ModelPackageValidationSpecification
-> ModelPackageValidationSpecification -> Bool
(ModelPackageValidationSpecification
 -> ModelPackageValidationSpecification -> Bool)
-> (ModelPackageValidationSpecification
    -> ModelPackageValidationSpecification -> Bool)
-> Eq ModelPackageValidationSpecification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelPackageValidationSpecification
-> ModelPackageValidationSpecification -> Bool
$c/= :: ModelPackageValidationSpecification
-> ModelPackageValidationSpecification -> Bool
== :: ModelPackageValidationSpecification
-> ModelPackageValidationSpecification -> Bool
$c== :: ModelPackageValidationSpecification
-> ModelPackageValidationSpecification -> Bool
Prelude.Eq, ReadPrec [ModelPackageValidationSpecification]
ReadPrec ModelPackageValidationSpecification
Int -> ReadS ModelPackageValidationSpecification
ReadS [ModelPackageValidationSpecification]
(Int -> ReadS ModelPackageValidationSpecification)
-> ReadS [ModelPackageValidationSpecification]
-> ReadPrec ModelPackageValidationSpecification
-> ReadPrec [ModelPackageValidationSpecification]
-> Read ModelPackageValidationSpecification
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelPackageValidationSpecification]
$creadListPrec :: ReadPrec [ModelPackageValidationSpecification]
readPrec :: ReadPrec ModelPackageValidationSpecification
$creadPrec :: ReadPrec ModelPackageValidationSpecification
readList :: ReadS [ModelPackageValidationSpecification]
$creadList :: ReadS [ModelPackageValidationSpecification]
readsPrec :: Int -> ReadS ModelPackageValidationSpecification
$creadsPrec :: Int -> ReadS ModelPackageValidationSpecification
Prelude.Read, Int -> ModelPackageValidationSpecification -> ShowS
[ModelPackageValidationSpecification] -> ShowS
ModelPackageValidationSpecification -> String
(Int -> ModelPackageValidationSpecification -> ShowS)
-> (ModelPackageValidationSpecification -> String)
-> ([ModelPackageValidationSpecification] -> ShowS)
-> Show ModelPackageValidationSpecification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelPackageValidationSpecification] -> ShowS
$cshowList :: [ModelPackageValidationSpecification] -> ShowS
show :: ModelPackageValidationSpecification -> String
$cshow :: ModelPackageValidationSpecification -> String
showsPrec :: Int -> ModelPackageValidationSpecification -> ShowS
$cshowsPrec :: Int -> ModelPackageValidationSpecification -> ShowS
Prelude.Show, (forall x.
 ModelPackageValidationSpecification
 -> Rep ModelPackageValidationSpecification x)
-> (forall x.
    Rep ModelPackageValidationSpecification x
    -> ModelPackageValidationSpecification)
-> Generic ModelPackageValidationSpecification
forall x.
Rep ModelPackageValidationSpecification x
-> ModelPackageValidationSpecification
forall x.
ModelPackageValidationSpecification
-> Rep ModelPackageValidationSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModelPackageValidationSpecification x
-> ModelPackageValidationSpecification
$cfrom :: forall x.
ModelPackageValidationSpecification
-> Rep ModelPackageValidationSpecification x
Prelude.Generic)

-- |
-- Create a value of 'ModelPackageValidationSpecification' 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:
--
-- 'validationRole', 'modelPackageValidationSpecification_validationRole' - The IAM roles to be used for the validation of the model package.
--
-- 'validationProfiles', 'modelPackageValidationSpecification_validationProfiles' - An array of @ModelPackageValidationProfile@ objects, each of which
-- specifies a batch transform job that Amazon SageMaker runs to validate
-- your model package.
newModelPackageValidationSpecification ::
  -- | 'validationRole'
  Prelude.Text ->
  -- | 'validationProfiles'
  Prelude.NonEmpty ModelPackageValidationProfile ->
  ModelPackageValidationSpecification
newModelPackageValidationSpecification :: Text
-> NonEmpty ModelPackageValidationProfile
-> ModelPackageValidationSpecification
newModelPackageValidationSpecification
  Text
pValidationRole_
  NonEmpty ModelPackageValidationProfile
pValidationProfiles_ =
    ModelPackageValidationSpecification' :: Text
-> NonEmpty ModelPackageValidationProfile
-> ModelPackageValidationSpecification
ModelPackageValidationSpecification'
      { $sel:validationRole:ModelPackageValidationSpecification' :: Text
validationRole =
          Text
pValidationRole_,
        $sel:validationProfiles:ModelPackageValidationSpecification' :: NonEmpty ModelPackageValidationProfile
validationProfiles =
          Tagged
  (NonEmpty ModelPackageValidationProfile)
  (Identity (NonEmpty ModelPackageValidationProfile))
-> Tagged
     (NonEmpty ModelPackageValidationProfile)
     (Identity (NonEmpty ModelPackageValidationProfile))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged
   (NonEmpty ModelPackageValidationProfile)
   (Identity (NonEmpty ModelPackageValidationProfile))
 -> Tagged
      (NonEmpty ModelPackageValidationProfile)
      (Identity (NonEmpty ModelPackageValidationProfile)))
-> NonEmpty ModelPackageValidationProfile
-> NonEmpty ModelPackageValidationProfile
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ModelPackageValidationProfile
pValidationProfiles_
      }

-- | The IAM roles to be used for the validation of the model package.
modelPackageValidationSpecification_validationRole :: Lens.Lens' ModelPackageValidationSpecification Prelude.Text
modelPackageValidationSpecification_validationRole :: (Text -> f Text)
-> ModelPackageValidationSpecification
-> f ModelPackageValidationSpecification
modelPackageValidationSpecification_validationRole = (ModelPackageValidationSpecification -> Text)
-> (ModelPackageValidationSpecification
    -> Text -> ModelPackageValidationSpecification)
-> Lens
     ModelPackageValidationSpecification
     ModelPackageValidationSpecification
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPackageValidationSpecification' {Text
validationRole :: Text
$sel:validationRole:ModelPackageValidationSpecification' :: ModelPackageValidationSpecification -> Text
validationRole} -> Text
validationRole) (\s :: ModelPackageValidationSpecification
s@ModelPackageValidationSpecification' {} Text
a -> ModelPackageValidationSpecification
s {$sel:validationRole:ModelPackageValidationSpecification' :: Text
validationRole = Text
a} :: ModelPackageValidationSpecification)

-- | An array of @ModelPackageValidationProfile@ objects, each of which
-- specifies a batch transform job that Amazon SageMaker runs to validate
-- your model package.
modelPackageValidationSpecification_validationProfiles :: Lens.Lens' ModelPackageValidationSpecification (Prelude.NonEmpty ModelPackageValidationProfile)
modelPackageValidationSpecification_validationProfiles :: (NonEmpty ModelPackageValidationProfile
 -> f (NonEmpty ModelPackageValidationProfile))
-> ModelPackageValidationSpecification
-> f ModelPackageValidationSpecification
modelPackageValidationSpecification_validationProfiles = (ModelPackageValidationSpecification
 -> NonEmpty ModelPackageValidationProfile)
-> (ModelPackageValidationSpecification
    -> NonEmpty ModelPackageValidationProfile
    -> ModelPackageValidationSpecification)
-> Lens
     ModelPackageValidationSpecification
     ModelPackageValidationSpecification
     (NonEmpty ModelPackageValidationProfile)
     (NonEmpty ModelPackageValidationProfile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelPackageValidationSpecification' {NonEmpty ModelPackageValidationProfile
validationProfiles :: NonEmpty ModelPackageValidationProfile
$sel:validationProfiles:ModelPackageValidationSpecification' :: ModelPackageValidationSpecification
-> NonEmpty ModelPackageValidationProfile
validationProfiles} -> NonEmpty ModelPackageValidationProfile
validationProfiles) (\s :: ModelPackageValidationSpecification
s@ModelPackageValidationSpecification' {} NonEmpty ModelPackageValidationProfile
a -> ModelPackageValidationSpecification
s {$sel:validationProfiles:ModelPackageValidationSpecification' :: NonEmpty ModelPackageValidationProfile
validationProfiles = NonEmpty ModelPackageValidationProfile
a} :: ModelPackageValidationSpecification) ((NonEmpty ModelPackageValidationProfile
  -> f (NonEmpty ModelPackageValidationProfile))
 -> ModelPackageValidationSpecification
 -> f ModelPackageValidationSpecification)
-> ((NonEmpty ModelPackageValidationProfile
     -> f (NonEmpty ModelPackageValidationProfile))
    -> NonEmpty ModelPackageValidationProfile
    -> f (NonEmpty ModelPackageValidationProfile))
-> (NonEmpty ModelPackageValidationProfile
    -> f (NonEmpty ModelPackageValidationProfile))
-> ModelPackageValidationSpecification
-> f ModelPackageValidationSpecification
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ModelPackageValidationProfile
 -> f (NonEmpty ModelPackageValidationProfile))
-> NonEmpty ModelPackageValidationProfile
-> f (NonEmpty ModelPackageValidationProfile)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    ModelPackageValidationSpecification
  where
  parseJSON :: Value -> Parser ModelPackageValidationSpecification
parseJSON =
    String
-> (Object -> Parser ModelPackageValidationSpecification)
-> Value
-> Parser ModelPackageValidationSpecification
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModelPackageValidationSpecification"
      ( \Object
x ->
          Text
-> NonEmpty ModelPackageValidationProfile
-> ModelPackageValidationSpecification
ModelPackageValidationSpecification'
            (Text
 -> NonEmpty ModelPackageValidationProfile
 -> ModelPackageValidationSpecification)
-> Parser Text
-> Parser
     (NonEmpty ModelPackageValidationProfile
      -> ModelPackageValidationSpecification)
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
"ValidationRole")
            Parser
  (NonEmpty ModelPackageValidationProfile
   -> ModelPackageValidationSpecification)
-> Parser (NonEmpty ModelPackageValidationProfile)
-> Parser ModelPackageValidationSpecification
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty ModelPackageValidationProfile)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ValidationProfiles")
      )

instance
  Prelude.Hashable
    ModelPackageValidationSpecification

instance
  Prelude.NFData
    ModelPackageValidationSpecification

instance
  Core.ToJSON
    ModelPackageValidationSpecification
  where
  toJSON :: ModelPackageValidationSpecification -> Value
toJSON ModelPackageValidationSpecification' {NonEmpty ModelPackageValidationProfile
Text
validationProfiles :: NonEmpty ModelPackageValidationProfile
validationRole :: Text
$sel:validationProfiles:ModelPackageValidationSpecification' :: ModelPackageValidationSpecification
-> NonEmpty ModelPackageValidationProfile
$sel:validationRole:ModelPackageValidationSpecification' :: ModelPackageValidationSpecification -> 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
"ValidationRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
validationRole),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ValidationProfiles" Text -> NonEmpty ModelPackageValidationProfile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty ModelPackageValidationProfile
validationProfiles)
          ]
      )