{-# 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.Braket.Types.ScriptModeConfig
-- 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.Braket.Types.ScriptModeConfig where

import Amazonka.Braket.Types.CompressionType
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

-- | Contains information about the Python scripts used for entry and by an
-- Amazon Braket job.
--
-- /See:/ 'newScriptModeConfig' smart constructor.
data ScriptModeConfig = ScriptModeConfig'
  { -- | The type of compression used by the Python scripts for an Amazon Braket
    -- job.
    ScriptModeConfig -> Maybe CompressionType
compressionType :: Prelude.Maybe CompressionType,
    -- | The path to the Python script that serves as the entry point for an
    -- Amazon Braket job.
    ScriptModeConfig -> Text
entryPoint :: Prelude.Text,
    -- | The URI that specifies the S3 path to the Python script module that
    -- contains the training script used by an Amazon Braket job.
    ScriptModeConfig -> Text
s3Uri :: Prelude.Text
  }
  deriving (ScriptModeConfig -> ScriptModeConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptModeConfig -> ScriptModeConfig -> Bool
$c/= :: ScriptModeConfig -> ScriptModeConfig -> Bool
== :: ScriptModeConfig -> ScriptModeConfig -> Bool
$c== :: ScriptModeConfig -> ScriptModeConfig -> Bool
Prelude.Eq, ReadPrec [ScriptModeConfig]
ReadPrec ScriptModeConfig
Int -> ReadS ScriptModeConfig
ReadS [ScriptModeConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ScriptModeConfig]
$creadListPrec :: ReadPrec [ScriptModeConfig]
readPrec :: ReadPrec ScriptModeConfig
$creadPrec :: ReadPrec ScriptModeConfig
readList :: ReadS [ScriptModeConfig]
$creadList :: ReadS [ScriptModeConfig]
readsPrec :: Int -> ReadS ScriptModeConfig
$creadsPrec :: Int -> ReadS ScriptModeConfig
Prelude.Read, Int -> ScriptModeConfig -> ShowS
[ScriptModeConfig] -> ShowS
ScriptModeConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptModeConfig] -> ShowS
$cshowList :: [ScriptModeConfig] -> ShowS
show :: ScriptModeConfig -> String
$cshow :: ScriptModeConfig -> String
showsPrec :: Int -> ScriptModeConfig -> ShowS
$cshowsPrec :: Int -> ScriptModeConfig -> ShowS
Prelude.Show, forall x. Rep ScriptModeConfig x -> ScriptModeConfig
forall x. ScriptModeConfig -> Rep ScriptModeConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptModeConfig x -> ScriptModeConfig
$cfrom :: forall x. ScriptModeConfig -> Rep ScriptModeConfig x
Prelude.Generic)

-- |
-- Create a value of 'ScriptModeConfig' 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:
--
-- 'compressionType', 'scriptModeConfig_compressionType' - The type of compression used by the Python scripts for an Amazon Braket
-- job.
--
-- 'entryPoint', 'scriptModeConfig_entryPoint' - The path to the Python script that serves as the entry point for an
-- Amazon Braket job.
--
-- 's3Uri', 'scriptModeConfig_s3Uri' - The URI that specifies the S3 path to the Python script module that
-- contains the training script used by an Amazon Braket job.
newScriptModeConfig ::
  -- | 'entryPoint'
  Prelude.Text ->
  -- | 's3Uri'
  Prelude.Text ->
  ScriptModeConfig
newScriptModeConfig :: Text -> Text -> ScriptModeConfig
newScriptModeConfig Text
pEntryPoint_ Text
pS3Uri_ =
  ScriptModeConfig'
    { $sel:compressionType:ScriptModeConfig' :: Maybe CompressionType
compressionType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:entryPoint:ScriptModeConfig' :: Text
entryPoint = Text
pEntryPoint_,
      $sel:s3Uri:ScriptModeConfig' :: Text
s3Uri = Text
pS3Uri_
    }

