{-# 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.FraudDetector.Types.ModelEndpointDataBlob
-- 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.FraudDetector.Types.ModelEndpointDataBlob 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

-- | A pre-formed Amazon SageMaker model input you can include if your
-- detector version includes an imported Amazon SageMaker model endpoint
-- with pass-through input configuration.
--
-- /See:/ 'newModelEndpointDataBlob' smart constructor.
data ModelEndpointDataBlob = ModelEndpointDataBlob'
  { -- | The byte buffer of the Amazon SageMaker model endpoint input data blob.
    ModelEndpointDataBlob -> Maybe Base64
byteBuffer :: Prelude.Maybe Data.Base64,
    -- | The content type of the Amazon SageMaker model endpoint input data blob.
    ModelEndpointDataBlob -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text
  }
  deriving (ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool
$c/= :: ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool
== :: ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool
$c== :: ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool
Prelude.Eq, ReadPrec [ModelEndpointDataBlob]
ReadPrec ModelEndpointDataBlob
Int -> ReadS ModelEndpointDataBlob
ReadS [ModelEndpointDataBlob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelEndpointDataBlob]
$creadListPrec :: ReadPrec [ModelEndpointDataBlob]
readPrec :: ReadPrec ModelEndpointDataBlob
$creadPrec :: ReadPrec ModelEndpointDataBlob
readList :: ReadS [ModelEndpointDataBlob]
$creadList :: ReadS [ModelEndpointDataBlob]
readsPrec :: Int -> ReadS ModelEndpointDataBlob
$creadsPrec :: Int -> ReadS ModelEndpointDataBlob
Prelude.Read, Int -> ModelEndpointDataBlob -> ShowS
[ModelEndpointDataBlob] -> ShowS
ModelEndpointDataBlob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelEndpointDataBlob] -> ShowS
$cshowList :: [ModelEndpointDataBlob] -> ShowS
show :: ModelEndpointDataBlob -> String
$cshow :: ModelEndpointDataBlob -> String
showsPrec :: Int -> ModelEndpointDataBlob -> ShowS
$cshowsPrec :: Int -> ModelEndpointDataBlob -> ShowS
Prelude.Show, forall x. Rep ModelEndpointDataBlob x -> ModelEndpointDataBlob
forall x. ModelEndpointDataBlob -> Rep ModelEndpointDataBlob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelEndpointDataBlob x -> ModelEndpointDataBlob
$cfrom :: forall x. ModelEndpointDataBlob -> Rep ModelEndpointDataBlob x
Prelude.Generic)

-- |
-- Create a value of 'ModelEndpointDataBlob' 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:
--
-- 'byteBuffer', 'modelEndpointDataBlob_byteBuffer' - The byte buffer of the Amazon SageMaker model endpoint input data blob.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'contentType', 'modelEndpointDataBlob_contentType' - The content type of the Amazon SageMaker model endpoint input data blob.
newModelEndpointDataBlob ::
  ModelEndpointDataBlob
newModelEndpointDataBlob :: ModelEndpointDataBlob
newModelEndpointDataBlob =
  ModelEndpointDataBlob'
    { $sel:byteBuffer:ModelEndpointDataBlob' :: Maybe Base64
byteBuffer =
        forall a. Maybe a
Prelude.Nothing,
      $sel:contentType:ModelEndpointDataBlob' :: Maybe Text
contentType = forall a. Maybe a
Prelude.Nothing
    }

-- | The byte buffer of the Amazon SageMaker model endpoint input data blob.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
modelEndpointDataBlob_byteBuffer :: Lens.Lens' ModelEndpointDataBlob (Prelude.Maybe Prelude.ByteString)
modelEndpointDataBlob_byteBuffer :: Lens' ModelEndpointDataBlob (Maybe ByteString)
modelEndpointDataBlob_byteBuffer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelEndpointDataBlob' {Maybe Base64
byteBuffer :: Maybe Base64
$sel:byteBuffer:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Base64
byteBuffer} -> Maybe Base64
byteBuffer) (\s :: ModelEndpointDataBlob
s@ModelEndpointDataBlob' {} Maybe Base64
a -> ModelEndpointDataBlob
s {$sel:byteBuffer:ModelEndpointDataBlob' :: Maybe Base64
byteBuffer = Maybe Base64
a} :: ModelEndpointDataBlob) 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 Iso' Base64 ByteString
Data._Base64

-- | The content type of the Amazon SageMaker model endpoint input data blob.
modelEndpointDataBlob_contentType :: Lens.Lens' ModelEndpointDataBlob (Prelude.Maybe Prelude.Text)
modelEndpointDataBlob_contentType :: Lens' ModelEndpointDataBlob (Maybe Text)
modelEndpointDataBlob_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelEndpointDataBlob' {Maybe Text
contentType :: Maybe Text
$sel:contentType:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: ModelEndpointDataBlob
s@ModelEndpointDataBlob' {} Maybe Text
a -> ModelEndpointDataBlob
s {$sel:contentType:ModelEndpointDataBlob' :: Maybe Text
contentType = Maybe Text
a} :: ModelEndpointDataBlob)

instance Prelude.Hashable ModelEndpointDataBlob where
  hashWithSalt :: Int -> ModelEndpointDataBlob -> Int
hashWithSalt Int
_salt ModelEndpointDataBlob' {Maybe Text
Maybe Base64
contentType :: Maybe Text
byteBuffer :: Maybe Base64
$sel:contentType:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Text
$sel:byteBuffer:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Base64
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Base64
byteBuffer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentType

instance Prelude.NFData ModelEndpointDataBlob where
  rnf :: ModelEndpointDataBlob -> ()
rnf ModelEndpointDataBlob' {Maybe Text
Maybe Base64
contentType :: Maybe Text
byteBuffer :: Maybe Base64
$sel:contentType:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Text
$sel:byteBuffer:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Base64
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Base64
byteBuffer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentType

instance Data.ToJSON ModelEndpointDataBlob where
  toJSON :: ModelEndpointDataBlob -> Value
toJSON ModelEndpointDataBlob' {Maybe Text
Maybe Base64
contentType :: Maybe Text
byteBuffer :: Maybe Base64
$sel:contentType:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Text
$sel:byteBuffer:ModelEndpointDataBlob' :: ModelEndpointDataBlob -> Maybe Base64
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"byteBuffer" 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 Base64
byteBuffer,
            (Key
"contentType" 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
contentType
          ]
      )