{-# 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-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.SageMaker.Types.Image where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | When a create, update, or delete operation fails, the reason for the
    -- failure.
    Image -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The name of the image as displayed.
    Image -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | The description of the image.
    Image -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | When the image was created.
    Image -> POSIX
creationTime :: Core.POSIX,
    -- | The Amazon Resource Name (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 :: Core.POSIX
  }
  deriving (Image -> Image -> Bool
(Image -> Image -> Bool) -> (Image -> Image -> Bool) -> Eq Image
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]
(Int -> ReadS Image)
-> ReadS [Image]
-> ReadPrec Image
-> ReadPrec [Image]
-> Read 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
(Int -> Image -> ShowS)
-> (Image -> String) -> ([Image] -> ShowS) -> Show Image
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. Image -> Rep Image x)
-> (forall x. Rep Image x -> Image) -> Generic Image
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:
--
-- 'failureReason', 'image_failureReason' - When a create, update, or delete operation fails, the reason for the
-- failure.
--
-- 'displayName', 'image_displayName' - The name of the image as displayed.
--
-- 'description', 'image_description' - The description of the image.
--
-- 'creationTime', 'image_creationTime' - When the image was created.
--
-- 'imageArn', 'image_imageArn' - The Amazon Resource Name (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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> POSIX
-> Text
-> Text
-> ImageStatus
-> POSIX
-> Image
Image'
      { $sel:failureReason:Image' :: Maybe Text
failureReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:displayName:Image' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:Image' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:creationTime:Image' :: POSIX
creationTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
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 =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_
      }

-- | When a create, update, or delete operation fails, the reason for the
-- failure.
image_failureReason :: Lens.Lens' Image (Prelude.Maybe Prelude.Text)
image_failureReason :: (Maybe Text -> f (Maybe Text)) -> Image -> f Image
image_failureReason = (Image -> Maybe Text)
-> (Image -> Maybe Text -> Image)
-> Lens Image Image (Maybe Text) (Maybe Text)
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)

-- | The name of the image as displayed.
image_displayName :: Lens.Lens' Image (Prelude.Maybe Prelude.Text)
image_displayName :: (Maybe Text -> f (Maybe Text)) -> Image -> f Image
image_displayName = (Image -> Maybe Text)
-> (Image -> Maybe Text -> Image)
-> Lens Image Image (Maybe Text) (Maybe Text)
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)

-- | The description of the image.
image_description :: Lens.Lens' Image (Prelude.Maybe Prelude.Text)
image_description :: (Maybe Text -> f (Maybe Text)) -> Image -> f Image
image_description = (Image -> Maybe Text)
-> (Image -> Maybe Text -> Image)
-> Lens Image Image (Maybe Text) (Maybe Text)
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)

-- | When the image was created.
image_creationTime :: Lens.Lens' Image Prelude.UTCTime
image_creationTime :: (UTCTime -> f UTCTime) -> Image -> f Image
image_creationTime = (Image -> POSIX)
-> (Image -> POSIX -> Image) -> Lens Image Image POSIX POSIX
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) ((POSIX -> f POSIX) -> Image -> f Image)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Image
-> f Image
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) of the image.
image_imageArn :: Lens.Lens' Image Prelude.Text
image_imageArn :: (Text -> f Text) -> Image -> f Image
image_imageArn = (Image -> Text)
-> (Image -> Text -> Image) -> Lens Image Image Text Text
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 :: (Text -> f Text) -> Image -> f Image
image_imageName = (Image -> Text)
-> (Image -> Text -> Image) -> Lens Image Image Text Text
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 :: (ImageStatus -> f ImageStatus) -> Image -> f Image
image_imageStatus = (Image -> ImageStatus)
-> (Image -> ImageStatus -> Image)
-> Lens Image Image ImageStatus 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 :: (UTCTime -> f UTCTime) -> Image -> f Image
image_lastModifiedTime = (Image -> POSIX)
-> (Image -> POSIX -> Image) -> Lens Image Image POSIX POSIX
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) ((POSIX -> f POSIX) -> Image -> f Image)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Image
-> f Image
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.Hashable Image

instance Prelude.NFData Image