-- | The type of compression used by the Python scripts for an Amazon Braket
-- job.
scriptModeConfig_compressionType :: Lens.Lens' ScriptModeConfig (Prelude.Maybe CompressionType)
scriptModeConfig_compressionType :: Lens' ScriptModeConfig (Maybe CompressionType)
scriptModeConfig_compressionType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScriptModeConfig' {Maybe CompressionType
compressionType :: Maybe CompressionType
$sel:compressionType:ScriptModeConfig' :: ScriptModeConfig -> Maybe CompressionType
compressionType} -> Maybe CompressionType
compressionType) (\s :: ScriptModeConfig
s@ScriptModeConfig' {} Maybe CompressionType
a -> ScriptModeConfig
s {$sel:compressionType:ScriptModeConfig' :: Maybe CompressionType
compressionType = Maybe CompressionType
a} :: ScriptModeConfig)

-- | The path to the Python script that serves as the entry point for an
-- Amazon Braket job.
scriptModeConfig_entryPoint :: Lens.Lens' ScriptModeConfig Prelude.Text
scriptModeConfig_entryPoint :: Lens' ScriptModeConfig Text
scriptModeConfig_entryPoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScriptModeConfig' {Text
entryPoint :: Text
$sel:entryPoint:ScriptModeConfig' :: ScriptModeConfig -> Text
entryPoint} -> Text
entryPoint) (\s :: ScriptModeConfig
s@ScriptModeConfig' {} Text
a -> ScriptModeConfig
s {$sel:entryPoint:ScriptModeConfig' :: Text
entryPoint = Text
a} :: ScriptModeConfig)

-- | The URI that specifies the S3 path to the Python script module that
-- contains the training script used by an Amazon Braket job.
scriptModeConfig_s3Uri :: Lens.Lens' ScriptModeConfig Prelude.Text
scriptModeConfig_s3Uri :: Lens' ScriptModeConfig Text
scriptModeConfig_s3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ScriptModeConfig' {Text
s3Uri :: Text
$sel:s3Uri:ScriptModeConfig' :: ScriptModeConfig -> Text
s3Uri} -> Text
s3Uri) (\s :: ScriptModeConfig
s@ScriptModeConfig' {} Text
a -> ScriptModeConfig
s {$sel:s3Uri:ScriptModeConfig' :: Text
s3Uri = Text
a} :: ScriptModeConfig)

instance Data.FromJSON ScriptModeConfig where
  parseJSON :: Value -> Parser ScriptModeConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ScriptModeConfig"
      ( \Object
x ->
          Maybe CompressionType -> Text -> Text -> ScriptModeConfig
ScriptModeConfig'
            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
"compressionType")
            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
"entryPoint")
            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")
      )

instance Prelude.Hashable ScriptModeConfig where
  hashWithSalt :: Int -> ScriptModeConfig -> Int
hashWithSalt Int
_salt ScriptModeConfig' {Maybe CompressionType
Text
s3Uri :: Text
entryPoint :: Text
compressionType :: Maybe CompressionType
$sel:s3Uri:ScriptModeConfig' :: ScriptModeConfig -> Text
$sel:entryPoint:ScriptModeConfig' :: ScriptModeConfig -> Text
$sel:compressionType:ScriptModeConfig' :: ScriptModeConfig -> Maybe CompressionType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CompressionType
compressionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
entryPoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
s3Uri

instance Prelude.NFData ScriptModeConfig where
  rnf :: ScriptModeConfig -> ()
rnf ScriptModeConfig' {Maybe CompressionType
Text
s3Uri :: Text
entryPoint :: Text
compressionType :: Maybe CompressionType
$sel:s3Uri:ScriptModeConfig' :: ScriptModeConfig -> Text
$sel:entryPoint:ScriptModeConfig' :: ScriptModeConfig -> Text
$sel:compressionType:ScriptModeConfig' :: ScriptModeConfig -> Maybe CompressionType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CompressionType
compressionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
entryPoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
s3Uri

instance Data.ToJSON ScriptModeConfig where
  toJSON :: ScriptModeConfig -> Value
toJSON ScriptModeConfig' {Maybe CompressionType
Text
s3Uri :: Text
entryPoint :: Text
compressionType :: Maybe CompressionType
$sel:s3Uri:ScriptModeConfig' :: ScriptModeConfig -> Text
$sel:entryPoint:ScriptModeConfig' :: ScriptModeConfig -> Text
$sel:compressionType:ScriptModeConfig' :: ScriptModeConfig -> Maybe CompressionType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"compressionType" 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 CompressionType
compressionType,
            forall a. a -> Maybe a
Prelude.Just (Key
"entryPoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
entryPoint),
            forall a. a -> Maybe a
Prelude.Just (Key
"s3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3Uri)
          ]
      )