{-# 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.ECRPublic.Types.ReferencedImageDetail
-- 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.ECRPublic.Types.ReferencedImageDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object that describes the image tag details returned by a
-- DescribeImageTags action.
--
-- /See:/ 'newReferencedImageDetail' smart constructor.
data ReferencedImageDetail = ReferencedImageDetail'
  { -- | The media type of the image manifest.
    ReferencedImageDetail -> Maybe Text
imageManifestMediaType :: Prelude.Maybe Prelude.Text,
    -- | The size, in bytes, of the image in the repository.
    --
    -- If the image is a manifest list, this will be the max size of all
    -- manifests in the list.
    --
    -- Beginning with Docker version 1.9, the Docker client compresses image
    -- layers before pushing them to a V2 Docker registry. The output of the
    -- @docker images@ command shows the uncompressed image size, so it may
    -- return a larger image size than the image sizes returned by
    -- DescribeImages.
    ReferencedImageDetail -> Maybe Integer
imageSizeInBytes :: Prelude.Maybe Prelude.Integer,
    -- | The @sha256@ digest of the image manifest.
    ReferencedImageDetail -> Maybe Text
imageDigest :: Prelude.Maybe Prelude.Text,
    -- | The artifact media type of the image.
    ReferencedImageDetail -> Maybe Text
artifactMediaType :: Prelude.Maybe Prelude.Text,
    -- | The date and time, expressed in standard JavaScript date format, at
    -- which the current image tag was pushed to the repository.
    ReferencedImageDetail -> Maybe POSIX
imagePushedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (ReferencedImageDetail -> ReferencedImageDetail -> Bool
(ReferencedImageDetail -> ReferencedImageDetail -> Bool)
-> (ReferencedImageDetail -> ReferencedImageDetail -> Bool)
-> Eq ReferencedImageDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReferencedImageDetail -> ReferencedImageDetail -> Bool
$c/= :: ReferencedImageDetail -> ReferencedImageDetail -> Bool
== :: ReferencedImageDetail -> ReferencedImageDetail -> Bool
$c== :: ReferencedImageDetail -> ReferencedImageDetail -> Bool
Prelude.Eq, ReadPrec [ReferencedImageDetail]
ReadPrec ReferencedImageDetail
Int -> ReadS ReferencedImageDetail
ReadS [ReferencedImageDetail]
(Int -> ReadS ReferencedImageDetail)
-> ReadS [ReferencedImageDetail]
-> ReadPrec ReferencedImageDetail
-> ReadPrec [ReferencedImageDetail]
-> Read ReferencedImageDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReferencedImageDetail]
$creadListPrec :: ReadPrec [ReferencedImageDetail]
readPrec :: ReadPrec ReferencedImageDetail
$creadPrec :: ReadPrec ReferencedImageDetail
readList :: ReadS [ReferencedImageDetail]
$creadList :: ReadS [ReferencedImageDetail]
readsPrec :: Int -> ReadS ReferencedImageDetail
$creadsPrec :: Int -> ReadS ReferencedImageDetail
Prelude.Read, Int -> ReferencedImageDetail -> ShowS
[ReferencedImageDetail] -> ShowS
ReferencedImageDetail -> String
(Int -> ReferencedImageDetail -> ShowS)
-> (ReferencedImageDetail -> String)
-> ([ReferencedImageDetail] -> ShowS)
-> Show ReferencedImageDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReferencedImageDetail] -> ShowS
$cshowList :: [ReferencedImageDetail] -> ShowS
show :: ReferencedImageDetail -> String
$cshow :: ReferencedImageDetail -> String
showsPrec :: Int -> ReferencedImageDetail -> ShowS
$cshowsPrec :: Int -> ReferencedImageDetail -> ShowS
Prelude.Show, (forall x. ReferencedImageDetail -> Rep ReferencedImageDetail x)
-> (forall x. Rep ReferencedImageDetail x -> ReferencedImageDetail)
-> Generic ReferencedImageDetail
forall x. Rep ReferencedImageDetail x -> ReferencedImageDetail
forall x. ReferencedImageDetail -> Rep ReferencedImageDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReferencedImageDetail x -> ReferencedImageDetail
$cfrom :: forall x. ReferencedImageDetail -> Rep ReferencedImageDetail x
Prelude.Generic)

