{-# 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.Greengrass.Types.S3MachineLearningModelResourceData
-- 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.Greengrass.Types.S3MachineLearningModelResourceData where

import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types.ResourceDownloadOwnerSetting
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Attributes that define an Amazon S3 machine learning resource.
--
-- /See:/ 'newS3MachineLearningModelResourceData' smart constructor.
data S3MachineLearningModelResourceData = S3MachineLearningModelResourceData'
  { S3MachineLearningModelResourceData
-> Maybe ResourceDownloadOwnerSetting
ownerSetting :: Prelude.Maybe ResourceDownloadOwnerSetting,
    -- | The absolute local path of the resource inside the Lambda environment.
    S3MachineLearningModelResourceData -> Maybe Text
destinationPath :: Prelude.Maybe Prelude.Text,
    -- | The URI of the source model in an S3 bucket. The model package must be
    -- in tar.gz or .zip format.
    S3MachineLearningModelResourceData -> Maybe Text
s3Uri :: Prelude.Maybe Prelude.Text
  }
  deriving (S3MachineLearningModelResourceData
-> S3MachineLearningModelResourceData -> Bool
(S3MachineLearningModelResourceData
 -> S3MachineLearningModelResourceData -> Bool)
-> (S3MachineLearningModelResourceData
    -> S3MachineLearningModelResourceData -> Bool)
-> Eq S3MachineLearningModelResourceData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3MachineLearningModelResourceData
-> S3MachineLearningModelResourceData -> Bool
$c/= :: S3MachineLearningModelResourceData
-> S3MachineLearningModelResourceData -> Bool
== :: S3MachineLearningModelResourceData
-> S3MachineLearningModelResourceData -> Bool
$c== :: S3MachineLearningModelResourceData
-> S3MachineLearningModelResourceData -> Bool
Prelude.Eq, ReadPrec [S3MachineLearningModelResourceData]
ReadPrec S3MachineLearningModelResourceData
Int -> ReadS S3MachineLearningModelResourceData
ReadS [S3MachineLearningModelResourceData]
(Int -> ReadS S3MachineLearningModelResourceData)
-> ReadS [S3MachineLearningModelResourceData]
-> ReadPrec S3MachineLearningModelResourceData
-> ReadPrec [S3MachineLearningModelResourceData]
-> Read S3MachineLearningModelResourceData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3MachineLearningModelResourceData]
$creadListPrec :: ReadPrec [S3MachineLearningModelResourceData]
readPrec :: ReadPrec S3MachineLearningModelResourceData
$creadPrec :: ReadPrec S3MachineLearningModelResourceData
readList :: ReadS [S3MachineLearningModelResourceData]
$creadList :: ReadS [S3MachineLearningModelResourceData]
readsPrec :: Int -> ReadS S3MachineLearningModelResourceData
$creadsPrec :: Int -> ReadS S3MachineLearningModelResourceData
Prelude.Read, Int -> S3MachineLearningModelResourceData -> ShowS
[S3MachineLearningModelResourceData] -> ShowS
S3MachineLearningModelResourceData -> String
(Int -> S3MachineLearningModelResourceData -> ShowS)
-> (S3MachineLearningModelResourceData -> String)
-> ([S3MachineLearningModelResourceData] -> ShowS)
-> Show S3MachineLearningModelResourceData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3MachineLearningModelResourceData] -> ShowS
$cshowList :: [S3MachineLearningModelResourceData] -> ShowS
show :: S3MachineLearningModelResourceData -> String
$cshow :: S3MachineLearningModelResourceData -> String
showsPrec :: Int -> S3MachineLearningModelResourceData -> ShowS
$cshowsPrec :: Int -> S3MachineLearningModelResourceData -> ShowS
Prelude.Show, (forall x.
 S3MachineLearningModelResourceData
 -> Rep S3MachineLearningModelResourceData x)
-> (forall x.
    Rep S3MachineLearningModelResourceData x
    -> S3MachineLearningModelResourceData)
-> Generic S3MachineLearningModelResourceData
forall x.
Rep S3MachineLearningModelResourceData x
-> S3MachineLearningModelResourceData
forall x.
S3MachineLearningModelResourceData
-> Rep S3MachineLearningModelResourceData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep S3MachineLearningModelResourceData x
-> S3MachineLearningModelResourceData
$cfrom :: forall x.
S3MachineLearningModelResourceData
-> Rep S3MachineLearningModelResourceData x
Prelude.Generic)

