{-# 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.MonitoringAppSpecification
-- 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.MonitoringAppSpecification 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

-- | Container image configuration object for the monitoring job.
--
-- /See:/ 'newMonitoringAppSpecification' smart constructor.
data MonitoringAppSpecification = MonitoringAppSpecification'
  { -- | An array of arguments for the container used to run the monitoring job.
    MonitoringAppSpecification -> Maybe (NonEmpty Text)
containerArguments :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | Specifies the entrypoint for a container used to run the monitoring job.
    MonitoringAppSpecification -> Maybe (NonEmpty Text)
containerEntrypoint :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | An Amazon S3 URI to a script that is called after analysis has been
    -- performed. Applicable only for the built-in (first party) containers.
    MonitoringAppSpecification -> Maybe Text
postAnalyticsProcessorSourceUri :: Prelude.Maybe Prelude.Text,
    -- | An Amazon S3 URI to a script that is called per row prior to running
    -- analysis. It can base64 decode the payload and convert it into a flatted
    -- json so that the built-in container can use the converted data.
    -- Applicable only for the built-in (first party) containers.
    MonitoringAppSpecification -> Maybe Text
recordPreprocessorSourceUri :: Prelude.Maybe Prelude.Text,
    -- | The container image to be run by the monitoring job.
    MonitoringAppSpecification -> Text
imageUri :: Prelude.Text
  }
  deriving (MonitoringAppSpecification -> MonitoringAppSpecification -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringAppSpecification -> MonitoringAppSpecification -> Bool
$c/= :: MonitoringAppSpecification -> MonitoringAppSpecification -> Bool
== :: MonitoringAppSpecification -> MonitoringAppSpecification -> Bool
$c== :: MonitoringAppSpecification -> MonitoringAppSpecification -> Bool
Prelude.Eq, ReadPrec [MonitoringAppSpecification]
ReadPrec MonitoringAppSpecification
Int -> ReadS MonitoringAppSpecification
ReadS [MonitoringAppSpecification]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringAppSpecification]
$creadListPrec :: ReadPrec [MonitoringAppSpecification]
readPrec :: ReadPrec MonitoringAppSpecification
$creadPrec :: ReadPrec MonitoringAppSpecification
readList :: ReadS [MonitoringAppSpecification]
$creadList :: ReadS [MonitoringAppSpecification]
readsPrec :: Int -> ReadS MonitoringAppSpecification
$creadsPrec :: Int -> ReadS MonitoringAppSpecification
Prelude.Read, Int -> MonitoringAppSpecification -> ShowS
[MonitoringAppSpecification] -> ShowS
MonitoringAppSpecification -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringAppSpecification] -> ShowS
$cshowList :: [MonitoringAppSpecification] -> ShowS
show :: MonitoringAppSpecification -> String
$cshow :: MonitoringAppSpecification -> String
showsPrec :: Int -> MonitoringAppSpecification -> ShowS
$cshowsPrec :: Int -> MonitoringAppSpecification -> ShowS
Prelude.Show, forall x.
Rep MonitoringAppSpecification x -> MonitoringAppSpecification
forall x.
MonitoringAppSpecification -> Rep MonitoringAppSpecification x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MonitoringAppSpecification x -> MonitoringAppSpecification
$cfrom :: forall x.
MonitoringAppSpecification -> Rep MonitoringAppSpecification x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringAppSpecification' 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:
--
-- 'containerArguments', 'monitoringAppSpecification_containerArguments' - An array of arguments for the container used to run the monitoring job.
--
-- 'containerEntrypoint', 'monitoringAppSpecification_containerEntrypoint' - Specifies the entrypoint for a container used to run the monitoring job.
--
-- 'postAnalyticsProcessorSourceUri', 'monitoringAppSpecification_postAnalyticsProcessorSourceUri' - An Amazon S3 URI to a script that is called after analysis has been
-- performed. Applicable only for the built-in (first party) containers.
--
-- 'recordPreprocessorSourceUri', 'monitoringAppSpecification_recordPreprocessorSourceUri' - An Amazon S3 URI to a script that is called per row prior to running
-- analysis. It can base64 decode the payload and convert it into a flatted
-- json so that the built-in container can use the converted data.
-- Applicable only for the built-in (first party) containers.
--
-- 'imageUri', 'monitoringAppSpecification_imageUri' - The container image to be run by the monitoring job.
newMonitoringAppSpecification ::
  -- | 'imageUri'
  Prelude.Text ->
  MonitoringAppSpecification
newMonitoringAppSpecification :: Text -> MonitoringAppSpecification
newMonitoringAppSpecification Text
pImageUri_ =
  MonitoringAppSpecification'
    { $sel:containerArguments:MonitoringAppSpecification' :: Maybe (NonEmpty Text)
containerArguments =
        forall a. Maybe a
Prelude.Nothing,
      $sel:containerEntrypoint:MonitoringAppSpecification' :: Maybe (NonEmpty Text)
containerEntrypoint = forall a. Maybe a
Prelude.Nothing,
      $sel:postAnalyticsProcessorSourceUri:MonitoringAppSpecification' :: Maybe Text
postAnalyticsProcessorSourceUri =
        forall a. Maybe a
Prelude.Nothing,
      $sel:recordPreprocessorSourceUri:MonitoringAppSpecification' :: Maybe Text
recordPreprocessorSourceUri = forall a. Maybe a
Prelude.Nothing,
      $sel:imageUri:MonitoringAppSpecification' :: Text
imageUri = Text
pImageUri_
    }

-- | An array of arguments for the container used to run the monitoring job.
monitoringAppSpecification_containerArguments :: Lens.Lens' MonitoringAppSpecification (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
monitoringAppSpecification_containerArguments :: Lens' MonitoringAppSpecification (Maybe (NonEmpty Text))
monitoringAppSpecification_containerArguments = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAppSpecification' {Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
$sel:containerArguments:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
containerArguments} -> Maybe (NonEmpty Text)
containerArguments) (\s :: MonitoringAppSpecification
s@MonitoringAppSpecification' {} Maybe (NonEmpty Text)
a -> MonitoringAppSpecification
s {$sel:containerArguments:MonitoringAppSpecification' :: Maybe (NonEmpty Text)
containerArguments = Maybe (NonEmpty Text)
a} :: MonitoringAppSpecification) 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

-- | Specifies the entrypoint for a container used to run the monitoring job.
monitoringAppSpecification_containerEntrypoint :: Lens.Lens' MonitoringAppSpecification (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
monitoringAppSpecification_containerEntrypoint :: Lens' MonitoringAppSpecification (Maybe (NonEmpty Text))
monitoringAppSpecification_containerEntrypoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAppSpecification' {Maybe (NonEmpty Text)
containerEntrypoint :: Maybe (NonEmpty Text)
$sel:containerEntrypoint:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
containerEntrypoint} -> Maybe (NonEmpty Text)
containerEntrypoint) (\s :: MonitoringAppSpecification
s@MonitoringAppSpecification' {} Maybe (NonEmpty Text)
a -> MonitoringAppSpecification
s {$sel:containerEntrypoint:MonitoringAppSpecification' :: Maybe (NonEmpty Text)
containerEntrypoint = Maybe (NonEmpty Text)
a} :: MonitoringAppSpecification) 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

-- | An Amazon S3 URI to a script that is called after analysis has been
-- performed. Applicable only for the built-in (first party) containers.
monitoringAppSpecification_postAnalyticsProcessorSourceUri :: Lens.Lens' MonitoringAppSpecification (Prelude.Maybe Prelude.Text)
monitoringAppSpecification_postAnalyticsProcessorSourceUri :: Lens' MonitoringAppSpecification (Maybe Text)
monitoringAppSpecification_postAnalyticsProcessorSourceUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAppSpecification' {Maybe Text
postAnalyticsProcessorSourceUri :: Maybe Text
$sel:postAnalyticsProcessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
postAnalyticsProcessorSourceUri} -> Maybe Text
postAnalyticsProcessorSourceUri) (\s :: MonitoringAppSpecification
s@MonitoringAppSpecification' {} Maybe Text
a -> MonitoringAppSpecification
s {$sel:postAnalyticsProcessorSourceUri:MonitoringAppSpecification' :: Maybe Text
postAnalyticsProcessorSourceUri = Maybe Text
a} :: MonitoringAppSpecification)