-- |
-- Create a value of 'ReferencedImageDetail' 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:
--
-- 'imageManifestMediaType', 'referencedImageDetail_imageManifestMediaType' - The media type of the image manifest.
--
-- 'imageSizeInBytes', 'referencedImageDetail_imageSizeInBytes' - The size, in bytes, of the image in the repository.
--
-- If the image is a manifest list, this will be the max size of all
-- manifests in the list.
--
-- Beginning with Docker version 1.9, the Docker client compresses image
-- layers before pushing them to a V2 Docker registry. The output of the
-- @docker images@ command shows the uncompressed image size, so it may
-- return a larger image size than the image sizes returned by
-- DescribeImages.
--
-- 'imageDigest', 'referencedImageDetail_imageDigest' - The @sha256@ digest of the image manifest.
--
-- 'artifactMediaType', 'referencedImageDetail_artifactMediaType' - The artifact media type of the image.
--
-- 'imagePushedAt', 'referencedImageDetail_imagePushedAt' - The date and time, expressed in standard JavaScript date format, at
-- which the current image tag was pushed to the repository.
newReferencedImageDetail ::
  ReferencedImageDetail
newReferencedImageDetail :: ReferencedImageDetail
newReferencedImageDetail =
  ReferencedImageDetail' :: Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> ReferencedImageDetail
ReferencedImageDetail'
    { $sel:imageManifestMediaType:ReferencedImageDetail' :: Maybe Text
imageManifestMediaType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageSizeInBytes:ReferencedImageDetail' :: Maybe Integer
imageSizeInBytes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:imageDigest:ReferencedImageDetail' :: Maybe Text
imageDigest = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:artifactMediaType:ReferencedImageDetail' :: Maybe Text
artifactMediaType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imagePushedAt:ReferencedImageDetail' :: Maybe POSIX
imagePushedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The media type of the image manifest.
referencedImageDetail_imageManifestMediaType :: Lens.Lens' ReferencedImageDetail (Prelude.Maybe Prelude.Text)
referencedImageDetail_imageManifestMediaType :: (Maybe Text -> f (Maybe Text))
-> ReferencedImageDetail -> f ReferencedImageDetail
referencedImageDetail_imageManifestMediaType = (ReferencedImageDetail -> Maybe Text)
-> (ReferencedImageDetail -> Maybe Text -> ReferencedImageDetail)
-> Lens
     ReferencedImageDetail
     ReferencedImageDetail
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferencedImageDetail' {Maybe Text
imageManifestMediaType :: Maybe Text
$sel:imageManifestMediaType:ReferencedImageDetail' :: ReferencedImageDetail -> Maybe Text
imageManifestMediaType} -> Maybe Text
imageManifestMediaType) (\s :: ReferencedImageDetail
s@ReferencedImageDetail' {} Maybe Text
a -> ReferencedImageDetail
s {$sel:imageManifestMediaType:ReferencedImageDetail' :: Maybe Text
imageManifestMediaType = Maybe Text
a} :: ReferencedImageDetail)

-- | The size, in bytes, of the image in the repository.
--
-- If the image is a manifest list, this will be the max size of all
-- manifests in the list.
--
-- Beginning with Docker version 1.9, the Docker client compresses image
-- layers before pushing them to a V2 Docker registry. The output of the
-- @docker images@ command shows the uncompressed image size, so it may
-- return a larger image size than the image sizes returned by
-- DescribeImages.
referencedImageDetail_imageSizeInBytes :: Lens.Lens' ReferencedImageDetail (Prelude.Maybe Prelude.Integer)
referencedImageDetail_imageSizeInBytes :: (Maybe Integer -> f (Maybe Integer))
-> ReferencedImageDetail -> f ReferencedImageDetail
referencedImageDetail_imageSizeInBytes = (ReferencedImageDetail -> Maybe Integer)
-> (ReferencedImageDetail
    -> Maybe Integer -> ReferencedImageDetail)
-> Lens
     ReferencedImageDetail
     ReferencedImageDetail
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferencedImageDetail' {Maybe Integer
imageSizeInBytes :: Maybe Integer
$sel:imageSizeInBytes:ReferencedImageDetail' :: ReferencedImageDetail -> Maybe Integer
imageSizeInBytes} -> Maybe Integer
imageSizeInBytes) (\s :: ReferencedImageDetail
s@ReferencedImageDetail' {} Maybe Integer
a -> ReferencedImageDetail
s {$sel:imageSizeInBytes:ReferencedImageDetail' :: Maybe Integer
imageSizeInBytes = Maybe Integer
a} :: ReferencedImageDetail)

-- | The @sha256@ digest of the image manifest.
referencedImageDetail_imageDigest :: Lens.Lens' ReferencedImageDetail (Prelude.Maybe Prelude.Text)
referencedImageDetail_imageDigest :: (Maybe Text -> f (Maybe Text))
-> ReferencedImageDetail -> f ReferencedImageDetail
referencedImageDetail_imageDigest = (ReferencedImageDetail -> Maybe Text)
-> (ReferencedImageDetail -> Maybe Text -> ReferencedImageDetail)
-> Lens
     ReferencedImageDetail
     ReferencedImageDetail
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferencedImageDetail' {Maybe Text
imageDigest :: Maybe Text
$sel:imageDigest:ReferencedImageDetail' :: ReferencedImageDetail -> Maybe Text
imageDigest} -> Maybe Text
imageDigest) (\s :: ReferencedImageDetail
s@ReferencedImageDetail' {} Maybe Text
a -> ReferencedImageDetail
s {$sel:imageDigest:ReferencedImageDetail' :: Maybe Text
imageDigest = Maybe Text
a} :: ReferencedImageDetail)

-- | The artifact media type of the image.
referencedImageDetail_artifactMediaType :: Lens.Lens' ReferencedImageDetail (Prelude.Maybe Prelude.Text)
referencedImageDetail_artifactMediaType :: (Maybe Text -> f (Maybe Text))
-> ReferencedImageDetail -> f ReferencedImageDetail
referencedImageDetail_artifactMediaType = (ReferencedImageDetail -> Maybe Text)
-> (ReferencedImageDetail -> Maybe Text -> ReferencedImageDetail)
-> Lens
     ReferencedImageDetail
     ReferencedImageDetail
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferencedImageDetail' {Maybe Text
artifactMediaType :: Maybe Text
$sel:artifactMediaType:ReferencedImageDetail' :: ReferencedImageDetail -> Maybe Text
artifactMediaType} -> Maybe Text
artifactMediaType) (\s :: ReferencedImageDetail
s@ReferencedImageDetail' {} Maybe Text
a -> ReferencedImageDetail
s {$sel:artifactMediaType:ReferencedImageDetail' :: Maybe Text
artifactMediaType = Maybe Text
a} :: ReferencedImageDetail)

-- | The date and time, expressed in standard JavaScript date format, at
-- which the current image tag was pushed to the repository.
referencedImageDetail_imagePushedAt :: Lens.Lens' ReferencedImageDetail (Prelude.Maybe Prelude.UTCTime)
referencedImageDetail_imagePushedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ReferencedImageDetail -> f ReferencedImageDetail
referencedImageDetail_imagePushedAt = (ReferencedImageDetail -> Maybe POSIX)
-> (ReferencedImageDetail -> Maybe POSIX -> ReferencedImageDetail)
-> Lens
     ReferencedImageDetail
     ReferencedImageDetail
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReferencedImageDetail' {Maybe POSIX
imagePushedAt :: Maybe POSIX
$sel:imagePushedAt:ReferencedImageDetail' :: ReferencedImageDetail -> Maybe POSIX
imagePushedAt} -> Maybe POSIX
imagePushedAt) (\s :: ReferencedImageDetail
s@ReferencedImageDetail' {} Maybe POSIX
a -> ReferencedImageDetail
s {$sel:imagePushedAt:ReferencedImageDetail' :: Maybe POSIX
imagePushedAt = Maybe POSIX
a} :: ReferencedImageDetail) ((Maybe POSIX -> f (Maybe POSIX))
 -> ReferencedImageDetail -> f ReferencedImageDetail)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ReferencedImageDetail
-> f ReferencedImageDetail
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON ReferencedImageDetail where
  parseJSON :: Value -> Parser ReferencedImageDetail
parseJSON =
    String
-> (Object -> Parser ReferencedImageDetail)
-> Value
-> Parser ReferencedImageDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ReferencedImageDetail"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> ReferencedImageDetail
ReferencedImageDetail'
            (Maybe Text
 -> Maybe Integer
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> ReferencedImageDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Integer
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> ReferencedImageDetail)
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
"imageManifestMediaType")
            Parser
  (Maybe Integer
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> ReferencedImageDetail)
-> Parser (Maybe Integer)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> ReferencedImageDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imageSizeInBytes")
            Parser
  (Maybe Text -> Maybe Text -> Maybe POSIX -> ReferencedImageDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> ReferencedImageDetail)
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
"imageDigest")
            Parser (Maybe Text -> Maybe POSIX -> ReferencedImageDetail)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> ReferencedImageDetail)
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
"artifactMediaType")
            Parser (Maybe POSIX -> ReferencedImageDetail)
-> Parser (Maybe POSIX) -> Parser ReferencedImageDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"imagePushedAt")
      )

instance Prelude.Hashable ReferencedImageDetail

instance Prelude.NFData ReferencedImageDetail