{-# 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.SageMaker.Types.Image
-- 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.SageMaker.Types.Image 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
import Amazonka.SageMaker.Types.ImageStatus

-- | A SageMaker image. A SageMaker image represents a set of container
-- images that are derived from a common base container image. Each of
-- these container images is represented by a SageMaker @ImageVersion@.
--
-- /See:/ 'newImage' smart constructor.
data Image = Image'
  { -- | The description of the image.
    Image -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the image as displayed.
    Image -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | When a create, update, or delete operation fails, the reason for the
    -- failure.
    Image -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | When the image was created.
    Image -> POSIX
creationTime :: Data.POSIX,
    -- | The ARN of the image.
    Image -> Text
imageArn :: Prelude.Text,
    -- | The name of the image.
    Image -> Text
imageName :: Prelude.Text,
    -- | The status of the image.
    Image -> ImageStatus
imageStatus :: ImageStatus,
    -- | When the image was last modified.
    Image -> POSIX
lastModifiedTime :: Data.POSIX
  }
  deriving (Image -> Image -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Image -> Image -> Bool
$c/= :: Image -> Image -> Bool
== :: Image -> Image -> Bool
$c== :: Image -> Image -> Bool
Prelude.Eq, ReadPrec [Image]
ReadPrec Image
Int -> ReadS Image
ReadS [Image]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Image]
$creadListPrec :: ReadPrec [Image]
readPrec :: ReadPrec Image
$creadPrec :: ReadPrec Image
readList :: ReadS [Image]
$creadList :: ReadS [Image]
readsPrec :: Int -> ReadS Image
$creadsPrec :: Int -> ReadS Image
Prelude.Read, Int -> Image -> ShowS
[Image] -> ShowS
Image -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Image] -> ShowS
$cshowList :: [Image] -> ShowS
show :: Image -> String
$cshow :: Image -> String
showsPrec :: Int -> Image -> ShowS
$cshowsPrec :: Int -> Image -> ShowS
Prelude.Show, forall x. Rep Image x -> Image
forall x. Image -> Rep Image x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Image x -> Image
$cfrom :: forall x. Image -> Rep Image x
Prelude.Generic)

-- |
-- Create a value of 'Image' 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:
--
-- 'description', 'image_description' - The description of the image.
--
-- 'displayName', 'image_displayName' - The name of the image as displayed.
--
-- 'failureReason', 'image_failureReason' - When a create, update, or delete operation fails, the reason for the
-- failure.
--
-- 'creationTime', 'image_creationTime' - When the image was created.
--
-- 'imageArn', 'image_imageArn' - The ARN of the image.
--
-- 'imageName', 'image_imageName' - The name of the image.
--
-- 'imageStatus', 'image_imageStatus' - The status of the image.
--
-- 'lastModifiedTime', 'image_lastModifiedTime' - When the image was last modified.
newImage ::
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'imageArn'
  Prelude.Text ->
  -- | 'imageName'
  Prelude.Text ->
  -- | 'imageStatus'
  ImageStatus ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  Image
newImage :: UTCTime -> Text -> Text -> ImageStatus -> UTCTime -> Image
newImage
  UTCTime
pCreationTime_
  Text
pImageArn_
  Text
pImageName_
  ImageStatus
pImageStatus_
  UTCTime
pLastModifiedTime_ =
    Image'
      { $sel:description:Image' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:displayName:Image' :: Maybe Text
displayName = forall a. Maybe a
Prelude.Nothing,
        $sel:failureReason:Image' :: Maybe Text
failureReason = forall a. Maybe a
Prelude.Nothing,
        $sel:creationTime:Image' :: POSIX
creationTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:imageArn:Image' :: Text
imageArn = Text
pImageArn_,
        $sel:imageName:Image' :: Text
imageName = Text
pImageName_,
        $sel:imageStatus:Image' :: ImageStatus
imageStatus = ImageStatus
pImageStatus_,
        $sel:lastModifiedTime:Image' :: POSIX
lastModifiedTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_
      }

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

-- | The name of the image as displayed.
image_displayName :: Lens.Lens' Image (Prelude.Maybe Prelude.Text)
image_displayName :: Lens' Image (Maybe Text)
image_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Image' {Maybe Text
displayName :: Maybe Text
$sel:displayName:Image' :: Image -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: Image
s@Image' {} Maybe Text
a -> Image
s {$sel:displayName:Image' :: Maybe Text
displayName = Maybe Text
a} :: Image)

