{-# 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.CvssScoreAdjustment
-- 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.CvssScoreAdjustment 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

-- | Details on adjustments Amazon Inspector made to the CVSS score for a
-- finding.
--
-- /See:/ 'newCvssScoreAdjustment' smart constructor.
data CvssScoreAdjustment = CvssScoreAdjustment'
  { -- | The metric used to adjust the CVSS score.
    CvssScoreAdjustment -> Maybe Text
metric :: Prelude.Maybe Prelude.Text,
    -- | The reason the CVSS score has been adjustment.
    CvssScoreAdjustment -> Maybe Text
reason :: Prelude.Maybe Prelude.Text
  }
  deriving (CvssScoreAdjustment -> CvssScoreAdjustment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CvssScoreAdjustment -> CvssScoreAdjustment -> Bool
$c/= :: CvssScoreAdjustment -> CvssScoreAdjustment -> Bool
== :: CvssScoreAdjustment -> CvssScoreAdjustment -> Bool
$c== :: CvssScoreAdjustment -> CvssScoreAdjustment -> Bool
Prelude.Eq, ReadPrec [CvssScoreAdjustment]
ReadPrec CvssScoreAdjustment
Int -> ReadS CvssScoreAdjustment
ReadS [CvssScoreAdjustment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CvssScoreAdjustment]
$creadListPrec :: ReadPrec [CvssScoreAdjustment]
readPrec :: ReadPrec CvssScoreAdjustment
$creadPrec :: ReadPrec CvssScoreAdjustment
readList :: ReadS [CvssScoreAdjustment]
$creadList :: ReadS [CvssScoreAdjustment]
readsPrec :: Int -> ReadS CvssScoreAdjustment
$creadsPrec :: Int -> ReadS CvssScoreAdjustment
Prelude.Read, Int -> CvssScoreAdjustment -> ShowS
[CvssScoreAdjustment] -> ShowS
CvssScoreAdjustment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CvssScoreAdjustment] -> ShowS
$cshowList :: [CvssScoreAdjustment] -> ShowS
show :: CvssScoreAdjustment -> String
$cshow :: CvssScoreAdjustment -> String
showsPrec :: Int -> CvssScoreAdjustment -> ShowS
$cshowsPrec :: Int -> CvssScoreAdjustment -> ShowS
Prelude.Show, forall x. Rep CvssScoreAdjustment x -> CvssScoreAdjustment
forall x. CvssScoreAdjustment -> Rep CvssScoreAdjustment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CvssScoreAdjustment x -> CvssScoreAdjustment
$cfrom :: forall x. CvssScoreAdjustment -> Rep CvssScoreAdjustment x
Prelude.Generic)

-- |
-- Create a value of 'CvssScoreAdjustment' 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:
--
-- 'metric', 'cvssScoreAdjustment_metric' - The metric used to adjust the CVSS score.
--
-- 'reason', 'cvssScoreAdjustment_reason' - The reason the CVSS score has been adjustment.
newCvssScoreAdjustment ::
  CvssScoreAdjustment
newCvssScoreAdjustment :: CvssScoreAdjustment
newCvssScoreAdjustment =
  CvssScoreAdjustment'
    { $sel:metric:CvssScoreAdjustment' :: Maybe Text
metric = forall a. Maybe a
Prelude.Nothing,
      $sel:reason:CvssScoreAdjustment' :: Maybe Text
reason = forall a. Maybe a
Prelude.Nothing
    }

-- | The metric used to adjust the CVSS score.
cvssScoreAdjustment_metric :: Lens.Lens' CvssScoreAdjustment (Prelude.Maybe Prelude.Text)
cvssScoreAdjustment_metric :: Lens' CvssScoreAdjustment (Maybe Text)
cvssScoreAdjustment_metric = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CvssScoreAdjustment' {Maybe Text
metric :: Maybe Text
$sel:metric:CvssScoreAdjustment' :: CvssScoreAdjustment -> Maybe Text
metric} -> Maybe Text
metric) (\s :: CvssScoreAdjustment
s@CvssScoreAdjustment' {} Maybe Text
a -> CvssScoreAdjustment
s {$sel:metric:CvssScoreAdjustment' :: Maybe Text
metric = Maybe Text
a} :: CvssScoreAdjustment)

-- | The reason the CVSS score has been adjustment.
cvssScoreAdjustment_reason :: Lens.Lens' CvssScoreAdjustment (Prelude.Maybe Prelude.Text)
cvssScoreAdjustment_reason :: Lens' CvssScoreAdjustment (Maybe Text)
cvssScoreAdjustment_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CvssScoreAdjustment' {Maybe Text
reason :: Maybe Text
$sel:reason:CvssScoreAdjustment' :: CvssScoreAdjustment -> Maybe Text
reason} -> Maybe Text
reason) (\s :: CvssScoreAdjustment
s@CvssScoreAdjustment' {} Maybe Text
a -> CvssScoreAdjustment
s {$sel:reason:CvssScoreAdjustment' :: Maybe Text
reason = Maybe Text
a} :: CvssScoreAdjustment)

instance Data.FromJSON CvssScoreAdjustment where
  parseJSON :: Value -> Parser CvssScoreAdjustment
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CvssScoreAdjustment"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> CvssScoreAdjustment
CvssScoreAdjustment'
            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
"metric")
            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
"reason")
      )

instance Prelude.Hashable CvssScoreAdjustment where
  hashWithSalt :: Int -> CvssScoreAdjustment -> Int
hashWithSalt Int
_salt CvssScoreAdjustment' {Maybe Text
reason :: Maybe Text
metric :: Maybe Text
$sel:reason:CvssScoreAdjustment' :: CvssScoreAdjustment -> Maybe Text
$sel:metric:CvssScoreAdjustment' :: CvssScoreAdjustment -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metric
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason

instance Prelude.NFData CvssScoreAdjustment where
  rnf :: CvssScoreAdjustment -> ()
rnf CvssScoreAdjustment' {Maybe Text
reason :: Maybe Text
metric :: Maybe Text
$sel:reason:CvssScoreAdjustment' :: CvssScoreAdjustment -> Maybe Text
$sel:metric:CvssScoreAdjustment' :: CvssScoreAdjustment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metric seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason