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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(MonitoringS3Output -> MonitoringS3Output -> Bool)
-> (MonitoringS3Output -> MonitoringS3Output -> Bool)
-> Eq MonitoringS3Output
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]
(Int -> ReadS MonitoringS3Output)
-> ReadS [MonitoringS3Output]
-> ReadPrec MonitoringS3Output
-> ReadPrec [MonitoringS3Output]
-> Read 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
(Int -> MonitoringS3Output -> ShowS)
-> (MonitoringS3Output -> String)
-> ([MonitoringS3Output] -> ShowS)
-> Show MonitoringS3Output
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. MonitoringS3Output -> Rep MonitoringS3Output x)
-> (forall x. Rep MonitoringS3Output x -> MonitoringS3Output)
-> Generic MonitoringS3Output
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' :: Maybe ProcessingS3UploadMode -> Text -> Text -> MonitoringS3Output
MonitoringS3Output'
    { $sel:s3UploadMode:MonitoringS3Output' :: Maybe ProcessingS3UploadMode
s3UploadMode = Maybe ProcessingS3UploadMode
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 :: (Maybe ProcessingS3UploadMode -> f (Maybe ProcessingS3UploadMode))
-> MonitoringS3Output -> f MonitoringS3Output
monitoringS3Output_s3UploadMode = (MonitoringS3Output -> Maybe ProcessingS3UploadMode)
-> (MonitoringS3Output
    -> Maybe ProcessingS3UploadMode -> MonitoringS3Output)
-> Lens
     MonitoringS3Output
     MonitoringS3Output
     (Maybe ProcessingS3UploadMode)
     (Maybe ProcessingS3UploadMode)
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 :: (Text -> f Text) -> MonitoringS3Output -> f MonitoringS3Output
monitoringS3Output_s3Uri = (MonitoringS3Output -> Text)
-> (MonitoringS3Output -> Text -> MonitoringS3Output)
-> Lens MonitoringS3Output MonitoringS3Output Text Text
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 :: (Text -> f Text) -> MonitoringS3Output -> f MonitoringS3Output
monitoringS3Output_localPath = (MonitoringS3Output -> Text)
-> (MonitoringS3Output -> Text -> MonitoringS3Output)
-> Lens MonitoringS3Output MonitoringS3Output Text Text
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 Core.FromJSON MonitoringS3Output where
  parseJSON :: Value -> Parser MonitoringS3Output
parseJSON =
    String
-> (Object -> Parser MonitoringS3Output)
-> Value
-> Parser MonitoringS3Output
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MonitoringS3Output"
      ( \Object
x ->
          Maybe ProcessingS3UploadMode -> Text -> Text -> MonitoringS3Output
MonitoringS3Output'
            (Maybe ProcessingS3UploadMode
 -> Text -> Text -> MonitoringS3Output)
-> Parser (Maybe ProcessingS3UploadMode)
-> Parser (Text -> Text -> MonitoringS3Output)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ProcessingS3UploadMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3UploadMode")
            Parser (Text -> Text -> MonitoringS3Output)
-> Parser Text -> Parser (Text -> MonitoringS3Output)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"S3Uri")
            Parser (Text -> MonitoringS3Output)
-> Parser Text -> Parser MonitoringS3Output
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"LocalPath")
      )

instance Prelude.Hashable MonitoringS3Output

instance Prelude.NFData MonitoringS3Output

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"S3UploadMode" Text -> ProcessingS3UploadMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ProcessingS3UploadMode -> Pair)
-> Maybe ProcessingS3UploadMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProcessingS3UploadMode
s3UploadMode,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
s3Uri),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LocalPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
localPath)
          ]
      )