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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECR.Types.Attribute
import Amazonka.ECR.Types.FindingSeverity
import qualified Amazonka.Prelude as Prelude

-- | Contains information about an image scan finding.
--
-- /See:/ 'newImageScanFinding' smart constructor.
data ImageScanFinding = ImageScanFinding'
  { -- | A collection of attributes of the host from which the finding is
    -- generated.
    ImageScanFinding -> Maybe [Attribute]
attributes :: Prelude.Maybe [Attribute],
    -- | The description of the finding.
    ImageScanFinding -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name associated with the finding, usually a CVE number.
    ImageScanFinding -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The finding severity.
    ImageScanFinding -> Maybe FindingSeverity
severity :: Prelude.Maybe FindingSeverity,
    -- | A link containing additional details about the security vulnerability.
    ImageScanFinding -> Maybe Text
uri :: Prelude.Maybe Prelude.Text
  }
  deriving (ImageScanFinding -> ImageScanFinding -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageScanFinding -> ImageScanFinding -> Bool
$c/= :: ImageScanFinding -> ImageScanFinding -> Bool
== :: ImageScanFinding -> ImageScanFinding -> Bool
$c== :: ImageScanFinding -> ImageScanFinding -> Bool
Prelude.Eq, ReadPrec [ImageScanFinding]
ReadPrec ImageScanFinding
Int -> ReadS ImageScanFinding
ReadS [ImageScanFinding]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageScanFinding]
$creadListPrec :: ReadPrec [ImageScanFinding]
readPrec :: ReadPrec ImageScanFinding
$creadPrec :: ReadPrec ImageScanFinding
readList :: ReadS [ImageScanFinding]
$creadList :: ReadS [ImageScanFinding]
readsPrec :: Int -> ReadS ImageScanFinding
$creadsPrec :: Int -> ReadS ImageScanFinding
Prelude.Read, Int -> ImageScanFinding -> ShowS
[ImageScanFinding] -> ShowS
ImageScanFinding -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageScanFinding] -> ShowS
$cshowList :: [ImageScanFinding] -> ShowS
show :: ImageScanFinding -> String
$cshow :: ImageScanFinding -> String
showsPrec :: Int -> ImageScanFinding -> ShowS
$cshowsPrec :: Int -> ImageScanFinding -> ShowS
Prelude.Show, forall x. Rep ImageScanFinding x -> ImageScanFinding
forall x. ImageScanFinding -> Rep ImageScanFinding x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageScanFinding x -> ImageScanFinding
$cfrom :: forall x. ImageScanFinding -> Rep ImageScanFinding x
Prelude.Generic)

-- |
-- Create a value of 'ImageScanFinding' 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:
--
-- 'attributes', 'imageScanFinding_attributes' - A collection of attributes of the host from which the finding is
-- generated.
--
-- 'description', 'imageScanFinding_description' - The description of the finding.
--
-- 'name', 'imageScanFinding_name' - The name associated with the finding, usually a CVE number.
--
-- 'severity', 'imageScanFinding_severity' - The finding severity.
--
-- 'uri', 'imageScanFinding_uri' - A link containing additional details about the security vulnerability.
newImageScanFinding ::
  ImageScanFinding
newImageScanFinding :: ImageScanFinding
newImageScanFinding =
  ImageScanFinding'
    { $sel:attributes:ImageScanFinding' :: Maybe [Attribute]
attributes = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ImageScanFinding' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ImageScanFinding' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:severity:ImageScanFinding' :: Maybe FindingSeverity
severity = forall a. Maybe a
Prelude.Nothing,
      $sel:uri:ImageScanFinding' :: Maybe Text
uri = forall a. Maybe a
Prelude.Nothing
    }

-- | A collection of attributes of the host from which the finding is
-- generated.
imageScanFinding_attributes :: Lens.Lens' ImageScanFinding (Prelude.Maybe [Attribute])
imageScanFinding_attributes :: Lens' ImageScanFinding (Maybe [Attribute])
imageScanFinding_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageScanFinding' {Maybe [Attribute]
attributes :: Maybe [Attribute]
$sel:attributes:ImageScanFinding' :: ImageScanFinding -> Maybe [Attribute]
attributes} -> Maybe [Attribute]
attributes) (\s :: ImageScanFinding
s@ImageScanFinding' {} Maybe [Attribute]
a -> ImageScanFinding
s {$sel:attributes:ImageScanFinding' :: Maybe [Attribute]
attributes = Maybe [Attribute]
a} :: ImageScanFinding) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The name associated with the finding, usually a CVE number.
imageScanFinding_name :: Lens.Lens' ImageScanFinding (Prelude.Maybe Prelude.Text)
imageScanFinding_name :: Lens' ImageScanFinding (Maybe Text)
imageScanFinding_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageScanFinding' {Maybe Text
name :: Maybe Text
$sel:name:ImageScanFinding' :: ImageScanFinding -> Maybe Text
name} -> Maybe Text
name) (\s :: ImageScanFinding
s@ImageScanFinding' {} Maybe Text
a -> ImageScanFinding
s {$sel:name:ImageScanFinding' :: Maybe Text
name = Maybe Text
a} :: ImageScanFinding)

-- | The finding severity.
imageScanFinding_severity :: Lens.Lens' ImageScanFinding (Prelude.Maybe FindingSeverity)
imageScanFinding_severity :: Lens' ImageScanFinding (Maybe FindingSeverity)
imageScanFinding_severity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageScanFinding' {Maybe FindingSeverity
severity :: Maybe FindingSeverity
$sel:severity:ImageScanFinding' :: ImageScanFinding -> Maybe FindingSeverity
severity} -> Maybe FindingSeverity
severity) (\s :: ImageScanFinding
s@ImageScanFinding' {} Maybe FindingSeverity
a -> ImageScanFinding
s {$sel:severity:ImageScanFinding' :: Maybe FindingSeverity
severity = Maybe FindingSeverity
a} :: ImageScanFinding)

-- | A link containing additional details about the security vulnerability.
imageScanFinding_uri :: Lens.Lens' ImageScanFinding (Prelude.Maybe Prelude.Text)
imageScanFinding_uri :: Lens' ImageScanFinding (Maybe Text)
imageScanFinding_uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageScanFinding' {Maybe Text
uri :: Maybe Text
$sel:uri:ImageScanFinding' :: ImageScanFinding -> Maybe Text
uri} -> Maybe Text
uri) (\s :: ImageScanFinding
s@ImageScanFinding' {} Maybe Text
a -> ImageScanFinding
s {$sel:uri:ImageScanFinding' :: Maybe Text
uri = Maybe Text
a} :: ImageScanFinding)

instance Data.FromJSON ImageScanFinding where
  parseJSON :: Value -> Parser ImageScanFinding
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ImageScanFinding"
      ( \Object
x ->
          Maybe [Attribute]
-> Maybe Text
-> Maybe Text
-> Maybe FindingSeverity
-> Maybe Text
-> ImageScanFinding
ImageScanFinding'
            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
"attributes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"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
"name")
            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
"severity")
            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
"uri")
      )

instance Prelude.Hashable ImageScanFinding where
  hashWithSalt :: Int -> ImageScanFinding -> Int
hashWithSalt Int
_salt ImageScanFinding' {Maybe [Attribute]
Maybe Text
Maybe FindingSeverity
uri :: Maybe Text
severity :: Maybe FindingSeverity
name :: Maybe Text
description :: Maybe Text
attributes :: Maybe [Attribute]
$sel:uri:ImageScanFinding' :: ImageScanFinding -> Maybe Text
$sel:severity:ImageScanFinding' :: ImageScanFinding -> Maybe FindingSeverity
$sel:name:ImageScanFinding' :: ImageScanFinding -> Maybe Text
$sel:description:ImageScanFinding' :: ImageScanFinding -> Maybe Text
$sel:attributes:ImageScanFinding' :: ImageScanFinding -> Maybe [Attribute]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Attribute]
attributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FindingSeverity
severity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
uri

instance Prelude.NFData ImageScanFinding where
  rnf :: ImageScanFinding -> ()
rnf ImageScanFinding' {Maybe [Attribute]
Maybe Text
Maybe FindingSeverity
uri :: Maybe Text
severity :: Maybe FindingSeverity
name :: Maybe Text
description :: Maybe Text
attributes :: Maybe [Attribute]
$sel:uri:ImageScanFinding' :: ImageScanFinding -> Maybe Text
$sel:severity:ImageScanFinding' :: ImageScanFinding -> Maybe FindingSeverity
$sel:name:ImageScanFinding' :: ImageScanFinding -> Maybe Text
$sel:description:ImageScanFinding' :: ImageScanFinding -> Maybe Text
$sel:attributes:ImageScanFinding' :: ImageScanFinding -> Maybe [Attribute]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Attribute]
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FindingSeverity
severity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
uri