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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 Core.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
(ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool)
-> (ModelEndpointDataBlob -> ModelEndpointDataBlob -> Bool)
-> Eq ModelEndpointDataBlob
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]
(Int -> ReadS ModelEndpointDataBlob)
-> ReadS [ModelEndpointDataBlob]
-> ReadPrec ModelEndpointDataBlob
-> ReadPrec [ModelEndpointDataBlob]
-> Read 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
(Int -> ModelEndpointDataBlob -> ShowS)
-> (ModelEndpointDataBlob -> String)
-> ([ModelEndpointDataBlob] -> ShowS)
-> Show ModelEndpointDataBlob
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. ModelEndpointDataBlob -> Rep ModelEndpointDataBlob x)
-> (forall x. Rep ModelEndpointDataBlob x -> ModelEndpointDataBlob)
-> Generic ModelEndpointDataBlob
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' :: Maybe Base64 -> Maybe Text -> ModelEndpointDataBlob
ModelEndpointDataBlob'
    { $sel:byteBuffer:ModelEndpointDataBlob' :: Maybe Base64
byteBuffer =
        Maybe Base64
forall a. Maybe a
Prelude.Nothing,
      $sel:contentType:ModelEndpointDataBlob' :: Maybe Text
contentType = Maybe Text
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 :: (Maybe ByteString -> f (Maybe ByteString))
-> ModelEndpointDataBlob -> f ModelEndpointDataBlob
modelEndpointDataBlob_byteBuffer = (ModelEndpointDataBlob -> Maybe Base64)
-> (ModelEndpointDataBlob -> Maybe Base64 -> ModelEndpointDataBlob)
-> Lens
     ModelEndpointDataBlob
     ModelEndpointDataBlob
     (Maybe Base64)
     (Maybe Base64)
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) ((Maybe Base64 -> f (Maybe Base64))
 -> ModelEndpointDataBlob -> f ModelEndpointDataBlob)
-> ((Maybe ByteString -> f (Maybe ByteString))
    -> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> ModelEndpointDataBlob
-> f ModelEndpointDataBlob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
     (Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64

-- | The content type of the Amazon SageMaker model endpoint input data blob.
modelEndpointDataBlob_contentType :: Lens.Lens' ModelEndpointDataBlob (Prelude.Maybe Prelude.Text)
modelEndpointDataBlob_contentType :: (Maybe Text -> f (Maybe Text))
-> ModelEndpointDataBlob -> f ModelEndpointDataBlob
modelEndpointDataBlob_contentType = (ModelEndpointDataBlob -> Maybe Text)
-> (ModelEndpointDataBlob -> Maybe Text -> ModelEndpointDataBlob)
-> Lens
     ModelEndpointDataBlob
     ModelEndpointDataBlob
     (Maybe Text)
     (Maybe Text)
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

instance Prelude.NFData ModelEndpointDataBlob

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"byteBuffer" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Base64 -> Pair) -> Maybe Base64 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
byteBuffer,
            (Text
"contentType" 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
contentType
          ]
      )