-- |
-- Create a value of 'S3MachineLearningModelResourceData' 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:
--
-- 'ownerSetting', 's3MachineLearningModelResourceData_ownerSetting' - Undocumented member.
--
-- 'destinationPath', 's3MachineLearningModelResourceData_destinationPath' - The absolute local path of the resource inside the Lambda environment.
--
-- 's3Uri', 's3MachineLearningModelResourceData_s3Uri' - The URI of the source model in an S3 bucket. The model package must be
-- in tar.gz or .zip format.
newS3MachineLearningModelResourceData ::
  S3MachineLearningModelResourceData
newS3MachineLearningModelResourceData :: S3MachineLearningModelResourceData
newS3MachineLearningModelResourceData =
  S3MachineLearningModelResourceData' :: Maybe ResourceDownloadOwnerSetting
-> Maybe Text -> Maybe Text -> S3MachineLearningModelResourceData
S3MachineLearningModelResourceData'
    { $sel:ownerSetting:S3MachineLearningModelResourceData' :: Maybe ResourceDownloadOwnerSetting
ownerSetting =
        Maybe ResourceDownloadOwnerSetting
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPath:S3MachineLearningModelResourceData' :: Maybe Text
destinationPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Uri:S3MachineLearningModelResourceData' :: Maybe Text
s3Uri = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
s3MachineLearningModelResourceData_ownerSetting :: Lens.Lens' S3MachineLearningModelResourceData (Prelude.Maybe ResourceDownloadOwnerSetting)
s3MachineLearningModelResourceData_ownerSetting :: (Maybe ResourceDownloadOwnerSetting
 -> f (Maybe ResourceDownloadOwnerSetting))
-> S3MachineLearningModelResourceData
-> f S3MachineLearningModelResourceData
s3MachineLearningModelResourceData_ownerSetting = (S3MachineLearningModelResourceData
 -> Maybe ResourceDownloadOwnerSetting)
-> (S3MachineLearningModelResourceData
    -> Maybe ResourceDownloadOwnerSetting
    -> S3MachineLearningModelResourceData)
-> Lens
     S3MachineLearningModelResourceData
     S3MachineLearningModelResourceData
     (Maybe ResourceDownloadOwnerSetting)
     (Maybe ResourceDownloadOwnerSetting)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3MachineLearningModelResourceData' {Maybe ResourceDownloadOwnerSetting
ownerSetting :: Maybe ResourceDownloadOwnerSetting
$sel:ownerSetting:S3MachineLearningModelResourceData' :: S3MachineLearningModelResourceData
-> Maybe ResourceDownloadOwnerSetting
ownerSetting} -> Maybe ResourceDownloadOwnerSetting
ownerSetting) (\s :: S3MachineLearningModelResourceData
s@S3MachineLearningModelResourceData' {} Maybe ResourceDownloadOwnerSetting
a -> S3MachineLearningModelResourceData
s {$sel:ownerSetting:S3MachineLearningModelResourceData' :: Maybe ResourceDownloadOwnerSetting
ownerSetting = Maybe ResourceDownloadOwnerSetting
a} :: S3MachineLearningModelResourceData)

-- | The absolute local path of the resource inside the Lambda environment.
s3MachineLearningModelResourceData_destinationPath :: Lens.Lens' S3MachineLearningModelResourceData (Prelude.Maybe Prelude.Text)
s3MachineLearningModelResourceData_destinationPath :: (Maybe Text -> f (Maybe Text))
-> S3MachineLearningModelResourceData
-> f S3MachineLearningModelResourceData
s3MachineLearningModelResourceData_destinationPath = (S3MachineLearningModelResourceData -> Maybe Text)
-> (S3MachineLearningModelResourceData
    -> Maybe Text -> S3MachineLearningModelResourceData)
-> Lens
     S3MachineLearningModelResourceData
     S3MachineLearningModelResourceData
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3MachineLearningModelResourceData' {Maybe Text
destinationPath :: Maybe Text
$sel:destinationPath:S3MachineLearningModelResourceData' :: S3MachineLearningModelResourceData -> Maybe Text
destinationPath} -> Maybe Text
destinationPath) (\s :: S3MachineLearningModelResourceData
s@S3MachineLearningModelResourceData' {} Maybe Text
a -> S3MachineLearningModelResourceData
s {$sel:destinationPath:S3MachineLearningModelResourceData' :: Maybe Text
destinationPath = Maybe Text
a} :: S3MachineLearningModelResourceData)

-- | The URI of the source model in an S3 bucket. The model package must be
-- in tar.gz or .zip format.
s3MachineLearningModelResourceData_s3Uri :: Lens.Lens' S3MachineLearningModelResourceData (Prelude.Maybe Prelude.Text)
s3MachineLearningModelResourceData_s3Uri :: (Maybe Text -> f (Maybe Text))
-> S3MachineLearningModelResourceData
-> f S3MachineLearningModelResourceData
s3MachineLearningModelResourceData_s3Uri = (S3MachineLearningModelResourceData -> Maybe Text)
-> (S3MachineLearningModelResourceData
    -> Maybe Text -> S3MachineLearningModelResourceData)
-> Lens
     S3MachineLearningModelResourceData
     S3MachineLearningModelResourceData
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3MachineLearningModelResourceData' {Maybe Text
s3Uri :: Maybe Text
$sel:s3Uri:S3MachineLearningModelResourceData' :: S3MachineLearningModelResourceData -> Maybe Text
s3Uri} -> Maybe Text
s3Uri) (\s :: S3MachineLearningModelResourceData
s@S3MachineLearningModelResourceData' {} Maybe Text
a -> S3MachineLearningModelResourceData
s {$sel:s3Uri:S3MachineLearningModelResourceData' :: Maybe Text
s3Uri = Maybe Text
a} :: S3MachineLearningModelResourceData)

instance
  Core.FromJSON
    S3MachineLearningModelResourceData
  where
  parseJSON :: Value -> Parser S3MachineLearningModelResourceData
parseJSON =
    String
-> (Object -> Parser S3MachineLearningModelResourceData)
-> Value
-> Parser S3MachineLearningModelResourceData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3MachineLearningModelResourceData"
      ( \Object
x ->
          Maybe ResourceDownloadOwnerSetting
-> Maybe Text -> Maybe Text -> S3MachineLearningModelResourceData
S3MachineLearningModelResourceData'
            (Maybe ResourceDownloadOwnerSetting
 -> Maybe Text -> Maybe Text -> S3MachineLearningModelResourceData)
-> Parser (Maybe ResourceDownloadOwnerSetting)
-> Parser
     (Maybe Text -> Maybe Text -> S3MachineLearningModelResourceData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResourceDownloadOwnerSetting)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OwnerSetting")
            Parser
  (Maybe Text -> Maybe Text -> S3MachineLearningModelResourceData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> S3MachineLearningModelResourceData)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DestinationPath")
            Parser (Maybe Text -> S3MachineLearningModelResourceData)
-> Parser (Maybe Text) -> Parser S3MachineLearningModelResourceData
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3Uri")
      )

instance
  Prelude.Hashable
    S3MachineLearningModelResourceData

instance
  Prelude.NFData
    S3MachineLearningModelResourceData

instance
  Core.ToJSON
    S3MachineLearningModelResourceData
  where
  toJSON :: S3MachineLearningModelResourceData -> Value
toJSON S3MachineLearningModelResourceData' {Maybe Text
Maybe ResourceDownloadOwnerSetting
s3Uri :: Maybe Text
destinationPath :: Maybe Text
ownerSetting :: Maybe ResourceDownloadOwnerSetting
$sel:s3Uri:S3MachineLearningModelResourceData' :: S3MachineLearningModelResourceData -> Maybe Text
$sel:destinationPath:S3MachineLearningModelResourceData' :: S3MachineLearningModelResourceData -> Maybe Text
$sel:ownerSetting:S3MachineLearningModelResourceData' :: S3MachineLearningModelResourceData
-> Maybe ResourceDownloadOwnerSetting
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OwnerSetting" Text -> ResourceDownloadOwnerSetting -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ResourceDownloadOwnerSetting -> Pair)
-> Maybe ResourceDownloadOwnerSetting -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceDownloadOwnerSetting
ownerSetting,
            (Text
"DestinationPath" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationPath,
            (Text
"S3Uri" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3Uri
          ]
      )