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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(AlgorithmImage -> AlgorithmImage -> Bool)
-> (AlgorithmImage -> AlgorithmImage -> Bool) -> Eq AlgorithmImage
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]
(Int -> ReadS AlgorithmImage)
-> ReadS [AlgorithmImage]
-> ReadPrec AlgorithmImage
-> ReadPrec [AlgorithmImage]
-> Read 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
(Int -> AlgorithmImage -> ShowS)
-> (AlgorithmImage -> String)
-> ([AlgorithmImage] -> ShowS)
-> Show AlgorithmImage
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. AlgorithmImage -> Rep AlgorithmImage x)
-> (forall x. Rep AlgorithmImage x -> AlgorithmImage)
-> Generic AlgorithmImage
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' :: Maybe Text -> Text -> AlgorithmImage
AlgorithmImage'
    { $sel:name:AlgorithmImage' :: Maybe Text
name = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> AlgorithmImage -> f AlgorithmImage
algorithmImage_name = (AlgorithmImage -> Maybe Text)
-> (AlgorithmImage -> Maybe Text -> AlgorithmImage)
-> Lens AlgorithmImage AlgorithmImage (Maybe Text) (Maybe Text)
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 :: (Text -> f Text) -> AlgorithmImage -> f AlgorithmImage
algorithmImage_dockerURI = (AlgorithmImage -> Text)
-> (AlgorithmImage -> Text -> AlgorithmImage)
-> Lens AlgorithmImage AlgorithmImage Text Text
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 Core.FromJSON AlgorithmImage where
  parseJSON :: Value -> Parser AlgorithmImage
parseJSON =
    String
-> (Object -> Parser AlgorithmImage)
-> Value
-> Parser AlgorithmImage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AlgorithmImage"
      ( \Object
x ->
          Maybe Text -> Text -> AlgorithmImage
AlgorithmImage'
            (Maybe Text -> Text -> AlgorithmImage)
-> Parser (Maybe Text) -> Parser (Text -> AlgorithmImage)
forall (f :: * -> *) a b. Functor 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
"name")
            Parser (Text -> AlgorithmImage)
-> Parser Text -> Parser AlgorithmImage
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"dockerURI")
      )

instance Prelude.Hashable AlgorithmImage

instance Prelude.NFData AlgorithmImage