{-# 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.MonitoringS3Output
-- 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.MonitoringS3Output 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.ProcessingS3UploadMode

-- | Information about where and how you want to store the results of a
-- monitoring job.
--
-- /See:/ 'newMonitoringS3Output' smart constructor.
data MonitoringS3Output = MonitoringS3Output'
  { -- | Whether to upload the results of the monitoring job continuously or
    -- after the job completes.
    MonitoringS3Output -> Maybe ProcessingS3UploadMode
s3UploadMode :: Prelude.Maybe ProcessingS3UploadMode,
    -- | A URI that identifies the Amazon S3 storage location where Amazon
    -- SageMaker saves the results of a monitoring job.
    MonitoringS3Output -> Text
s3Uri :: Prelude.Text,
    -- | The local path to the Amazon S3 storage location where Amazon SageMaker
    -- saves the results of a monitoring job. LocalPath is an absolute path for
    -- the output data.
    MonitoringS3Output -> Text
localPath :: Prelude.Text
  }
  deriving (MonitoringS3Output -> MonitoringS3Output -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MonitoringS3Output -> MonitoringS3Output -> Bool
$c/= :: MonitoringS3Output -> MonitoringS3Output -> Bool
== :: MonitoringS3Output -> MonitoringS3Output -> Bool
$c== :: MonitoringS3Output -> MonitoringS3Output -> Bool
Prelude.Eq, ReadPrec [MonitoringS3Output]
ReadPrec MonitoringS3Output
Int -> ReadS MonitoringS3Output
ReadS [MonitoringS3Output]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MonitoringS3Output]
$creadListPrec :: ReadPrec [MonitoringS3Output]
readPrec :: ReadPrec MonitoringS3Output
$creadPrec :: ReadPrec MonitoringS3Output
readList :: ReadS [MonitoringS3Output]
$creadList :: ReadS [MonitoringS3Output]
readsPrec :: Int -> ReadS MonitoringS3Output
$creadsPrec :: Int -> ReadS MonitoringS3Output
Prelude.Read, Int -> MonitoringS3Output -> ShowS
[MonitoringS3Output] -> ShowS
MonitoringS3Output -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MonitoringS3Output] -> ShowS
$cshowList :: [MonitoringS3Output] -> ShowS
show :: MonitoringS3Output -> String
$cshow :: MonitoringS3Output -> String
showsPrec :: Int -> MonitoringS3Output -> ShowS
$cshowsPrec :: Int -> MonitoringS3Output -> ShowS
Prelude.Show, forall x. Rep MonitoringS3Output x -> MonitoringS3Output
forall x. MonitoringS3Output -> Rep MonitoringS3Output x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MonitoringS3Output x -> MonitoringS3Output
$cfrom :: forall x. MonitoringS3Output -> Rep MonitoringS3Output x
Prelude.Generic)

-- |
-- Create a value of 'MonitoringS3Output' 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:
--
-- 's3UploadMode', 'monitoringS3Output_s3UploadMode' - Whether to upload the results of the monitoring job continuously or
-- after the job completes.
--
-- 's3Uri', 'monitoringS3Output_s3Uri' - A URI that identifies the Amazon S3 storage location where Amazon
-- SageMaker saves the results of a monitoring job.
--
-- 'localPath', 'monitoringS3Output_localPath' - The local path to the Amazon S3 storage location where Amazon SageMaker
-- saves the results of a monitoring job. LocalPath is an absolute path for
-- the output data.
newMonitoringS3Output ::
  -- | 's3Uri'
  Prelude.Text ->
  -- | 'localPath'
  Prelude.Text ->
  MonitoringS3Output
newMonitoringS3Output :: Text -> Text -> MonitoringS3Output
newMonitoringS3Output Text
pS3Uri_ Text
pLocalPath_ =
  MonitoringS3Output'
    { $sel:s3UploadMode:MonitoringS3Output' :: Maybe ProcessingS3UploadMode
s3UploadMode = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:MonitoringS3Output' :: Text
s3Uri = Text
pS3Uri_,
      $sel:localPath:MonitoringS3Output' :: Text
localPath = Text
pLocalPath_
    }

-- | Whether to upload the results of the monitoring job continuously or
-- after the job completes.
monitoringS3Output_s3UploadMode :: Lens.Lens' MonitoringS3Output (Prelude.Maybe ProcessingS3UploadMode)
monitoringS3Output_s3UploadMode :: Lens' MonitoringS3Output (Maybe ProcessingS3UploadMode)
monitoringS3Output_s3UploadMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringS3Output' {Maybe ProcessingS3UploadMode
s3UploadMode :: Maybe ProcessingS3UploadMode
$sel:s3UploadMode:MonitoringS3Output' :: MonitoringS3Output -> Maybe ProcessingS3UploadMode
s3UploadMode} -> Maybe ProcessingS3UploadMode
s3UploadMode) (\s :: MonitoringS3Output
s@MonitoringS3Output' {} Maybe ProcessingS3UploadMode
a -> MonitoringS3Output
s {$sel:s3UploadMode:MonitoringS3Output' :: Maybe ProcessingS3UploadMode
s3UploadMode = Maybe ProcessingS3UploadMode
a} :: MonitoringS3Output)

