{-# 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.Personalize.Types.AlgorithmImage
-- 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.Personalize.Types.AlgorithmImage 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

-- | Describes an algorithm image.
--
-- /See:/ 'newAlgorithmImage' smart constructor.
data AlgorithmImage = AlgorithmImage'
  { -- | The name of the algorithm image.
    AlgorithmImage -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The URI of the Docker container for the algorithm image.
    AlgorithmImage -> Text
dockerURI :: Prelude.Text
  }
  deriving (AlgorithmImage -> AlgorithmImage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlgorithmImage -> AlgorithmImage -> Bool
$c/= :: AlgorithmImage -> AlgorithmImage -> Bool
== :: AlgorithmImage -> AlgorithmImage -> Bool
$c== :: AlgorithmImage -> AlgorithmImage -> Bool
Prelude.Eq, ReadPrec [AlgorithmImage]
ReadPrec AlgorithmImage
Int -> ReadS AlgorithmImage
ReadS [AlgorithmImage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AlgorithmImage]
$creadListPrec :: ReadPrec [AlgorithmImage]
readPrec :: ReadPrec AlgorithmImage
$creadPrec :: ReadPrec AlgorithmImage
readList :: ReadS [AlgorithmImage]
$creadList :: ReadS [AlgorithmImage]
readsPrec :: Int -> ReadS AlgorithmImage
$creadsPrec :: Int -> ReadS AlgorithmImage
Prelude.Read, Int -> AlgorithmImage -> ShowS
[AlgorithmImage] -> ShowS
AlgorithmImage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlgorithmImage] -> ShowS
$cshowList :: [AlgorithmImage] -> ShowS
show :: AlgorithmImage -> String
$cshow :: AlgorithmImage -> String
showsPrec :: Int -> AlgorithmImage -> ShowS
$cshowsPrec :: Int -> AlgorithmImage -> ShowS
Prelude.Show, forall x. Rep AlgorithmImage x -> AlgorithmImage
forall x. AlgorithmImage -> Rep AlgorithmImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AlgorithmImage x -> AlgorithmImage
$cfrom :: forall x. AlgorithmImage -> Rep AlgorithmImage x
Prelude.Generic)

-- |
-- Create a value of 'AlgorithmImage' 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:
--
-- 'name', 'algorithmImage_name' - The name of the algorithm image.
--
-- 'dockerURI', 'algorithmImage_dockerURI' - The URI of the Docker container for the algorithm image.
newAlgorithmImage ::
  -- | 'dockerURI'
  Prelude.Text ->
  AlgorithmImage
newAlgorithmImage :: Text -> AlgorithmImage
newAlgorithmImage Text
pDockerURI_ =
  AlgorithmImage'
    { $sel:name:AlgorithmImage' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:dockerURI:AlgorithmImage' :: Text
dockerURI = Text
pDockerURI_
    }

-- | The name of the algorithm image.
algorithmImage_name :: Lens.Lens' AlgorithmImage (Prelude.Maybe Prelude.Text)
algorithmImage_name :: Lens' AlgorithmImage (Maybe Text)
algorithmImage_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmImage' {Maybe Text
name :: Maybe Text
$sel:name:AlgorithmImage' :: AlgorithmImage -> Maybe Text
name} -> Maybe Text
name) (\s :: AlgorithmImage
s@AlgorithmImage' {} Maybe Text
a -> AlgorithmImage
s {$sel:name:AlgorithmImage' :: Maybe Text
name = Maybe Text
a} :: AlgorithmImage)

-- | The URI of the Docker container for the algorithm image.
algorithmImage_dockerURI :: Lens.Lens' AlgorithmImage Prelude.Text
algorithmImage_dockerURI :: Lens' AlgorithmImage Text
algorithmImage_dockerURI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AlgorithmImage' {Text
dockerURI :: Text
$sel:dockerURI:AlgorithmImage' :: AlgorithmImage -> Text
dockerURI} -> Text
dockerURI) (\s :: AlgorithmImage
s@AlgorithmImage' {} Text
a -> AlgorithmImage
s {$sel:dockerURI:AlgorithmImage' :: Text
dockerURI = Text
a} :: AlgorithmImage)

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

instance Prelude.Hashable AlgorithmImage where
  hashWithSalt :: Int -> AlgorithmImage -> Int
hashWithSalt Int
_salt AlgorithmImage' {Maybe Text
Text
dockerURI :: Text
name :: Maybe Text
$sel:dockerURI:AlgorithmImage' :: AlgorithmImage -> Text
$sel:name:AlgorithmImage' :: AlgorithmImage -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dockerURI

instance Prelude.NFData AlgorithmImage where
  rnf :: AlgorithmImage -> ()
rnf AlgorithmImage' {Maybe Text
Text
dockerURI :: Text
name :: Maybe Text
$sel:dockerURI:AlgorithmImage' :: AlgorithmImage -> Text
$sel:name:AlgorithmImage' :: AlgorithmImage -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dockerURI