{-# 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.Lightsail.Types.ContainerImage
-- 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.Lightsail.Types.ContainerImage 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 a container image that is registered to an Amazon Lightsail
-- container service.
--
-- /See:/ 'newContainerImage' smart constructor.
data ContainerImage = ContainerImage'
  { -- | The timestamp when the container image was created.
    ContainerImage -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The digest of the container image.
    ContainerImage -> Maybe Text
digest :: Prelude.Maybe Prelude.Text,
    -- | The name of the container image.
    ContainerImage -> Maybe Text
image :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerImage -> ContainerImage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerImage -> ContainerImage -> Bool
$c/= :: ContainerImage -> ContainerImage -> Bool
== :: ContainerImage -> ContainerImage -> Bool
$c== :: ContainerImage -> ContainerImage -> Bool
Prelude.Eq, ReadPrec [ContainerImage]
ReadPrec ContainerImage
Int -> ReadS ContainerImage
ReadS [ContainerImage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerImage]
$creadListPrec :: ReadPrec [ContainerImage]
readPrec :: ReadPrec ContainerImage
$creadPrec :: ReadPrec ContainerImage
readList :: ReadS [ContainerImage]
$creadList :: ReadS [ContainerImage]
readsPrec :: Int -> ReadS ContainerImage
$creadsPrec :: Int -> ReadS ContainerImage
Prelude.Read, Int -> ContainerImage -> ShowS
[ContainerImage] -> ShowS
ContainerImage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerImage] -> ShowS
$cshowList :: [ContainerImage] -> ShowS
show :: ContainerImage -> String
$cshow :: ContainerImage -> String
showsPrec :: Int -> ContainerImage -> ShowS
$cshowsPrec :: Int -> ContainerImage -> ShowS
Prelude.Show, forall x. Rep ContainerImage x -> ContainerImage
forall x. ContainerImage -> Rep ContainerImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ContainerImage x -> ContainerImage
$cfrom :: forall x. ContainerImage -> Rep ContainerImage x
Prelude.Generic)

-- |
-- Create a value of 'ContainerImage' 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:
--
-- 'createdAt', 'containerImage_createdAt' - The timestamp when the container image was created.
--
-- 'digest', 'containerImage_digest' - The digest of the container image.
--
-- 'image', 'containerImage_image' - The name of the container image.
newContainerImage ::
  ContainerImage
newContainerImage :: ContainerImage
newContainerImage =
  ContainerImage'
    { $sel:createdAt:ContainerImage' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:digest:ContainerImage' :: Maybe Text
digest = forall a. Maybe a
Prelude.Nothing,
      $sel:image:ContainerImage' :: Maybe Text
image = forall a. Maybe a
Prelude.Nothing
    }

-- | The timestamp when the container image was created.
containerImage_createdAt :: Lens.Lens' ContainerImage (Prelude.Maybe Prelude.UTCTime)
containerImage_createdAt :: Lens' ContainerImage (Maybe UTCTime)
containerImage_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerImage' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ContainerImage' :: ContainerImage -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ContainerImage
s@ContainerImage' {} Maybe POSIX
a -> ContainerImage
s {$sel:createdAt:ContainerImage' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ContainerImage) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

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

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

instance Data.FromJSON ContainerImage where
  parseJSON :: Value -> Parser ContainerImage
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContainerImage"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> Maybe Text -> ContainerImage
ContainerImage'
            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
"createdAt")
            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
"digest")
            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
"image")
      )

instance Prelude.Hashable ContainerImage where
  hashWithSalt :: Int -> ContainerImage -> Int
hashWithSalt Int
_salt ContainerImage' {Maybe Text
Maybe POSIX
image :: Maybe Text
digest :: Maybe Text
createdAt :: Maybe POSIX
$sel:image:ContainerImage' :: ContainerImage -> Maybe Text
$sel:digest:ContainerImage' :: ContainerImage -> Maybe Text
$sel:createdAt:ContainerImage' :: ContainerImage -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
digest
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
image

instance Prelude.NFData ContainerImage where
  rnf :: ContainerImage -> ()
rnf ContainerImage' {Maybe Text
Maybe POSIX
image :: Maybe Text
digest :: Maybe Text
createdAt :: Maybe POSIX
$sel:image:ContainerImage' :: ContainerImage -> Maybe Text
$sel:digest:ContainerImage' :: ContainerImage -> Maybe Text
$sel:createdAt:ContainerImage' :: ContainerImage -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
digest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
image