-- | When a create, update, or delete operation fails, the reason for the
-- failure.
image_failureReason :: Lens.Lens' Image (Prelude.Maybe Prelude.Text)
image_failureReason :: Lens' Image (Maybe Text)
image_failureReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Image' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:Image' :: Image -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: Image
s@Image' {} Maybe Text
a -> Image
s {$sel:failureReason:Image' :: Maybe Text
failureReason = Maybe Text
a} :: Image)

-- | When the image was created.
image_creationTime :: Lens.Lens' Image Prelude.UTCTime
image_creationTime :: Lens' Image UTCTime
image_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Image' {POSIX
creationTime :: POSIX
$sel:creationTime:Image' :: Image -> POSIX
creationTime} -> POSIX
creationTime) (\s :: Image
s@Image' {} POSIX
a -> Image
s {$sel:creationTime:Image' :: POSIX
creationTime = POSIX
a} :: Image) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ARN of the image.
image_imageArn :: Lens.Lens' Image Prelude.Text
image_imageArn :: Lens' Image Text
image_imageArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Image' {Text
imageArn :: Text
$sel:imageArn:Image' :: Image -> Text
imageArn} -> Text
imageArn) (\s :: Image
s@Image' {} Text
a -> Image
s {$sel:imageArn:Image' :: Text
imageArn = Text
a} :: Image)

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

-- | The status of the image.
image_imageStatus :: Lens.Lens' Image ImageStatus
image_imageStatus :: Lens' Image ImageStatus
image_imageStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Image' {ImageStatus
imageStatus :: ImageStatus
$sel:imageStatus:Image' :: Image -> ImageStatus
imageStatus} -> ImageStatus
imageStatus) (\s :: Image
s@Image' {} ImageStatus
a -> Image
s {$sel:imageStatus:Image' :: ImageStatus
imageStatus = ImageStatus
a} :: Image)

-- | When the image was last modified.
image_lastModifiedTime :: Lens.Lens' Image Prelude.UTCTime
image_lastModifiedTime :: Lens' Image UTCTime
image_lastModifiedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Image' {POSIX
lastModifiedTime :: POSIX
$sel:lastModifiedTime:Image' :: Image -> POSIX
lastModifiedTime} -> POSIX
lastModifiedTime) (\s :: Image
s@Image' {} POSIX
a -> Image
s {$sel:lastModifiedTime:Image' :: POSIX
lastModifiedTime = POSIX
a} :: Image) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON Image where
  parseJSON :: Value -> Parser Image
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Image"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> POSIX
-> Text
-> Text
-> ImageStatus
-> POSIX
-> Image
Image'
            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
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DisplayName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FailureReason")
            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
"CreationTime")
            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
"ImageArn")
            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
"ImageName")
            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
"ImageStatus")
            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
"LastModifiedTime")
      )

instance Prelude.Hashable Image where
  hashWithSalt :: Int -> Image -> Int
hashWithSalt Int
_salt Image' {Maybe Text
Text
POSIX
ImageStatus
lastModifiedTime :: POSIX
imageStatus :: ImageStatus
imageName :: Text
imageArn :: Text
creationTime :: POSIX
failureReason :: Maybe Text
displayName :: Maybe Text
description :: Maybe Text
$sel:lastModifiedTime:Image' :: Image -> POSIX
$sel:imageStatus:Image' :: Image -> ImageStatus
$sel:imageName:Image' :: Image -> Text
$sel:imageArn:Image' :: Image -> Text
$sel:creationTime:Image' :: Image -> POSIX
$sel:failureReason:Image' :: Image -> Maybe Text
$sel:displayName:Image' :: Image -> Maybe Text
$sel:description:Image' :: Image -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
displayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
failureReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imageArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imageName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ImageStatus
imageStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastModifiedTime

instance Prelude.NFData Image where
  rnf :: Image -> ()
rnf Image' {Maybe Text
Text
POSIX
ImageStatus
lastModifiedTime :: POSIX
imageStatus :: ImageStatus
imageName :: Text
imageArn :: Text
creationTime :: POSIX
failureReason :: Maybe Text
displayName :: Maybe Text
description :: Maybe Text
$sel:lastModifiedTime:Image' :: Image -> POSIX
$sel:imageStatus:Image' :: Image -> ImageStatus
$sel:imageName:Image' :: Image -> Text
$sel:imageArn:Image' :: Image -> Text
$sel:creationTime:Image' :: Image -> POSIX
$sel:failureReason:Image' :: Image -> Maybe Text
$sel:displayName:Image' :: Image -> Maybe Text
$sel:description:Image' :: Image -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
displayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
failureReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
imageArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
imageName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ImageStatus
imageStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastModifiedTime