{-# 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.ECR.Types.ImageScanStatus
-- 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.ECR.Types.ImageScanStatus where

import qualified Amazonka.Core as Core
import Amazonka.ECR.Types.ScanStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The current status of an image scan.
--
-- /See:/ 'newImageScanStatus' smart constructor.
data ImageScanStatus = ImageScanStatus'
  { -- | The current state of an image scan.
    ImageScanStatus -> Maybe ScanStatus
status :: Prelude.Maybe ScanStatus,
    -- | The description of the image scan status.
    ImageScanStatus -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ImageScanStatus -> ImageScanStatus -> Bool
(ImageScanStatus -> ImageScanStatus -> Bool)
-> (ImageScanStatus -> ImageScanStatus -> Bool)
-> Eq ImageScanStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageScanStatus -> ImageScanStatus -> Bool
$c/= :: ImageScanStatus -> ImageScanStatus -> Bool
== :: ImageScanStatus -> ImageScanStatus -> Bool
$c== :: ImageScanStatus -> ImageScanStatus -> Bool
Prelude.Eq, ReadPrec [ImageScanStatus]
ReadPrec ImageScanStatus
Int -> ReadS ImageScanStatus
ReadS [ImageScanStatus]
(Int -> ReadS ImageScanStatus)
-> ReadS [ImageScanStatus]
-> ReadPrec ImageScanStatus
-> ReadPrec [ImageScanStatus]
-> Read ImageScanStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageScanStatus]
$creadListPrec :: ReadPrec [ImageScanStatus]
readPrec :: ReadPrec ImageScanStatus
$creadPrec :: ReadPrec ImageScanStatus
readList :: ReadS [ImageScanStatus]
$creadList :: ReadS [ImageScanStatus]
readsPrec :: Int -> ReadS ImageScanStatus
$creadsPrec :: Int -> ReadS ImageScanStatus
Prelude.Read, Int -> ImageScanStatus -> ShowS
[ImageScanStatus] -> ShowS
ImageScanStatus -> String
(Int -> ImageScanStatus -> ShowS)
-> (ImageScanStatus -> String)
-> ([ImageScanStatus] -> ShowS)
-> Show ImageScanStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageScanStatus] -> ShowS
$cshowList :: [ImageScanStatus] -> ShowS
show :: ImageScanStatus -> String
$cshow :: ImageScanStatus -> String
showsPrec :: Int -> ImageScanStatus -> ShowS
$cshowsPrec :: Int -> ImageScanStatus -> ShowS
Prelude.Show, (forall x. ImageScanStatus -> Rep ImageScanStatus x)
-> (forall x. Rep ImageScanStatus x -> ImageScanStatus)
-> Generic ImageScanStatus
forall x. Rep ImageScanStatus x -> ImageScanStatus
forall x. ImageScanStatus -> Rep ImageScanStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageScanStatus x -> ImageScanStatus
$cfrom :: forall x. ImageScanStatus -> Rep ImageScanStatus x
Prelude.Generic)

-- |
-- Create a value of 'ImageScanStatus' 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:
--
-- 'status', 'imageScanStatus_status' - The current state of an image scan.
--
-- 'description', 'imageScanStatus_description' - The description of the image scan status.
newImageScanStatus ::
  ImageScanStatus
newImageScanStatus :: ImageScanStatus
newImageScanStatus =
  ImageScanStatus' :: Maybe ScanStatus -> Maybe Text -> ImageScanStatus
ImageScanStatus'
    { $sel:status:ImageScanStatus' :: Maybe ScanStatus
status = Maybe ScanStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ImageScanStatus' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The current state of an image scan.
imageScanStatus_status :: Lens.Lens' ImageScanStatus (Prelude.Maybe ScanStatus)
imageScanStatus_status :: (Maybe ScanStatus -> f (Maybe ScanStatus))
-> ImageScanStatus -> f ImageScanStatus
imageScanStatus_status = (ImageScanStatus -> Maybe ScanStatus)
-> (ImageScanStatus -> Maybe ScanStatus -> ImageScanStatus)
-> Lens
     ImageScanStatus
     ImageScanStatus
     (Maybe ScanStatus)
     (Maybe ScanStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageScanStatus' {Maybe ScanStatus
status :: Maybe ScanStatus
$sel:status:ImageScanStatus' :: ImageScanStatus -> Maybe ScanStatus
status} -> Maybe ScanStatus
status) (\s :: ImageScanStatus
s@ImageScanStatus' {} Maybe ScanStatus
a -> ImageScanStatus
s {$sel:status:ImageScanStatus' :: Maybe ScanStatus
status = Maybe ScanStatus
a} :: ImageScanStatus)

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

instance Core.FromJSON ImageScanStatus where
  parseJSON :: Value -> Parser ImageScanStatus
parseJSON =
    String
-> (Object -> Parser ImageScanStatus)
-> Value
-> Parser ImageScanStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImageScanStatus"
      ( \Object
x ->
          Maybe ScanStatus -> Maybe Text -> ImageScanStatus
ImageScanStatus'
            (Maybe ScanStatus -> Maybe Text -> ImageScanStatus)
-> Parser (Maybe ScanStatus)
-> Parser (Maybe Text -> ImageScanStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ScanStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser (Maybe Text -> ImageScanStatus)
-> Parser (Maybe Text) -> Parser ImageScanStatus
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")
      )

instance Prelude.Hashable ImageScanStatus

instance Prelude.NFData ImageScanStatus