-- | A URI that identifies the Amazon S3 storage location where Amazon
-- SageMaker saves the results of a monitoring job.
monitoringS3Output_s3Uri :: Lens.Lens' MonitoringS3Output Prelude.Text
monitoringS3Output_s3Uri :: Lens' MonitoringS3Output Text
monitoringS3Output_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringS3Output' {Text
s3Uri :: Text
$sel:s3Uri:MonitoringS3Output' :: MonitoringS3Output -> Text
s3Uri} -> Text
s3Uri) (\s :: MonitoringS3Output
s@MonitoringS3Output' {} Text
a -> MonitoringS3Output
s {$sel:s3Uri:MonitoringS3Output' :: Text
s3Uri = Text
a} :: MonitoringS3Output)

-- | The local path to the Amazon S3 storage location where Amazon SageMaker
-- saves the results of a monitoring job. LocalPath is an absolute path for
-- the output data.
monitoringS3Output_localPath :: Lens.Lens' MonitoringS3Output Prelude.Text
monitoringS3Output_localPath :: Lens' MonitoringS3Output Text
monitoringS3Output_localPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MonitoringS3Output' {Text
localPath :: Text
$sel:localPath:MonitoringS3Output' :: MonitoringS3Output -> Text
localPath} -> Text
localPath) (\s :: MonitoringS3Output
s@MonitoringS3Output' {} Text
a -> MonitoringS3Output
s {$sel:localPath:MonitoringS3Output' :: Text
localPath = Text
a} :: MonitoringS3Output)

instance Data.FromJSON MonitoringS3Output where
  parseJSON :: Value -> Parser MonitoringS3Output
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MonitoringS3Output"
      ( \Object
x ->
          Maybe ProcessingS3UploadMode -> Text -> Text -> MonitoringS3Output
MonitoringS3Output'
            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
"S3UploadMode")
            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
"S3Uri")
            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
"LocalPath")
      )

instance Prelude.Hashable MonitoringS3Output where
  hashWithSalt :: Int -> MonitoringS3Output -> Int
hashWithSalt Int
_salt MonitoringS3Output' {Maybe ProcessingS3UploadMode
Text
localPath :: Text
s3Uri :: Text
s3UploadMode :: Maybe ProcessingS3UploadMode
$sel:localPath:MonitoringS3Output' :: MonitoringS3Output -> Text
$sel:s3Uri:MonitoringS3Output' :: MonitoringS3Output -> Text
$sel:s3UploadMode:MonitoringS3Output' :: MonitoringS3Output -> Maybe ProcessingS3UploadMode
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProcessingS3UploadMode
s3UploadMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localPath

instance Prelude.NFData MonitoringS3Output where
  rnf :: MonitoringS3Output -> ()
rnf MonitoringS3Output' {Maybe ProcessingS3UploadMode
Text
localPath :: Text
s3Uri :: Text
s3UploadMode :: Maybe ProcessingS3UploadMode
$sel:localPath:MonitoringS3Output' :: MonitoringS3Output -> Text
$sel:s3Uri:MonitoringS3Output' :: MonitoringS3Output -> Text
$sel:s3UploadMode:MonitoringS3Output' :: MonitoringS3Output -> Maybe ProcessingS3UploadMode
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ProcessingS3UploadMode
s3UploadMode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
localPath

instance Data.ToJSON MonitoringS3Output where
  toJSON :: MonitoringS3Output -> Value
toJSON MonitoringS3Output' {Maybe ProcessingS3UploadMode
Text
localPath :: Text
s3Uri :: Text
s3UploadMode :: Maybe ProcessingS3UploadMode
$sel:localPath:MonitoringS3Output' :: MonitoringS3Output -> Text
$sel:s3Uri:MonitoringS3Output' :: MonitoringS3Output -> Text
$sel:s3UploadMode:MonitoringS3Output' :: MonitoringS3Output -> Maybe ProcessingS3UploadMode
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"S3UploadMode" 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 ProcessingS3UploadMode
s3UploadMode,
            forall a. a -> Maybe a
Prelude.Just (Key
"S3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri),
            forall a. a -> Maybe a
Prelude.Just (Key
"LocalPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
localPath)
          ]
      )