{-# 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.Remediation
-- 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.Remediation 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.Recommendation
import qualified Amazonka.Prelude as Prelude

-- | Information on how to remediate a finding.
--
-- /See:/ 'newRemediation' smart constructor.
data Remediation = Remediation'
  { -- | An object that contains information about the recommended course of
    -- action to remediate the finding.
    Remediation -> Maybe Recommendation
recommendation :: Prelude.Maybe Recommendation
  }
  deriving (Remediation -> Remediation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Remediation -> Remediation -> Bool
$c/= :: Remediation -> Remediation -> Bool
== :: Remediation -> Remediation -> Bool
$c== :: Remediation -> Remediation -> Bool
Prelude.Eq, ReadPrec [Remediation]
ReadPrec Remediation
Int -> ReadS Remediation
ReadS [Remediation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Remediation]
$creadListPrec :: ReadPrec [Remediation]
readPrec :: ReadPrec Remediation
$creadPrec :: ReadPrec Remediation
readList :: ReadS [Remediation]
$creadList :: ReadS [Remediation]
readsPrec :: Int -> ReadS Remediation
$creadsPrec :: Int -> ReadS Remediation
Prelude.Read, Int -> Remediation -> ShowS
[Remediation] -> ShowS
Remediation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Remediation] -> ShowS
$cshowList :: [Remediation] -> ShowS
show :: Remediation -> String
$cshow :: Remediation -> String
showsPrec :: Int -> Remediation -> ShowS
$cshowsPrec :: Int -> Remediation -> ShowS
Prelude.Show, forall x. Rep Remediation x -> Remediation
forall x. Remediation -> Rep Remediation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Remediation x -> Remediation
$cfrom :: forall x. Remediation -> Rep Remediation x
Prelude.Generic)

-- |
-- Create a value of 'Remediation' 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:
--
-- 'recommendation', 'remediation_recommendation' - An object that contains information about the recommended course of
-- action to remediate the finding.
newRemediation ::
  Remediation
newRemediation :: Remediation
newRemediation =
  Remediation' {$sel:recommendation:Remediation' :: Maybe Recommendation
recommendation = forall a. Maybe a
Prelude.Nothing}

-- | An object that contains information about the recommended course of
-- action to remediate the finding.
remediation_recommendation :: Lens.Lens' Remediation (Prelude.Maybe Recommendation)
remediation_recommendation :: Lens' Remediation (Maybe Recommendation)
remediation_recommendation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Remediation' {Maybe Recommendation
recommendation :: Maybe Recommendation
$sel:recommendation:Remediation' :: Remediation -> Maybe Recommendation
recommendation} -> Maybe Recommendation
recommendation) (\s :: Remediation
s@Remediation' {} Maybe Recommendation
a -> Remediation
s {$sel:recommendation:Remediation' :: Maybe Recommendation
recommendation = Maybe Recommendation
a} :: Remediation)

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

instance Prelude.Hashable Remediation where
  hashWithSalt :: Int -> Remediation -> Int
hashWithSalt Int
_salt Remediation' {Maybe Recommendation
recommendation :: Maybe Recommendation
$sel:recommendation:Remediation' :: Remediation -> Maybe Recommendation
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Recommendation
recommendation

instance Prelude.NFData Remediation where
  rnf :: Remediation -> ()
rnf Remediation' {Maybe Recommendation
recommendation :: Maybe Recommendation
$sel:recommendation:Remediation' :: Remediation -> Maybe Recommendation
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Recommendation
recommendation