-- | An Amazon S3 URI to a script that is called per row prior to running
-- analysis. It can base64 decode the payload and convert it into a flatted
-- json so that the built-in container can use the converted data.
-- Applicable only for the built-in (first party) containers.
monitoringAppSpecification_recordPreprocessorSourceUri :: Lens.Lens' MonitoringAppSpecification (Prelude.Maybe Prelude.Text)
monitoringAppSpecification_recordPreprocessorSourceUri :: Lens' MonitoringAppSpecification (Maybe Text)
monitoringAppSpecification_recordPreprocessorSourceUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAppSpecification' {Maybe Text
recordPreprocessorSourceUri :: Maybe Text
$sel:recordPreprocessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
recordPreprocessorSourceUri} -> Maybe Text
recordPreprocessorSourceUri) (\s :: MonitoringAppSpecification
s@MonitoringAppSpecification' {} Maybe Text
a -> MonitoringAppSpecification
s {$sel:recordPreprocessorSourceUri:MonitoringAppSpecification' :: Maybe Text
recordPreprocessorSourceUri = Maybe Text
a} :: MonitoringAppSpecification)

-- | The container image to be run by the monitoring job.
monitoringAppSpecification_imageUri :: Lens.Lens' MonitoringAppSpecification Prelude.Text
monitoringAppSpecification_imageUri :: Lens' MonitoringAppSpecification Text
monitoringAppSpecification_imageUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringAppSpecification' {Text
imageUri :: Text
$sel:imageUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Text
imageUri} -> Text
imageUri) (\s :: MonitoringAppSpecification
s@MonitoringAppSpecification' {} Text
a -> MonitoringAppSpecification
s {$sel:imageUri:MonitoringAppSpecification' :: Text
imageUri = Text
a} :: MonitoringAppSpecification)

instance Data.FromJSON MonitoringAppSpecification where
  parseJSON :: Value -> Parser MonitoringAppSpecification
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MonitoringAppSpecification"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe Text
-> Text
-> MonitoringAppSpecification
MonitoringAppSpecification'
            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
"ContainerArguments")
            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
"ContainerEntrypoint")
            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
"PostAnalyticsProcessorSourceUri")
            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
"RecordPreprocessorSourceUri")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ImageUri")
      )

instance Prelude.Hashable MonitoringAppSpecification where
  hashWithSalt :: Int -> MonitoringAppSpecification -> Int
hashWithSalt Int
_salt MonitoringAppSpecification' {Maybe (NonEmpty Text)
Maybe Text
Text
imageUri :: Text
recordPreprocessorSourceUri :: Maybe Text
postAnalyticsProcessorSourceUri :: Maybe Text
containerEntrypoint :: Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
$sel:imageUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Text
$sel:recordPreprocessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
$sel:postAnalyticsProcessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
$sel:containerEntrypoint:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
$sel:containerArguments:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
containerArguments
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
containerEntrypoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
postAnalyticsProcessorSourceUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
recordPreprocessorSourceUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imageUri

instance Prelude.NFData MonitoringAppSpecification where
  rnf :: MonitoringAppSpecification -> ()
rnf MonitoringAppSpecification' {Maybe (NonEmpty Text)
Maybe Text
Text
imageUri :: Text
recordPreprocessorSourceUri :: Maybe Text
postAnalyticsProcessorSourceUri :: Maybe Text
containerEntrypoint :: Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
$sel:imageUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Text
$sel:recordPreprocessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
$sel:postAnalyticsProcessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
$sel:containerEntrypoint:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
$sel:containerArguments:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
containerArguments
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
containerEntrypoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
postAnalyticsProcessorSourceUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
recordPreprocessorSourceUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
imageUri

instance Data.ToJSON MonitoringAppSpecification where
  toJSON :: MonitoringAppSpecification -> Value
toJSON MonitoringAppSpecification' {Maybe (NonEmpty Text)
Maybe Text
Text
imageUri :: Text
recordPreprocessorSourceUri :: Maybe Text
postAnalyticsProcessorSourceUri :: Maybe Text
containerEntrypoint :: Maybe (NonEmpty Text)
containerArguments :: Maybe (NonEmpty Text)
$sel:imageUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Text
$sel:recordPreprocessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
$sel:postAnalyticsProcessorSourceUri:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe Text
$sel:containerEntrypoint:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
$sel:containerArguments:MonitoringAppSpecification' :: MonitoringAppSpecification -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ContainerArguments" 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 Text)
containerArguments,
            (Key
"ContainerEntrypoint" 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 Text)
containerEntrypoint,
            (Key
"PostAnalyticsProcessorSourceUri" 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
postAnalyticsProcessorSourceUri,
            (Key
"RecordPreprocessorSourceUri" 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
recordPreprocessorSourceUri,
            forall a. a -> Maybe a
Prelude.Just (Key
"ImageUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
imageUri)
          ]
      )